desktop: Import and Export work offline; the menu toggle is reachable; errors say why
CI & Build / Build now, or wait for Android? (push) Successful in 4s
Android / Build, or is the channel already serving this? (push) Successful in 4s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Web typecheck and unit tests (push) Successful in 12s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 2s
CI & Build / Python tests (push) Successful in 13s
CI & Build / integration (push) Successful in 48s
CI & Build / Build & push image (push) Skipped
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Successful in 4m26s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 3m32s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 4m10s
Desktop (Tauri) / Update manifest (push) Successful in 4s
Android / Kotlin + Rust (APK) (push) Successful in 12m42s

Export and Import were a link to the server and a reject("needs a server") on the
desktop. Both now run in the core with no server:

- core/src/local/portable.rs builds the same zip the server writes (notes.json,
  a Markdown file per note, each attachment this device holds) and reads either
  export marker or a Google Keep Takeout zip, with the server's decompression
  budget and an all-or-nothing transaction. Export saves to Downloads (no new
  plugin) and the sidebar says where; Import takes the archive as raw IPC bytes.
- core/testdata/portable.json pins the format for both copies: the server runs
  its Keep and native readers against it (test_portable_fixture.py) and checks
  its real export's keys (test_integration.py); the core runs the same cases.
- Found on the way: both importers skipped a Keep note that is only a photo as
  "empty". It now imports, on the server and in the core.
- New dependency, approved: `zip` (deflate only) plus `flate2` on its pure-Rust
  backend, both already in the lockfile.

The AppImage applications-menu toggle moves from Account, which the desktop
never shows, to the Sync page; the first-run prompt now says so.

errorMessage (#5236) replaces the hand-rolled `.error ?? …` / `.message ?? e`
reads at the remaining catch sites, so a desktop failure shows its real reason.

Task #5170.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 11:36:42 -04:00
co-authored by Claude Opus 5.5
parent ac4427f834
commit 5989ffc1c6
27 changed files with 1365 additions and 88 deletions
+2 -58
View File
@@ -7,7 +7,7 @@ import BaseButton from "../components/BaseButton.vue";
import BaseInput from "../components/BaseInput.vue";
import ClientDownloads from "../components/ClientDownloads.vue";
import Icon from "../components/Icon.vue";
import { isDesktop, desktop as desktopBridge, type IntegrationStatus } from "../desktop/bridge";
import { errorMessage } from "../api/errors";
// Per-user (not admin) management of linked native clients — the Tauri desktop and
// Android apps authenticate sync with a device bearer token issued here.
@@ -23,9 +23,6 @@ const creating = ref(false);
// The freshly-issued plaintext token — shown ONCE (never retrievable again).
const freshToken = ref("");
// Desktop-app self-integration (Linux AppImage only; the card is hidden otherwise).
const desktopStatus = ref<IntegrationStatus | null>(null);
const desktopBusy = ref(false);
async function load() {
error.value = "";
@@ -45,7 +42,7 @@ async function link() {
freshToken.value = await devices.create(newName.value.trim() || "Device");
newName.value = "";
} catch (e) {
error.value = (e as { error?: string }).error ?? "Couldn't create a device token.";
error.value = errorMessage(e, "Couldn't create a device token.");
} finally {
creating.value = false;
}
@@ -74,36 +71,8 @@ function fmt(iso: string | null): string {
return new Date(iso).toLocaleString();
}
async function loadDesktop() {
if (!isDesktop()) return;
try {
desktopStatus.value = await desktopBridge.integrationStatus();
} catch {
desktopStatus.value = null;
}
}
async function toggleIntegration() {
desktopBusy.value = true;
try {
desktopStatus.value = desktopStatus.value?.is_integrated
? await desktopBridge.unintegrate()
: await desktopBridge.integrate();
ui.showToast(
desktopStatus.value?.is_integrated
? "Added to your applications menu."
: "Removed from your applications menu.",
);
} catch (e) {
ui.showToast((e as { message?: string }).message ?? "Couldn't update the menu entry.");
} finally {
desktopBusy.value = false;
}
}
onMounted(() => {
void load();
void loadDesktop();
});
</script>
@@ -132,31 +101,6 @@ onMounted(() => {
paste it into the app when it asks to connect. You can revoke a device at any time.
</p>
<!-- Desktop app self-integration (Linux AppImage only) -->
<section
v-if="desktopStatus?.is_appimage"
class="mb-6 flex items-center justify-between gap-4 rounded-xl border border-neutral-200 p-4 dark:border-neutral-800"
>
<div class="min-w-0">
<p class="text-sm font-medium text-neutral-800 dark:text-neutral-100">Desktop app</p>
<p class="mt-0.5 text-xs text-neutral-400">
{{
desktopStatus.is_integrated
? "Inkwell is in your applications menu."
: "Add Inkwell to your applications menu to launch it like an installed app."
}}
</p>
</div>
<BaseButton
:variant="desktopStatus.is_integrated ? 'ghost' : 'primary'"
:loading="desktopBusy"
class="shrink-0"
@click="toggleIntegration"
>
{{ desktopStatus.is_integrated ? "Remove" : "Add to applications" }}
</BaseButton>
</section>
<!-- Every client this server holds, the one that fits this machine on top.
Hides itself when the server holds none. -->
<ClientDownloads />