diff --git a/web/src/app.rs b/web/src/app.rs index 21bbb78d..44bdf54d 100644 --- a/web/src/app.rs +++ b/web/src/app.rs @@ -7,9 +7,9 @@ use leptos_use::{use_cookie, utils::FromToStringCodec}; #[component] pub fn App() -> impl IntoView { - let (token, set_token) = use_cookie::("token"); + let (auth, set_auth) = use_cookie::("token"); let (username, set_username) = use_cookie::("username"); - provide_context(token); + provide_context(auth); let home_tl = Timeline::new(format!("{URL_BASE}/users/{}/inbox/page", username.get().unwrap_or_default())); let server_tl = Timeline::new(format!("{URL_BASE}/inbox/page")); @@ -19,23 +19,25 @@ pub fn App() -> impl IntoView { let (menu, set_menu) = create_signal(screen_width <= 786); spawn_local(async move { - if let Err(e) = server_tl.more(token).await { + if let Err(e) = server_tl.more(auth).await { tracing::error!("error populating timeline: {e}"); } }); - if token.get().is_some() { + if auth.get().is_some() { spawn_local(async move { - if let Err(e) = home_tl.more(token).await { + if let Err(e) = home_tl.more(auth).await { tracing::error!("error populating timeline: {e}"); } }); } + let title_target = if auth.present() { "/web/home" } else { "/web/server" }; + view! { @@ -44,8 +46,8 @@ pub fn App() -> impl IntoView {
impl IntoView {
} } else { view! { } @@ -102,7 +104,7 @@ pub fn App() -> impl IntoView {

- "\u{26fc} woven under moonlight :: "src" :: wip by alemi " + "\u{26fc} woven under moonlight :: "src" :: wip by alemi :: "top
} diff --git a/web/src/auth.rs b/web/src/auth.rs index f4d1dd2e..58db5eb6 100644 --- a/web/src/auth.rs +++ b/web/src/auth.rs @@ -2,6 +2,13 @@ use leptos::*; use crate::prelude::*; +pub type Auth = Signal>; +pub trait AuthToken { + fn present(&self) -> bool; + fn token(&self) -> String; +} + + #[component] pub fn LoginBox( token_tx: WriteSignal>, @@ -84,12 +91,6 @@ struct AuthResponse { expires: chrono::DateTime, } -pub type Auth = Signal>; -pub trait AuthToken { - fn present(&self) -> bool; - fn token(&self) -> String; -} - impl AuthToken for Signal> { fn token(&self) -> String { match self.get() { diff --git a/web/src/page.rs b/web/src/page.rs index 76d0a9ea..8bf387bc 100644 --- a/web/src/page.rs +++ b/web/src/page.rs @@ -11,6 +11,20 @@ pub fn AboutPage() -> impl IntoView { about

μpub" is a micro social network powered by "ActivityPub

+

"the "fediverse" is an ensemble of social networks, which, while independently hosted, can communicate with each other"

+

content is aggregated in timelines, logged out users can only access global server timeline

+
+
+ } +} + +#[component] +pub fn ConfigPage() -> impl IntoView { + view! { +
+ config +
+

"not implemented :("

}