Files
Oxicloud/frontend/svelte.config.js
T
DioCrafts db97a88956 feat(upload): skip unreadable files (FIFOs/sockets) + auto-reload on new deploy
Two robustness fixes behind the recurring "folder upload stuck at ~93%" reports.

1. Skip non-regular files up front. A copied s6/runit service tree contains
   FIFOs (e.g. supervise/control named pipes) that report a size but BLOCK
   FOREVER when the browser reads them — the deterministic ~8-files-short that
   no retry/watchdog tweak could fix. uploadBatch/uploadTree now probe each
   file's first chunk against a 3 s timeout (partitionReadable), upload only the
   readable ones, and report the rest: "N uploaded · M skipped (not regular
   files)". Progress runs over the uploadable count, so it reaches 100% instead
   of parking at 93% while a lane hangs on a pipe.

2. Auto-reload on a new deploy. svelte.config.js polls _app/version.json
   (60 s); the root layout reloads itself when the deployed build changes —
   unless an upload is in flight — so an open tab can't keep running stale code
   after a rebuild (the recurring "my fix isn't applied" trap).

npm run check: 0 errors, 58 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 12:08:29 +02:00

44 lines
1.4 KiB
JavaScript

import adapter from '@sveltejs/adapter-static';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/**
* SvelteKit config — pure SPA via adapter-static.
*
* Phase 0: output to the local `build/` dir so the existing `static-dist/`
* (still produced by build.rs) is untouched. At cutover (Phase 5) the
* `pages`/`assets` targets switch to `../static-dist` and build.rs stops
* generating assets.
*
* `fallback: 'index.html'` makes every unmatched client route serve the SPA
* shell, which the Rust web layer will mirror with a ServeFile fallback.
*
* @type {import('@sveltejs/kit').Config}
*/
const config = {
preprocess: vitePreprocess(),
kit: {
adapter: adapter({
// Cutover: emit the SPA into the repo-root `static-dist/` that the Rust
// web layer serves in release. build.rs no longer generates this dir
// (gated behind OXICLOUD_LEGACY_ASSETS for rollback).
pages: '../static-dist',
assets: '../static-dist',
fallback: 'index.html',
precompress: false,
strict: true
}),
// All routes are client-rendered; SSR/prerender are disabled in +layout.ts.
alias: {
$lib: './src/lib'
},
// Poll `_app/version.json` so an open tab notices a fresh deploy; the root
// layout reloads itself when it does, instead of silently running stale
// code after a rebuild (the classic "my fix isn't applied" trap).
version: {
pollInterval: 60000
}
}
};
export default config;