summary refs log tree commit diff
path: root/src/connections/Facebook
diff options
context:
space:
mode:
Diffstat (limited to 'src/connections/Facebook')
-rw-r--r--src/connections/Facebook/FacebookSettings.ts23
-rw-r--r--src/connections/Facebook/index.ts10
2 files changed, 9 insertions, 24 deletions
diff --git a/src/connections/Facebook/FacebookSettings.ts b/src/connections/Facebook/FacebookSettings.ts
deleted file mode 100644

index f130358a1..000000000 --- a/src/connections/Facebook/FacebookSettings.ts +++ /dev/null
@@ -1,23 +0,0 @@ -/* - Spacebar: A FOSS re-implementation and extension of the Discord.com backend. - Copyright (C) 2023 Spacebar and Spacebar Contributors - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <https://www.gnu.org/licenses/>. -*/ - -export class FacebookSettings { - enabled: boolean = false; - clientId: string | null = null; - clientSecret: string | null = null; -} diff --git a/src/connections/Facebook/index.ts b/src/connections/Facebook/index.ts
index 29317c2e6..3abd5669e 100644 --- a/src/connections/Facebook/index.ts +++ b/src/connections/Facebook/index.ts
@@ -18,7 +18,7 @@ import { ConnectedAccount, Connection, ConnectionLoader, DiscordApiErrors } from "@spacebar/util"; import wretch from "wretch"; -import { FacebookSettings } from "./FacebookSettings"; +import { GenericOAuthSettings as FacebookSettings } from "../GenericOAuthSettings"; import { ConnectedAccountCommonOAuthTokenResponse, ConnectionCallbackSchema } from "@spacebar/schemas"; export interface FacebookErrorResponse { @@ -37,6 +37,10 @@ interface UserResponse { export default class FacebookConnection extends Connection { public readonly id = "facebook"; + public readonly friendlyName = "Facebook"; + public readonly setupUrl = "(missing - contributions welcome)"; + public readonly requiredScopes = []; + public readonly authorizeUrl = "https://www.facebook.com/v14.0/dialog/oauth"; public readonly tokenUrl = "https://graph.facebook.com/v14.0/oauth/access_token"; public readonly userInfoUrl = "https://graph.facebook.com/v14.0/me"; @@ -49,6 +53,10 @@ export default class FacebookConnection extends Connection { if (this.settings.enabled && (!this.settings.clientId || !this.settings.clientSecret)) throw new Error(`Invalid settings for connection ${this.id}`); } + public get isConfigured(): boolean { + return !!this.settings.clientId && !!this.settings.clientSecret; + } + getAuthorizationUrl(userId: string): string { const state = this.createState(userId); const url = new URL(this.authorizeUrl);