3x-ui/web
MHSanaei d97ce19f30
fix(windows): clean shutdown, working panel restart, harden kernel32 load
Three Windows-specific issues addressed:

1. Orphaned xray-windows-amd64 after VS Code debugger stop. Delve's
   "Stop" sends TerminateProcess to the Go binary, which is uncatchable
   — our signal handlers never run, so xrayService.StopXray() is skipped
   and xray is left dangling. Spawn xray as a child of a Job Object with
   JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE so the OS kills xray when our
   handle to the job is closed (which happens even on TerminateProcess).
   Also trap os.Interrupt in main so Ctrl+C in the terminal runs the
   graceful path.

2. /panel/setting/restartPanel logged "failed to send SIGHUP signal: not
   supported by windows" because Windows can't deliver arbitrary signals.
   Add a restart hook in web/global; main registers it to push SIGHUP
   into its own signal channel, and RestartPanel calls the hook before
   falling back to the (Unix-only) signal path. Same restart-loop code
   runs in both cases.

3. util/sys/sys_windows.go now uses windows.NewLazySystemDLL so the
   kernel32.dll resolve is pinned to %SystemRoot%\System32 (prevents
   DLL hijacking by a planted DLL next to the binary). Local filetime
   type replaced with windows.Filetime, and the unreliable
   syscall.GetLastError() fallback replaced with a type assertion on the
   errno captured at call time.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 22:57:36 +02:00
..
controller chore: apply modernize analyzer fixes across codebase 2026-05-18 12:24:52 +02:00
entity chore: apply modernize analyzer fixes across codebase 2026-05-18 12:24:52 +02:00
global fix(windows): clean shutdown, working panel restart, harden kernel32 load 2026-05-18 22:57:36 +02:00
job feat(database): add PostgreSQL as an optional backend alongside SQLite 2026-05-18 15:40:39 +02:00
locale v3 2026-05-10 02:13:42 +02:00
middleware Security hardening: sessions, SSRF, CSP nonce, CSRF logout, trusted proxies (#4275) 2026-05-13 12:52:52 +02:00
network docs: add comments for all functions 2025-09-20 09:35:50 +02:00
runtime fix(nodes): route per-client ops through node clients API + orphan sweep 2026-05-17 23:29:29 +02:00
service fix(windows): clean shutdown, working panel restart, harden kernel32 load 2026-05-18 22:57:36 +02:00
session Security hardening: sessions, SSRF, CSP nonce, CSRF logout, trusted proxies (#4275) 2026-05-13 12:52:52 +02:00
translation feat(database): add PostgreSQL as an optional backend alongside SQLite 2026-05-18 15:40:39 +02:00
websocket chore: apply modernize analyzer fixes across codebase 2026-05-18 12:24:52 +02:00
web.go Security hardening: sessions, SSRF, CSP nonce, CSRF logout, trusted proxies (#4275) 2026-05-13 12:52:52 +02:00