feat: hostapd_cli status
This commit is contained in:
parent
c98adcee74
commit
3bd0dabc6e
2 changed files with 12 additions and 0 deletions
11
src/main.rs
11
src/main.rs
|
@ -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";
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue