windows: share-link and subscription parsing, admin-only edits
ps-core::links ports upstream's proxy_url_parsers.py and proxy_parsing.py: every scheme, each backend's refusals, XRay rendering, subscription decoding, tags and the server checks. Upstream's build-outbound tests are ported case for case, and tools/parity/links.py runs ~750 links through both implementations: no differences. config::privileged_changes names the edits only an administrator may make: anything that runs a program, passes arguments through, or names a local file, since the service runs as LocalSystem. Names that become paths or service names are validated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c837db1c18
commit
77d4cefe0e
12 files changed
+2821
-3
No files matched your search
@@ -0,0 +1,22 @@
|
||||
//! For the parity check against upstream (tools/parity/links.py): JSON lines in,
|
||||
//! `{"url", "tag", "backend"}`, JSON lines out, `{"ok": outbound}` or `{"error": message}`.
|
||||
|
||||
use std::io::{BufRead, Write};
|
||||
|
||||
use ps_core::links::{LinkBackend, build_outbound};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
fn main() {
|
||||
let stdout = std::io::stdout();
|
||||
let mut out = stdout.lock();
|
||||
for line in std::io::stdin().lock().lines() {
|
||||
let line = line.expect("stdin");
|
||||
let req: Value = serde_json::from_str(&line).expect("a JSON request");
|
||||
let backend = if req["backend"] == "xray" { LinkBackend::Xray } else { LinkBackend::SingBox };
|
||||
let result = match build_outbound(req["url"].as_str().unwrap(), req["tag"].as_str().unwrap(), backend) {
|
||||
Ok(ob) => json!({ "ok": ob }),
|
||||
Err(e) => json!({ "error": e.to_string() }),
|
||||
};
|
||||
writeln!(out, "{result}").unwrap();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user