Devlog: CAP Flight Logbook — v3 → v3.6
The headline feature is Google Drive backup/sync, but there are a few smaller fixes riding along with it.
1. Google Sign-In + Drive backup (the big one)
v3 had no cloud storage at all — everything lived in localStorage under the cap_v3 key and that was it. v3.6 adds the Google API script tag to the page head and roughly 400 new lines of JS implementing a full backup pipeline:
- Sign-in flow: tries Google One Tap first, falls back to an explicit popup-based OAuth token request if One Tap is suppressed by the browser. Also auto-restores a previous session silently on load if the user had signed in before.
-
Drive folder/file management: creates (or finds) a
CAP Flight Logbookfolder in the user’s Drive, and creates/updates acap_logbook_backup.jsonfile inside it. - Pull-then-push merge on first sign-in: treats Drive as the source of truth, merges in any local-only flight entries that were logged offline, then writes the merged result back. It reports how many entries were loaded, kept, or dropped.
- Manual restore: a “Restore from Drive” button that fully overwrites local state with whatever’s in Drive (with a confirm dialog warning it’s destructive).
- Sign-out: clears all the Drive-related localStorage keys and the in-memory token/user.
-
UI feedback: a dismissible colored banner system (
showDriveBanner/hideDriveBanner) for sync errors, popup-blocked warnings, and merge summaries; plus a small sync-status indicator both in the Settings card and now in the top bar (shows a green checkmark with the user’s first name once signed in). -
save()was changed from a one-line localStorage write to also triggerdriveBackup()whenever a Google token is present — so every save silently pushes to Drive in the background.
2. Settings page reorganized
The old single “Data” card is now split into a “Google Drive backup” card (sign-in button, account info, restore button) followed by a separate “Local data” card for whatever local-only settings used to live there. This is purely a layout consequence of feature #1, but worth noting since any custom styling targeting the old card title would need updating.
3. Airport search fallback rewritten
apRenderFallback() — the function that runs when the OpenAIP API is unreachable or no API key is set — was reworked:
- v3 shipped a hardcoded ~120-airport fallback list (
AIRPORTS_FB) and did fuzzy scoring/ranking against it locally so users without a working API key still got reasonable autocomplete results. - v3.6 removes that entire list and instead just shows a hint message (different wording depending on whether it’s a network error vs. missing API key) plus a “manual entry” option to add the typed ICAO code directly.
This is a meaningful behavior change, not just a refactor: v3.6 users without an API key (or with OpenAIP down) lose airport name/city autocomplete entirely and have to type/know the ICAO code themselves. It does shave a few hundred lines of static data out of the bundle, though.
4. Minor refactors
-
rHeroUnit(c)was extracted into its own function instead of being an inline template literal — same output, just cleaner. - The Settings “Data” card title and a couple of inline conditionals were tidied up to support the new sync-status helper
rSyncStatus(ctx), which now serves both the top bar and the settings card from one function.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.