Skip to content
Closed
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: 14 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@ the user's login shell. Do not spawn processes before that call, and keep the
Surface backend errors verbatim in the UI (`Failed to load X: ${e}`) — a generic
message hid this exact problem for a long time.

### In-app updater

`updaterStore` (`src/lib/stores/updater.svelte.ts`) wraps `@tauri-apps/plugin-updater`.
The root layout calls `init()` once; checks run 15s after launch and every 6h when
`settings.autoCheckUpdates` is on. Background checks are *silent* — only an
available update changes UI state, so offline/private setups never see errors.
The manifest is `update.json` on gh-pages (published from tauri-action's
`latest.json` by `release-please.yml`) with the GitHub Releases URL as fallback.
Linux `.deb`/`.rpm` cannot self-update; `updater_can_self_update` (Rust) reports
this via the `APPIMAGE` env var and the UI links to Releases instead.

To verify a published release end-to-end (manifest, download, signature) without
installing anything: `cd src-tauri && cargo run --example updater_probe`.

### Component Library (`src/lib/components/ui/`)

- **DataTable**: Powerful table with sorting, filtering, column visibility, drag-and-drop, and batch actions.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Kore uses GitHub Actions for automated testing and releases.

### Setting Up Auto-Updates

The Tauri updater requires signed binaries. To set this up:
The in-app updater checks `https://devtheops.github.io/kore/update.json` (falling back to the `latest.json` asset on the latest GitHub Release) and verifies downloads against the public key below. To set up signing for a fork:

1. **Generate signing keys**:

Expand Down
3 changes: 3 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions docs/src/content/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ sudo dpkg -i kore_*.deb

## Updating

Kore includes a built-in auto-updater. When a new version is available you will see a notification in the app. Click **Update** to download and install in the background.
Kore checks for updates shortly after launch and every six hours. When a new version is available, a green dot appears on the **Settings** icon in the sidebar; open **Settings → Updates** to read the release notes and click **Install & Restart**. Updates are downloaded from GitHub Releases and verified against Kore's signing key before they are applied.

Alternatively, download the latest installer from the [Releases page](https://github.com/DEVtheOPS/kore/releases/latest) and install it over the existing version.
Turn off automatic checks with **Check for updates automatically** in the same card — you can still check manually with **Check Now**.

Linux `.deb` / `.rpm` installs cannot replace themselves: Kore shows the new version and links to the [Releases page](https://github.com/DEVtheOPS/kore/releases/latest) so you can install the package with your package manager. AppImage, macOS, and Windows installs update in place.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@tauri-apps/plugin-fs": "~2.5.0",
"@tauri-apps/plugin-notification": "~2.4.0",
"@tauri-apps/plugin-opener": "^2.5.5",
"@tauri-apps/plugin-process": "^2.3.1",
"@tauri-apps/plugin-updater": "~2.11.0",
"@tauri-apps/plugin-websocket": "~2.4.3",
"@types/js-yaml": "^4.0.9",
Expand Down
11 changes: 11 additions & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs", version

[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-updater = "2"
tauri-plugin-process = "2"

[profile.dev]
incremental = true # Compile your binary in smaller steps.
Expand Down
4 changes: 3 additions & 1 deletion src-tauri/capabilities/desktop.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"main"
],
"permissions": [
"updater:default",
"updater:allow-check",
"updater:allow-download-and-install",
"process:allow-restart",
"websocket:default"
]
}
51 changes: 51 additions & 0 deletions src-tauri/examples/updater_probe.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#![allow(clippy::expect_used)]
//! Manual probe: `cargo run --example updater_probe` downloads and verifies
//! the latest release against the real manifest and public key.
use tauri_plugin_updater::UpdaterExt;

fn main() {
tauri::Builder::default()
.plugin(tauri_plugin_updater::Builder::new().build())
.setup(|app| {
let handle = app.handle().clone();
tauri::async_runtime::spawn(async move {
let updater = handle
.updater_builder()
.version_comparator(|_current, _remote| true)
.build()
.expect("build updater");
match updater.check().await {
Ok(Some(u)) => {
eprintln!("[probe] available {} -> {}", u.current_version, u.version);
let mut total = 0usize;
match u
.download(
|chunk, len| {
total += chunk;
if let Some(len) = len {
if total % (5 << 20) < chunk {
eprintln!("[probe] {}/{}", total, len);
}
}
},
|| eprintln!("[probe] download finished"),
)
.await
{
Ok(bytes) => eprintln!(
"[probe] downloaded + signature verified: {} bytes",
bytes.len()
),
Err(e) => eprintln!("[probe] download/verify FAILED: {e}"),
}
}
Ok(None) => eprintln!("[probe] no update"),
Err(e) => eprintln!("[probe] check failed: {e}"),
}
handle.exit(0);
});
Ok(())
})
.run(tauri::generate_context!())
.expect("run");
}
4 changes: 4 additions & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod image_utils;
mod import;
mod input_validation;
mod k8s;
mod updater_info;

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
Expand Down Expand Up @@ -37,6 +38,7 @@ pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_websocket::init())
.plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_process::init())
.plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_dialog::init())
Expand Down Expand Up @@ -145,6 +147,8 @@ pub fn run() {
import::import_add_cluster,
// Image processing
image_utils::process_icon_file,
// Updater
updater_info::updater_can_self_update,
// Legacy config
config::import_kubeconfig
])
Expand Down
34 changes: 34 additions & 0 deletions src-tauri/src/updater_info.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//! Whether the running install can replace itself via the built-in updater.
//!
//! The updater ships an AppImage for Linux, so .deb/.rpm installs must upgrade
//! through their package manager. Tauri's own updater detects AppImage via the
//! `APPIMAGE` environment variable set by the AppImage runtime.

#[tauri::command]
pub fn updater_can_self_update() -> bool {
can_self_update(
cfg!(target_os = "linux"),
std::env::var_os("APPIMAGE").is_some(),
)
}

fn can_self_update(is_linux: bool, is_appimage: bool) -> bool {
!is_linux || is_appimage
}

#[cfg(test)]
mod tests {
use super::can_self_update;

#[test]
fn linux_requires_appimage() {
assert!(can_self_update(true, true));
assert!(!can_self_update(true, false));
}

#[test]
fn other_platforms_always_self_update() {
assert!(can_self_update(false, false));
assert!(can_self_update(false, true));
}
}
9 changes: 8 additions & 1 deletion src/lib/components/IconSidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Home, Plus, Settings as SettingsIcon, MoreVertical } from "lucide-svelte";
import { clustersStore } from "$lib/stores/clusters.svelte";
import { bookmarksStore } from "$lib/stores/bookmarks.svelte";
import { updaterStore } from "$lib/stores/updater.svelte";
import { page } from "$app/stores";
import Menu from "$lib/components/ui/Menu.svelte";
import type { MenuItem } from "$lib/components/ui/Menu.svelte";
Expand Down Expand Up @@ -165,9 +166,15 @@
href="/settings"
class="flex items-center justify-center h-16 hover:bg-bg-main transition-colors relative"
class:bg-bg-main={isActive("/settings")}
title="Settings"
title={updaterStore.available ? `Settings — update v${updaterStore.info?.version} available` : "Settings"}
>
<SettingsIcon size={28} class={isActive("/settings") ? "text-primary" : "text-text-main"} />
{#if updaterStore.available}
<span
class="absolute top-3 right-3 w-2.5 h-2.5 rounded-full bg-success ring-2 ring-bg-sidebar"
aria-label="Update available"
></span>
{/if}
</a>
</aside>

Expand Down
119 changes: 119 additions & 0 deletions src/lib/components/UpdatesCard.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<script lang="ts">
import Card from '$lib/components/ui/Card.svelte';
import Button from '$lib/components/ui/Button.svelte';
import Checkbox from '$lib/components/ui/Checkbox.svelte';
import Badge from '$lib/components/ui/Badge.svelte';
import { Download, RefreshCw, RotateCw, ExternalLink } from 'lucide-svelte';
import { openUrl } from '@tauri-apps/plugin-opener';
import { settingsStore } from '$lib/stores/settings.svelte';
import { updaterStore } from '$lib/stores/updater.svelte';

function toggleAutoCheck(enabled: boolean) {
settingsStore.setAutoCheckUpdates(enabled);
updaterStore.scheduleAutoChecks();
}

function formatChecked(d: Date | null): string {
return d ? d.toLocaleString() : 'never';
}

async function openReleases() {
try {
await openUrl(updaterStore.releasesUrl);
} catch (e) {
console.error('Failed to open releases page', e);
}
}
</script>

<Card class="p-6">
<div class="flex items-start gap-4">
<div class="p-3 bg-bg-popover rounded-full">
<Download size={24} class="text-primary" />
</div>
<div class="flex-1 space-y-4">
<div>
<h3 class="font-bold text-lg mb-1">Updates</h3>
<p class="text-text-muted text-sm">
Kore {updaterStore.currentVersion ? `v${updaterStore.currentVersion}` : ''}
<span class="mx-1">·</span>
Last checked: {formatChecked(updaterStore.lastChecked)}
</p>
</div>

<label class="flex items-center gap-2 text-sm cursor-pointer">
<Checkbox checked={settingsStore.value.autoCheckUpdates} onchange={toggleAutoCheck} />
Check for updates automatically (on launch and every 6 hours)
</label>

{#if updaterStore.error}
<div class="p-3 bg-error/10 text-error rounded-md border border-error/20 text-sm">{updaterStore.error}</div>
{/if}

{#if updaterStore.available && updaterStore.info}
<div class="p-4 bg-bg-panel rounded-md border border-border-subtle space-y-3">
<div class="flex items-center gap-2">
<Badge variant="success">v{updaterStore.info.version} available</Badge>
{#if updaterStore.info.date}
<span class="text-xs text-text-muted">{new Date(updaterStore.info.date).toLocaleDateString()}</span>
{/if}
</div>

{#if updaterStore.info.body}
<pre class="text-xs text-text-muted whitespace-pre-wrap max-h-48 overflow-auto font-sans">{updaterStore.info.body}</pre>
{/if}

{#if updaterStore.status === 'downloading'}
<div class="space-y-1">
<div class="h-1.5 rounded-full bg-bg-main border border-border-subtle overflow-hidden">
<div class="h-full bg-primary transition-all" style="width: {updaterStore.progress ?? 0}%"></div>
</div>
<div class="text-xs text-text-muted">
Downloading{updaterStore.progress != null ? ` ${updaterStore.progress}%` : '...'}
</div>
</div>
{:else if updaterStore.status === 'ready'}
<div class="flex items-center gap-3">
<span class="text-sm">Update installed. Restart to finish.</span>
<Button size="sm" onclick={() => updaterStore.restart()}>
<RotateCw size={14} />
Restart Now
</Button>
</div>
{:else if updaterStore.canSelfUpdate}
<Button size="sm" onclick={() => updaterStore.downloadAndInstall()}>
<Download size={14} />
Install & Restart
</Button>
{:else}
<div class="space-y-2">
<p class="text-sm text-text-muted">
This install was made with a system package (.deb/.rpm), so it can't update itself. Download the new
package from GitHub Releases and install it with your package manager.
</p>
<Button size="sm" variant="outline" onclick={openReleases}>
<ExternalLink size={14} />
Open Releases
</Button>
</div>
{/if}
</div>
{:else}
<div class="flex items-center gap-3">
<Button
size="sm"
variant="outline"
onclick={() => updaterStore.check()}
disabled={updaterStore.status === 'checking'}
>
<RefreshCw size={14} class={updaterStore.status === 'checking' ? 'animate-spin' : ''} />
{updaterStore.status === 'checking' ? 'Checking...' : 'Check Now'}
</Button>
{#if updaterStore.status === 'up-to-date'}
<span class="text-sm text-text-muted">You're on the latest version.</span>
{/if}
</div>
{/if}
</div>
</div>
</Card>
7 changes: 7 additions & 0 deletions src/lib/stores/settings.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ export interface Settings {
theme: Theme;
codeTheme: CodeTheme;
refreshInterval: number;
autoCheckUpdates: boolean;
}

class SettingsStore {
value = $state<Settings>({
theme: 'kore',
codeTheme: 'same-as-app',
refreshInterval: 5000,
autoCheckUpdates: true,
});

constructor() {
Expand Down Expand Up @@ -43,6 +45,11 @@ class SettingsStore {
this.save();
}

setAutoCheckUpdates(enabled: boolean) {
this.value.autoCheckUpdates = enabled;
this.save();
}

get effectiveCodeTheme(): Theme {
if (this.value.codeTheme === 'same-as-app') {
return this.value.theme;
Expand Down
Loading
Loading