finish hooking up the unregistered servers page

main
_ 2021-03-15 19:22:23 +00:00
parent 699cb671ec
commit 8a04481236
2 changed files with 26 additions and 1 deletions

View File

@ -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,
} }
} }

View File

@ -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,