From 26fc263cd4fabc631a759d958023025390bf1a26 Mon Sep 17 00:00:00 2001 From: Magnus Hoff Date: Tue, 7 Nov 2017 15:50:00 +0100 Subject: [PATCH] Reword about page. Add list of dependencies and licenses --- src/resources/about_resource.rs | 58 +++++++++++++++++++++++++++++++-- templates/about.html | 29 ++++++++++++++--- 2 files changed, 79 insertions(+), 8 deletions(-) diff --git a/src/resources/about_resource.rs b/src/resources/about_resource.rs index 83d11fb..5aae35f 100644 --- a/src/resources/about_resource.rs +++ b/src/resources/about_resource.rs @@ -15,11 +15,61 @@ impl AboutResource { } } +enum License { + Bsd3Clause, + Gpl3, + Mit, + Mpl2, + Ofl11, +} + +impl License { + fn link(&self) -> &'static str { + use self::License::*; + match self { + &Bsd3Clause => "bsd-3-clause", + &Gpl3 => "gpl3", + &Mit => "mit", + &Mpl2 => "mpl2", + &Ofl11 => "sil-ofl-1.1", + } + } + + fn name(&self) -> &'static str { + use self::License::*; + match self { + &Bsd3Clause => "BSD-3-Clause", + &Gpl3 => "GPL3", + &Mit => "MIT", + &Mpl2 => "MPL2", + &Ofl11 => "OFL-1.1", + } + } +} + +struct Dependency { + name: &'static str, + copyright: &'static str, + license: License, +} + +lazy_static! { + static ref DEPS: &'static [Dependency] = &[ + Dependency { + name: "Amatic SC", + copyright: "Copyright 2015 The Amatic SC Project Authors (contact@sansoxygen.com)", + license: License::Ofl11, + }, + ]; +} + #[derive(BartDisplay)] #[template="templates/about.html"] -struct Template; +struct Template<'a> { + deps: &'a [Dependency] +} -impl Template { +impl<'a> Template<'a> { fn pkg_version(&self) -> &str { env!("CARGO_PKG_VERSION") } } @@ -45,7 +95,9 @@ impl Resource for AboutResource { .with_body(Layout { base: None, // Hmm, should perhaps accept `base` as argument title: "About Sausagewiki", - body: &Template, + body: &Template { + deps: &*DEPS + }, }.to_string())) })) } diff --git a/templates/about.html b/templates/about.html index a04634b..c382de0 100644 --- a/templates/about.html +++ b/templates/about.html @@ -4,9 +4,9 @@
-

This site is running version {{pkg_version()}} of Sausagewiki.

-

Sausagewiki is a simple, self-contained wiki engine.

-

Copyright © 2017 Magnus Hovland Hoff

+

This site is running version {{pkg_version()}} of Sausagewiki, a simple, +self-contained wiki engine.

+

Copyright © 2017 Magnus Hovland Hoff.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -14,11 +14,30 @@ Foundation, either version 3 of the License, or (at your option) any later version.

-

See also the full license text.

+

+See also the full license text and the +project home page. +

-Project home page +A huge thanks to Rust and +SQLite. Without these amazing projects, +Sausagewiki would never have materialized.

+ +

+Sausagewiki builds on a number of projects, copyright by their respective +copyright holders and distributed under various licenses: +

+ + + + +{{#deps}} + +{{/deps}} + +
ProjectCopyright noticeLicense
{{.name}}{{.copyright}}{{.license.name()}}