initial commit

This commit is contained in:
azykov@mail.ru
2026-08-25 17:07:55 +03:00
commit cfae2d91f4
29 changed files with 2749 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
import react from '@vitejs/plugin-react'
import { defineConfig, loadEnv, type ProxyOptions } from 'vite'
// https://vite.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const proxy: Record<string, ProxyOptions> = {}
if (env.CALDAV_URL) {
const target = new URL(env.CALDAV_URL)
const basePath = target.pathname.replace(/\/$/, '')
// Credentials never reach the client bundle: the dev server injects
// Basic auth on the proxied request, browser code only ever calls /caldav/.
const headers: Record<string, string> = {}
if (env.CALDAV_USERNAME && env.CALDAV_PASSWORD) {
const token = Buffer.from(`${env.CALDAV_USERNAME}:${env.CALDAV_PASSWORD}`).toString('base64')
headers.Authorization = `Basic ${token}`
}
proxy['/caldav'] = {
target: target.origin,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/caldav/, basePath),
headers,
}
}
return {
plugins: [react()],
server: { proxy },
}
})