windows: authorize streamed requests, self-removal on uninstall, tun on

- Every request is authorized before it is handled, including `logs -f`,
  which skipped the check.
- The state root is checked once per process: a second check under Wine
  moved the live root (and its log) aside.
- uninstall removes Program Files after it exits: cmd got a garbled
  quoted command line; it now runs raw, outside the folder, windowless.
- install no longer fails when the first start does; it says how to start.
- `proxy-ctl proxy tun on` also turns on proxy.tun.enable.
- build-tg-ws-proxy.sh resolves its output path before changing directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 5.5 committed 2026-10-27 00:41:53 +03:00
1 parent 28cc7b2cbe
commit 8af7b2e628
5 files changed
+62 -15

No files matched your search

+16 -1
View File
@@ -71,8 +71,23 @@ impl Paths {
/// lets anyone else in is moved aside, never adopted: ProgramData lets any user make
/// folders, and the service runs what is under `bin\` as SYSTEM.
pub fn create_all(&self) -> std::io::Result<()> {
// Once per process: a second check of a root this process made (and may be writing
// its log into) has nothing to learn, and moving it aside then would lose the log.
static CHECKED: std::sync::Mutex<Vec<PathBuf>> = std::sync::Mutex::new(Vec::new());
let first = {
let mut checked = CHECKED.lock().unwrap();
let first = !checked.contains(&self.root);
if first {
checked.push(self.root.clone());
}
first
};
#[cfg(windows)]
secure::ensure_root(&self.root)?;
if first {
secure::ensure_root(&self.root)?;
}
#[cfg(not(windows))]
let _ = first;
#[cfg(not(windows))]
std::fs::create_dir_all(&self.root)?;
for dir in [self.subscriptions(), self.rule_sets(), self.cache(), self.run(), self.logs(), self.bin()] {