mirror of
https://github.com/ringhyacinth/Star-Office-UI
synced 2026-04-21 13:27:19 +00:00
Merge pull request #61 from Jah-yee/fix/issue-54-unauthorized
fix: avoid 401 Unauthorized on first page load (fixes #54)
This commit is contained in:
commit
8ac5b51c3f
2 changed files with 21 additions and 2 deletions
|
|
@ -4182,6 +4182,7 @@ function toggleBrokerPanel() {
|
|||
bindAssetDrawerBackgroundDeselect();
|
||||
await ensureGeminiConfigLoaded();
|
||||
if (assetDrawerAuthed) {
|
||||
await applySavedPositionOverrides();
|
||||
await refreshAssetDrawerList();
|
||||
await renderHomeFavorites(false);
|
||||
bindDrawerFileMeta();
|
||||
|
|
@ -4212,6 +4213,7 @@ function toggleBrokerPanel() {
|
|||
bindAssetDrawerBackgroundDeselect();
|
||||
await ensureGeminiConfigLoaded();
|
||||
if (assetDrawerAuthed) {
|
||||
await applySavedPositionOverrides();
|
||||
await refreshAssetDrawerList();
|
||||
await renderHomeFavorites(false);
|
||||
bindDrawerFileMeta();
|
||||
|
|
@ -4835,7 +4837,15 @@ function toggleBrokerPanel() {
|
|||
|
||||
// 启动 Phaser 游戏
|
||||
new Phaser.Game(config);
|
||||
setTimeout(() => { applySavedPositionOverrides(); }, 600);
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
const authRes = await fetch('/assets/auth/status', { cache: 'no-store' });
|
||||
const authData = await authRes.json();
|
||||
if (authData && authData.ok && authData.authed) {
|
||||
await applySavedPositionOverrides();
|
||||
}
|
||||
} catch (e) {}
|
||||
}, 600);
|
||||
}
|
||||
|
||||
function preload() {
|
||||
|
|
|
|||
|
|
@ -3300,6 +3300,7 @@ function toggleBrokerPanel() {
|
|||
bindAssetDrawerBackgroundDeselect();
|
||||
await ensureGeminiConfigLoaded();
|
||||
if (assetDrawerAuthed) {
|
||||
await applySavedPositionOverrides();
|
||||
await refreshAssetDrawerList();
|
||||
await renderHomeFavorites(false);
|
||||
bindDrawerFileMeta();
|
||||
|
|
@ -3925,7 +3926,15 @@ function toggleBrokerPanel() {
|
|||
console.warn('flowers 规格探测失败,使用默认 65x65', e);
|
||||
}
|
||||
|
||||
applySavedPositionOverrides();
|
||||
// Only fetch /assets/positions and /assets/defaults when user is authed,
|
||||
// to avoid 401 Unauthorized on first load for new visitors (issue #54).
|
||||
try {
|
||||
const authRes = await fetch('/assets/auth/status', { cache: 'no-store' });
|
||||
const authData = await authRes.json();
|
||||
if (authData && authData.ok && authData.authed) {
|
||||
await applySavedPositionOverrides();
|
||||
}
|
||||
} catch (e) {}
|
||||
}, 600);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue