fix(app): make Modrinth account SSO logins from the app work (#4345)

This commit is contained in:
Alejandro González
2025-09-06 23:35:50 +02:00
committed by GitHub
parent e2f07a7848
commit a323bf6c25
4 changed files with 20 additions and 16 deletions

View File

@@ -109,7 +109,7 @@ export const getAuthUrl = (provider, redirect = '/dashboard') => {
const route = useNativeRoute()
const fullURL = route.query.launcher
? 'https://launcher-files.modrinth.com'
? getLauncherRedirectUrl(route)
: `${config.public.siteUrl}/auth/sign-in?redirect=${redirect}`
return `${config.public.apiBaseUrl}auth/init?provider=${provider}&url=${encodeURIComponent(fullURL)}`
@@ -131,3 +131,12 @@ export const removeAuthProvider = async (provider) => {
stopLoading()
}
export const getLauncherRedirectUrl = (route) => {
const usesLocalhostRedirectionScheme =
['4', '6'].includes(route.query.ipver) && Number(route.query.port) < 65536
return usesLocalhostRedirectionScheme
? `http://${route.query.ipver === '4' ? '127.0.0.1' : '[::1]'}:${route.query.port}`
: `https://launcher-files.modrinth.com`
}