Compare commits

...

5 commits

4 changed files with 36 additions and 31 deletions

View file

@ -22,7 +22,7 @@ impl apb::server::Inbox for Context {
let object_model = self.insert_object(object_node, Some(server)).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?;
tracing::info!("{} posted {}", activity_model.id, object_model.id);
tracing::info!("{} posted {}", activity_model.actor, object_model.id);
Ok(())
}

View file

@ -59,9 +59,13 @@ pub fn App() -> impl IntoView {
}
server_tl.more(auth);
local_tl.more(auth);
if auth_present { home_tl.more(auth) };
})
};
} else {
server_tl.more(auth);
local_tl.more(auth);
}
view! {
<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
// 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?
{move || {
view! {
<main>
<Routes>
<Route path="/web" view=move ||
if auth.present() {
view! { <Redirect path="/web/home" /> }
} else {
view! { <Redirect path="/web/server" /> }
}
/>
<main>
<Routes>
<Route path="/web" view=move ||
if auth.present() {
view! { <Redirect path="/web/home" /> }
} else {
view! { <Redirect path="/web/server" /> }
}
/>
<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/local" view=move || view! { <TimelinePage name="server" tl=local_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/local" view=move || view! { <TimelinePage name="local" tl=local_tl /> } />
<Route path="/web/about" view=AboutPage />
<Route path="/web/config" view=move || view! { <ConfigPage setter=set_config /> } />
<Route path="/web/config/dev" view=DebugPage />
<Route path="/web/about" view=AboutPage />
<Route path="/web/config" view=move || view! { <ConfigPage setter=set_config /> } />
<Route path="/web/config/dev" view=DebugPage />
<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/users/:id" view=move || view! { <UserPage tl=user_tl /> } />
<Route path="/web/objects/:id" view=move || view! { <ObjectPage tl=context_tl /> } />
<Route path="/web/search" view=SearchPage />
<Route path="/web/register" view=RegisterPage />
<Route path="/web/search" view=SearchPage />
<Route path="/web/register" view=RegisterPage />
<Route path="/" view=move || view! { <Redirect path="/web" /> } />
</Routes>
</main>
}
}}
<Route path="/" view=move || view! { <Redirect path="/web" /> } />
</Routes>
</main>
</Router>
</div>
</div>

View file

@ -7,6 +7,9 @@ use apb::{target::Addressed, Base, Activity, Object};
#[component]
pub fn ActivityLine(activity: crate::Object) -> impl IntoView {
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 = CACHE.get_or(&actor_id, serde_json::Value::String(actor_id.clone()).into());
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} >
{kind.as_ref().to_string()}
</a>
{activity_url}
<PrivacyMarker addressed=activity.addressed() />
</code>
</span>

View file

@ -37,7 +37,8 @@ impl Timeline {
}
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;
spawn_local(async move {
_self.loading.set(true);
@ -150,8 +151,8 @@ pub fn TimelineFeed(tl: Timeline) -> impl IntoView {
let _auto_loader = create_local_resource(
move || (scroll_debounced.get(), height.get()),
move |(s, h)| async move {
if !config.get().infinite_scroll { return }
if s > 0.0 && h - s < view_height && !tl.loading.get() {
if !config.get_untracked().infinite_scroll { return }
if h - s < view_height {
tl.more(auth);
}
},