Compare commits

...

1 Commits

Author SHA1 Message Date
Laan Tungir
a2f7a7fceb Fix music optional auth to detect existing logged-in session on page load 2026-04-19 13:43:13 -04:00
2 changed files with 20 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
{
"VERSION": "v0.7.2",
"VERSION_NUMBER": "0.7.2",
"BUILD_DATE": "2026-04-19T17:37:32.473Z"
"VERSION": "v0.7.3",
"VERSION_NUMBER": "0.7.3",
"BUILD_DATE": "2026-04-19T17:43:13.562Z"
}

View File

@@ -1617,6 +1617,21 @@ import { GreyscaleAPI } from './js/greyscale-api.mjs';
return message.includes('authentication required');
}
async function tryGetPubkeyWithoutPrompt({ attempts = 8, delayMs = 350 } = {}) {
for (let i = 0; i < attempts; i += 1) {
try {
const pubkey = await getPubkey();
if (pubkey) return pubkey;
} catch {
// Signer can attach slightly after initial script execution.
}
if (i < attempts - 1) {
await new Promise((resolve) => setTimeout(resolve, delayMs));
}
}
return '';
}
function isReadOnlyTargetMode() {
return Boolean(targetPubkey && (!currentPubkey || targetPubkey !== currentPubkey));
}
@@ -1695,13 +1710,8 @@ import { GreyscaleAPI } from './js/greyscale-api.mjs';
throw error;
}
try {
currentPubkey = await getPubkey();
isAuthenticated = Boolean(currentPubkey);
} catch {
currentPubkey = null;
isAuthenticated = false;
}
currentPubkey = await tryGetPubkeyWithoutPrompt();
isAuthenticated = Boolean(currentPubkey);
}
async function initializeAuthenticatedPageFeatures() {