fix(userscript): strip Asura build hash from seriesId
This commit is contained in:
@@ -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],
|
||||
|
||||
Reference in New Issue
Block a user