Tauri 2 shell with a React/TypeScript interface and libmpv playback composed beneath the web view (DirectComposition on Windows). Shared code with per-OS platform modules and configs so macOS and Linux can follow. - Plex sign-in (browser, plex.tv/link or manual), server selection, Plex Home - Home, Movies and TV Shows (Discover, Library, Collections), search, people - Title pages with logos, ratings, cast, extras, seasons and episodes - Direct play with Plex conversion fallback, tracks, markers, autoplay - Metadata editing, artwork, fix match, refresh, analyze and deletion - Resumable offline downloads - App settings and Plex server administration with a live dashboard - Signed updater feed and Forgejo CI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { defineConfig, type Plugin } from 'vite';
|
|
import react from '@vitejs/plugin-react';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
|
|
/**
|
|
* Development only: lets the browser preview start signed in using the
|
|
* repository's ignored `.env`. Never part of a build.
|
|
*/
|
|
function devSession(): Plugin {
|
|
return {
|
|
name: 'kaleido-dev-session',
|
|
apply: 'serve',
|
|
configureServer(server) {
|
|
server.middlewares.use('/__dev/session', (_req, res) => {
|
|
const file = [process.env.KALEIDO_DEV_ENV, path.resolve(import.meta.dirname, '.env'), path.resolve(import.meta.dirname, '../Custom plex client/.env')].find(
|
|
(f) => f && fs.existsSync(f),
|
|
);
|
|
try {
|
|
const text = fs.readFileSync(file!, 'utf8');
|
|
const get = (k: string) => text.match(new RegExp(`^${k}=(.*)$`, 'm'))?.[1]?.trim().replace(/^"|"$/g, '');
|
|
res.setHeader('Content-Type', 'application/json');
|
|
res.end(JSON.stringify({ server: get('PLEX_SERVER_URL'), token: get('PLEX_TOKEN') }));
|
|
} catch {
|
|
res.statusCode = 404;
|
|
res.end('{}');
|
|
}
|
|
});
|
|
},
|
|
};
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), devSession()],
|
|
clearScreen: false,
|
|
server: { port: 1420, strictPort: true, watch: { ignored: ['**/src-tauri/**'] } },
|
|
build: { target: 'es2022', chunkSizeWarningLimit: 1500 },
|
|
});
|