From 328aef00e1afca8cc795f47b4ea58708a162f9ff Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 18 Jan 2022 17:41:38 +0100 Subject: [PATCH] tidy up --- packages/backend-core/src/middleware/passport/google.js | 1 - packages/server/src/api/controllers/datasource.js | 7 +++++++ packages/server/src/definitions/datasource.ts | 3 +-- packages/server/src/integrations/googlesheets.ts | 6 +++--- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/backend-core/src/middleware/passport/google.js b/packages/backend-core/src/middleware/passport/google.js index efe64d6337..cb93844c31 100644 --- a/packages/backend-core/src/middleware/passport/google.js +++ b/packages/backend-core/src/middleware/passport/google.js @@ -46,7 +46,6 @@ exports.strategyFactory = async function ( clientID: config.clientID, clientSecret: config.clientSecret, callbackURL: callbackUrl, - store: true, }, verify ) diff --git a/packages/server/src/api/controllers/datasource.js b/packages/server/src/api/controllers/datasource.js index f08b622c3e..198c1bf36b 100644 --- a/packages/server/src/api/controllers/datasource.js +++ b/packages/server/src/api/controllers/datasource.js @@ -38,6 +38,13 @@ exports.fetch = async function (ctx) { ) ).rows.map(row => row.doc) + for (let datasource of datasources) { + if (datasource.config && datasource.config.auth) { + // strip secrets from response so they don't show in the network request + delete datasource.config.auth + } + } + ctx.body = [bbInternalDb, ...datasources] } diff --git a/packages/server/src/definitions/datasource.ts b/packages/server/src/definitions/datasource.ts index ce67b717e4..102f098703 100644 --- a/packages/server/src/definitions/datasource.ts +++ b/packages/server/src/definitions/datasource.ts @@ -87,8 +87,7 @@ export interface ExtraQueryConfig { export interface Integration { docs: string plus?: boolean - // TODO: use a proper type here - auth?: { type: "google" } + auth?: { type: string } description: string friendlyName: string datasource: {} diff --git a/packages/server/src/integrations/googlesheets.ts b/packages/server/src/integrations/googlesheets.ts index 65cb965a42..ca8338330e 100644 --- a/packages/server/src/integrations/googlesheets.ts +++ b/packages/server/src/integrations/googlesheets.ts @@ -248,11 +248,11 @@ module GoogleSheetsModule { } } - async deleteTable(query: any) { + async deleteTable(sheet: any) { try { await this.connect() - const sheet = await this.client.sheetsByTitle[query.sheet] - return await sheet.delete() + const sheetToDelete = await this.client.sheetsByTitle[sheet] + return await sheetToDelete.delete() } catch (err) { console.error("Error deleting table in google sheets", err) throw err