Fondation

This commit is contained in:
alma 2026-01-17 13:51:20 +01:00
parent de64c10603
commit d24f507daa
2 changed files with 20 additions and 2 deletions

View File

@ -73,7 +73,16 @@ export async function GET(request: Request) {
} }
} }
const baseUrl = process.env.NEXT_PUBLIC_IFRAME_PAROLE_URL?.split('/channel')[0]; // Extract base URL, removing any paths like /channel, /_oauth/connect, etc.
let baseUrl = process.env.NEXT_PUBLIC_IFRAME_PAROLE_URL;
if (baseUrl) {
// Remove /channel and everything after
baseUrl = baseUrl.split('/channel')[0];
// Remove /_oauth/connect and everything after
baseUrl = baseUrl.split('/_oauth')[0];
// Remove trailing slashes
baseUrl = baseUrl.replace(/\/+$/, '');
}
if (!baseUrl) { if (!baseUrl) {
logger.error('[ROCKET_CHAT] Failed to get Rocket.Chat base URL'); logger.error('[ROCKET_CHAT] Failed to get Rocket.Chat base URL');
return NextResponse.json({ error: 'Server configuration error' }, { status: 500 }); return NextResponse.json({ error: 'Server configuration error' }, { status: 500 });

View File

@ -18,7 +18,16 @@ export async function GET(request: Request) {
); );
} }
const baseUrl = process.env.NEXT_PUBLIC_IFRAME_PAROLE_URL?.split('/channel')[0]; // Extract base URL, removing any paths like /channel, /_oauth/connect, etc.
let baseUrl = process.env.NEXT_PUBLIC_IFRAME_PAROLE_URL;
if (baseUrl) {
// Remove /channel and everything after
baseUrl = baseUrl.split('/channel')[0];
// Remove /_oauth/connect and everything after
baseUrl = baseUrl.split('/_oauth')[0];
// Remove trailing slashes
baseUrl = baseUrl.replace(/\/+$/, '');
}
if (!baseUrl) { if (!baseUrl) {
logger.error('[ROCKET_CHAT_USER_TOKEN] Failed to get Rocket.Chat base URL'); logger.error('[ROCKET_CHAT_USER_TOKEN] Failed to get Rocket.Chat base URL');
return NextResponse.json( return NextResponse.json(