finish hooking up the unregistered servers page
parent
699cb671ec
commit
8a04481236
|
@ -309,8 +309,32 @@ async fn handle_server_list_internal (state: &Arc <RelayState>)
|
||||||
async fn handle_unregistered_servers_internal (state: &Arc <RelayState>)
|
async fn handle_unregistered_servers_internal (state: &Arc <RelayState>)
|
||||||
-> UnregisteredServerListPage
|
-> UnregisteredServerListPage
|
||||||
{
|
{
|
||||||
|
use LastSeen::*;
|
||||||
|
|
||||||
|
let now = Utc::now ();
|
||||||
|
|
||||||
|
let server_list = {
|
||||||
|
let guard = state.unregistered_servers.read ().await;
|
||||||
|
(*guard).clone ()
|
||||||
|
};
|
||||||
|
|
||||||
|
let unregistered_servers = server_list.into_iter ()
|
||||||
|
.map (|x| {
|
||||||
|
let last_seen = match pretty_print_last_seen (now, x.seen) {
|
||||||
|
Negative => "Error (negative time)".into (),
|
||||||
|
Connected => "Recently".into (),
|
||||||
|
Description (s) => s.into (),
|
||||||
|
};
|
||||||
|
|
||||||
|
UnregisteredServer {
|
||||||
|
name: x.name,
|
||||||
|
tripcode: base64::encode (x.tripcode.as_bytes ()),
|
||||||
|
last_seen,
|
||||||
|
}
|
||||||
|
}).collect ();
|
||||||
|
|
||||||
UnregisteredServerListPage {
|
UnregisteredServerListPage {
|
||||||
unregistered_servers: vec! [],
|
unregistered_servers,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ impl Default for ServerStatus {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive (Clone)]
|
||||||
pub struct RejectedServer {
|
pub struct RejectedServer {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub tripcode: blake3::Hash,
|
pub tripcode: blake3::Hash,
|
||||||
|
|
Loading…
Reference in New Issue