Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions tauri/scripts/publish-linux-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@ for (const file of process.argv.slice(2)) {
}
JS
node scripts/updater-manifest.mjs "$bundle/appimage" "$version" --check
notes="$(mktemp)"
trap 'rm -f "$notes"' EXIT
release_dir="$(mktemp -d)"
trap 'rm -rf -- "$release_dir"' EXIT
notes="$release_dir/notes.md"
archive="$release_dir/HyprTrack.Desktop_${version}_linux-x86_64.zip"
python3 -m zipfile -c "$archive" "${assets[@]}"
python3 -m zipfile -t "$archive"
(cd "$release_dir" && sha256sum "$(basename "$archive")" > "$(basename "$archive").sha256")
assets+=("$archive" "$archive.sha256")
RELEASE_NOTES="$notes" node --input-type=module <<'JS'
import fs from 'node:fs'
const version = process.env.RELEASE_TAG.slice(1)
const entry = JSON.parse(fs.readFileSync('src/lib/releases.json', 'utf8')).find(r => r.version === version)
if (!entry) throw Error('Missing release notes')
fs.writeFileSync(process.env.RELEASE_NOTES, [entry.title, '', ...entry.highlights.map(s => `- ${s}`), '', 'Linux network capture needs the one-time NetHogs setup described in the README. Signed in-app updates are available for AppImage installations.', ''].join('\n'))
fs.writeFileSync(process.env.RELEASE_NOTES, [entry.title, '', `Release date · ${entry.date}`, '', ...entry.highlights.map(s => `- ${s}`), '', 'Linux network capture needs the one-time NetHogs setup described in the README. Signed in-app updates are available for AppImage installations.', ''].join('\n'))
JS

if gh release view "$tag" --json isDraft >/dev/null 2>&1; then
Expand All @@ -54,5 +60,5 @@ for asset in "${assets[@]}"; do
done
[[ "$uploaded" == true ]] || exit 1
done
[[ "$(gh release view "$tag" --json assets --jq '.assets | length')" == 6 ]]
[[ "$(gh release view "$tag" --json assets --jq '.assets | length')" == "${#assets[@]}" ]]
gh release edit "$tag" --draft=false
14 changes: 9 additions & 5 deletions tauri/src/components/app-updates.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useRef, useState } from "react"
import type { AppUpdateState } from "../hooks/use-app-update"
import type { ReleaseNotice } from "../hooks/use-release-notice"
import { installedReleaseHistory, type ReleaseNotice } from "../hooks/use-release-notice"
import "./app-updates.css"

function progressLabel(update: AppUpdateState) {
Expand All @@ -14,7 +14,9 @@ function progressLabel(update: AppUpdateState) {

export function UpdateControl({ update, compact = false }: { update: AppUpdateState; compact?: boolean }) {
const [open, setOpen] = useState(false)
const [showHistory, setShowHistory] = useState(false)
if (compact && !update.availableVersion && !update.busy) return null
const history = compact ? null : installedReleaseHistory(update.info.version)
const percent = update.progress?.total ? Math.min(100, Math.round(update.progress.downloaded / update.progress.total * 100)) : null
const install = () => { setOpen(true); void update.install() }
return <div className={compact ? "app-update-control" : "app-update-settings"}>
Expand All @@ -23,9 +25,11 @@ export function UpdateControl({ update, compact = false }: { update: AppUpdateSt
<p>{update.availableVersion ? `Version ${update.availableVersion} is ready.` : update.checking ? "Checking for updates…" : update.checked && update.info.updateSupported ? "You have the latest published version." : "Updates are checked when the app opens."}</p>
{!update.info.updateSupported ? <p>In-app installation is available in the Linux AppImage. Update DEB/RPM packages through your package manager.</p> : null}
<div className="app-update-actions"><button className="button secondary" type="button" disabled={update.checking || update.busy} onClick={() => { setOpen(true); void update.check() }}>{update.checking ? "Checking…" : "Check for updates"}</button>
{history && <button className="button secondary" type="button" onClick={() => setShowHistory(true)}>Release history</button>}
{update.availableVersion ? <button className="button primary" type="button" disabled={update.busy || !update.info.updateSupported} onClick={install}>{update.busy ? progressLabel(update) : "Install & restart"}</button> : null}
</div>
</>}
{showHistory && history && <ReleaseNoticeDialog notice={history} history onDismiss={() => setShowHistory(false)} />}
{(compact ? open : true) && (update.busy || update.error) ? <div className={compact ? "app-update-popover" : "app-update-status"} role={update.error ? "alert" : "status"} aria-live="polite">
<strong>{update.error ? "Could not complete the update" : progressLabel(update)}</strong><p>{update.error ?? "Your usage database and preferences stay in place."}</p>
{update.busy ? <div className={`app-update-track ${percent === null ? "indeterminate" : ""}`} role="progressbar" aria-label="App update progress" aria-valuemin={0} aria-valuemax={100} aria-valuenow={percent ?? undefined}><span style={{ width: `${percent ?? 35}%` }} /></div> : null}
Expand All @@ -34,7 +38,7 @@ export function UpdateControl({ update, compact = false }: { update: AppUpdateSt
</div>
}

export function ReleaseNoticeDialog({ notice, onDismiss }: { notice: ReleaseNotice; onDismiss: () => void }) {
export function ReleaseNoticeDialog({ notice, history = false, onDismiss }: { notice: ReleaseNotice; history?: boolean; onDismiss: () => void }) {
const dialog = useRef<HTMLDialogElement>(null)
const closeButton = useRef<HTMLButtonElement>(null)
useEffect(() => {
Expand All @@ -44,12 +48,12 @@ export function ReleaseNoticeDialog({ notice, onDismiss }: { notice: ReleaseNoti
return () => element?.close()
}, [])
return <dialog ref={dialog} className="release-notice" aria-labelledby="release-notice-title" onCancel={(event) => { event.preventDefault(); onDismiss() }}>
<div className="release-notice-header"><p className="eyebrow">Updated to v{notice.version}</p><h1 id="release-notice-title">What’s new in HyprTrack</h1>
<p>{notice.previousVersion ? `Changes since v${notice.previousVersion}.` : "Here’s what changed in this release."} {notice.releases.length > 1 ? `${notice.releases.length} updates included.` : ""}</p></div>
<div className="release-notice-header"><p className="eyebrow">{history ? "Installed" : "Updated to"} v{notice.version}</p><h1 id="release-notice-title">{history ? "Release history" : "What’s new in HyprTrack"}</h1>
{!history && <p>{notice.previousVersion ? `Changes since v${notice.previousVersion}.` : "Here’s what changed in this release."} {notice.releases.length > 1 ? `${notice.releases.length} updates included.` : ""}</p>}</div>
<div className="release-notice-content">{notice.releases.map(release => <article className="release-entry" key={release.version}>
<div className="release-entry-meta"><span className="pill">v{release.version}</span><time dateTime={release.date}>{new Intl.DateTimeFormat("en-IN", { day: "numeric", month: "long", year: "numeric", timeZone: "Asia/Kolkata" }).format(new Date(`${release.date}T00:00:00+05:30`))}</time></div>
<h2>{release.title}</h2><ul>{release.highlights.map(highlight => <li key={highlight}>{highlight}</li>)}</ul>
</article>)}</div>
<div className="release-notice-footer"><span>These notes won’t appear again for this version.</span><button ref={closeButton} className="button primary" type="button" onClick={onDismiss}>Continue to HyprTrack</button></div>
<div className="release-notice-footer">{!history && <span>Find these notes again in Settings.</span>}<button ref={closeButton} className="button primary" type="button" onClick={onDismiss}>{history ? "Close" : "Continue to HyprTrack"}</button></div>
</dialog>
}
6 changes: 6 additions & 0 deletions tauri/src/hooks/use-release-notice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ function compare(a: string, b: string) {
return 0
}

export function installedReleaseHistory(version: string): ReleaseNotice | null {
if (!/^\d+\.\d+\.\d+$/.test(version)) return null
const installed = releases.filter(release => compare(release.version, version) <= 0)
return installed.length ? { version, previousVersion: null, releases: installed } : null
}

export function consumeReleaseNotice(version: string, storage: Storage, hasExistingActivity = false): ReleaseNotice | null {
if (!/^\d+\.\d+\.\d+$/.test(version)) return null
try {
Expand Down
10 changes: 10 additions & 0 deletions tauri/src/lib/releases.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
[
{
"version": "2.2.3",
"date": "2026-11-25",
"title": "Safer network capture and release history",
"highlights": [
"The network helper checks permissions before setting capture capabilities, and the collector uses the trusted helper path.",
"Choose Release history in Settings to see what changed in each installed version.",
"Download the Linux packages, signatures and checksums together as a ZIP."
]
},
{
"version": "2.2.2",
"date": "2026-10-27",
Expand Down
Loading