feat: proxy embed assets to in-cluster project57 [deploy]
CI Pipeline / check-commit (push) Successful in 7s
CI Pipeline / deploy-only (push) Has been skipped
CI Pipeline / build (push) Successful in 27s
CI Pipeline / deploy (push) Failing after 2s

This commit is contained in:
mdszxy committed 2026-10-05 17:42:36 +08:00
1 parent f717f1d481
commit fe18e608dc
8 files changed
+67 -36

No files matched your search

+8 -10
View File
@@ -1,7 +1,3 @@
const A_ORIGIN = (
import.meta.env.VITE_A_ORIGIN || "https://swissicapital.net"
).replace(/\/$/, "");
const errorEl = document.getElementById("aurora-error");
function showError(message: string) {
@@ -22,25 +18,27 @@ function loadScript(src: string): Promise<void> {
}
async function boot() {
const origin = window.location.origin;
try {
await loadScript(`${A_ORIGIN}/embed/aurora.js?v=1`);
await loadScript(`${origin}/embed/aurora.js?v=1`);
} catch {
showError(
`无法加载 A 站脚本:${A_ORIGIN}/embed/aurora.js。请先在 project57 执行 pnpm build:embed 并启动 A 站,或修改 .env 中的 VITE_A_ORIGIN。`
`无法加载前台脚本:${origin}/embed/aurora.js。请确认 B 站已反代到 A 站,且 A 站已部署 embed 产物。`
);
return;
}
const api = window.AuroraSite;
if (!api?.mount) {
showError("A 站脚本已加载,但未找到 AuroraSite.mount。");
showError("脚本已加载,但未找到 AuroraSite.mount。");
return;
}
api.mount("#aurora-root", {
assetBase: A_ORIGIN,
apiBase: A_ORIGIN,
cssUrl: `${A_ORIGIN}/embed/aurora.css?v=1`,
assetBase: origin,
apiBase: origin,
cssUrl: `${origin}/embed/aurora.css?v=1`,
history: "hash",
});
}