v0.28.0 3cb3770

vite.config.ts RawHistoryFolder

1import { defineConfig } from "vite";
2import { svelte } from "@sveltejs/vite-plugin-svelte";
3import { resolve } from "path";
4import { pageGenerator } from "./vite-plugin-pages";
5import { copyFileSync, existsSync, mkdirSync } from "fs";
6
7// Page configurations for dumb:// protocol pages
8const pages = {
9  homepage: {
10    entry: "src/pages/homepage.ts",
11    output: "homepage.min.js",
12    global: "DumberHomepage",
13    html: {
14      name: "homepage",
15      title: "Dumber Browser",
16      script: "homepage.min.js",
17      css: "style.css",
18      filename: "index.html",
19    },
20  },
21  error: {
22    entry: "src/pages/error.ts",
23    output: "error.min.js",
24    global: "DumberError",
25    html: {
26      name: "error",
27      title: "Error",
28      script: "error.min.js",
29      css: "style.css",
30      filename: "error.html",
31    },
32  },
33  config: {
34    entry: "src/pages/config.ts",
35    output: "config.min.js",
36    global: "DumberConfig",
37    html: {
38      name: "config",
39      title: "Settings",
40      script: "config.min.js",
41      css: "style.css",
42      filename: "config.html",
43    },
44  },
45  webrtc: {
46    entry: "src/pages/webrtc.ts",
47    output: "webrtc.min.js",
48    global: "DumberWebRTC",
49    html: {
50      name: "webrtc",
51      title: "WebRTC Diagnostics",
52      script: "webrtc.min.js",
53      css: "style.css",
54      filename: "webrtc.html",
55    },
56  },
57} as const;
58
59// Get page from VITE_PAGE env var, default to building all
60const targetPage = process.env.VITE_PAGE as keyof typeof pages | undefined;
61
62// Copy public assets to output directory
63function copyPublicAssets() {
64  const outDir = resolve(__dirname, "../assets/webui");
65  const publicDir = resolve(__dirname, "public");
66  if (!existsSync(outDir)) {
67    mkdirSync(outDir, { recursive: true });
68  }
69  // Copy favicon.png for dumb:// URL favicons
70  const faviconSrc = resolve(publicDir, "favicon.png");
71  if (existsSync(faviconSrc)) {
72    copyFileSync(faviconSrc, resolve(outDir, "favicon.png"));
73  }
74}
75
76// Build single page config
77function buildPageConfig(pageName: keyof typeof pages) {
78  const page = pages[pageName];
79  return defineConfig({
80    plugins: [
81      svelte({
82        emitCss: false, // Inline component CSS for shadow DOM compatibility
83      }),
84      pageGenerator([page.html]),
85      {
86        name: "copy-public-assets",
87        closeBundle() {
88          copyPublicAssets();
89        },
90      },
91    ],
92    build: {
93      rollupOptions: {
94        input: resolve(__dirname, page.entry),
95        output: {
96          dir: "../assets/webui",
97          entryFileNames: page.output,
98          chunkFileNames: "[name].js",
99          assetFileNames: "[name].[ext]",
100          manualChunks: undefined,
101          format: "iife",
102          name: page.global,
103        },
104      },
105      emptyOutDir: false,
106      target: ["es2020", "chrome91", "firefox90"],
107      minify: true,
108      sourcemap: false,
109      cssCodeSplit: false,
110      assetsInlineLimit: 4096,
111    },
112    resolve: {
113      alias: {
114        $lib: resolve(__dirname, "src/lib"),
115        $components: resolve(__dirname, "src/components"),
116      },
117    },
118  });
119}
120
121// Export config for specified page or default to homepage
122// Use VITE_PAGE=homepage or VITE_PAGE=blocked to select
123export default buildPageConfig(targetPage || "homepage");

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close