From 79e88cb2f44ef74d1412e84ed648849958132ed1 Mon Sep 17 00:00:00 2001 From: Fries Date: Mon, 3 Jul 2023 23:59:56 -0700 Subject: [PATCH] add a WIP index page --- LICENSE | 64 ++++++++++++++++++++++---------------------- public/style.css | 5 ++++ src/assets.rs | 7 +++++ src/routes.rs | 6 ++--- templates/index.html | 26 ++++++++++++++++++ 5 files changed, 73 insertions(+), 35 deletions(-) create mode 100644 templates/index.html diff --git a/LICENSE b/LICENSE index 0e259d4..98d0b28 100644 --- a/LICENSE +++ b/LICENSE @@ -2,14 +2,14 @@ Creative Commons Legal Code CC0 1.0 Universal - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. Statement of Purpose @@ -43,22 +43,22 @@ Related Rights"). Copyright and Related Rights include, but are not limited to, the following: i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; + communicate, and translate a Work; ii. moral rights retained by the original author(s) and/or performer(s); iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; + likeness depicted in a Work; iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; + subject to the limitations in paragraph 4(a), below; v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; + in a Work; vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. + world based on applicable law or treaty, and any national + implementations thereof. 2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, @@ -102,20 +102,20 @@ express Statement of Purpose. 4. Limitations and Disclaimers. a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. + surrendered, licensed or otherwise affected by this document. b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work. + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/public/style.css b/public/style.css index b1801cb..a1019a2 100644 --- a/public/style.css +++ b/public/style.css @@ -23,6 +23,11 @@ body { color: var(--text-color) } +a { + color: var(--link-color); + font-size: 22px; +} + p { font-size: 22px; } diff --git a/src/assets.rs b/src/assets.rs index 35ea3a0..83579a0 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -3,6 +3,7 @@ use std::borrow::Cow; use askama_rocket::Template; use rocket::http::Status; use rust_embed::RustEmbed; +use shared::names::Site; #[derive(RustEmbed)] #[folder = "public/"] @@ -23,6 +24,12 @@ pub struct ErrorTemplate<'a> { pub error_description: &'a str } +#[derive(Template)] +#[template(path = "index.html")] +pub struct IndexTemplate { + pub sites: Vec +} + #[derive(Responder)] pub struct ErrorTemplateResponder<'a> { template: ErrorTemplate<'a> diff --git a/src/routes.rs b/src/routes.rs index 5c4c95b..ae59684 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -1,5 +1,5 @@ use crate::{ - assets::ErrorTemplate, + assets::{ErrorTemplate, IndexTemplate}, links::{next_url, previous_url}, sites::get_global_names, }; @@ -23,8 +23,8 @@ pub struct JsonResponse { } #[get("/")] -pub fn index() -> &'static str { - "Like, this is a webring, meow!" +pub async fn index() -> IndexTemplate { + IndexTemplate { sites: get_global_names().await } } #[get("/previous?")] diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..71bb1a4 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,26 @@ + + + + + + + Meowy Webring + + + + +
+

Welcome

+

Sites

+ {% for site in sites %} + {% match site.name %} + {% when Some with (value) %} +

{{ value }}

+ {% when None %} +

{{ site.url }}

+ {% endmatch %} + {% endfor %} +
+ + +