Modif uri

This commit is contained in:
ExostFlash 2025-08-28 23:54:59 +02:00
parent 830b60dad0
commit 40436b21ab
2 changed files with 8 additions and 2 deletions

View file

@ -6,7 +6,10 @@ const BOT_SECRET = "vhk6jp_jYjvShOqpI8MJ2Efjjm_9Cmyi";
exports.handleDiscordAuth = async (request, reply) => { exports.handleDiscordAuth = async (request, reply) => {
const protocol = request.protocol || (request.headers['x-forwarded-proto'] || '').split(',')[0] || 'http'; 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 REDIRECT_URI = `${protocol}://${host}/auth/discord/callback`;
const code = request.query.code; const code = request.query.code;

View file

@ -11,7 +11,10 @@ module.exports = async function (app, opts) {
// --- Auth Discord --- // --- Auth Discord ---
app.get('/auth/discord', async (req, reply) => { app.get('/auth/discord', async (req, reply) => {
const protocol = req.protocol || (req.headers['x-forwarded-proto'] || '').split(',')[0] || 'http'; 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 redirectUri = `${protocol}://${host}/auth/discord/callback`;
const clientId = '1410578978712060024'; const clientId = '1410578978712060024';