Move redirect uri generation to getRedirectUri function of Connection class.
Use api_endpointPublic instead of cdn_endpointPublic
This commit is contained in:
@@ -20,5 +20,5 @@ export class ApiConfiguration {
|
||||
defaultVersion: string = "9";
|
||||
activeVersions: string[] = ["6", "7", "8", "9"];
|
||||
useFosscordEnhancements: boolean = true;
|
||||
endpointPublic: string = "/api";
|
||||
endpointPublic: string | null = null;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import crypto from "crypto";
|
||||
import { ConnectedAccount } from "../entities";
|
||||
import { ConnectedAccountSchema, ConnectionCallbackSchema } from "../schemas";
|
||||
import { DiscordApiErrors } from "../util";
|
||||
import { Config, DiscordApiErrors } from "../util";
|
||||
|
||||
/**
|
||||
* A connection that can be used to connect to an external service.
|
||||
@@ -19,6 +19,16 @@ export default abstract class Connection {
|
||||
*/
|
||||
abstract getAuthorizationUrl(userId: string): string;
|
||||
|
||||
/**
|
||||
* Returns the redirect_uri for a connection type
|
||||
* @returns redirect_uri for this connection
|
||||
*/
|
||||
getRedirectUri() {
|
||||
const endpointPublic =
|
||||
Config.get().api.endpointPublic ?? "http://localhost:3001";
|
||||
return `${endpointPublic}/connections/${this.id}/callback`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the callback
|
||||
* @param args Callback arguments
|
||||
|
||||
Reference in New Issue
Block a user