refactor: rebrand userscript storage keys, hosts and wordmark

This commit is contained in:
2026-08-06 02:47:33 +07:00
parent f30d4cc7cb
commit d41a1d2c0b
4 changed files with 31 additions and 16 deletions
+2 -2
View File
@@ -46,7 +46,7 @@
// htmx replaces the list on a tab switch, so re-apply to the new cards.
document.body.addEventListener("htmx:afterSwap", applyFilter);
document.addEventListener("mangabm:refilter", applyFilter);
document.addEventListener("bmgr:refilter", applyFilter);
})();
function setActiveTab(el) {
@@ -58,7 +58,7 @@ function setActiveTab(el) {
});
// The strip is outside the swapped region, so its visibility is re-decided
// here rather than by the server that just answered.
document.dispatchEvent(new Event("mangabm:refilter"));
document.dispatchEvent(new Event("bmgr:refilter"));
}
// The chapter-edit form and the archive/finish/remove confirm rows are the
+2 -2
View File
@@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="color-scheme" content="dark light">
<title>mangaBookmark</title>
<title>BookmarkManager</title>
<link rel="icon" href="/static/logo.svg" type="image/svg+xml">
<link rel="stylesheet" href="/static/style.css">
<link rel="preload" href="/static/fonts/instrument-serif-400-latin.woff2" as="font" type="font/woff2" crossorigin>
@@ -19,7 +19,7 @@
{{template "icons" .}}
<div class="sheet">
<header class="topbar">
<h1 class="brand">{{template "mark" .}}<span>manga<em>Bookmark</em></span></h1>
<h1 class="brand">{{template "mark" .}}<span>Bookmark<em>Manager</em></span></h1>
<form method="post" action="/logout">
<button type="submit" class="ghost">Log out</button>
</form>
+2 -2
View File
@@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="color-scheme" content="dark light">
<title>mangaBookmark</title>
<title>BookmarkManager</title>
<link rel="icon" href="/static/logo.svg" type="image/svg+xml">
<link rel="stylesheet" href="/static/style.css">
<link rel="preload" href="/static/fonts/instrument-serif-400-latin.woff2" as="font" type="font/woff2" crossorigin>
@@ -14,7 +14,7 @@
<main class="login-card">
<div>
<span class="eyebrow">Private library</span>
<h1 class="brand">{{template "mark" .}}<span>manga<em>Bookmark</em></span></h1>
<h1 class="brand">{{template "mark" .}}<span>Bookmark<em>Manager</em></span></h1>
</div>
<form method="post" action="/login">
<div>
+25 -10
View File
@@ -4,8 +4,8 @@
// @version 1.6.0
// @description Track read progress on Asura, Demonic, Comix & Kagane and sync to a self-hosted backend. Bromite-compatible (no GM_* APIs).
// @author you
// @downloadURL https://manga-api.violetcrown.my.id/u/40d79969b5442f90df4fe306a092c7c50e7b4a7a98099f98cc398f4fb374b1df/manga-bookmark.user.js
// @updateURL https://manga-api.violetcrown.my.id/u/40d79969b5442f90df4fe306a092c7c50e7b4a7a98099f98cc398f4fb374b1df/manga-bookmark.user.js
// @downloadURL https://bookmark-api.violetcrown.my.id/u/40d79969b5442f90df4fe306a092c7c50e7b4a7a98099f98cc398f4fb374b1df/manga-bookmark.user.js
// @updateURL https://bookmark-api.violetcrown.my.id/u/40d79969b5442f90df4fe306a092c7c50e7b4a7a98099f98cc398f4fb374b1df/manga-bookmark.user.js
// @match https://asuracomic.net/*
// @match https://asurascans.com/*
// @match https://demonicscans.org/*
@@ -21,19 +21,34 @@
// ============================================================
// CONFIG — fill these in before installing.
// ============================================================
const API_BASE = "https://manga-api.violetcrown.my.id"; // your backend origin, no trailing slash
const API_BASE = "https://bookmark-api.violetcrown.my.id"; // your backend origin, no trailing slash
const API_TOKEN = "40d79969b5442f90df4fe306a092c7c50e7b4a7a98099f98cc398f4fb374b1df"; // must equal backend API_TOKEN
const WEB_BASE = "https://manga.violetcrown.my.id"; // the browser UI, for the panel's nav chips
const WEB_BASE = "https://bookmark.violetcrown.my.id"; // the browser UI, for the panel's nav chips
// This script owns the manga library; the novel script is a separate install
// with its own prefix, so the two never share a cache, a queue or a panel.
const STORE_PREFIX = "bmgr:manga:";
// Safe in Bromite's isolated world: the page's own JS cannot read these.
const CACHE_KEY = "mangabm:cache";
const CACHE_KEY = STORE_PREFIX + "cache";
// Per-device record of when each series was last checked for new chapters.
// Deliberately not synced: each device does its own checking.
const LASTCHECKED_KEY = "mangabm:lastchecked";
const LASTCHECKED_KEY = STORE_PREFIX + "lastchecked";
const LATEST_CHECK_THROTTLE_MS = 4 * 60 * 60 * 1000;
const LATEST_CHECK_BATCH = 1; // series fetched per navigation
// One-time carry-over from the pre-rebrand key names. The cache would rebuild
// itself from the server, but the retry queue would not: dropping it loses
// writes made while offline.
for (const name of ["cache", "lastchecked", "queue", "fabpos"]) {
const old = localStorage.getItem("mangabm:" + name);
if (old !== null && localStorage.getItem(STORE_PREFIX + name) === null) {
localStorage.setItem(STORE_PREFIX + name, old);
}
localStorage.removeItem("mangabm:" + name);
}
// ============================================================
// Site adapters
//
@@ -534,13 +549,13 @@
// A failed write is not rolled back and not lost: the key is parked here and
// replayed when the backend is next reachable. Entries carry no payload — the
// body is read from state.byKey at send time, because state.list *is* the
// desired state and is already persisted in mangabm:cache. One entry per key,
// desired state and is already persisted under CACHE_KEY. One entry per key,
// so two writes to the same series cannot replay out of order, an
// archive-then-unarchive collapses to whatever the cache now says, and a
// queued DELETE replaces a queued PUT rather than racing it.
// ============================================================
const QUEUE_KEY = "mangabm:queue";
const QUEUE_KEY = STORE_PREFIX + "queue";
const QUEUE_MAX = 200; // ~12 KB; realistically bounded by the bookmark count
const QUEUE_MAX_ATTEMPTS = 10;
@@ -1075,7 +1090,7 @@
// FAB placement + dragging (snaps to nearest left/right edge)
// ============================================================
const FAB_KEY = "mangabm:fabpos";
const FAB_KEY = STORE_PREFIX + "fabpos";
const FAB_MARGIN = 12; // vertical breathing room at the top and bottom
const FAB_EDGE = 0; // horizontal: an edge tab sits flush against the side
const ARM_MS = 400; // hold this long on the invisible strip to arm a drag
@@ -1580,7 +1595,7 @@
</g>
</g>
</svg>
<span>manga<em>Bookmark</em></span>
<span>Bookmark<em>Manager</em></span>
</span>
<button id="closeBtn" aria-label="Close">close</button>
</header>