music preloader fixes:

* stop scanning after 5 folders
* don't walk into errorpages (such as unmapped root)

and improve errortoast in case of network issues
This commit is contained in:
ed 2024-06-07 11:38:40 +00:00
parent aab57cb24b
commit db6059e100
2 changed files with 19 additions and 1 deletions

View file

@ -400,6 +400,7 @@ var Ls = {
"badreply": "Failed to parse reply from server",
"xhr403": "403: Access denied\n\ntry pressing F5, maybe you got logged out",
"xhr0": "unknown (probably lost connection to server, or server is offline)",
"cf_ok": "sorry about that -- DD" + wah + "oS protection kicked in\n\nthings should resume in about 30 sec\n\nif nothing happens, hit F5 to reload the page",
"tl_xe1": "could not list subfolders:\n\nerror ",
"tl_xe2": "404: Folder not found",
@ -910,6 +911,7 @@ var Ls = {
"badreply": "Ugyldig svar ifra serveren",
"xhr403": "403: Tilgang nektet\n\nkanskje du ble logget ut? prøv å trykk F5",
"xhr0": "ukjent (enten nettverksproblemer eller serverkrasj)",
"cf_ok": "beklager -- liten tilfeldig kontroll, alt OK\n\nting skal fortsette om ca. 30 sekunder\n\nhvis ikkeno skjer, trykk F5 for å laste siden på nytt",
"tl_xe1": "kunne ikke hente undermapper:\n\nfeil ",
"tl_xe2": "404: Mappen finnes ikke",
@ -2589,6 +2591,12 @@ var mpui = (function () {
if (mpl.prescan_evp == evp)
throw "evp match";
if (mpl.traversals++ > 4) {
mpl.prescan_evp = null;
toast.inf(10, L.mm_nof);
throw L.mm_nof;
}
mpl.prescan_evp = evp;
toast.inf(10, L.mm_prescan);
treectl.ls_cb = repreload;
@ -6341,8 +6349,15 @@ var treectl = (function () {
var res = JSON.parse(this.responseText);
}
catch (ex) {
if (!this.hydrate)
if (r.ls_cb) {
r.ls_cb = null;
return toast.inf(10, L.mm_nof);
}
if (!this.hydrate) {
location = this.top;
return;
}
return toast.err(30, "bad <code>?ls</code> reply;\nexpected json, got this:\n\n" + esc(this.responseText + ''));
}

View file

@ -2024,6 +2024,9 @@ function xhrchk(xhr, prefix, e404, lvl, tag) {
if (xhr.status == 404)
return toast.err(0, prefix + e404 + suf, tag);
if (!xhr.status && !errtxt)
return toast.err(0, prefix + L.xhr0);
if (is_cf && (xhr.status == 403 || xhr.status == 503)) {
var now = Date.now(), td = now - cf_cha_t;
if (td < 15000)