A daily cycle (first check 10s after start, gated by auto_check_update)
checks the server and stages the current offer's installer under a name
stamped with its version: only a surviving future publishes the staged
file, and a stage that no longer verifies against the offer is replaced.
The staged version is exposed through the get_staged_update command and
the verge://staged-update-changed event, so the update button becomes a
single restart action when the installer is ready. An install displaces
the cycle; a cancel never touches staged bytes, and turning
auto_check_update off stops new downloads without a discard protocol.
The cache's consumer, the startup auto-install UI, was retired in
#8747; what remained was a faster dialog install for later-session
clicks. That did not carry the cost: every cache function, the
discard handshake with the config write lock, the daily tick, and
a persistent installer-sized directory for users who never install.
The actor now serves Install and Cancel only: the dialog install
always downloads with progress events, which the dialog already
renders, and auto_check_update keeps gating the frontend's own
update check.
The sidecar's version filter duplicated what Update::verify already
enforces: the plugin's signature binds the release version, so bytes
cached from an earlier offer fail verification for the current one.
Dropping it costs one full-bin read per release transition and leaves
the cache as a single file published by one rename.
Three failure-semantics gaps in the actor refactor:
- The blocking cache writer published the cache inside a task that a
preemption detaches, so a discard could delete the cache, ack the
config-write holder, and still leave a published cache behind it.
The rename and metadata write now run on the actor after the
blocking write's await, so only a surviving future can publish.
- The discard ack awaited a bulk unlink while the executor held the
config write lock. The cache is now invalidated by an O(1) rename
and unlinked detached.
- A panic in the actor ended all updating for the rest of the
process; the global panic hook logs it, but nothing recovered. The
loop now runs catch_unwind epochs, restarting with the mailbox and
the daily check backed off.
The reinstall page runs the previous uninstaller, which removes the
Service, and the new installer only tried to start one. Record whether
clash_verge_service exists, with its start type and running state, in
.onInit before that uninstaller can run. When it existed, Section Install
reinstalls it with the bundled cores and their hashes through the
installer's own elevation, then restores a non-automatic start type and
the stopped state. A first install still never adds a Service.
A failed reinstall or restore is logged, shown in a warning dialog that is
auto-confirmed under /S, and sets exit code 2, so the installer does not
report success.
Validated only by compiling the macros with makensis -WX against the real
SimpleSC plugin; not run on Windows.
Refs #8553
* perf(traffic): shorten sidebar graph animation
* refactor(service)!: remove the development service channel workflow
Delete the verge-dev/dev-sidecar features, the dev.mjs script family,
and the CLASH_VERGE_DEV_SERVICE_DIR staging chain. Debug builds keep
the isolated .dev application data directory and dev sidecar IPC names
through #[cfg(debug_assertions)] instead of the removed feature.
Point clash_verge_service_ipc at tag v2.8.2.
* chore(service): track the development-channel removal draft
Point clash_verge_service_ipc at the removal branch while its PR is
open; flip to tag v2.8.2 once the service side merges.
* chore(service): track the released service 2.8.2
The removal branch merged as clash-verge-rev/clash-verge-service-ipc#105
(with the digest opt-in from clash-verge-rev/clash-verge-service-ipc#106
and the 2.8.2 release bump on top), so track the service repository's
main directly instead of the draft branch.
* perf(enhance): move tun mapping and alpn strings instead of cloning
enforce_tun deep-cloned the tun mapping two lines before overwriting
it; take_mapping now moves it instead (end state identical for absent,
non-mapping and mapping values, including key order). builtin_hy_alpn
cloned each hysteria node's alpn String only to dodge a borrow conflict
while re-inserting under the same key; take it in place via get_mut +
mem::take. The in-place guard preserves non-string alpn values that a
remove-based shape would silently drop.
Measured per enhance run on 200 hysteria nodes: hy_alpn 600 -> 200
allocations; enforce_tun 29 -> 3.
* perf(tray): hoist tooltip version string
update_tooltip re-derived the version string from CARGO_PKG_VERSION on
every tray refresh; compute it once in a LazyLock. std::string::String
is spelled out because bare String in this module resolves to the
tristr alias.
* refactor(cmd): take sidecar fallback as AsyncFnOnce(&str)
finish_service_installation's FnOnce(String) -> FallbackFuture bound
forced reason.clone() before the call. AsyncFnOnce(&str) borrows the
reason and moves it into the Sidecar outcome - one allocation instead
of two - and drops the FallbackFuture generic entirely. The
windows-only call site's closure shape is verified with standalone
rustc (edition 2024) repros; Windows CI compiles it definitively.
* refactor(tray): store the tooltip version as a static str
The only consumer reads the value as a str, so the String static
allocated even when the version carries no build metadata. Return the
env! literal directly in that case and leak the trimmed form otherwise;
the LazyLock already owns the value for the process lifetime.
* chore(enhance): drop comment on the alpn take
* perf(feat): share runtime mappings across port-save probes via Arc
Every proxy-port save deep-copied the full runtime Mapping twice (current
and candidate) so the rare post-restart re-probe could retain ownership.
Wrap both in Arc once: the first probe takes refcount clones, the re-probe
moves the same Arcs. Probe inputs are identical mappings and the
spawn_blocking Send + 'static bounds are unchanged.
Measured on a representative 200-proxy/30-group runtime config: one
Mapping clone costs 10,053 allocations / 1.02 MiB; the Arc handoff costs
0 / 0. Both copies per save are gone.
* perf(config): borrow through selected-node persistence closures
record_selected_node and persist_reconciled_selected copied the group,
node and profile strings up-front for the persist_selected_update
closure, including on the no-change early-return path. The closure bound
is FnOnce + Send without 'static (the same shape forget_selected_node
already relies on), so capture &str and &[PrfSelected] borrows instead
and construct owned strings only at the storage points. as_deref
comparisons keep content semantics.
* chore(feat): drop a narration comment on the Arc handoff
* perf(core): remove redundant copies on service IPC paths
Allocation and copy trims on the service IPC hot paths; the wire format
is untouched:
- store the owner session proof as Arc: active_service_session()
retrieval becomes a refcount clone instead of a 64-char string copy
per call (~12 call sites, including the frontend-polled log path).
The one external caller takes Proof: Borrow<OwnerSessionProof> so its
four test closures stay unchanged.
- build the session token hex with one allocation instead of 32
format! allocations plus Vec growth (35 -> 1 allocations measured),
mirroring owner_identity::encode_token.
- reuse one RuntimeFileRequest across the provider cache-sync chunk
loop; only .offset changes per chunk.
- move the proposed session token out of StartClashRequest on success
instead of cloning it up-front.
- report the non-actionable service status by reference before
set_status takes ownership.
- hoist the macOS install markers to LazyLock, pass osascript args as
an array, compare the install-wait core name via the requirement
array, and log the silent-updater version by reference.
* fix(core): gate the LazyLock import to macOS
The install-marker static is the only LazyLock user in the module and
is macOS-gated; the ungated import made clippy -D warnings fail the
Linux and Windows builds. Co-locate the import with its cfg.
In rule mode, picking a node in a url-test or fallback group also points the first select group listing it at that group. Toggle in Misc settings, on by default.
* perf(enhance): cache chain items by file identity
Every config generation re-read and re-parsed all seven chain files.
Cache the parsed ChainItem keyed by (path, mtime, length) and clone on
hit: measured 486us -> 20us per generation (-95.9%) on a seven-file
chain set (merge/script/rules fixtures). Profile saves go through
tmp+rename so mtime always changes.
* perf(config): guard runtime yaml re-serialization
runtime_config_yaml re-serialized the multi-megabyte runtime Mapping on
every call even when unchanged. Hash the Mapping tree (Value: Hash) and
return the cached Arc<String> handle on hit: 4.10ms -> ~0.39ms (hash
290us, ~-90%) for a 3000-node config on the unchanged path, and the
handle keeps both hit and miss at a refcount clone instead of copying
the yaml body. The 64-bit SipHash key is sound here: a birthday
collision needs ~2^32 distinct config states at a volume of a few
hundred generations per day, and a colliding pair only serves one stale
yaml until the next config change re-hashes.
* build(deps): bump tauri-plugin-mihomo to 0.7.1
Pins the revision that derives Clone on ProxyType and DelayHistory,
which the upcoming proxy-view cache needs to return cached views
without changing the IPC contract.
* refactor(backend): right-size the new caches' storage
The chain cache never shares its stored ChainItem -- every hit
deep-clones it -- so its Arc wrapper only added indirection; store it
directly and const-shape it behind a LazyLock static instead of a
OnceLock accessor. The yaml cache keeps Arc<String> because callers
receive the stored handle, making hit and miss clones O(1).
* style(config): hoist the runtime yaml cache to module scope
Match the module-level placement of the chain cache and the other
named statics; the closure-local declaration shadowed nothing but read
worse and forced rustfmt to split the line.
* refactor(config): adopt tristr for config strings
Wire the tristr git dependency (pinned rev) and switch the config and
enhance modules from smartstring::alias::String to tristr::alias::String.
Drop the smartstring-era per-field specta overrides except the three
webdav fields required by serialize_with and the ipc::JsonValue bridge:
tristr maps to Primitive::str natively and the generated bindings stay
byte-identical (gen-contract --check passes).
Call sites in not-yet-migrated modules (cmd/core/feat/utils) are bridged
with explicit tristr::alias::String paths and as_str().into() conversions;
each bridge is absorbed when its module migrates.
* refactor(cmd): adopt tristr for command strings
Switch the cmd module from smartstring::alias::String to
tristr::alias::String and drop its smartstring-era per-field specta
overrides (ProfileSelection/ProfileCreate/ProfilePatch, RuntimeLogs);
bindings stay byte-identical. Calls into not-yet-migrated feat/core
functions keep smartstring-typed locals via full paths until those
modules migrate.
* refactor(core): adopt tristr for core strings
Switch the core module (validate, timer, sysopt, backup, hotkey, tray,
manager, notify) from smartstring::alias::String to tristr::alias::String
and drop the smartstring-era specta overrides on ValidationOutcome and
the notify payload structs; bindings stay byte-identical. WebDAV calls
from the not-yet-migrated feat module are bridged with as_str().into().
* refactor(feat): adopt tristr for feature strings
Switch the feat module (backup, icon, dns, profile, clash) from
smartstring::alias::String to tristr::alias::String, drop its
smartstring-era specta overrides (IconInfo, backup listings,
DnsOverrideOutcome), and absorb the temporary smartstring-typed bridge
locals the cmd module used to call into feat.
* refactor(utils): adopt tristr for utility strings
Switch utils/network.rs and utils/resolve/scheme.rs from
smartstring::alias::String to tristr::alias::String and absorb the
temporary user_agent and profile-name bridge conversions.
* refactor(deps): drop smartstring in favor of tristr
Remove the smartstring workspace and member dependencies and its
Cargo.lock entry; tristr is the only string representation left.
* build(deps): bump tristr to fuzz-harness fix rev
Pin 3738d8c renames the stale vstr path dependency in the upstream
fuzz manifest so its seven targets build again; library code is
unchanged from 3756ed1a.
Every menu API call runs on the main thread; invoked from a worker,
each call pays a blocking round-trip there and back (channel, event
loop hop, recv). Rebuilding the tray menu with proxy groups enabled
issued one round-trip per menu item — 200+ for a typical subscription —
and the per-call wait grows whenever the event loop is busy with
webview work.
Gather the async inputs (verge/clash/profiles snapshots, proxies and
runtime group order) on the caller's task, then build the menu and
attach it in a single run_on_main_thread closure where every item
constructs inline. Measured on a standalone tauri bench (5 groups x
40 nodes): a rebuild drops from ~6.2ms to ~1.6ms on an idle event
loop and from ~11.4ms to ~1.6ms with the loop busy (8ms of work per
16ms frame), with ~450 fewer allocations (~155KB) per rebuild.
* fix: mechanical string conversions
- &String parameters become &str (event payload fields borrow &str; wire format unchanged)
- Cow/std-string double conversions collapse to a single Into
- sha256 digests format through a shared hex lookup table instead of one
format! allocation per byte
- i18n placeholder replacement only allocates when the placeholder exists
* perf(enhance): marshal scripts by value and diff fields by fingerprint
- scripts cross into boa via JsValue::from_json/to_json instead of the
JSON text round-trip (config clone + json string + UTF-16 JsString +
stringify + re-parse all disappear); size guards use an allocation-free
approximate walk
- merge documents and tun/dns patches move values instead of deep-cloning
whole sub-trees per pass
- authoritative-field snapshots hash dns/hosts/tun values instead of
cloning them around every chain item (9 snapshots per enhance)
- proxy-name cleanup sets build from &str in one conversion
* perf(config): write yaml headers in place and record selections without copying
- save_yaml_str takes an optional header prefix written as separate chunks,
so the MB-scale serialized payload is never duplicated by format! just
to prepend a comment (profiles/verge/clash/runtime yaml all benefit;
file bytes unchanged)
- the runtime yaml string no longer round-trips through a prefixed copy;
write_runtime_file adds the header when persisting
- record/forget selected nodes mutate the stored selection list in place
instead of cloning it per click
* perf(tray): drop the redundant full rebuild in update_part
update_part rebuilt the menu twice back to back: once without proxy groups,
then a spawned full update_menu. Keep the partial rebuild only.
* fix(service): detect the service on OpenRC
* chore(deps): bump Service IPC and bundle to 2.8.1
* docs(changelog): note OpenRC service fixes
* docs(changelog): shorten OpenRC fix entry
---------
Co-authored-by: Tunglies <77394545+Tunglies@users.noreply.github.com>
* chore(dev): reject mismatched Service and SDK versions
* chore(deps): consume Service 2.8.0 and merged sysproxy 0.7.2
* chore: omit changelog entry from Service integration
The window and webview backgrounds retain their startup colors when
the resolved theme changes. With Tauri's full-size content view,
these colors affect the native titlebar even after setTheme succeeds.
Synchronize both backgrounds through WebviewWindow.setBackgroundColor
on macOS, reuse the startup palette, and allow both background commands.
Wry commit 1d1b870 implemented macOS background colors through
WKWebView.underPageBackgroundColor. CVR adopted that behavior in
7d29c0c6 (#6318), making the fixed startup colors from 683667f8 (#5637)
effective on macOS.
Closes#8205Closes#7968Closes#8272Closes#8625
Upstream: https://github.com/tauri-apps/wry/commit/1d1b8707665b4638e040dde7a88cd33d77ba2ebc
Co-authored-by: qzda <qinzhidaoa@gmail.com>
Co-authored-by: Vickers Zhu <vickerszhu@163.com>
Route frontend and tray node selections through the same backend flow for
selection, persistence, state refresh, and connection cleanup. Read the
group's previous selection before switching and preserve the original
rule of closing only connections whose chains contain that selection.
Run optional cleanup in the background and keep its failures separate
from successful selection. Remove redundant frontend effects and unused
IPC commands, and refresh the proxy view for every successful switch.
Refs: 32095daf90
Refs: bea0dde074
Quote plain hex short-id values before YAML parsing, since a value like 1234e123 becomes a float that cannot be restored. Keep the rewrite only when nothing else changes, and let the editor save check a quoted copy.
- Drop tauri-plugin-process: no frontend or Rust consumer; exit and
restart already go through the exit_app/restart_app commands backed
by AppHandle::exit/restart. Remove the registration and the unused
process:allow-exit capability.
- Replace the glob dev dependency with Node's built-in fs.globSync in
prebuild's service permission step (Node baseline is 26.13.0).
- Remove unused direct Cargo declarations: bitflags and regex (source
and workspace entries), and src-tauri's criterion dev-dependency;
clash-verge-draft keeps criterion for its bench.
- Narrow sysinfo to the network/system features actually consumed.
- Use futures::StreamExt for DelayQueue in the timer and drop the
tokio-stream direct declaration (still transitively present via
clash-verge-service-ipc).
Refresh the tray menu, icon, and tooltip after service operations so restored TUN capability is reflected without changing the saved TUN setting.
Ref: e60285b4ae