Skip to content

Commit 35d209f

Browse files
committed
for obscure bad-cookies issue, autonuke cookies
don't ask me how or why some people seem to have unreadable cookie data on localhost
1 parent fe05bc4 commit 35d209f

File tree

2 files changed

+23
-10
lines changed

2 files changed

+23
-10
lines changed

docs/Video Model Support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,3 +417,4 @@ There's a full step by step guide for video model usage here: <https://github.co
417417
- You can use the Wan 2.1 Lightx2v or other causvid-likes (see [CausVid Section Above](#wan-causvid---high-speed-14b)) on the Wan 2.2 14B (not on the 5B)
418418
- For I2V, this seems to "just work"
419419
- For T2V, this has soe visual oddities but does still mostly work
420+
- Wan 2.2 has an official prompting guide book: <https://alidocs.dingtalk.com/i/nodes/EpGBa2Lm8aZxe5myC99MelA2WgN7R35y>

src/wwwroot/js/util.js

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -482,18 +482,30 @@ function getCookie(name) {
482482

483483
/** Lists all cookies that start with the given prefix. */
484484
function listCookies(prefix) {
485-
let decodedCookie = decodeURIComponent(document.cookie);
486-
let ca = decodedCookie.split(';');
487-
let result = [];
488-
for(let i = 0; i < ca.length; i++) {
489-
let c = ca[i].trim();
490-
let equal = c.indexOf('=');
491-
let name = c.substring(0, equal);
492-
if (name.startsWith(prefix)) {
493-
result.push(name);
485+
try {
486+
let decodedCookie = decodeURIComponent(document.cookie);
487+
let ca = decodedCookie.split(';');
488+
let result = [];
489+
for(let i = 0; i < ca.length; i++) {
490+
let c = ca[i].trim();
491+
let equal = c.indexOf('=');
492+
let name = c.substring(0, equal);
493+
if (name.startsWith(prefix)) {
494+
result.push(name);
495+
}
494496
}
497+
return result;
498+
}
499+
catch (e) {
500+
console.error('Error listing cookies:', e);
501+
if (e instanceof URIError) { // Malformed cookie data, try to nuke em
502+
for (let cookie of document.cookie.split(';')) {
503+
let name = cookie.trim().split('=')[0];
504+
deleteCookie(name);
505+
}
506+
}
507+
return [];
495508
}
496-
return result;
497509
}
498510

499511
/** Deletes the cookie with the given name. */

0 commit comments

Comments
 (0)