All-in-one Uberspace deployment: - Backend: Node.js Express on port 3000 (/api/*) - Frontend: Static files served by Apache (/) - URL: https://wtp.uber.space Removed: - GitHub Actions workflow - Cloudflare Worker setup service - CloudflareSetupPage component - CloudflareService - 404.html (GitHub Pages redirect) - Cloudflare menu item from Settings Simplified: - Use VITE_BASE_PATH and VITE_API_URL for config - Single deployment target (no multi-env complexity) Co-Authored-By: Claude <noreply@anthropic.com>
44 lines
1.0 KiB
TypeScript
44 lines
1.0 KiB
TypeScript
import react from "@vitejs/plugin-react";
|
|
import { defineConfig, loadEnv } from "vite";
|
|
import { handleSteamRefresh, handleConfigLoad } from "./server/steam-api.mjs";
|
|
import { handleGameAsset } from "./server/assets-api.mjs";
|
|
|
|
const apiMiddlewarePlugin = {
|
|
name: "api-middleware",
|
|
configureServer(server) {
|
|
server.middlewares.use((req, res, next) => {
|
|
const url = req.url ?? "";
|
|
if (url.startsWith("/api/steam/refresh")) {
|
|
return handleSteamRefresh(req, res);
|
|
}
|
|
if (url.startsWith("/api/config/load")) {
|
|
return handleConfigLoad(req, res);
|
|
}
|
|
if (url.startsWith("/api/games/")) {
|
|
return handleGameAsset(req, res);
|
|
}
|
|
next();
|
|
});
|
|
},
|
|
};
|
|
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), "");
|
|
|
|
return {
|
|
// GitHub Pages: /whattoplay/
|
|
// Uberspace: /
|
|
base: env.VITE_BASE_PATH || "/whattoplay/",
|
|
plugins: [react(), apiMiddlewarePlugin],
|
|
server: {
|
|
port: 5173,
|
|
hmr: {
|
|
overlay: true,
|
|
},
|
|
watch: {
|
|
usePolling: true,
|
|
},
|
|
},
|
|
};
|
|
});
|