mirror of
https://github.com/JoshiCodes/knock.git
synced 2026-12-04 15:29:40 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4960f6d419
|
@@ -19,6 +19,9 @@ jobs:
|
||||
macos:
|
||||
if: github.event_name == 'push' || inputs.platforms == 'all' || contains(inputs.platforms, 'macos')
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v5
|
||||
@@ -31,8 +34,19 @@ jobs:
|
||||
- run: npm ci
|
||||
- name: Test
|
||||
run: cargo test -p knock-core --locked
|
||||
- name: App (universal .app and .dmg)
|
||||
run: npx tauri build --target universal-apple-darwin --bundles app,dmg
|
||||
- name: App (universal .app and .dmg, plus a signed update package)
|
||||
run: |
|
||||
# Update packages only when the signing key is available.
|
||||
extra=""
|
||||
if [ -n "$TAURI_SIGNING_PRIVATE_KEY" ]; then extra='--config {"bundle":{"createUpdaterArtifacts":true}}'; fi
|
||||
npx tauri build --target universal-apple-darwin --bundles app,dmg $extra
|
||||
v=$(node -p "require('./src-tauri/tauri.conf.json').version")
|
||||
mkdir -p dist-update
|
||||
b=target/universal-apple-darwin/release/bundle/macos
|
||||
if [ -f "$b/knock.app.tar.gz" ]; then
|
||||
cp "$b/knock.app.tar.gz" "dist-update/knock_${v}_universal.app.tar.gz"
|
||||
cp "$b/knock.app.tar.gz.sig" "dist-update/knock_${v}_universal.app.tar.gz.sig"
|
||||
fi
|
||||
- name: CLI (universal binary)
|
||||
run: |
|
||||
cargo build --release --locked -p knock-cli --target aarch64-apple-darwin
|
||||
@@ -53,12 +67,16 @@ jobs:
|
||||
path: |
|
||||
target/universal-apple-darwin/release/bundle/dmg/*.dmg
|
||||
knock-cli-macos-universal.tar.gz
|
||||
dist-update/*
|
||||
|
||||
# Best effort per the spec.
|
||||
windows:
|
||||
if: github.event_name == 'push' || inputs.platforms == 'all' || contains(inputs.platforms, 'windows')
|
||||
runs-on: windows-latest
|
||||
continue-on-error: true
|
||||
env:
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v5
|
||||
@@ -67,8 +85,14 @@ jobs:
|
||||
cache: npm
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- run: npm ci
|
||||
- name: App (.msi and setup .exe)
|
||||
run: npx tauri build --bundles msi,nsis
|
||||
- name: App (.msi and setup .exe, signed for updates)
|
||||
shell: bash
|
||||
run: |
|
||||
if [ -n "$TAURI_SIGNING_PRIVATE_KEY" ]; then
|
||||
npx tauri build --bundles msi,nsis --config '{"bundle":{"createUpdaterArtifacts":true}}'
|
||||
else
|
||||
npx tauri build --bundles msi,nsis
|
||||
fi
|
||||
- name: CLI
|
||||
shell: pwsh
|
||||
run: |
|
||||
@@ -80,6 +104,7 @@ jobs:
|
||||
path: |
|
||||
target/release/bundle/msi/*.msi
|
||||
target/release/bundle/nsis/*.exe
|
||||
target/release/bundle/nsis/*.exe.sig
|
||||
knock-cli-windows-x64.zip
|
||||
|
||||
# Native amd64 Linux build on Ubuntu 22.04, with the AppImage the arm64
|
||||
@@ -170,6 +195,32 @@ jobs:
|
||||
with:
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
- name: Update manifest for macOS and Windows
|
||||
env:
|
||||
TAG: ${{ github.ref_name }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
cd artifacts
|
||||
v="${TAG#v}"
|
||||
base="https://github.com/$REPO/releases/download/$TAG"
|
||||
mac=$(ls *_universal.app.tar.gz 2>/dev/null | head -1 || true)
|
||||
win=$(ls *-setup.exe 2>/dev/null | head -1 || true)
|
||||
if [ -z "$mac$win" ]; then echo "no signed update packages, skipping latest.json"; exit 0; fi
|
||||
python3 - "$v" "$base" "$mac" "$win" <<'PY'
|
||||
import json, sys, datetime, os
|
||||
v, base, mac, win = sys.argv[1:5]
|
||||
platforms = {}
|
||||
def sig(f):
|
||||
return open(f + ".sig").read().strip() if f and os.path.exists(f + ".sig") else None
|
||||
if mac and sig(mac):
|
||||
for p in ("darwin-aarch64", "darwin-x86_64"):
|
||||
platforms[p] = {"signature": sig(mac), "url": f"{base}/{mac}"}
|
||||
if win and sig(win):
|
||||
platforms["windows-x86_64"] = {"signature": sig(win), "url": f"{base}/{win}"}
|
||||
json.dump({"version": v, "notes": f"knock {v}", "pub_date": datetime.datetime.now(datetime.timezone.utc).isoformat(), "platforms": platforms}, open("latest.json", "w"), indent=2)
|
||||
print(open("latest.json").read())
|
||||
PY
|
||||
|
||||
- name: Checksums
|
||||
run: |
|
||||
cd artifacts
|
||||
|
||||
Generated
+156
-1
@@ -894,6 +894,15 @@ dependencies = [
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "constant_time_eq"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "144e7f1de087984240b7816d47f698b414979faa6f40839c5b86d6bd47db57b7"
|
||||
dependencies = [
|
||||
"rustversion",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cookie"
|
||||
version = "0.18.3"
|
||||
@@ -1593,6 +1602,16 @@ dependencies = [
|
||||
"rustc_version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1255e7a9f1902190d4c10a75f2f7f495d3d3ce13e9ba26e6c48683a0f4dbed7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "find-msvc-tools"
|
||||
version = "0.1.16"
|
||||
@@ -2891,7 +2910,9 @@ dependencies = [
|
||||
"tauri-plugin-dialog",
|
||||
"tauri-plugin-notification",
|
||||
"tauri-plugin-opener",
|
||||
"tauri-plugin-process",
|
||||
"tauri-plugin-single-instance",
|
||||
"tauri-plugin-updater",
|
||||
"tokio",
|
||||
"tokio-tungstenite",
|
||||
"tracing",
|
||||
@@ -3184,6 +3205,12 @@ version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "minisign-verify"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "871285dc19d8d0ebe0eef3d0e99a205f2a71363b122632cbbfa4a6c370a960ce"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.8.9"
|
||||
@@ -3292,6 +3319,18 @@ dependencies = [
|
||||
"memoffset",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nix"
|
||||
version = "0.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77730ed34f01f4990cb2ea67fec715ecebc6fab9a6396cf83c5529b13f581bdc"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"cfg-if",
|
||||
"cfg_aliases",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "7.1.3"
|
||||
@@ -3611,6 +3650,18 @@ dependencies = [
|
||||
"objc2-core-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-osa-kit"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"objc2",
|
||||
"objc2-app-kit",
|
||||
"objc2-foundation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "objc2-quartz-core"
|
||||
version = "0.3.2"
|
||||
@@ -3732,6 +3783,20 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "osakit"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b"
|
||||
dependencies = [
|
||||
"objc2",
|
||||
"objc2-foundation",
|
||||
"objc2-osa-kit",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "owo-colors"
|
||||
version = "4.4.0"
|
||||
@@ -4629,6 +4694,7 @@ checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
|
||||
dependencies = [
|
||||
"aws-lc-rs",
|
||||
"once_cell",
|
||||
"ring",
|
||||
"rustls-pki-types",
|
||||
"rustls-webpki",
|
||||
"subtle",
|
||||
@@ -5611,6 +5677,17 @@ dependencies = [
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tar"
|
||||
version = "0.4.46"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"
|
||||
dependencies = [
|
||||
"filetime",
|
||||
"libc",
|
||||
"xattr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "target-lexicon"
|
||||
version = "0.12.16"
|
||||
@@ -5853,6 +5930,16 @@ dependencies = [
|
||||
"zbus 5.19.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-process"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74ae3d8549ae564c0397377373e262f340908eb23a5b9fbe03f2a00007dc0038"
|
||||
dependencies = [
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-single-instance"
|
||||
version = "2.5.5"
|
||||
@@ -5870,6 +5957,40 @@ dependencies = [
|
||||
"zbus 5.19.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-plugin-updater"
|
||||
version = "2.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d957abbcb3f9f6c76d22a3a0f012f30880640d0bccb5634d2b12a9937e4c872b"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"dirs",
|
||||
"flate2",
|
||||
"futures-util",
|
||||
"http",
|
||||
"infer",
|
||||
"libc",
|
||||
"log",
|
||||
"minisign-verify",
|
||||
"osakit",
|
||||
"percent-encoding",
|
||||
"reqwest",
|
||||
"rustls",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tar",
|
||||
"tauri",
|
||||
"tauri-plugin",
|
||||
"tempfile",
|
||||
"thiserror 2.0.21",
|
||||
"time",
|
||||
"tokio",
|
||||
"url",
|
||||
"windows-sys 0.61.2",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime"
|
||||
version = "2.12.4"
|
||||
@@ -6388,6 +6509,12 @@ dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typed-path"
|
||||
version = "0.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e"
|
||||
|
||||
[[package]]
|
||||
name = "typeid"
|
||||
version = "1.0.3"
|
||||
@@ -7326,6 +7453,16 @@ dependencies = [
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xattr"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "963d6fab92d5504b971dc8bd90ca743c2575e590bc8071ea5bc571598667ae08"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xdg-home"
|
||||
version = "1.3.0"
|
||||
@@ -7375,7 +7512,7 @@ dependencies = [
|
||||
"futures-sink",
|
||||
"futures-util",
|
||||
"hex",
|
||||
"nix",
|
||||
"nix 0.29.0",
|
||||
"ordered-stream",
|
||||
"rand 0.8.8",
|
||||
"serde",
|
||||
@@ -7631,6 +7768,24 @@ dependencies = [
|
||||
"syn 3.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "9.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d8dbe089cf6b0448b78f5fc50139ab5aaa40d08ac07cdc1baf2c13add35fcce"
|
||||
dependencies = [
|
||||
"constant_time_eq",
|
||||
"crc32fast",
|
||||
"getrandom 0.4.3",
|
||||
"indexmap 2.14.2",
|
||||
"libc",
|
||||
"memchr",
|
||||
"nix 0.32.0",
|
||||
"typed-path",
|
||||
"windows-sys 0.61.2",
|
||||
"zeroize",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zlib-rs"
|
||||
version = "0.6.9"
|
||||
|
||||
Generated
+20
@@ -29,6 +29,8 @@
|
||||
"@tauri-apps/plugin-dialog": "^2.8.4",
|
||||
"@tauri-apps/plugin-notification": "^2.8.1",
|
||||
"@tauri-apps/plugin-opener": "^2.7.3",
|
||||
"@tauri-apps/plugin-process": "^2.4.0",
|
||||
"@tauri-apps/plugin-updater": "^2.14.1",
|
||||
"cm6-graphql": "^1.0.0",
|
||||
"graphql": "^17.1.0",
|
||||
"jsonpath-plus": "^11.3.0"
|
||||
@@ -1364,6 +1366,24 @@
|
||||
"@tauri-apps/api": "^2.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/plugin-process": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-process/-/plugin-process-2.4.0.tgz",
|
||||
"integrity": "sha512-GddrmsSLAYrLa/yTXlXK/YRDzUgYeeOnUXTbiyvJWkmI424RmDPD3FVLeqcon7rv6O6ZfhBilcrHWnSo7o6hIQ==",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/plugin-updater": {
|
||||
"version": "2.14.1",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-updater/-/plugin-updater-2.14.1.tgz",
|
||||
"integrity": "sha512-Hr7nlBm1wT6xbwzjZ/S36YULazu8MNlj5vvOwMl47fXI7HTa5Bjl1PbDEwVHaZTAKzE1VZsUy35UqnbrQxmYQw==",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tsconfig/svelte": {
|
||||
"version": "5.0.9",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/svelte/-/svelte-5.0.9.tgz",
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
"@tauri-apps/plugin-dialog": "^2.8.4",
|
||||
"@tauri-apps/plugin-notification": "^2.8.1",
|
||||
"@tauri-apps/plugin-opener": "^2.7.3",
|
||||
"@tauri-apps/plugin-process": "^2.4.0",
|
||||
"@tauri-apps/plugin-updater": "^2.14.1",
|
||||
"cm6-graphql": "^1.0.0",
|
||||
"graphql": "^17.1.0",
|
||||
"jsonpath-plus": "^11.3.0"
|
||||
|
||||
@@ -30,6 +30,8 @@ tauri = { version = "2", features = [] }
|
||||
tauri-plugin-dialog = "2"
|
||||
tauri-plugin-opener = "2"
|
||||
tauri-plugin-notification = "2"
|
||||
tauri-plugin-updater = "2"
|
||||
tauri-plugin-process = "2"
|
||||
tauri-plugin-single-instance = { version = "2", features = ["deep-link"] }
|
||||
tauri-plugin-deep-link = "2"
|
||||
rusqlite = { version = "0.37", features = ["bundled"] }
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
"deep-link:default",
|
||||
"core:webview:allow-create-webview-window",
|
||||
"core:window:allow-set-title",
|
||||
"notification:default"
|
||||
"notification:default",
|
||||
"updater:default",
|
||||
"process:allow-restart"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ pub fn run() {
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.plugin(tauri_plugin_process::init())
|
||||
.setup(|app| {
|
||||
let dir = app.path().app_data_dir()?;
|
||||
app.manage(state::AppState::new(dir)?);
|
||||
|
||||
@@ -35,6 +35,15 @@
|
||||
"knock"
|
||||
]
|
||||
}
|
||||
},
|
||||
"updater": {
|
||||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDM2QjY4RUU5MzQwNzQzNTIKUldSU1F3YzA2WTYyTnNPZU0zR0xQUjl4dmUvQlpZazJkVXhjUE1JbDhNNTJRUUdzQjI4UTVCdlMK",
|
||||
"endpoints": [
|
||||
"https://github.com/JoshiCodes/knock/releases/latest/download/latest.json"
|
||||
],
|
||||
"windows": {
|
||||
"installMode": "passive"
|
||||
}
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { isPermissionGranted, requestPermission, sendNotification } from '@tauri-apps/plugin-notification';
|
||||
import { errorText } from '$lib/api';
|
||||
import { check as checkInstallable, type Update } from '@tauri-apps/plugin-updater';
|
||||
import { relaunch } from '@tauri-apps/plugin-process';
|
||||
|
||||
/** macOS and Windows update themselves; Linux updates come from the package manager. */
|
||||
export const canSelfUpdate = /Mac|Win/.test(navigator.userAgent);
|
||||
|
||||
export interface Release {
|
||||
version: string;
|
||||
@@ -38,6 +43,10 @@ class Updates {
|
||||
checking = $state(false);
|
||||
lastError = $state<string | null>(null);
|
||||
askNow = $state(false);
|
||||
/** Signed update package ready to install (macOS, Windows). */
|
||||
installable = $state<Update | null>(null);
|
||||
installing = $state(false);
|
||||
progress = $state<number | null>(null);
|
||||
|
||||
start() {
|
||||
if (this.mode === null) {
|
||||
@@ -64,6 +73,7 @@ class Updates {
|
||||
const skipped = get('knock.updates.skip');
|
||||
if (r.newer && (manual || skipped !== r.version)) {
|
||||
this.available = r;
|
||||
if (canSelfUpdate) await this.findInstallable();
|
||||
if (!manual) await this.notify(r);
|
||||
}
|
||||
return r;
|
||||
@@ -75,6 +85,39 @@ class Updates {
|
||||
}
|
||||
}
|
||||
|
||||
private async findInstallable() {
|
||||
try {
|
||||
this.installable = await checkInstallable();
|
||||
} catch {
|
||||
// No signed package for this platform (yet); the download link still works.
|
||||
this.installable = null;
|
||||
}
|
||||
}
|
||||
|
||||
/** Downloads, verifies the signature, installs and restarts. */
|
||||
async install() {
|
||||
const u = this.installable;
|
||||
if (!u) return;
|
||||
this.installing = true;
|
||||
this.progress = 0;
|
||||
let total = 0;
|
||||
let done = 0;
|
||||
try {
|
||||
await u.downloadAndInstall((ev) => {
|
||||
if (ev.event === 'Started') total = ev.data.contentLength ?? 0;
|
||||
else if (ev.event === 'Progress') {
|
||||
done += ev.data.chunkLength;
|
||||
this.progress = total ? Math.round((done / total) * 100) : null;
|
||||
}
|
||||
});
|
||||
await relaunch();
|
||||
} catch (e) {
|
||||
this.lastError = `Update failed: ${errorText(e)}`;
|
||||
this.installing = false;
|
||||
this.progress = null;
|
||||
}
|
||||
}
|
||||
|
||||
skip() {
|
||||
if (this.available) set('knock.updates.skip', this.available.version);
|
||||
this.available = null;
|
||||
|
||||
@@ -6,11 +6,23 @@
|
||||
|
||||
{#if updates.available}
|
||||
{@const r = updates.available}
|
||||
{#if updates.lastError && updates.installing === false && updates.installable}
|
||||
<div class="border-t border-line px-3 py-1 text-[12px] text-delete">{updates.lastError}</div>
|
||||
{/if}
|
||||
<div class="flex shrink-0 items-center gap-3 border-t border-l-2 border-t-line border-l-cyan bg-input/60 px-3 py-1.5 text-[12px] [:root:not(.dark)_&]:border-l-cyan-deep">
|
||||
<span class="text-strong">knock {r.version} is available.</span>
|
||||
<span class="text-fg-muted">Your version keeps working; updates come through your package manager or the download page.</span>
|
||||
<span class="flex-1"></span>
|
||||
<button class="font-bold text-accent hover:underline" onclick={() => openUrl(r.url)}>Download and release notes</button>
|
||||
{#if updates.installable}
|
||||
<span class="text-fg-muted">{updates.installing ? `Downloading${updates.progress !== null ? ` ${updates.progress} %` : '…'} knock restarts when it is done.` : 'Signed update, ready to install.'}</span>
|
||||
<span class="flex-1"></span>
|
||||
{#if !updates.installing}
|
||||
<button class="font-bold text-accent hover:underline" onclick={() => updates.install()}>Install and restart</button>
|
||||
<button class="text-fg-muted hover:text-fg" onclick={() => openUrl(r.url)}>Release notes</button>
|
||||
{/if}
|
||||
{:else}
|
||||
<span class="text-fg-muted">Your version keeps working; updates come through your package manager or the download page.</span>
|
||||
<span class="flex-1"></span>
|
||||
<button class="font-bold text-accent hover:underline" onclick={() => openUrl(r.url)}>Download and release notes</button>
|
||||
{/if}
|
||||
<button class="text-fg-muted hover:text-fg" onclick={() => updates.skip()}>Skip this version</button>
|
||||
<button class="grid size-5 place-items-center text-fg-subtle hover:text-fg" title="Hide until next start" onclick={() => (updates.available = null)}><Icon name="x" size={11} /></button>
|
||||
</div>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<div class="flex items-center gap-4">
|
||||
<div class="flex-1">
|
||||
<div>Tell me about new versions</div>
|
||||
<div class="text-[12px] text-fg-subtle">Once a day knock asks GitHub for the latest release. Nothing else is sent. knock never updates itself; use your package manager or the download page.</div>
|
||||
<div class="text-[12px] text-fg-subtle">Once a day knock asks GitHub for the latest release. Nothing else is sent. On macOS and Windows knock can install signed updates when you confirm; on Linux, update through your package manager.</div>
|
||||
</div>
|
||||
<Switch checked={updates.mode === 'on'} onchange={(v) => updates.choose(v)} aria-label="Check for updates" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user