windows: the service names zapret's presets and tg-ws-proxy's links
- zapret-presets: the presets of the installed zapret release and the one configured; proxy-ctl zapret presets. - tg-links: tg-ws-proxy's tg:// links (dd, and ee with a fake-TLS domain), as it prints them; they carry its secret, so the secrets scope. proxy-ctl tg link. No more reading them out of its log. - tools/dev-service.sh: the service on Linux with a demo outbound, for working on the app. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4ae30dac3c
commit
63aede0dc1
5 files changed
+136
-1
No files matched your search
@@ -133,7 +133,7 @@ fn scope_of(req: &Request) -> Option<Scope> {
|
||||
Request::Pin { .. } | Request::Mode { .. } | Request::RuleSetsUpdate => Some(Scope::Routing),
|
||||
Request::Disable { .. } | Request::SubsUpdate { .. } | Request::Test { .. } => Some(Scope::Outbounds),
|
||||
// Backend logs name the sites visited (at info), and errors may quote what was dialled.
|
||||
Request::RenderedConfig | Request::Logs { .. } => Some(Scope::Secrets),
|
||||
Request::RenderedConfig | Request::Logs { .. } | Request::TgLinks => Some(Scope::Secrets),
|
||||
Request::Restart { .. } | Request::Start { .. } | Request::Stop { .. } => Some(Scope::Services),
|
||||
_ => None,
|
||||
}
|
||||
@@ -454,6 +454,27 @@ pub async fn handle(req: Request, peer: &Peer, shared: &Shared) -> Response {
|
||||
Response::ok(json!(list))
|
||||
}
|
||||
|
||||
Request::ZapretPresets => {
|
||||
let s = shared.lock().await;
|
||||
let bats: Vec<String> = std::fs::read_dir(s.paths().bin().join("zapret"))
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.filter_map(|e| e.ok()?.file_name().into_string().ok())
|
||||
.collect();
|
||||
Response::ok(json!({
|
||||
"presets": ps_core::zapret::presets(&bats),
|
||||
"current": s.cfg().zapret.discord_youtube.config_name,
|
||||
}))
|
||||
}
|
||||
|
||||
Request::TgLinks => {
|
||||
let s = shared.lock().await;
|
||||
match crate::tg::secret(s.cfg(), s.paths()) {
|
||||
Ok(secret) => Response::ok(json!({ "links": crate::tg::links(s.cfg(), &secret) })),
|
||||
Err(e) => Response::err(format!("tg-ws-proxy's secret: {e:#}")),
|
||||
}
|
||||
}
|
||||
|
||||
Request::ComponentsInstall { names } => {
|
||||
// Programs the service runs as SYSTEM: an administrator's call, whatever the scopes.
|
||||
if !peer.admin {
|
||||
|
||||
Reference in new issue
Block a user