Skip sourcing project aliases from the global profile when the system install lives in an unreadable directory such as /root. Add regression coverage for readable and restricted project paths.
Refs #292
* fix(config): drop subconverter-injected port/socks-port/redir-port so only mixed-port is kept
The bundled subconverter base templates hard-code a static listener block
(port/socks-port/redir-port, with socks-port=7891). normalize_runtime_config
only rewrites mixed-port and leaves that block in the generated config, while
resolve_runtime_ports does not know those ports exist. On a busy shared host
where 7890 is already taken, the auto-resolver shifts mixed-port to 7891 and it
collides with the injected socks-port=7891. mihomo then binds socks on 7891 and
silently fails to bind the mixed (http) listener, so the port clashctl exports
as http_proxy has no HTTP handler and every request dies with
"curl: (56) Proxy CONNECT aborted".
Strip the legacy listener keys during normalization so the framework's single
auto-managed mixed-port is the only proxy listener, which is what the default
template already intends.
* refactor(config): consolidate legacy port deletion into a single del() call
Addresses Copilot review feedback on #276. Verified the bundled yq v4.52.4
supports deleting multiple paths in one del() expression.
- Add kkgithub.com (hostpath) to the default mirror pool alongside the
existing gh-proxy.org / ghfast.top / ghproxy.net entries; all four
verified reachable and capable of proxying GitHub release downloads.
- Add doctor_download_mirrors() section to 'clashctl doctor': shows
whether a custom mirror (CLASH_GH_PROXY / CLASH_GH_PROXY_POOL) is
active or the built-in pool is in use, last successful/failed mirror
URL from the state file, and a one-liner hint for setting a custom
mirror prefix.
- README: add 'GitHub 下载加速' subsection under .env config to explain
that all GitHub assets (kernel, GEO data, yq, subconverter, dashboard)
automatically go through the mirror pool, document CLASH_GH_PROXY and
CLASH_GH_PROXY_POOL env vars with examples, and point users to
ghproxy.link for a live mirror list and 'clashctl doctor' for status.
Problem 1 - can_manage_tun_safely() missed setcap grants:
- Add kernel_binary_has_cap_net_admin(): use getcap to detect file
capability cap_net_admin on the kernel binary, so a user who ran
'setcap cap_net_admin,cap_net_raw+ep mihomo' is allowed through.
- Extend can_manage_tun_safely() to call this check after the existing
capsh (current-shell) check.
- In cmd_tun_on(), add a process-level fallback via the existing
tun_process_has_cap_net_admin() for cases where getcap is unavailable
but the running process already holds the capability.
Problem 2 - sudo clashctl corrupts runtime file ownership:
- Add guard_sudo_on_user_install(): detects root + SUDO_USER +
stored install scope == user, refuses with a clear message and
instructs the user to run as the install user directly.
- Call the guard at the entry of both cmd_tun_on() and cmd_tun_off()
so neither write path can corrupt runtime/ file ownership.
#265 / #272: systemd_user_available() now requires XDG_RUNTIME_DIR and a
live D-Bus socket before probing systemctl --user, preventing false-positives
in containers (K8s/containerd) where systemctl exists but D-Bus is absent.
#274: Remove 'export' from CLASH_FOR_LINUX_SHELL_LOADED guard in profile.sh
generation so the variable stays local to the sourcing shell and does not
leak into child shells (VSCode terminal, tmux pane, bash subshell), which
was causing alias.sh to be skipped and http_proxy not exported in children.
#270: Ensure compinit is loaded before bashcompinit in the generated zsh
completion script so that compdef is available when bashcompinit registers
completions, fixing 'command not found: compdef' on zsh setups that do not
call compinit themselves.
#271: Extend container_env_type() to detect cgroups v2 + containerd/K8s
environments where /proc/1/cgroup only contains '0::/' and neither
/.dockerenv nor legacy cgroup keywords are present. Detection now also
inspects PID 1 comm and overlay root filesystem as fallbacks.
#266: resolve_runtime_ports() accepts an optional config-file hint; when
MIXED_PORT is not explicitly set in the environment, the port is read from
the config file being normalized. normalize_runtime_config() passes its
target file, so a user's 'mixed-port: 7899' in their subscription YAML is
preserved instead of being silently overwritten with the default 7890.
Generalize Tun source-IP detection in doctor log evidence: parse the
TUN adapter CIDR from logs and match traffic against it, while keeping
built-in default Tun ranges (28.x, 198.18.x, 198.19.x). Add offline
check script covering the new detection cases.