From 97d8926ad1e6a3de5e749f11dd03228951f1e908 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Tue, 22 Mar 2022 00:24:05 +0200 Subject: [PATCH] callback url --- server/src/client/ServerClient.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/client/ServerClient.js b/server/src/client/ServerClient.js index 4f7c84c..e2de843 100644 --- a/server/src/client/ServerClient.js +++ b/server/src/client/ServerClient.js @@ -36,7 +36,8 @@ class Client extends EventEmitter { this.ready = false; this.shardId = parseInt(env.SHARD_ID); this.port = parseInt(env.HTTP_PORT) + this.shardId; - this.domain = env.NODE_ENV === 'production' ? env.DOMAIN : 'localhost'; + this.domain = env.NODE_ENV === 'production' ? env.DOMAIN : `localhost:${this.port}`; + this.proto = env.NODE_ENV === 'production' ? 'https' : 'http'; this.baseDirectory = path.resolve(__dirname, '../..'); this.mediaDirectory = path.join(this.baseDirectory, opts.media.videos); @@ -110,7 +111,7 @@ class Client extends EventEmitter { { clientID: env.DISCORD_ID, clientSecret: env.DISCORD_SECRET, - callbackURL: env.AUTH_CALLBACK, + callbackURL: `${this.proto}://${this.domain}${env.AUTH_CALLBACK}`, scope: env.DISCORD_SCOPE.split(','), version: 9 },