mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
bc12143015
* fix(auth): recover from expired edge auth proxy sessions The service worker answered every page load from the precached app shell, so once an edge auth proxy's session cookie (e.g. Cloudflare Access, OAuth2 Proxy) expired, the proxy never saw the navigation and could not redirect to its login page. The app loaded from cache, its API calls were redirected cross-origin and failed, and it fell back to its own login screen with no way out short of clearing site data. Serve navigations network-first and fall back to the precached shell only when offline. vite-plugin-pwa defaults navigateFallback to index.html, which would register a cache-only route ahead of this one, so disable it explicitly. Cache only 200 responses so a proxy's redirect is never stored as the page. Request API redirects manually so a proxy redirect is detected directly and triggers a full reload, which the proxy can then send to its login page. Cap these reloads to one per 15 seconds so a reload answered from cache again surfaces an error instead of looping. Fixes #642 * fix(auth): harden edge auth proxy recovery against loops and cache growth Force manual redirects after caller options so no request can opt back into following a proxy redirect. Skip the reload when session storage is unavailable, since the loop guard cannot work without it. Drop the navigation network timeout so a slow proxy redirect is never replaced by the cached page, and cap the app shell cache, which stores one entry per visited URL. Ref #642 * test(auth): isolate useLoginOptions module state between tests The composable keeps its cached options, error, and in-flight request at module level, so they carried over between tests in the file. Reset the module and import it fresh for each test so a future test cannot pass or fail depending on what ran before it. Ref #642 * fix(auth): let edge proxy handle sign-in navigations Keep the offline shell under a distinct precache URL so Workbox cannot serve root navigations before the proxy sees them. Route public auth requests through the redirect-aware fetch path so expired edge sessions open reauthentication. Ref #642 * fix(auth): keep offline shell off root URLs Prevent Workbox from mapping root query variants to the precached offline shell so expired proxy sessions reach the network. --------- Co-authored-by: neon <18559658+neonsolstice@users.noreply.github.com>
BookOrbit - Client
Vue 3 SPA built with Vite and Tailwind CSS v4.
Running
From the repo root: pnpm dev (starts both server and client).
Client only: pnpm dev (from this directory). Runs at http://localhost:6263.
The Vite dev server proxies /api and /socket.io requests to the backend at localhost:6262.
IDE setup
- VS Code: Install the Vue (Official) extension. Disable Vetur if installed.
- WebStorm / IntelliJ: Vue support is built in. Enable TypeScript service for
.vuefiles. - Browser: Install Vue.js devtools and enable Custom Object Formatters in DevTools settings.
Project layout
src/
├── features/ Feature modules (one folder per domain)
│ ├── auth/ Login, registration, password reset
│ ├── book/ Book detail, covers, metadata
│ ├── library/ Library management
│ ├── collection/ Book collections
│ ├── smart-scope/ Saved search views
│ ├── scanner/ Scan progress UI
│ ├── reader/ Book reader (epub, pdf, cbz)
│ ├── settings/ User settings
│ └── admin/ Admin panel (users, roles, settings)
├── components/ Shared components (header, sidebar, icons)
│ └── ui/ Reusable UI primitives (button, dialog, etc.)
├── composables/ Global composables
├── views/ Route-level page components
├── router/ Vue Router config and guards
├── lib/ Utilities (api client, helpers)
├── stores/ Pinia stores (theme only - prefer composables)
└── assets/ CSS, fonts, static assets
Testing
pnpm test:unit # run unit tests
pnpm test:cov # run unit tests with coverage
Key conventions
- All components use
<script setup lang="ts">(Composition API only). - Feature state lives in composables (
features/<name>/composables/use*.ts), not global stores. - HTTP calls use the native
fetchAPI viasrc/lib/api.ts. - Styling with Tailwind CSS v4 utility classes. Theme tokens are CSS variables in
src/assets/main.css. - Icons from
@lucide/vueonly. - Shared types imported from
@bookorbit/types.