- Webhooks for automations: per-job secret, Gitea/GitHub HMAC signatures, payload appended to the instructions; settings on the automations page - Service worker gets a new file name per build (proxies that cache *.js served a stale worker, which broke updates and Android installation); /sw.js is a kill switch that removes old workers - Push: devices re-register their subscription with the server on start and before a test; the test reports why a push service rejected a message Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
2.2 KiB
TypeScript
60 lines
2.2 KiB
TypeScript
import { defineConfig } from "vite";
|
||
import react from "@vitejs/plugin-react";
|
||
import { VitePWA } from "vite-plugin-pwa";
|
||
|
||
const backend = process.env.CODECRAFT_BACKEND ?? "http://127.0.0.1:8787";
|
||
|
||
const BUILD_ID = Date.now().toString(36);
|
||
|
||
export default defineConfig({
|
||
plugins: [
|
||
react(),
|
||
VitePWA({
|
||
registerType: "autoUpdate",
|
||
// A new file name per build: reverse proxies with "cache assets" (e.g. Nginx
|
||
// Proxy Manager) cache *.js by URL – a stale service worker would break
|
||
// updates and installation. /sw.js is a kill switch for old installations.
|
||
filename: `sw-${BUILD_ID}.js`,
|
||
injectRegister: false,
|
||
includeAssets: ["icon.svg", "apple-touch-icon.png"],
|
||
manifest: {
|
||
name: "CodeCraft",
|
||
short_name: "CodeCraft",
|
||
description: "Web-based coding harness for AI models",
|
||
theme_color: "#282828",
|
||
background_color: "#282828",
|
||
display: "standalone",
|
||
start_url: "/",
|
||
id: "/",
|
||
scope: "/",
|
||
orientation: "any",
|
||
categories: ["developer", "productivity"],
|
||
icons: [
|
||
{ src: "icon-192.png", sizes: "192x192", type: "image/png" },
|
||
{ src: "icon-512.png", sizes: "512x512", type: "image/png" },
|
||
{ src: "icon-maskable-512.png", sizes: "512x512", type: "image/png", purpose: "maskable" },
|
||
{ src: "icon.svg", sizes: "any", type: "image/svg+xml" },
|
||
],
|
||
screenshots: [
|
||
{ src: "screenshots/wide.png", sizes: "1400x860", type: "image/png", form_factor: "wide", label: "Chat with an agent" },
|
||
{ src: "screenshots/narrow.png", sizes: "780x1688", type: "image/png", form_factor: "narrow", label: "CodeCraft on the phone" },
|
||
],
|
||
},
|
||
workbox: {
|
||
// The API is always live data; only the app shell is cached.
|
||
navigateFallbackDenylist: [/^\/api/, /^\/cli/],
|
||
runtimeCaching: [],
|
||
// The STEP importer (OpenCascade, ~8 MB) is loaded only when needed.
|
||
globIgnores: ["**/occt-import-js*", "**/screenshots/**", "sw.js"],
|
||
// Web Push handlers (push, notificationclick).
|
||
importScripts: ["push-sw.mjs"],
|
||
},
|
||
}),
|
||
],
|
||
server: {
|
||
proxy: {
|
||
"/api": { target: backend, ws: true, changeOrigin: true },
|
||
},
|
||
},
|
||
});
|