about summary refs log tree commit diff
path: root/kittybox-rs/templates/src/templates.rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2023-07-29 21:59:56 +0300
committerVika <vika@fireburn.ru>2023-07-29 21:59:56 +0300
commit0617663b249f9ca488e5de652108b17d67fbaf45 (patch)
tree11564b6c8fa37bf9203a0a4cc1c4e9cc088cb1a5 /kittybox-rs/templates/src/templates.rs
parent26c2b79f6a6380ae3224e9309b9f3352f5717bd7 (diff)
downloadkittybox-0617663b249f9ca488e5de652108b17d67fbaf45.tar.zst
Moved the entire Kittybox tree into the root
Diffstat (limited to 'kittybox-rs/templates/src/templates.rs')
-rw-r--r--kittybox-rs/templates/src/templates.rs168
1 files changed, 0 insertions, 168 deletions
diff --git a/kittybox-rs/templates/src/templates.rs b/kittybox-rs/templates/src/templates.rs
deleted file mode 100644
index 63c67c5..0000000
--- a/kittybox-rs/templates/src/templates.rs
+++ /dev/null
@@ -1,168 +0,0 @@
-use http::StatusCode;
-use kittybox_util::MicropubChannel;
-
-use crate::{Feed, VCard};
-
-markup::define! {
-    Template<'a>(title: &'a str, blog_name: &'a str, feeds: Vec<MicropubChannel>, user: Option<String>, content: String) {
-        @markup::doctype()
-        html {
-            head {
-                title { @title }
-                link[rel="preconnect", href="https://fonts.gstatic.com"];
-                link[rel="stylesheet", href="/.kittybox/static/style.css"];
-                meta[name="viewport", content="initial-scale=1, width=device-width"];
-
-                link[rel="micropub", href="/.kittybox/micropub"];
-                link[rel="micropub_media", href="/.kittybox/media"];
-                link[rel="indieauth_metadata", href="/.kittybox/indieauth/metadata"];
-                link[rel="webmention", href="/.kittybox/webmention"];
-                // legacy links for some dumb clients
-                link[rel="authorization_endpoint", href="/.kittybox/indieauth/auth"];
-                link[rel="token_endpoint", href="/.kittybox/indieauth/token"];
-                // LibreJS-compliant JS licensing info (because TypeScript is a bitch)
-                link[rel="jslicense", href="/.kittybox/static/jslicense.html"];
-                /*@if let Some(endpoints) = endpoints {
-                    @if let Some(webmention) = &endpoints.webmention {
-                        link[rel="webmention", href=&webmention];
-                    }
-                    @if let Some(microsub) = &endpoints.microsub {
-                        link[rel="microsub", href=&microsub];
-                    }
-                }*/
-            }
-            body {
-                a[href="#main_content", id="skip-to-content"] { "Skip to content" }
-                // TODO Somehow compress headerbar into a menu when the screen space is tight
-                nav #headerbar {
-                    ul {
-                        li { a #homepage[href="/"] { @blog_name } }
-                        @for feed in feeds.iter() {
-                            li { a[href=&feed.uid] { @feed.name } }
-                        }
-                        li.shiftright {
-                            @if user.is_none() {
-                                a #login[href="/login"] { "Sign in" }
-                            } else {
-                                span {
-                                    @user.as_ref().unwrap() " - " a #logout[href="/logout"] { "Sign out" }
-                                }
-                            }
-                        }
-                    }
-                }
-                main #main_content {
-                    @markup::raw(content)
-                }
-                footer {
-                    p {
-                        "Powered by " a[href="https://sr.ht/~vikanezrimaya/kittybox"] {
-                            "Kittybox"
-                        }
-                    }
-                }
-            }
-        }
-    }
-    MainPage<'a>(feed: &'a serde_json::Value, card: &'a serde_json::Value, cursor: Option<&'a str>, webring: bool) {
-        .sidebyside {
-            @VCard { card }
-            #dynamicstuff {
-                div {
-                    p { "This section will provide interesting statistics or tidbits about my life in this exact moment (with maybe a small delay)." }
-                    p { "It will probably require JavaScript to self-update, but I promise to keep this widget lightweight and open-source!" }
-                    p { small {
-                        "JavaScript isn't a menace, stop fearing it or I will switch to WebAssembly "
-                        "and knock your nico-nico-kneecaps so fast with its speed you won't even notice that... "
-                        small { "omae ha mou shindeiru" }
-                        @markup::raw("<!-- NANI?!!! -->")
-                    } }
-                }
-                @if *webring {
-                    #webring {
-                        a[href="https://xn--sr8hvo.ws/previous"] { "←" }
-                        " An "
-                        a[href="https://xn--sr8hvo.ws"] {
-                            "IndieWeb Webring"
-                        }
-                        " πŸ•ΈπŸ’ "
-                        a[href="https://xn--sr8hvo.ws/next"] { "β†’" }
-                    }
-                }
-            }
-        }
-        @Feed { feed, cursor: *cursor }
-    }
-    ErrorPage(code: StatusCode, msg: Option<String>) {
-        h1 { @format!("HTTP {code}") }
-        @match *code {
-            StatusCode::UNAUTHORIZED => {
-                p { "Looks like you need to authenticate yourself before seeing this page. Try logging in with IndieAuth using the Login button above!" }
-            }
-            StatusCode::FORBIDDEN => {
-                p { "Looks like you're forbidden from viewing this page." }
-                p {
-                    "This might've been caused by being banned from viewing my website"
-                    "or simply by trying to see what you're not supposed to see, "
-                    "like a private post that's not intended for you. It's ok, it happens."
-                }
-            }
-            StatusCode::GONE => {
-                p { "Looks like the page you're trying to find is gone and is never coming back." }
-            }
-            StatusCode::UNAVAILABLE_FOR_LEGAL_REASONS => {
-            p { "The page is there, but I can't legally provide it to you because the censorship said so." }
-            }
-            StatusCode::NOT_FOUND => {
-                p { "Looks like there's no such page. Maybe you or someone else mistyped a URL or my database experienced data loss." }
-            }
-            StatusCode::IM_A_TEAPOT => {
-                p { "Wait, do you seriously expect my website to brew you coffee? It's not a coffee machine!" }
-
-                p {
-                    small {
-                        "I could brew you some coffee tho if we meet one day... "
-                        small {
-                            i {
-                                "i-it's nothing personal, I just like brewing coffee, b-baka!!!~ >.<!"
-                            }
-                        }
-                    }
-                }
-            }
-            StatusCode::BAD_REQUEST => {
-                @match msg {
-                    None => {
-                        p {
-                            "There was an undescribed error in your request. "
-                            "Please try again later or with a different request."
-                        }
-                    }
-                    Some(msg) => {
-                        p {
-                            "There was a following error in your request:"
-                        }
-                        blockquote { pre { @msg } }
-                    }
-                }
-            }
-            StatusCode::INTERNAL_SERVER_ERROR => {
-                @match msg {
-                    None => {
-                        p { "It seems like you have found an error. Not to worry, it has already been logged." }
-                    }
-                    Some(msg) => {
-                        p { "The server encountered an error while processing your request:" }
-                        blockquote { @msg }
-                        p { "Don't worry, it has already been logged." }
-                    }
-                }
-            }
-            _ => {
-                p { "It seems like you have found an error. Not to worry, it has already been logged." }
-            }
-        }
-        P { "For now, may I suggest to visit " a[href="/"] {"the main page"} " of this website?" }
-
-    }
-}