aboutsummaryrefslogtreecommitdiffstats
path: root/nvtable
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 /nvtable
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>
Diffstat (limited to 'nvtable')
-rwxr-xr-xnvtable14
1 files changed, 13 insertions, 1 deletions
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; }