This commit is contained in:
dakocha3
2026-09-21 17:40:25 +03:00
commit 309188d191
52 changed files with 5124 additions and 0 deletions
@@ -0,0 +1,48 @@
package ru.pdguard.api;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
import ru.pdguard.config.SystemPolicy;
import ru.pdguard.config.SystemsConfig;
import ru.pdguard.detect.RuleRegistry;
import java.util.List;
import java.util.Map;
/** Просмотр действующих настроек и принудительное их перечитывание. */
@Path("/admin")
public class AdminResource {
private final SystemsConfig systems;
private final RuleRegistry registry;
public AdminResource(SystemsConfig systems, RuleRegistry registry) {
this.systems = systems;
this.registry = registry;
}
@GET
@Path("/config")
@Produces(MediaType.APPLICATION_JSON)
public Map<String, SystemPolicy> config() {
return systems.current();
}
@GET
@Path("/types")
@Produces(MediaType.APPLICATION_JSON)
public List<String> types() {
return registry.knownTypes();
}
@POST
@Path("/reload")
@Produces(MediaType.APPLICATION_JSON)
public Map<String, SystemPolicy> reload() {
systems.reload();
return systems.current();
}
}