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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ Releases up to 0.3.5 are described on the [GitHub releases page](https://github.

## [Unreleased]

## [0.5.3] - 2026-11-13

### Fixed
- **Folders open the way they were left.** The sidebar remembers which folders are collapsed in each vault, in the settings file, instead of opening every folder expanded at each start. Renaming a folder keeps it collapsed; folders deleted since are forgotten.
- **New versions show up within a minute.** The app checks every minute instead of every 10, and again when the window comes back from the tray. A check that hung (after sleep or a network change) no longer blocks the later ones, and checks no longer keep their discarded results in memory. After its dialog closes, a found version stays on offer in the title bar (**Restart to update**), and a newer release replaces it as soon as it is published.

## [0.5.2] - 2026-11-11

Expand Down Expand Up @@ -106,7 +109,8 @@ Releases up to 0.3.5 are described on the [GitHub releases page](https://github.
- Dependency updates: Tauri plugins, iroh 1.3, rusqlite 0.40, base64 0.23, html-escape 0.3 and GitHub Actions.
- Community, security and design documentation ([#32](https://github.com/LowBloat/LowNotes/issues/32), [#33](https://github.com/LowBloat/LowNotes/issues/33)).

[Unreleased]: https://github.com/LowBloat/LowNotes/compare/v0.5.2...HEAD
[Unreleased]: https://github.com/LowBloat/LowNotes/compare/v0.5.3...HEAD
[0.5.3]: https://github.com/LowBloat/LowNotes/compare/v0.5.2...v0.5.3
[0.5.2]: https://github.com/LowBloat/LowNotes/compare/v0.5.1...v0.5.2
[0.5.1]: https://github.com/LowBloat/LowNotes/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/LowBloat/LowNotes/compare/v0.4.2...v0.5.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ In-app updates are signed separately and verified before installation.

When you close the window, the app stays in the system tray by default. Opening LowNotes again shows and focuses the existing window, restoring it if minimized. Only one instance runs at a time. You can change the close-to-tray behavior in **Settings → General**; the tray menu also lets you quit completely.

LowNotes checks for a new version every few minutes and when its window regains focus, downloads it in the background and then asks to restart. On Linux, updates follow the installation format. DEB and RPM packages installed from the release files update inside LowNotes with a package of the same format (dpkg or rpm installs it after the administrator password prompt), and unmanaged AppImages in a writable folder replace themselves. The Arch package shows a new-version notice with a download for the matching package; install it with pacman. Repository, AUR, Flatpak and Snap installations should be updated through their original source when the new version becomes available there. Portable `.tar.gz` installations require replacing the application files manually. Native packages never replace their executable with an AppImage.
LowNotes checks for a new version every minute and when its window comes back, downloads it in the background and then asks to restart. On Linux, updates follow the installation format. DEB and RPM packages installed from the release files update inside LowNotes with a package of the same format (dpkg or rpm installs it after the administrator password prompt), and unmanaged AppImages in a writable folder replace themselves. The Arch package shows a new-version notice with a download for the matching package; install it with pacman. Repository, AUR, Flatpak and Snap installations should be updated through their original source when the new version becomes available there. Portable `.tar.gz` installations require replacing the application files manually. Native packages never replace their executable with an AppImage.

## What the app offers

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lownotes",
"version": "0.5.2",
"version": "0.5.3",
"description": "Local-first Markdown note-taking app with encrypted P2P sync, real-time collaboration and optional AI for Windows, Linux and macOS.",
"homepage": "https://lowbloat.app/en/produtos/lownotes/",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

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

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lownotes"
version = "0.5.2"
version = "0.5.3"
description = "Local-first Markdown notes with serverless P2P sync and real-time collaboration"
authors = ["LowBloat"]
license = "AGPL-3.0-only"
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "LowNotes",
"version": "0.5.2",
"version": "0.5.3",
"identifier": "dev.lowbloat.lownotes",
"build": {
"beforeDevCommand": "bun run icons && bun run dev",
Expand Down
18 changes: 17 additions & 1 deletion src/lib/components/TitleBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
import type { createWindowFrame } from '$lib/state/window-frame.svelte';
import MenuList from './MenuList.svelte';

let { menus, title, detail = '', frame } = $props<{
let { menus, title, detail = '', frame, update = null, onUpdate } = $props<{
menus: AppMenu[];
title: string;
/** Shown dimmed after the title, such as the vault name. */
detail?: string;
frame: ReturnType<typeof createWindowFrame>;
/** A newer version waiting for the user; `downloaded` once a restart installs it. */
update?: { version: string; downloaded?: boolean } | null;
onUpdate?: () => void;
}>();

let buttons = $state<HTMLButtonElement[]>([]);
Expand Down Expand Up @@ -153,6 +156,13 @@

<div class="flex-1" data-tauri-drag-region></div>

{#if update && onUpdate}
<button type="button" class="update-button" onclick={onUpdate} title={$t('update.body', { version: update.version })}>
<span class="update-dot" aria-hidden="true"></span>
{$t(update.downloaded ? 'titlebar.updateReady' : 'titlebar.updateAvailable')}
</button>
{/if}

{#if !IS_MAC}
<div class="flex items-stretch">
<button type="button" class="window-button" onclick={frame.minimize} aria-label={$t('titlebar.minimize')} title={$t('titlebar.minimize')}>
Expand Down Expand Up @@ -183,6 +193,12 @@
.titlebar { height: var(--titlebar-height); min-height: var(--titlebar-height); }
/* Room for the native traffic lights drawn over the bar. */
.titlebar.mac { padding-left: 78px; }
.update-button {
display: flex; align-items: center; gap: 6px; margin: 4px 6px; padding: 0 10px; border-radius: 6px;
color: var(--accent-light); font-weight: 600; outline: none; white-space: nowrap;
}
.update-button:hover, .update-button:focus-visible { background: var(--bg-hover); }
.update-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.window-button { width: 46px; display: grid; place-items: center; color: var(--text-muted); outline: none; }
.window-button:hover, .window-button:focus-visible { background: var(--bg-hover); color: var(--text-main); }
.window-button.close:hover, .window-button.close:focus-visible { background: #c42b1c; color: #fff; }
Expand Down
1 change: 1 addition & 0 deletions src/lib/i18n/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ const enUS = {
darkTheme: 'Dark theme', assistant: 'Assistant panel', zoomIn: 'Zoom in', zoomOut: 'Zoom out', actualSize: 'Actual size',
documentation: 'Documentation', reportProblem: 'Report a problem', checkUpdates: 'Check for updates…', about: 'About LowNotes',
upToDate: 'LowNotes is up to date.', updateCheckFailed: 'LowNotes could not check for updates. Try again later.',
updateAvailable: 'Update available', updateReady: 'Restart to update',
},
menu: {
bold: 'Bold', italic: 'Italic',
Expand Down
1 change: 1 addition & 0 deletions src/lib/i18n/locales/es-ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ const esES: Dictionary = {
darkTheme: 'Tema oscuro', assistant: 'Panel del asistente', zoomIn: 'Acercar', zoomOut: 'Alejar', actualSize: 'Tamaño real',
documentation: 'Documentación', reportProblem: 'Informar de un problema', checkUpdates: 'Buscar actualizaciones…', about: 'Acerca de LowNotes',
upToDate: 'LowNotes está actualizado.', updateCheckFailed: 'LowNotes no pudo buscar actualizaciones. Inténtalo más tarde.',
updateAvailable: 'Actualización disponible', updateReady: 'Reiniciar para actualizar',
},
menu: {
bold: 'Negrita', italic: 'Cursiva',
Expand Down
1 change: 1 addition & 0 deletions src/lib/i18n/locales/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ const ptBR: Dictionary = {
darkTheme: 'Tema escuro', assistant: 'Painel do assistente', zoomIn: 'Aumentar zoom', zoomOut: 'Diminuir zoom', actualSize: 'Tamanho original',
documentation: 'Documentação', reportProblem: 'Relatar um problema', checkUpdates: 'Procurar atualizações…', about: 'Sobre o LowNotes',
upToDate: 'O LowNotes está atualizado.', updateCheckFailed: 'O LowNotes não conseguiu procurar atualizações. Tente mais tarde.',
updateAvailable: 'Atualização disponível', updateReady: 'Reiniciar para atualizar',
},
menu: {
bold: 'Negrito', italic: 'Itálico',
Expand Down
53 changes: 38 additions & 15 deletions src/lib/state/updates.svelte.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import { getUpdatePolicy } from '$lib/api';
import { appAlert } from '$lib/dialogs.svelte';
import { ts } from '$lib/i18n';
import { checkAvailableUpdate, type AvailableUpdate } from '$lib/updates';
import { checkAvailableUpdate, discardUpdate, type AvailableUpdate } from '$lib/updates';
import type { AppSettings, UpdatePolicy } from '$lib/types';

const CHECK_INTERVAL_MS = 10 * 60 * 1000;
/** The manifest is a small file on GitHub; checking every minute means a new
* release reaches open windows within a minute of being published. */
const CHECK_INTERVAL_MS = 60 * 1000;
/** Focus comes and goes quickly; at most one extra check per this long. */
const FOCUS_GAP_MS = 2 * 60 * 1000;
const FOCUS_GAP_MS = 15 * 1000;
/** A stalled background download must not block later checks forever. The
* dialog's own download has no limit. */
const DOWNLOAD_TIMEOUT_MS = 15 * 60 * 1000;

/** Looks for a new version at startup, every few minutes and when
* the window regains focus, honoring the user's automatic-check preference and
* a skipped version. A copy that can update itself (Windows installer, macOS
* app, writable AppImage, .deb or .rpm) downloads the signed update in the
/** Looks for a new version at startup, every minute and when the window
* comes back, honoring the user's automatic-check preference and a skipped
* version. A copy that can update itself (Windows installer, macOS app,
* writable AppImage, .deb or .rpm) downloads the signed update in the
* background first, so the dialog only has to restart to install it. Each
* version is announced once; the Help menu check opens it again. */
* version opens the dialog once; afterwards the title bar keeps offering it,
* and a newer release replaces it as soon as it is published. */
export function createUpdateChecker(getSettings: () => AppSettings | null) {
const state = $state({
pending: null as AvailableUpdate | null,
Expand All @@ -29,32 +35,40 @@ export function createUpdateChecker(getSettings: () => AppSettings | null) {
async function check(manual = false) {
const settings = getSettings();
if (!manual && settings?.update_check === false) return;
if (busy) {
// The dialog shows one version at a time; look again once it closes.
if (busy || (state.open && !manual)) {
if (manual && state.pending) state.open = true;
return;
}
busy = true;
lastCheck = Date.now();
try {
state.policy = await getUpdatePolicy();
state.policy ??= await getUpdatePolicy();
const update = await checkAvailableUpdate(state.policy);
if (!update) {
discardUpdate(state.pending);
state.pending = null;
if (manual) void appAlert(ts('titlebar.upToDate'));
return;
}
// Already announced (and maybe downloaded): keep it, the download lives
// in that installer. Only an explicit check opens the dialog again.
if (state.pending?.version === update.version) {
discardUpdate(update);
if (manual) state.open = true;
return;
}
if (!manual && update.version === settings?.skipped_version) return;
if (!manual && update.version === settings?.skipped_version) {
discardUpdate(update);
return;
}
const previous = state.pending;
if (!manual && update.installer) {
await prefetch(update);
} else {
state.pending = update;
}
discardUpdate(previous);
state.open = true;
} catch (error) {
console.error('Failed to check for updates:', error);
Expand All @@ -67,27 +81,36 @@ export function createUpdateChecker(getSettings: () => AppSettings | null) {
/** Downloads and verifies quietly; on failure the dialog downloads again. */
async function prefetch(update: AvailableUpdate) {
try {
await update.installer?.download();
await update.installer?.download(undefined, { timeout: DOWNLOAD_TIMEOUT_MS });
state.pending = { ...update, downloaded: true };
} catch (error) {
console.error('Failed to download the update in the background:', error);
state.pending = update;
}
}

function onFocus() {
function checkSoon() {
if (Date.now() - lastCheck > FOCUS_GAP_MS) void check();
}

// The window can come back from the tray or another desktop without focus.
function onVisibilityChange() {
if (document.visibilityState === 'visible') checkSoon();
}

function start() {
if (timer) return;
void check();
timer = setInterval(() => void check(), CHECK_INTERVAL_MS);
window.addEventListener('focus', onFocus);
window.addEventListener('focus', checkSoon);
document.addEventListener('visibilitychange', onVisibilityChange);
}

function stop() {
if (timer) clearInterval(timer);
window.removeEventListener('focus', onFocus);
timer = undefined;
window.removeEventListener('focus', checkSoon);
document.removeEventListener('visibilitychange', onVisibilityChange);
}

return { state, check, start, stop };
Expand Down
12 changes: 11 additions & 1 deletion src/lib/updates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,26 @@ export interface AvailableUpdate {
downloaded?: boolean;
}

/** A check that hangs (a network that changed under it, a sleeping laptop)
* would otherwise keep every later check waiting. */
export const CHECK_TIMEOUT_MS = 30 * 1000;

export async function checkAvailableUpdate(
policy: UpdatePolicy,
nativeCheck: typeof check = check,
externalCheck: () => Promise<ReleaseNotice | null> = checkExternalUpdate,
): Promise<AvailableUpdate | null> {
if (!policy.can_install) return await externalCheck();
const update = await nativeCheck({ target: policy.updater_target ?? undefined });
const update = await nativeCheck({ target: policy.updater_target ?? undefined, timeout: CHECK_TIMEOUT_MS });
return update ? { version: update.version, body: update.body, installer: update } : null;
}

/** Each native check holds the update (and its download) on the Rust side
* until closed; checks run every minute, so the ones not kept are released. */
export function discardUpdate(update: AvailableUpdate | null | undefined) {
update?.installer?.close().catch(() => {});
}

export function canInstallUpdate(policy: UpdatePolicy | null, update: AvailableUpdate | null): boolean {
return policy?.can_install === true && update?.installer !== undefined;
}
Expand Down
5 changes: 4 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,8 @@
});
const windowTitle = $derived(isSettingsOpen ? $t('settings.title')
: selectedNotePath ? items.find((item) => item.path === selectedNotePath)?.title ?? selectedNotePath : 'LowNotes');
// After its dialog closes, a new version stays on offer in the title bar unless skipped.
const offeredUpdate = $derived(updates.state.pending?.version !== settings?.skipped_version ? updates.state.pending : null);

$effect(() => {
if (!IS_MAC) return;
Expand Down Expand Up @@ -413,7 +415,8 @@
</script>

<div class="flex flex-col h-screen w-screen overflow-hidden bg-[var(--bg-main)] text-[var(--text-main)]">
<TitleBar menus={appMenus} title={windowTitle} detail={activeVault?.name ?? ''} {frame} />
<TitleBar menus={appMenus} title={windowTitle} detail={activeVault?.name ?? ''} {frame}
update={offeredUpdate} onUpdate={() => (updates.state.open = true)} />
<div class="relative flex flex-1 min-h-0 overflow-hidden">
{#if settings?.credential_error && !isSettingsOpen}
<div class="fixed top-[calc(var(--titlebar-height)+12px)] right-3 z-40 max-w-lg p-4 rounded-lg border border-[var(--danger)] bg-[var(--bg-card)] shadow-lg" role="alert">
Expand Down
14 changes: 14 additions & 0 deletions tests/e2e/title-bar.pw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,17 @@ test('menu commands reach the editor and the sidebar', async ({ page }) => {
expect(fixture.errors).toEqual([]);
} finally { fixture.destroy(); }
});

test('a new version stays on offer in the title bar after its dialog closes', async ({ page }) => {
const fixture = await openVault(page, { update: { version: '9.9.9', body: 'Notes' } });
try {
const dialog = page.getByRole('dialog', { name: 'Update available' });
await expect(dialog.getByRole('button', { name: 'Restart now' })).toBeVisible();
await dialog.getByRole('button', { name: 'Later' }).click();
await expect(dialog).toBeHidden();
await page.locator('header.titlebar').getByRole('button', { name: 'Restart to update' }).click();
await expect(dialog.getByRole('button', { name: 'Restart now' })).toBeVisible();
expect(fixture.calls.filter(call => call.command === 'plugin:updater|check')[0]?.args).toMatchObject({ timeout: 30000 });
expect(fixture.errors).toEqual([]);
} finally { fixture.destroy(); }
});
18 changes: 17 additions & 1 deletion tests/updates.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from 'bun:test';
import type { Update } from '@tauri-apps/plugin-updater';
import { canInstallUpdate, checkAvailableUpdate, updateInstructionKey } from '../src/lib/updates';
import { CHECK_TIMEOUT_MS, canInstallUpdate, checkAvailableUpdate, discardUpdate, updateInstructionKey } from '../src/lib/updates';
import type { UpdateChannel, UpdatePolicy } from '../src/lib/types';

function policy(channel: UpdateChannel, canInstall = false): UpdatePolicy {
Expand Down Expand Up @@ -45,6 +45,22 @@ test('Windows and macOS keep their default updater target', async () => {
expect(update).toBeNull();
});

test('native checks give up instead of blocking the next ones', async () => {
let timeout: number | undefined;
await checkAvailableUpdate(policy('internal', true), async (options) => { timeout = options?.timeout; return null; });
expect(timeout).toBe(CHECK_TIMEOUT_MS);
});

test('discarded updates release their native resource', async () => {
let closed = 0;
const installer = { version: '0.2.7', close: async () => { closed++; } } as Update;
discardUpdate({ version: '0.2.7', installer });
discardUpdate({ version: '0.2.7', download_url: null });
discardUpdate(null);
await Promise.resolve();
expect(closed).toBe(1);
});

test('each Linux installation has matching update instructions', () => {
for (const channel of ['arch', 'deb', 'rpm', 'flatpak', 'snap', 'portable', 'appimage'] as const) {
expect(updateInstructionKey(policy(channel))).toBe(`update.${channel}Hint`);
Expand Down
Loading