Compare commits
5 commits
1cc41cced3
...
2a6b6a88ae
Author | SHA1 | Date | |
---|---|---|---|
2a6b6a88ae | |||
32ce9391a4 | |||
40dc245680 | |||
4bb0b6b4da | |||
91316c99af |
4 changed files with 36 additions and 31 deletions
|
@ -22,7 +22,7 @@ impl apb::server::Inbox for Context {
|
||||||
let object_model = self.insert_object(object_node, Some(server)).await?;
|
let object_model = self.insert_object(object_node, Some(server)).await?;
|
||||||
let expanded_addressing = self.expand_addressing(activity_model.addressed()).await?;
|
let expanded_addressing = self.expand_addressing(activity_model.addressed()).await?;
|
||||||
self.address_to(Some(activity_model.internal), Some(object_model.internal), &expanded_addressing).await?;
|
self.address_to(Some(activity_model.internal), Some(object_model.internal), &expanded_addressing).await?;
|
||||||
tracing::info!("{} posted {}", activity_model.id, object_model.id);
|
tracing::info!("{} posted {}", activity_model.actor, object_model.id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,13 @@ pub fn App() -> impl IntoView {
|
||||||
}
|
}
|
||||||
|
|
||||||
server_tl.more(auth);
|
server_tl.more(auth);
|
||||||
|
local_tl.more(auth);
|
||||||
if auth_present { home_tl.more(auth) };
|
if auth_present { home_tl.more(auth) };
|
||||||
})
|
})
|
||||||
};
|
} else {
|
||||||
|
server_tl.more(auth);
|
||||||
|
local_tl.more(auth);
|
||||||
|
}
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<nav class="w-100 mt-1 mb-1 pb-s">
|
<nav class="w-100 mt-1 mb-1 pb-s">
|
||||||
|
@ -107,37 +111,33 @@ pub fn App() -> impl IntoView {
|
||||||
// in a sense it's what we want: refreshing the home tl is main purpose, but also
|
// in a sense it's what we want: refreshing the home tl is main purpose, but also
|
||||||
// server tl may contain stuff we can no longer see, or otherwise we may now be
|
// server tl may contain stuff we can no longer see, or otherwise we may now be
|
||||||
// entitled to see new posts. so while being ugly it's techically correct ig?
|
// entitled to see new posts. so while being ugly it's techically correct ig?
|
||||||
{move || {
|
<main>
|
||||||
view! {
|
<Routes>
|
||||||
<main>
|
<Route path="/web" view=move ||
|
||||||
<Routes>
|
if auth.present() {
|
||||||
<Route path="/web" view=move ||
|
view! { <Redirect path="/web/home" /> }
|
||||||
if auth.present() {
|
} else {
|
||||||
view! { <Redirect path="/web/home" /> }
|
view! { <Redirect path="/web/server" /> }
|
||||||
} else {
|
}
|
||||||
view! { <Redirect path="/web/server" /> }
|
/>
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Route path="/web/home" view=move || view! { <TimelinePage name="home" tl=home_tl /> } />
|
<Route path="/web/home" view=move || view! { <TimelinePage name="home" tl=home_tl /> } />
|
||||||
<Route path="/web/server" view=move || view! { <TimelinePage name="server" tl=server_tl /> } />
|
<Route path="/web/server" view=move || view! { <TimelinePage name="server" tl=server_tl /> } />
|
||||||
<Route path="/web/local" view=move || view! { <TimelinePage name="server" tl=local_tl /> } />
|
<Route path="/web/local" view=move || view! { <TimelinePage name="local" tl=local_tl /> } />
|
||||||
|
|
||||||
<Route path="/web/about" view=AboutPage />
|
<Route path="/web/about" view=AboutPage />
|
||||||
<Route path="/web/config" view=move || view! { <ConfigPage setter=set_config /> } />
|
<Route path="/web/config" view=move || view! { <ConfigPage setter=set_config /> } />
|
||||||
<Route path="/web/config/dev" view=DebugPage />
|
<Route path="/web/config/dev" view=DebugPage />
|
||||||
|
|
||||||
<Route path="/web/users/:id" view=move || view! { <UserPage tl=user_tl /> } />
|
<Route path="/web/users/:id" view=move || view! { <UserPage tl=user_tl /> } />
|
||||||
<Route path="/web/objects/:id" view=move || view! { <ObjectPage tl=context_tl /> } />
|
<Route path="/web/objects/:id" view=move || view! { <ObjectPage tl=context_tl /> } />
|
||||||
|
|
||||||
<Route path="/web/search" view=SearchPage />
|
<Route path="/web/search" view=SearchPage />
|
||||||
<Route path="/web/register" view=RegisterPage />
|
<Route path="/web/register" view=RegisterPage />
|
||||||
|
|
||||||
<Route path="/" view=move || view! { <Redirect path="/web" /> } />
|
<Route path="/" view=move || view! { <Redirect path="/web" /> } />
|
||||||
</Routes>
|
</Routes>
|
||||||
</main>
|
</main>
|
||||||
}
|
|
||||||
}}
|
|
||||||
</Router>
|
</Router>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,6 +7,9 @@ use apb::{target::Addressed, Base, Activity, Object};
|
||||||
#[component]
|
#[component]
|
||||||
pub fn ActivityLine(activity: crate::Object) -> impl IntoView {
|
pub fn ActivityLine(activity: crate::Object) -> impl IntoView {
|
||||||
let object_id = activity.object().id().unwrap_or_default();
|
let object_id = activity.object().id().unwrap_or_default();
|
||||||
|
let activity_url = activity.id().map(|x| view! {
|
||||||
|
<sup><small><a class="clean ml-s" href={x.to_string()} target="_blank">"↗"</a></small></sup>
|
||||||
|
});
|
||||||
let actor_id = activity.actor().id().unwrap_or_default();
|
let actor_id = activity.actor().id().unwrap_or_default();
|
||||||
let actor = CACHE.get_or(&actor_id, serde_json::Value::String(actor_id.clone()).into());
|
let actor = CACHE.get_or(&actor_id, serde_json::Value::String(actor_id.clone()).into());
|
||||||
let kind = activity.activity_type().unwrap_or(apb::ActivityType::Activity);
|
let kind = activity.activity_type().unwrap_or(apb::ActivityType::Activity);
|
||||||
|
@ -25,6 +28,7 @@ pub fn ActivityLine(activity: crate::Object) -> impl IntoView {
|
||||||
<a class="upub-title clean" title={object_id} href={href} >
|
<a class="upub-title clean" title={object_id} href={href} >
|
||||||
{kind.as_ref().to_string()}
|
{kind.as_ref().to_string()}
|
||||||
</a>
|
</a>
|
||||||
|
{activity_url}
|
||||||
<PrivacyMarker addressed=activity.addressed() />
|
<PrivacyMarker addressed=activity.addressed() />
|
||||||
</code>
|
</code>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -37,7 +37,8 @@ impl Timeline {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn more(&self, auth: Auth) {
|
pub fn more(&self, auth: Auth) {
|
||||||
if self.loading.get() { return }
|
if self.loading.get_untracked() { return }
|
||||||
|
if self.over.get_untracked() { return }
|
||||||
let _self = *self;
|
let _self = *self;
|
||||||
spawn_local(async move {
|
spawn_local(async move {
|
||||||
_self.loading.set(true);
|
_self.loading.set(true);
|
||||||
|
@ -150,8 +151,8 @@ pub fn TimelineFeed(tl: Timeline) -> impl IntoView {
|
||||||
let _auto_loader = create_local_resource(
|
let _auto_loader = create_local_resource(
|
||||||
move || (scroll_debounced.get(), height.get()),
|
move || (scroll_debounced.get(), height.get()),
|
||||||
move |(s, h)| async move {
|
move |(s, h)| async move {
|
||||||
if !config.get().infinite_scroll { return }
|
if !config.get_untracked().infinite_scroll { return }
|
||||||
if s > 0.0 && h - s < view_height && !tl.loading.get() {
|
if h - s < view_height {
|
||||||
tl.more(auth);
|
tl.more(auth);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue