mirror of
https://github.com/redlib-org/redlib.git
synced 2025-06-10 00:27:50 +00:00
feat: p2p monitoring
This commit is contained in:
parent
051b63c6de
commit
3f0b27604b
4 changed files with 54 additions and 10 deletions
12
src/main.rs
12
src/main.rs
|
@ -4,7 +4,9 @@
|
|||
|
||||
use cached::proc_macro::cached;
|
||||
use clap::{Arg, ArgAction, Command};
|
||||
use redlib::p2p::ONLINE;
|
||||
use std::str::FromStr;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
use futures_lite::FutureExt;
|
||||
use hyper::Uri;
|
||||
|
@ -227,6 +229,16 @@ async fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
// Manual overrides for online value
|
||||
app.at("/force_offline").get(|_| {
|
||||
ONLINE.store(false, Ordering::SeqCst);
|
||||
resource("", "text/plain", false).boxed()
|
||||
});
|
||||
app.at("/force_online").get(|_| {
|
||||
ONLINE.store(true, Ordering::SeqCst);
|
||||
resource("", "text/plain", false).boxed()
|
||||
});
|
||||
|
||||
// Read static files
|
||||
app.at("/style.css").get(|_| style().boxed());
|
||||
app
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue