可信代码库-配置文件修复定向URL改为动态获取

This commit is contained in:
fmk1023
2025-08-26 17:52:32 +08:00
parent 9c58b289a2
commit 452eda019a
9 changed files with 22 additions and 11 deletions

View File

@@ -37,7 +37,8 @@ onMounted(async() => {
const excRes = /(.*)_(.*)/.exec(state as string);
if (excRes) {
if (window.parent) {
window.opener?.postMessage({ fn: 'otho', type, code, state: excRes[1] }, (import.meta as any).env.VITE_HOST);
// window.opener?.postMessage({ fn: 'otho', type, code, state: excRes[1] }, (import.meta as any).env.VITE_HOST);
window.opener?.postMessage({ fn: 'otho', type, code, state: excRes[1] }, window.location.origin + '/openRepoPortal');
window?.close();
}
return;
@@ -94,7 +95,8 @@ const emitEvents = (type: 'success' | 'fail' = 'success', error_info?: string, p
if (type === 'success') {
// 登录后回到登录前页面 hack一下automgit跳转
if (route.query?.installation_id) {
window.location.href = `${(import.meta as any).env.VITE_HOST}${path || '/'}`;
// window.location.href = `${(import.meta as any).env.VITE_HOST}${path || '/'}`;
window.location.href = `${window.location.origin}/openRepoPortal${path || '/'}`;
} else {
url && localStorage.removeItem('loginReturnUrl');
url ? window.location.href = url : router.replace('/');
@@ -118,7 +120,8 @@ const emitEvents = (type: 'success' | 'fail' = 'success', error_info?: string, p
type,
message: error_info || type === 'success' ? '' : '你已取消授权',
path
}, (import.meta as any).env.VITE_HOST);
// }, (import.meta as any).env.VITE_HOST);
}, window.location.origin + '/openRepoPortal');
window?.close();
}
}