aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-08 20:34:31 +0200
committerDanilo M. <danix@danix.xyz>2026-08-08 20:34:31 +0200
commit8094c6725824d2dc836e390a655c0a0e9c0745f7 (patch)
treedd28abe2b7fe6ce76cf0037fedc7c6ce210341fe
parentfcbbf31343b9d1e441d3ae24900386dc03c4706f (diff)
downloaddanix-nvchecker-8094c6725824d2dc836e390a655c0a0e9c0745f7.tar.gz
danix-nvchecker-8094c6725824d2dc836e390a655c0a0e9c0745f7.zip
Track Typora
Typora ships no git repo and no per-platform feed beyond its changelog: the Sparkle dev_update.xml carries the macOS dev channel and reports a different version, and /releases/all scrapes an unrelated number, so the stanza reads the version headings on /releases/linux. It is an Electron app unpacked under /opt, so it is neither a package, an AppImage nor a flatpak and none of the existing installed-version sources see it. Add an OPT_JSON map reading the version out of a JSON file, keyed by stanza name. Typora is currently its only entry; /opt was checked for others before adding a generic scanner. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
-rw-r--r--CLAUDE.md6
-rw-r--r--README.md11
-rw-r--r--nvchecker.toml7
-rwxr-xr-xnvtable14
4 files changed, 31 insertions, 7 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 0b76b62..01ed26d 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -72,8 +72,10 @@ the rest, and they are separate because the mappings differ per direction:
SlackBuild directory (`kitty` → `kitty-bin`). Adding one map for both breaks
the other direction.
-**Installed version** resolves through three sources in order:
-`/var/log/packages`, then the appimage-updater state file, then `flatpak list`.
+**Installed version** resolves through four sources in order: the `OPT_JSON`
+map (apps unpacked under `/opt` that are none of the below, currently Typora,
+declared as `<path>:<jq filter>`), `/var/log/packages`, the appimage-updater
+state file, then `flatpak list`.
**Repo version** is the `VERSION=` line from
`<repo>/<category>/<pkg>/<pkg>.info`. Note the category level: `.info` files sit
diff --git a/README.md b/README.md
index ce22136..aa1b40a 100644
--- a/README.md
+++ b/README.md
@@ -88,12 +88,15 @@ automatically when output is not a terminal.
anything itself, so it is fast enough to run on every login; refreshing that
file is nvchecker's job.
-**installed** is resolved from three sources, in order:
+**installed** is resolved from four sources, in order:
-1. `/var/log/packages` for Slackware packages
-2. `~/.local/state/appimage-updater/installed.json` for AppImages managed by
+1. the `OPT_JSON` map, for apps unpacked under `/opt` that are none of the
+ below and carry their version in a JSON file (Electron apps such as Typora).
+ Each entry is a stanza name mapped to `<path>:<jq filter>`.
+2. `/var/log/packages` for Slackware packages
+3. `~/.local/state/appimage-updater/installed.json` for AppImages managed by
[appimage-updater](https://git.danix.xyz/appimage-updater/)
-3. `flatpak list` for flatpak apps
+4. `flatpak list` for flatpak apps
**repo** is the `VERSION=` line of `<repo>/<category>/<pkg>/<pkg>.info` across
the configured SlackBuild repositories.
diff --git a/nvchecker.toml b/nvchecker.toml
index 5a3c990..0c0569e 100644
--- a/nvchecker.toml
+++ b/nvchecker.toml
@@ -390,6 +390,13 @@ github = "SoftFever/OrcaSlicer"
use_latest_release = true
prefix = "v"
+# Proprietary, no git repo. The Linux changelog is the only per-platform feed:
+# dev_update.xml carries the macOS dev channel and reports a different version.
+[Typora]
+source = "regex"
+url = "https://typora.io/releases/linux"
+regex = "<h2>([0-9]+\\.[0-9]+\\.[0-9]+)</h2>"
+
[cherrytree]
source = "github"
github = "giuspen/cherrytree"
diff --git a/nvtable b/nvtable
index 1eb008a..4955f92 100755
--- a/nvtable
+++ b/nvtable
@@ -49,6 +49,13 @@ declare -A REPO_ALIAS=(
[metasploit-framework]="metasploit-framework-bin"
)
+# Stanza name -> JSON file carrying the installed version, for apps unpacked
+# under /opt that are neither a package, an AppImage, nor a flatpak. Value is
+# "<path>:<jq filter>".
+declare -A OPT_JSON=(
+ [Typora]="/opt/Typora-linux-x64/resources/package.json:.version"
+)
+
SHOW_ALL=0; NO_TAKE=0; NO_COLOR=0; NO_EMOJI=0
for a in "$@"; do
case "$a" in
@@ -140,7 +147,12 @@ if command -v flatpak >/dev/null 2>&1; then
fi
installed_of() { # echoes "version" or "" ; handles alias + case-insensitive
- local n=$1 cand v
+ local n=$1 cand v spec f
+ if [[ -n ${OPT_JSON[$n]:-} ]]; then
+ spec=${OPT_JSON[$n]}; f=${spec%%:*}
+ [[ -r $f ]] && v=$(jq -r "${spec#*:} // empty" "$f" 2>/dev/null) \
+ && [[ -n $v ]] && { echo "$v"; return; }
+ fi
for cand in ${ALIAS[$n]:-$n}; do
# Anchored lookup first: correct even when VERSION contains a dash.
v=$(pkg_version "$cand") && { echo "$v"; return; }