From 40436b21abe57bed3e24cb31362aaab245deb0a2 Mon Sep 17 00:00:00 2001 From: ExostFlash Date: Thu, 28 Aug 2025 23:54:59 +0200 Subject: [PATCH] Modif uri --- discord.js | 5 ++++- routes/other.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/discord.js b/discord.js index 18797e6..1d5ca42 100644 --- a/discord.js +++ b/discord.js @@ -6,7 +6,10 @@ const BOT_SECRET = "vhk6jp_jYjvShOqpI8MJ2Efjjm_9Cmyi"; exports.handleDiscordAuth = async (request, reply) => { const protocol = request.protocol || (request.headers['x-forwarded-proto'] || '').split(',')[0] || 'http'; - const host = request.hostname || request.headers.host; + let host = request.hostname || request.headers.host; + if (host == 'localhost') { + host = host + ":3000"; + } const REDIRECT_URI = `${protocol}://${host}/auth/discord/callback`; const code = request.query.code; diff --git a/routes/other.js b/routes/other.js index d8037f3..4b86d1f 100644 --- a/routes/other.js +++ b/routes/other.js @@ -11,7 +11,10 @@ module.exports = async function (app, opts) { // --- Auth Discord --- app.get('/auth/discord', async (req, reply) => { const protocol = req.protocol || (req.headers['x-forwarded-proto'] || '').split(',')[0] || 'http'; - const host = req.hostname || req.headers.host; + let host = req.hostname || req.headers.host; + if (host == 'localhost') { + host = host + ":3000"; + } const redirectUri = `${protocol}://${host}/auth/discord/callback`; const clientId = '1410578978712060024';