Changeset 72f936a in Klonkt
- Timestamp:
- 07/16/2026 12:20:51 PM (8 weeks ago)
- Branches:
- main
- Children:
- 8878814
- Parents:
- df9da7d
- git-author:
- Robin <roboburr@…> (07/12/2026 11:37:06 PM)
- git-committer:
- Robin <roboburr@…> (07/16/2026 12:20:51 PM)
- File:
-
- 1 edited
-
src/routes/admin-updates.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/routes/admin-updates.js
rdf9da7d r72f936a 31 31 const HOME = process.env.HOME || ''; 32 32 const APP_DIR = process.cwd(); 33 const BRANCH = process.env.KLONKT_BRANCH || 'main';34 33 const GIT_DIR = process.env.KLONKT_GIT_DIR || path.join(HOME, 'git-repos/prutfolio.git'); 35 34 const UPDATE_SCRIPT = process.env.KLONKT_UPDATE_SCRIPT || path.join(HOME, 'bin/klonkt-self-update.sh'); … … 39 38 // a repo that actually exists, so it never logs "fatal: not a git repository". 40 39 const IS_CHECKOUT = (() => { try { return fs.existsSync(path.join(APP_DIR, '.git')); } catch { return false; } })(); 40 41 // A checkout must track the branch it is ACTUALLY on: a self-hoster who checked out 42 // `stable` should be compared to origin/stable, not main — otherwise the update panel 43 // shows main's commits as "latest" and a bogus "behind" count (confusing for stable 44 // users). Env override wins (the bare fleet sets KLONKT_BRANCH); then the checkout's 45 // current branch; then main as a last resort. 46 const CHECKOUT_BRANCH = IS_CHECKOUT ? (() => { 47 try { 48 const b = execFileSync('git', ['-C', APP_DIR, 'rev-parse', '--abbrev-ref', 'HEAD'], 49 { encoding: 'utf8', timeout: 8000, stdio: ['ignore', 'pipe', 'ignore'] }).trim(); 50 return (b && b !== 'HEAD') ? b : null; 51 } catch { return null; } 52 })() : null; 53 const BRANCH = process.env.KLONKT_BRANCH || CHECKOUT_BRANCH || 'main'; 41 54 const REMOTE_REF = IS_CHECKOUT ? `origin/${BRANCH}` : BRANCH; // what "latest" resolves to 42 55
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)