feat: hostapd_cli status

This commit is contained in:
DarkCat09 2025-03-26 15:51:27 +04:00
parent c98adcee74
commit 3bd0dabc6e
Signed by: DarkCat09
SSH key fingerprint: SHA256:SnH1iYY/ogxxRmt1I6piy+aVUUzrOWvfksQWfhZ8JUM
2 changed files with 12 additions and 0 deletions

View file

@ -28,6 +28,7 @@ async fn main() -> std::io::Result<()> {
.service(poweroff)
.service(ping)
.service(clients)
.service(ap_config)
.service(temp)
.state(cfg.clone())
})
@ -73,6 +74,16 @@ async fn clients() -> Result<impl Responder> {
.map_err(Into::into)
}
#[web::get("/apcfg")]
async fn ap_config(cfg: State<Config>) -> Result<impl Responder> {
Ok(util::format_output(
util::run_as_root(&cfg.doas, "/usr/sbin/hostapd_cli")
.arg("status")
.output()
.await?,
))
}
#[web::get("/temp")]
async fn temp(cfg: State<Config>) -> Result<impl Responder> {
const EXE: &str = "/usr/bin/vcgencmd";

View file

@ -37,6 +37,7 @@
<a href="/off">Power off</a>
<a href="/ping">Ping 1.1.1.1</a>
<a href="/ips">List IPs</a>
<a href="/apcfg">Show AP config</a>
<a href="/temp">Get CPU temp</a>
</body>
</html>