From 3a2210b9c86d84689656a5a9cf441e6c4f50f000 Mon Sep 17 00:00:00 2001 From: Sulthan Zaki Date: Tue, 28 Jul 2026 06:52:52 +0700 Subject: [PATCH] fix(userscript): strip Asura build hash from seriesId --- userscript/manga-bookmark.user.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/userscript/manga-bookmark.user.js b/userscript/manga-bookmark.user.js index 2e3107e..3a5acb0 100644 --- a/userscript/manga-bookmark.user.js +++ b/userscript/manga-bookmark.user.js @@ -66,6 +66,18 @@ return out; } + // Asura appends a site-wide build hash to every slug + // ("...-059befe1"); it rotates on each redeploy, so it must not be part + // of the series identity — old keys can never match pages after a + // redeploy. Only the ID strips it; seriesUrl keeps the full slug because + // navigation needs the current hash (stale ones 302). Must stay in sync + // with asuraBuildHash in backend/store.go. + // ponytail: a real title ending in exactly 8 hex chars would lose its + // last segment; none known. + function stripBuildHash(slug) { + return slug.replace(/-[0-9a-f]{8}$/, ""); + } + const asura = { site: "asura", // asuracomic.net deep links 301 to the asurascans.com *root*, dropping the @@ -83,7 +95,7 @@ return { type: "chapter", site: this.site, - seriesId: m[1], + seriesId: stripBuildHash(m[1]), title: cleanTitle(meta("og:title")), cover: meta("og:image") || "", seriesUrl: loc.origin + "/comics/" + m[1], @@ -98,7 +110,7 @@ return { type: "series", site: this.site, - seriesId: m[1], + seriesId: stripBuildHash(m[1]), title: cleanTitle(meta("og:title")), cover: meta("og:image") || "", seriesUrl: loc.origin + "/comics/" + m[1],