improve sync ui

This commit is contained in:
Robin Appelman 2024-11-24 20:23:51 +01:00
commit ed63ffa394
8 changed files with 129 additions and 51 deletions

View file

@ -86,6 +86,8 @@ pub struct SiteConfig {
pub api: String,
#[serde(default = "default_maps")]
pub maps: String,
#[serde(default = "default_sync")]
pub sync: String,
}
fn default_api() -> String {
@ -96,6 +98,10 @@ fn default_maps() -> String {
"https://maps.demos.tf/".into()
}
fn default_sync() -> String {
"wss://sync.demos.tf/".into()
}
#[derive(Debug, Deserialize)]
pub struct TracingConfig {
pub endpoint: String,

View file

@ -74,6 +74,7 @@ struct App {
openid: SteamOpenId,
api: String,
maps: String,
sync: String,
map_list: MapList,
pub session_store: MemoryStore,
}
@ -156,6 +157,7 @@ async fn main() -> Result<()> {
.expect("invalid steam login url"),
api: config.site.api,
maps: config.site.maps,
sync: config.site.sync,
map_list,
session_store: session_store.clone(),
});
@ -518,6 +520,7 @@ async fn viewer(
ViewerPage {
demo,
maps: &app.maps,
sync: &app.sync,
},
session,
))

View file

@ -8,6 +8,7 @@ use std::borrow::Cow;
pub struct ViewerPage<'a> {
pub demo: Option<Demo>,
pub maps: &'a str,
pub sync: &'a str,
}
#[derive(Asset)]
@ -48,8 +49,9 @@ impl Page for ViewerPage<'_> {
let script = ViewerScript::url();
let style_url = ViewerStyle::url();
let maps = self.maps;
let sync = self.sync;
html! {
.viewer-page data-maps = (maps) {
.viewer-page data-maps = (maps) data-sync = (sync) {
@if let Some(demo) = self.demo.as_ref() {
input type = "hidden" name = "url" value = (demo.url) {}
progress.download min = "0" max = "100" value = "0" {}