summaryrefslogtreecommitdiff
path: root/src/pages.rs
blob: cc6c4e214448bda5f833b88d6b558e01ee4cd894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
use crate::layout::{DynScaffold, Scaffold};
use rocket::{
    get,
    http::{ContentType, Cookie, CookieJar},
    post,
    response::Redirect,
    uri,
};

#[get("/")]
pub fn r_root() -> Redirect {
    Redirect::to(uri!(r_about()))
}

#[get("/about")]
pub fn r_about() -> DynScaffold<'static> {
    Scaffold {
        title: "about".to_string(),
        content: markup::new! {
            p {
                "Hi. I am a normal person from planet earth. "
                "I enjoy starting projects and never finishing them. "
                "I am also supporting the free software movement by writing exclusively free software in my spare time. "
            }
            h2 { "current interests" }
            ul {
                li { "development of a general-purpose systems programming language" }
                li { "replacing existing software with rust rewrites and rocket emotes" }
                li { "stuff" }
            }
            h2 { "languages I know" }
            ul {
                li { "Rust" }
                li { "English" }
                li { "Haskell" }
                li { "German" }
                li { "Typescript" }
                li { "C" }
                li { "toki pona" }
                li { "Python" }
                li { "Nim, Zig, some French and others that I don't really care about" }
            }
        },
    }
}

#[get("/projects")]
pub fn r_projects() -> DynScaffold<'static> {
    Scaffold {
        title: "projects".to_string(),
        content: markup::new! {
            p { "I am starting a lot of projects - here are a few selected ones:" }
            ul {
                li {
                    b{"keks-meet:"} " a simple secure web conferencing application. "
                    "(" a[href="https://meet.metamuffin.org"]{"hosted"} "; " a[href="https://codeberg.org/metamuffin/keks-meet"]{"code"} ")"
                }
                li {
                    b{"gnix:"} " a stupid reverse proxy to replace nginx. serving the webpage you are viewing right now. "
                    "(" a[href="https://metamuffin.org"]{"hosted"} "; " a[href="https://codeberg.org/metamuffin/gnix"]{"code"} ")"
                }
                li {
                    b{"pfadfinder:"} " parallel anytime A* for openstreetmap with custom frontend and integration into the existing one. "
                    "(" a[href="https://codeberg.org/metamuffin/pfadfinder"]{"code"} ")"
                }
                li {
                    b{"video-codec-experiments:"} " a few attempts of creating my own video codecs, making use of motion compensation, dct, quantization and more. "
                    "(" a[href="https://codeberg.org/metamuffin/video-codec-experiments"]{"code"} ")"
                }
                li {
                    b{"pixelflut tools:"} " the programs I hacked together when playing pixelflut. includes GPU-acceleration for updating the canvas with minimal bandwidth usage. "
                    "(" a[href="https://codeberg.org/metamuffin/video-codec-experiments"]{"code"} ")"
                }
                li {
                    b{"karlender:"} " a personal calender suite consisting of a daemon, a graphical and a command-line user interface. "
                    "supports very flexible condition based recurring tasks and automatic scheduling so you dont need to decide. "
                    "(" a[href="https://codeberg.org/metamuffin/video-codec-experiments"]{"code"} ")"
                }
            }
        },
    }
}

#[get("/contact")]
pub fn r_contact() -> DynScaffold<'static> {
    Scaffold {
        title: "contact".to_string(),
        content: markup::new! {
            p { "You can reach out to me in a bunch of ways. I am also generally looking for nice software ideas to implement." }
            ul {
                li { "matrix: " a[href="https://matrix.to/#/@metamuffin:metamuffin.org"]{"@metamuffin:metamuffin.org"} }
                li { "fedi: " a[href="https://social.metamuffin.org/@metamuffin"]{"@metamuffin@social.metamuffin.org"} }
                li { "electronic mail: " a[href="mailto:metamuffin@disroot.org"]{"mailto:metamuffin@disroot.org"} }
                li { "telepathy: come on, just try hard enough" }
            }
        },
    }
}

#[get("/key.asc")]
pub fn r_pgp_key() -> &'static str {
    include_str!("../assets/key.asc")
}

#[get("/style.css")]
pub fn r_style() -> (ContentType, &'static str) {
    (ContentType::CSS, include_str!("../assets/style.css"))
}

#[post("/toggle_css")]
pub fn r_toggle_css(jar: &CookieJar) -> Redirect {
    let has_css = jar.get("css").map(|v| v.value() == "yes").unwrap_or(false);
    jar.add(
        Cookie::build("css", if has_css { "no" } else { "yes" })
            .permanent()
            .finish(),
    );
    Redirect::to(rocket::uri!(r_root()))
}