Instance about page

Fixes #39
This commit is contained in:
Bat 2018-09-01 17:39:40 +01:00
parent b66e8942a9
commit 092ad5b795
12 changed files with 207 additions and 9 deletions

View File

@ -72,6 +72,14 @@ impl Instance {
.len() > 0 .len() > 0
} }
pub fn main_admin(&self, conn: &PgConnection) -> User {
users::table.filter(users::instance_id.eq(self.id))
.filter(users::is_admin.eq(true))
.limit(1)
.get_result::<User>(conn)
.expect("Couldn't load admins")
}
pub fn compute_box(&self, prefix: &'static str, name: String, box_name: &'static str) -> String { pub fn compute_box(&self, prefix: &'static str, name: String, box_name: &'static str) -> String {
ap_url(format!( ap_url(format!(
"{instance}/{prefix}/{name}/{box_name}", "{instance}/{prefix}/{name}/{box_name}",
@ -96,4 +104,8 @@ impl Instance {
)).get_result::<Instance>(conn) )).get_result::<Instance>(conn)
.expect("Couldn't update instance") .expect("Couldn't update instance")
} }
pub fn count(conn: &PgConnection) -> i64 {
instances::table.count().get_result(conn).expect("Couldn't count instances")
}
} }

View File

@ -438,5 +438,23 @@ msgstr "Artikel geschrieben haben"
msgid "Read the detailed rules" msgid "Read the detailed rules"
msgstr "Lies die detailierten Regeln" msgstr "Lies die detailierten Regeln"
#, fuzzy
msgid "Delete this article"
msgstr "Neueste Artikel"
msgid "And connected to"
msgstr ""
#, fuzzy
msgid "other instances"
msgstr "Über diese Instanz"
#, fuzzy
msgid "Administred by"
msgstr "Administration"
msgid "Runs Plume {{ version }}"
msgstr ""
#~ msgid "Your password should be at least 8 characters long" #~ msgid "Your password should be at least 8 characters long"
#~ msgstr "Das Passwort sollte mindestens 8 Zeichen lang sein" #~ msgstr "Das Passwort sollte mindestens 8 Zeichen lang sein"

View File

@ -430,3 +430,18 @@ msgstr ""
msgid "Read the detailed rules" msgid "Read the detailed rules"
msgstr "" msgstr ""
msgid "Delete this article"
msgstr ""
msgid "And connected to"
msgstr ""
msgid "other instances"
msgstr ""
msgid "Administred by"
msgstr ""
msgid "Runs Plume {{ version }}"
msgstr ""

View File

@ -256,7 +256,8 @@ msgid "You need to be logged in order to edit your profile"
msgstr "Vous devez vous connecter pour modifier votre profil" msgstr "Vous devez vous connecter pour modifier votre profil"
msgid "By {{ link_1 }}{{ link_2 }}{{ link_3 }}{{ name | escape }}{{ link_4 }}" msgid "By {{ link_1 }}{{ link_2 }}{{ link_3 }}{{ name | escape }}{{ link_4 }}"
msgstr "Par {{ link_1 }}{{ link_2 }}{{ link_3 }}{{ name | escape }}{{ link_4 }}" msgstr ""
"Par {{ link_1 }}{{ link_2 }}{{ link_3 }}{{ name | escape }}{{ link_4 }}"
msgid "{{ data }} reshared your article" msgid "{{ data }} reshared your article"
msgstr "{{ data }} a repartagé votre article" msgstr "{{ data }} a repartagé votre article"
@ -407,14 +408,16 @@ msgid "Plume is a decentralized blogging engine."
msgstr "Plume est un moteur de blog décentralisé." msgstr "Plume est un moteur de blog décentralisé."
msgid "Authors can manage various blogs from an unique website." msgid "Authors can manage various blogs from an unique website."
msgstr "Les auteur⋅ice⋅s peuvent gérer différents blogs au sein d'un même site." msgstr ""
"Les auteur⋅ice⋅s peuvent gérer différents blogs au sein d'un même site."
msgid "" msgid ""
"Articles are also visible on other Plume websites, and you can interact with " "Articles are also visible on other Plume websites, and you can interact with "
"them directly from other platforms like Mastodon." "them directly from other platforms like Mastodon."
msgstr "" msgstr ""
"Les articles sont également visibles sur d'autres sites Plume, et vous pouvez " "Les articles sont également visibles sur d'autres sites Plume, et vous "
"interagir avec directement depuis d'autres plateformes telles que Mastodon." "pouvez interagir avec directement depuis d'autres plateformes telles que "
"Mastodon."
msgid "Create your account" msgid "Create your account"
msgstr "Créer votre compte" msgstr "Créer votre compte"
@ -437,5 +440,23 @@ msgstr "articles"
msgid "Read the detailed rules" msgid "Read the detailed rules"
msgstr "Lire les règles détaillées" msgstr "Lire les règles détaillées"
#, fuzzy
msgid "Delete this article"
msgstr "Derniers articles"
msgid "And connected to"
msgstr ""
#, fuzzy
msgid "other instances"
msgstr "À propos de cette instance"
#, fuzzy
msgid "Administred by"
msgstr "Administration"
msgid "Runs Plume {{ version }}"
msgstr ""
#~ msgid "Your password should be at least 8 characters long" #~ msgid "Your password should be at least 8 characters long"
#~ msgstr "Votre mot de passe doit faire au moins 8 caractères." #~ msgstr "Votre mot de passe doit faire au moins 8 caractères."

View File

@ -68,7 +68,8 @@ msgstr "Notificacións"
msgid "" msgid ""
"Written by {{ link_1 }}{{ url }}{{ link_2 }}{{ name | escape }}{{ link_3 }}" "Written by {{ link_1 }}{{ url }}{{ link_2 }}{{ name | escape }}{{ link_3 }}"
msgstr "Escrito por {{ link_1 }}{{ url }}{{ link_2 }}{{ name | escape }}{{ link_3 }}" msgstr ""
"Escrito por {{ link_1 }}{{ url }}{{ link_2 }}{{ name | escape }}{{ link_3 }}"
msgid "This article is under the {{ license }} license." msgid "This article is under the {{ license }} license."
msgstr "Este artigo ten licenza {{ license }}" msgstr "Este artigo ten licenza {{ license }}"
@ -251,7 +252,8 @@ msgid "You need to be logged in order to edit your profile"
msgstr "Debe estar conectada para editar o seu perfil" msgstr "Debe estar conectada para editar o seu perfil"
msgid "By {{ link_1 }}{{ link_2 }}{{ link_3 }}{{ name | escape }}{{ link_4 }}" msgid "By {{ link_1 }}{{ link_2 }}{{ link_3 }}{{ name | escape }}{{ link_4 }}"
msgstr "Por {{ link_1 }}{{ link_2 }}{{ link_3 }}{{ name | escape }}{{ link_4 }}" msgstr ""
"Por {{ link_1 }}{{ link_2 }}{{ link_3 }}{{ name | escape }}{{ link_4 }}"
msgid "{{ data }} reshared your article" msgid "{{ data }} reshared your article"
msgstr "{{ data }} comparteu o seu artigo" msgstr "{{ data }} comparteu o seu artigo"
@ -322,7 +324,9 @@ msgstr[0] "Unha autora en este blog: "
msgstr[1] "{{ count }} autoras en este blog: " msgstr[1] "{{ count }} autoras en este blog: "
msgid "Login or use your Fediverse account to interact with this article" msgid "Login or use your Fediverse account to interact with this article"
msgstr "Conéctese ou utilice a súa conta no fediverso para interactuar con este artigo" msgstr ""
"Conéctese ou utilice a súa conta no fediverso para interactuar con este "
"artigo"
msgid "Optional" msgid "Optional"
msgstr "Opcional" msgstr "Opcional"
@ -401,8 +405,9 @@ msgstr "As autoras poden xestionar varios blogs desde un único sitio web."
msgid "" msgid ""
"Articles are also visible on other Plume websites, and you can interact with " "Articles are also visible on other Plume websites, and you can interact with "
"them directly from other platforms like Mastodon." "them directly from other platforms like Mastodon."
msgstr "Os artigos son visibles tamén en outros sitios Plume, e pode interactuar con" msgstr ""
"eles desde outras plataformas como Mastadon." "Os artigos son visibles tamén en outros sitios Plume, e pode interactuar "
"coneles desde outras plataformas como Mastadon."
msgid "Create your account" msgid "Create your account"
msgstr "Cree a súa conta" msgstr "Cree a súa conta"
@ -424,3 +429,21 @@ msgstr "artigos"
msgid "Read the detailed rules" msgid "Read the detailed rules"
msgstr "Lea o detalle das normas" msgstr "Lea o detalle das normas"
#, fuzzy
msgid "Delete this article"
msgstr "Últimos artigos"
msgid "And connected to"
msgstr ""
#, fuzzy
msgid "other instances"
msgstr "Sobre esta instancia"
#, fuzzy
msgid "Administred by"
msgstr "Administración"
msgid "Runs Plume {{ version }}"
msgstr ""

View File

@ -433,5 +433,23 @@ msgstr "artikler"
msgid "Read the detailed rules" msgid "Read the detailed rules"
msgstr "Les reglene" msgstr "Les reglene"
#, fuzzy
msgid "Delete this article"
msgstr "Siste artikler"
msgid "And connected to"
msgstr ""
#, fuzzy
msgid "other instances"
msgstr "Om denne instansen"
#, fuzzy
msgid "Administred by"
msgstr "Administrasjon"
msgid "Runs Plume {{ version }}"
msgstr ""
#~ msgid "Your password should be at least 8 characters long" #~ msgid "Your password should be at least 8 characters long"
#~ msgstr "Passordet ditt må bestå av minst åtte tegn" #~ msgstr "Passordet ditt må bestå av minst åtte tegn"

View File

@ -444,6 +444,24 @@ msgstr "artykuły"
msgid "Read the detailed rules" msgid "Read the detailed rules"
msgstr "Przeczytaj szczegółowe zasady" msgstr "Przeczytaj szczegółowe zasady"
#, fuzzy
msgid "Delete this article"
msgstr "Najnowsze artykuły"
msgid "And connected to"
msgstr ""
#, fuzzy
msgid "other instances"
msgstr "O tej instancji"
#, fuzzy
msgid "Administred by"
msgstr "Administracja"
msgid "Runs Plume {{ version }}"
msgstr ""
#~ msgid "Your password should be at least 8 characters long" #~ msgid "Your password should be at least 8 characters long"
#~ msgstr "Twoje hasło musi składać się przynajmniej z 8 znaków" #~ msgstr "Twoje hasło musi składać się przynajmniej z 8 znaków"

View File

@ -423,3 +423,15 @@ msgstr ""
msgid "Delete this article" msgid "Delete this article"
msgstr "" msgstr ""
msgid "And connected to"
msgstr ""
msgid "other instances"
msgstr ""
msgid "Administred by"
msgstr ""
msgid "Runs Plume {{ version }}"
msgstr ""

View File

@ -54,6 +54,7 @@ fn main() {
routes::instance::update_settings, routes::instance::update_settings,
routes::instance::shared_inbox, routes::instance::shared_inbox,
routes::instance::nodeinfo, routes::instance::nodeinfo,
routes::instance::about,
routes::likes::create, routes::likes::create,
routes::likes::create_auth, routes::likes::create_auth,

View File

@ -123,3 +123,16 @@ fn nodeinfo(conn: DbConn) -> Json<serde_json::Value> {
"metadata": {} "metadata": {}
})) }))
} }
#[get("/about")]
fn about(user: User, conn: DbConn) -> Template {
Template::render("instance/about", json!({
"account": user,
"instance": Instance::get_local(&*conn),
"admin": Instance::get_local(&*conn).map(|i| i.main_admin(&*conn).to_json(&*conn)),
"version": "0.1.0",
"n_users": User::count_local(&*conn),
"n_articles": Post::count_local(&*conn),
"n_instances": Instance::count(&*conn) - 1
}))
}

View File

@ -42,6 +42,13 @@ small {
margin: 4rem 0; margin: 4rem 0;
} }
.banner {
background: #DADADA;
padding-top: 2em;
padding-bottom: 1em;
margin: 3em 0px;
}
/* /*
* == Header == * == Header ==
*/ */

View File

@ -0,0 +1,40 @@
{% extends "base" %}
{% import "macros" as macros %}
{% block title %}
About {{ instance.name }}
{% endblock title %}
{% block content %}
<h1>{{ "About {{ instance_name }}" | _(instance_name=instance.name) }}</h1>
<section>
{{ instance.short_description_html | safe }}
</section>
<div class="banner">
<section class="stats">
<div>
<p>{{ "Home to" | _ }}</p>
<em>{{ n_users }}</em>
<p>{{ "people" | _ }}</p>
</div>
<div>
<p>{{ "Who wrote" | _ }}</p>
<em>{{ n_articles }}</em>
<p>{{ "articles" | _ }}</p>
</div>
<div>
<p>{{ "And connected to" | _ }}</p>
<em>{{ n_instances }}</em>
<p>{{ "other instances" | _ }}</p>
</div>
<div>
<p>{{ "Administred by" | _ }}</p>
<p><a href="/@/{{ admin.fqn }}">{{ admin.name }}</a><small>(@{{ admin.fqn }})</small></p>
</div>
</section>
<p>{{ "Runs Plume {{ version }}" | _(version=version) }}
</div>
<section>
{{ instance.long_description_html | safe }}
</section>
{% endblock content %}