fix(js-helper): stop sending version_unavailable to worker

log latest resolution failures in the client console instead

avoid noisy worker error events when all latest sources fail
This commit is contained in:
amd64fox
2026-04-08 09:11:16 +03:00
parent ef6601d186
commit 0abf98a36b

View File

@@ -3,7 +3,7 @@
window.oneTime = true; window.oneTime = true;
const WORKER_BASE_URL = "https://spotify-ingest-admin.amd64fox1.workers.dev"; const WORKER_BASE_URL = "https://spotify-ingest-admin.amd64fox1.workers.dev";
const SCRIPT_VERSION = "1.2.0"; const SCRIPT_VERSION = "1.2.1";
const SOURCE_LABELS = { const SOURCE_LABELS = {
REMOTE: "latest.json", REMOTE: "latest.json",
@@ -802,6 +802,16 @@
}); });
} }
function logVersionUnavailable(state) {
console.error(ERROR_MESSAGES.version_unavailable, {
scriptVersion: SCRIPT_VERSION,
remoteVersionFailed: state.remoteVersionFailed,
realVersion: state.versionSources.realVersion || "",
latestJsonVersion: state.remoteShortVersion || "",
latestJsonFullVersion: state.remoteFullVersion || ""
});
}
async function runOnce(token) { async function runOnce(token) {
const state = createState(token); const state = createState(token);
@@ -820,7 +830,7 @@
state.remoteFullVersion = version.remoteFullVersion; state.remoteFullVersion = version.remoteFullVersion;
if (!state.spotifyAppVersion) { if (!state.spotifyAppVersion) {
sendError(state, "version_unavailable"); logVersionUnavailable(state);
return; return;
} }