The documentation site's domain has expired and its pages described a
2021 v2rayA. The page now carries its own docs, written against the
current code and shipped with the build, so what a user reads matches the
binary they run: quick start, transparent proxy, routing rules, inbounds
and sharing, flags and environment, troubleshooting. English and
Simplified Chinese; the other locales read the English text and say so.
The sections are Markdown under gui/src/docs/<locale>/, compiled to HTML
at build time by a small vite plugin around marked (a devDependency; the
bundle carries no parser) and loaded on demand, so the first load does not
grow. Headings get ids from their text. The flag table is not written by
hand: GET /api/params reads conf.Params' struct tags (id, short, default,
desc) through reflection, the same tags gonfig parses, and the page renders
it, so a new flag documents itself.
"#docs" and "#docs/<section>" open the page; the RoutingA dialog's help
button, the About page and small book icons in the settings sections and
the inbound dialogs point there instead of at the dead site or the wiki.
The navigation gains a fifth destination.
The toolchain of the rewrite: Vite with vite-plugin-pwa (autoUpdate,
/api/ never cached), vue-tsc, ESLint's flat config, Vitest with
happy-dom and a mount helper, an i18n check and a gzip size gate in CI,
Red Hat Text self-hosted under /static/fonts.
Vue 2 has been out of support since the end of 2023, and every library
the GUI sits on is pinned to it: Buefy 0.9, Vuex 3, vue-i18n 8,
vue-virtual-scroller 1, @vitejs/plugin-vue2. This commit swaps the
toolchain; the templates still carry Vue 2 syntax (.sync, slot,
slot-scope, .native) and the build fails on them until the next commit.
- buefy 3.1 is the official Vue 3 release and depends on Bulma 1, so
buefy.scss is rewritten as `@use "bulma/sass" with (...)`, keeping the
same colour values; Bulma 1 needs Dart Sass >= 1.79 for color.channel,
hence sass ^1.86. The danger colour's 0.73 alpha, which Bulma 1 drops,
is restored on the CSS variable.
- The root instance is built by plugins/session.js. Its restart() replaces
$remount: Vue 3 has no $children to walk, and Buefy 3 mounts each
programmatic dialog in its own application, so restart() closes the
registered handles, unmounts the root (whose beforeUnmount hooks close
the WebSocket and the matchMedia listener) and mounts a new one.
Components keep calling this.$remount(); it is set as a global property
from session.js rather than imported by the tree, which would be a
circular import.
- axios, dayjs and the Buefy toast register on the application instead of
Vue.prototype; module-level code uses i18n.global, the legacy instance
no longer exposes t() directly.
Dependabot's bump fails the build: vite.config.js defined the global apiRoot
as a template literal evaluated on every read (the backend address lives in
localStorage and the address dialog changes it), and Vite 5+ only accepts a
literal in define. The global is a getter on window now, installed by a plugin
imported first in main.js, returning the same expression on every read; the
call sites are untouched.
lucide-static's stylesheet declares eot, woff2, woff, ttf and a legacy SVG
font for all 2112 icons, so Vite copied every format into web/ and the
embedded binary grew from about 26 MB to 48 MB; the SVG font alone is 20 MB of
glyph outlines. The interface uses 44 icons.
A Vite plugin (gui/build/lucide-subset.mjs) scans src/ for icon names — class
usage, icon props, dialog options and the Buefy pack's internalIcons — subsets
lucide.woff2 to those glyphs with subset-font and serves the result as a
virtual stylesheet with the 8 KB font inlined. A name the font does not have
fails the build naming it, where it used to render an empty box.
lucide-static's font CSS references all five webfont formats (eot, ttf,
svg, woff, woff2), so Vite emitted ~23 MB of icon fonts into the web panel;
the SVG font alone was ~20.6 MB. All of them render the same glyphs.
scripts/lucide-font.mjs now regenerates src/assets/lucide-font.css from the
upstream CSS with a woff-only @font-face (woff is supported by every
browser since IE9) and runs automatically via the prebuild/preserve hooks,
so a lucide-static upgrade stays in sync. The build output drops from
~23 MB of font files to a single ~414 KB woff while keeping all icon
classes.
Icons came from a home-made icon font (32 glyphs) plus Material Design
Icons for Buefy's internals and a few controls. Both are replaced by the
Lucide webfont from lucide-static: it is registered as Buefy's default
pack (with internal icon mappings for check, alert, chevrons, eye, close,
loading), every inline <i> uses a Lucide class, the sidebar handle image
becomes an icon, and the iconfont directory, its two @imports, @mdi/font
and webpack-iconfont-plugin-nodejs are removed.
The GUI has been built with Vite since the vue-cli setup was replaced, but
vue.config.js, babel.config.js, public/index.html, registerServiceWorker.js
and eight dependencies from that setup were still in the tree; Vite never
read them and yarn lint failed on every file because babel.config.js
named the uninstalled @vue/cli-plugin-babel/preset. Remove them, let
@babel/eslint-parser run without a config file, and bump axios to the
0.30 line (security fixes; dependabot #1656). webpack-iconfont-plugin-nodejs
stays because the checked-in font preview still names it.
yarn lint now executes: 0 errors, 1186 warnings, all pre-existing.
* Turn on Gzip compression on the front end;
- Use compression-webpack-plugin plugin;
- Configure in vue.config.js
- Enable compression only in production mode
* Remove original compression method