feat: spellcheck menu, typewriter mode, file associations, updater hardening

English spellcheck suggestions with Add-to-dictionary in the native context menu plus a Settings toggle. Typewriter caret-centering mode. OS file associations for .md/.txt and Open File wording. Updater: release URL surfaced, single progress listener, two-byte tarball check, installer wait guard. Search/installer test suites registered; chapter-list layout polish; ignore KDE .directory files.
This commit is contained in:
avi 2026-09-19 16:38:17 -05:00
commit 542a545c0d
17 changed files with 445 additions and 73 deletions

View file

@ -44,6 +44,37 @@ assert(sh.includes(`'/tmp/it'\\''s.tar.gz'`), "shQuote escapes embedded single q
assert(sh.includes("kill -0"), "installer waits for app pid");
assert(sh.includes("-xzf"), "installer extracts gz");
// Real Gitea release-JSON shape (tag_name/html_url/body/assets with sizes).
const gitea = u.parseRelease({
id: 5,
tag_name: "v0.2.0",
html_url: "https://git.atitlan.io/avi/Folio/releases/tag/v0.2.0",
body: "Bug fixes",
assets: [
{ name: "Folio-0.2.0-linux-x86_64.tar.gz", browser_download_url: "https://git.atitlan.io/avi/Folio/releases/download/v0.2.0/Folio-0.2.0-linux-x86_64.tar.gz", size: 123456 },
{ name: "Folio-0.2.0-linux-amd64.deb", browser_download_url: "https://git.atitlan.io/avi/Folio/releases/download/v0.2.0/Folio-0.2.0-linux-amd64.deb", size: 111 },
{ name: "Folio-0.2.0.AppImage", browser_download_url: "https://git.atitlan.io/avi/Folio/releases/download/v0.2.0/Folio-0.2.0.AppImage", size: 222 },
],
});
assert(gitea.version === "0.2.0", "gitea tag parsed");
assert(gitea.url === "https://git.atitlan.io/avi/Folio/releases/tag/v0.2.0", "gitea release url kept");
assert(gitea.notes === "Bug fixes", "gitea notes kept");
assert(u.pickAsset(gitea.assets).name.endsWith(".tar.gz"), "gitea: tar.gz picked over deb/AppImage");
assert(u.isTrustedDownloadUrl(gitea.assets[0].browser_download_url, "https://git.atitlan.io"), "gitea asset url trusted");
// No installable archive cases.
assert(u.pickAsset([]) === null, "empty assets -> no pick");
const debOnly = u.parseRelease({ tag_name: "v0.3.0", assets: [{ name: "Folio.deb", browser_download_url: "https://git.atitlan.io/x/Folio.deb" }] });
assert(u.pickAsset(debOnly.assets) === null, "deb-only release -> no pick (tar.gz required)");
// Version edge cases.
assert(!u.isNewer("0.1.0", "0.1.0"), "same version not an update");
assert(!u.isNewer("0.1.0", "0.2.0"), "older release not an update");
assert(u.compareVersions("0.1.2-rc1", "0.1.2") === 0, "rc suffix ignored in compare");
assert(u.parseVersion("nope") === null, "unparseable version -> null");
assert(!u.isTrustedDownloadUrl("http://git.atitlan.io/a.tar.gz", "https://git.atitlan.io"), "http vs https rejected");
assert(!u.isTrustedDownloadUrl("not a url", "https://git.atitlan.io"), "malformed url rejected");
assert(m.mdTitle("# My Heading\nbody", "file") === "My Heading", "title from H1");
assert(m.mdTitle("no heading", "file") === "file", "title falls back to filename stem");