Add a dedicated page for the federated feed
This commit is contained in:
parent
1496598a45
commit
79348e06ff
|
@ -61,6 +61,8 @@ fn main() {
|
||||||
routes::instance::local,
|
routes::instance::local,
|
||||||
routes::instance::paginated_feed,
|
routes::instance::paginated_feed,
|
||||||
routes::instance::feed,
|
routes::instance::feed,
|
||||||
|
routes::instance::paginated_federated,
|
||||||
|
routes::instance::federated,
|
||||||
routes::instance::admin,
|
routes::instance::admin,
|
||||||
routes::instance::update_settings,
|
routes::instance::update_settings,
|
||||||
routes::instance::shared_inbox,
|
routes::instance::shared_inbox,
|
||||||
|
|
|
@ -79,6 +79,22 @@ fn paginated_feed(conn: DbConn, user: User, page: Page) -> Template {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[get("/federated")]
|
||||||
|
fn federated(conn: DbConn, user: Option<User>) -> Template {
|
||||||
|
paginated_federated(conn, user, Page::first())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[get("/federated?<page>")]
|
||||||
|
fn paginated_federated(conn: DbConn, user: Option<User>, page: Page) -> Template {
|
||||||
|
let articles = Post::get_recents_page(&*conn, page.limits());
|
||||||
|
Template::render("instance/federated", json!({
|
||||||
|
"account": user.map(|u| u.to_json(&*conn)),
|
||||||
|
"page": page.page,
|
||||||
|
"n_pages": Page::total(Post::count_local(&*conn) as i32),
|
||||||
|
"articles": articles.into_iter().map(|p| p.to_json(&*conn)).collect::<Vec<serde_json::Value>>()
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
#[get("/admin")]
|
#[get("/admin")]
|
||||||
fn admin(conn: DbConn, admin: Admin) -> Template {
|
fn admin(conn: DbConn, admin: Admin) -> Template {
|
||||||
Template::render("instance/admin", json!({
|
Template::render("instance/admin", json!({
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
{% extends "base" %}
|
||||||
|
{% import "macros" as macros %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{{ "All the articles of the Fediverse" | _ }}
|
||||||
|
{% endblock title %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1>{{ "All the articles of the Fediverse" | _ }}</h1>
|
||||||
|
|
||||||
|
<div class="cards">
|
||||||
|
{% for article in articles %}
|
||||||
|
{{ macros::post_card(article=article) }}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{{ macros::paginate(page=page, total=n_pages) }}
|
||||||
|
{% endblock content %}
|
Loading…
Reference in New Issue