diff --git a/CHANGELOG.md b/CHANGELOG.md index 173cec3..e0273b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 6.9.0 + +- Change: a worker behind the userscript is now flagged on the page itself with a **⚠ Redeploy worker** button next to the JavStore controls, instead of only in the Cloud sync panel, where it was easy to miss. Tapping it shows both versions and points to the worker's Cloudflare build. The panel still lists the worker version. + ## 6.8.1 - Fix: on the Userscripts app for Safari (iPhone, iPad and Mac), nothing was ever saved. Pasting a sync link, or saving the sync settings by hand, showed "Sync settings could not be saved", and visited history was gone after every reload. That app offers only the dotted GM4 API (`GM.getValue`, `GM.setValue`, …) and no `GM_*` functions, so every storage call failed. The script now uses whichever of the two forms the userscript manager provides, and requests the `GM.*` grants too. After updating, paste the sync link again and save. diff --git a/README.md b/README.md index 8bb85dd..3ec55c7 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Once it is deployed, open the `JVS` panel → **Cloud sync**, enter the worker U - The worker applies the same rules as the local merge—newest timestamp wins per URL, tombstones and the clear/retention horizons outrank stale entries—so a device that has been offline for a week cannot overwrite what the others recorded, and clearing history on one device clears it everywhere instead of being undone. A device that pushes a stale entry is handed the winning one back. - Because a Durable Object is single-threaded, each sync's read-merge-write is serialized and strongly consistent: two devices syncing in the same second queue behind one another rather than racing. - Settings sync too, including the match and excluded terms, and they merge setting by setting: each one goes to the device that changed it last. A setting a device has never changed carries no timestamp and cannot win, so a new install picks up your keywords from the worker instead of pushing its defaults over them, even if you changed something else on it first. **Restore defaults** and a backup import set every setting on purpose, so they win everywhere. -- The Cloud sync panel shows the worker version from the worker's last answer, and warns when the worker is behind the userscript and needs redeploying. When the worker is ahead instead, an **⚠ Update script** button appears on screen and links to the latest release, because the userscript manager has not installed it yet. +- The Cloud sync panel shows the worker version from the worker's last answer. When the worker is behind the userscript, a **⚠ Redeploy worker** button appears on screen next to the JavStore controls; tap it for the versions. The worker redeploys through Cloudflare whenever `main` changes, so a lasting warning means its Cloudflare build did not go through. When the worker is ahead instead, an **⚠ Update script** button appears on screen and links to the latest release, because the userscript manager has not installed it yet. - AdGuard for Android clears a userscript's storage whenever it installs an update. After setting sync up, press **Copy sync link** and keep the link somewhere private, such as a password manager. After a wipe, open it on JavStore, or paste it into the endpoint box and save, to set everything up again. The link carries your token, so treat it like a password. - The endpoint and token live only on the device they were entered on. They are never written into the synced document, never appear in an exported backup, and are not left in the page: the token box stays empty once a token is stored and only reports that one exists. - A worker that is unreachable does not affect anything locally: history is still saved to the userscript manager, and the next sync picks it up. diff --git a/javstore-full-layout-cleanup.user.js b/javstore-full-layout-cleanup.user.js index baec383..86b7284 100644 --- a/javstore-full-layout-cleanup.user.js +++ b/javstore-full-layout-cleanup.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name JavStore Full Layout Cleanup - No Sidebars + Mosaic Overlay // @namespace http://tampermonkey.net/ -// @version 6.8.1 +// @version 6.9.0 // @description Clean up JavStore's layout, filter keyword-matched thumbnails, and track visited items with private, configurable controls. // @homepageURL https://github.com/jitdor/userscript-javstore // @supportURL https://github.com/jitdor/userscript-javstore/issues @@ -29,7 +29,7 @@ (function () { 'use strict'; - const SCRIPT_VERSION = '6.8.1'; + const SCRIPT_VERSION = '6.9.0'; // The same address as @downloadURL: opening it hands the newest release to the // userscript manager, which offers to install it. const INSTALL_URL = 'https://github.com/jitdor/userscript-javstore/releases/latest/download/javstore-full-layout-cleanup.user.js'; @@ -1617,14 +1617,21 @@ return 0; } + // A worker that only says it is "older than" some version is behind by definition. + function workerBehindScript() { + if (!syncConfigured() || !remoteWorkerVersion) return false; + return !/^\d+(\.\d+)*$/.test(remoteWorkerVersion) + || compareVersions(remoteWorkerVersion, SCRIPT_VERSION) < 0; + } + function describeWorkerVersion() { if (!syncConfigured()) return ''; if (!remoteWorkerVersion) return 'Worker version: not known until the first sync on this page.'; - const known = /^\d+(\.\d+)*$/.test(remoteWorkerVersion); - const behind = !known || compareVersions(remoteWorkerVersion, SCRIPT_VERSION) < 0; - return behind - ? `Worker version: ${remoteWorkerVersion}, behind this script (${SCRIPT_VERSION}). Redeploy the worker.` - : `Worker version: ${remoteWorkerVersion}.`; + return `Worker version: ${remoteWorkerVersion}.`; + } + + function describeWorkerBehind() { + return `Your sync worker is ${remoteWorkerVersion}, behind this script (${SCRIPT_VERSION}). The worker redeploys from main through Cloudflare, so check its latest build in the Cloudflare dashboard.`; } // The worker deploys from the same commit the release is cut from, so a worker ahead of @@ -2126,6 +2133,9 @@ const workerVersion = describeWorkerVersion(); ui.workerVersion.textContent = workerVersion; ui.workerVersion.hidden = !workerVersion; + const workerBehind = workerBehindScript(); + ui.redeployButton.hidden = !workerBehind; + if (workerBehind) ui.redeployButton.title = describeWorkerBehind(); const behind = scriptBehindWorker(); ui.updateButton.hidden = !behind; ui.updateWarning.hidden = !behind; @@ -2143,7 +2153,7 @@ ui.toast.classList.toggle('error', isError); ui.toast.classList.add('show'); window.clearTimeout(ui.toastTimer); - ui.toastTimer = window.setTimeout(() => ui?.toast.classList.remove('show'), 2800); + ui.toastTimer = window.setTimeout(() => ui?.toast.classList.remove('show'), Math.max(2800, message.length * 60)); } function splitTerms(value) { @@ -2394,8 +2404,8 @@ .muted { color: #9ca3af; font-size: 12px; } .warning { padding: 8px; border-radius: 8px; color: #fecaca; background: #7f1d1d; } .warning a { color: #fff; } - .pill.update { border-color: #fca5a5; background: #991b1b; } - .pill.update:hover { background: #7f1d1d; } + .pill.update, .pill.redeploy { border-color: #fca5a5; background: #991b1b; } + .pill.update:hover, .pill.redeploy:hover { background: #7f1d1d; } .pill[hidden], .warning[hidden] { display: none; } .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .full { grid-column: 1 / -1; } @@ -2435,6 +2445,7 @@