mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
idk
This commit is contained in:
1 parent
2fbbdf0322
commit
d21273b418
5 files changed
+80
-3
No files matched your search
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import { logger } from "../../core/Logger.mjs";
|
||||
import { apiCall, isLastFmUserNotFound, noteStaleUser } from "./constants.mjs";
|
||||
import { apiCall, isLastFmFatalLinkError, isLastFmUserNotFound, noteStaleUser } from "./constants.mjs";
|
||||
|
||||
/**
|
||||
* @type {object}
|
||||
@@ -42,6 +42,12 @@ const ScrobblingMixin = {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (isLastFmFatalLinkError(err)) {
|
||||
if (noteStaleUser(this, userId)) {
|
||||
logger.warn(`[LastFm] Now-playing updates paused for ${userId}: ${err.message} (session revoked — attempting auto-recovery, will auto-unlink if unrecoverable)`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
logger.warn(`[LastFm] updateNowPlaying failed for ${userId}: ${err.message}`);
|
||||
}
|
||||
},
|
||||
@@ -77,6 +83,12 @@ const ScrobblingMixin = {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (isLastFmFatalLinkError(err)) {
|
||||
if (noteStaleUser(this, userId)) {
|
||||
logger.warn(`[LastFm] Scrobbling paused for ${userId}: ${err.message} (session revoked — attempting auto-recovery, will auto-unlink if unrecoverable)`);
|
||||
}
|
||||
return;
|
||||
}
|
||||
logger.warn(`[LastFm] Scrobble failed for ${userId}: ${err.message}`);
|
||||
}
|
||||
},
|
||||
@@ -106,6 +118,12 @@ const ScrobblingMixin = {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (isLastFmFatalLinkError(e)) {
|
||||
if (noteStaleUser(this, userId)) {
|
||||
logger.warn(`[LastFm] Scrobble count sync skipped for ${userId}: ${e.message} (session revoked — attempting auto-recovery, will auto-unlink if unrecoverable)`);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
logger.warn("[LastFm] Error:", e?.message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,10 @@ function isLastFmUserNotFound(err) {
|
||||
function isLastFmFatalLinkError(err) {
|
||||
if (isLastFmUserNotFound(err)) return true;
|
||||
const msg = String(err?.message ?? "");
|
||||
return /Last\.fm error 4:/.test(msg) || /authentication failed/i.test(msg);
|
||||
return /Last\.fm error [49]:/.test(msg)
|
||||
|| /authentication failed/i.test(msg)
|
||||
|| /invalid session key/i.test(msg)
|
||||
|| /Last\.fm HTTP 40[13]:/.test(msg);
|
||||
}
|
||||
|
||||
/** @type {Set<string>} @description Users already warned about as stale (dedup for background flows). */
|
||||
|
||||
Reference in new issue
Block a user