✨ finish blog
✨ add first blog entry 🎨 rework ui+ux ✨ add freemono
This commit is contained in:
@@ -1,58 +1,48 @@
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct Author {
|
||||
pub id: u8,
|
||||
pub image_url: String,
|
||||
pub name: String,
|
||||
pub keywords: Vec<String>,
|
||||
pub about: String,
|
||||
pub image_url: &'static str,
|
||||
pub name: &'static str,
|
||||
pub keywords: &'static [&'static str],
|
||||
pub about: &'static str,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub struct Post {
|
||||
pub id: u8,
|
||||
pub authors: &'static [u8],
|
||||
pub title: &'static str,
|
||||
pub utcdate: &'static str,
|
||||
pub content: &'static str,
|
||||
}
|
||||
|
||||
impl BlogEntry for Author {
|
||||
fn from_entry(entry: &mut Entry) -> Self {
|
||||
match entry.id {
|
||||
0 => Self {
|
||||
id: entry.id,
|
||||
image_url: "profile.avif".to_string(),
|
||||
name: "iouring".to_string(),
|
||||
keywords: vec!["meow".to_string(), "mrrp".to_string(), "mew".to_string()],
|
||||
about: "sup".to_string(),
|
||||
},
|
||||
_ => Self {
|
||||
*Self::AUTHORS
|
||||
.get(entry.id as usize)
|
||||
.cloned()
|
||||
.unwrap_or(&Self {
|
||||
id: u8::MAX,
|
||||
image_url: "".to_string(),
|
||||
name: "not found".to_string(),
|
||||
keywords: vec![],
|
||||
about: "".to_string(),
|
||||
},
|
||||
}
|
||||
image_url: "",
|
||||
name: "not found",
|
||||
keywords: [].as_slice(),
|
||||
about: "",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct Post {
|
||||
pub id: u8,
|
||||
pub author: Author,
|
||||
pub title: String,
|
||||
pub content: Vec<String>,
|
||||
}
|
||||
impl BlogEntry for Post {
|
||||
fn from_entry(entry: &mut Entry) -> Self {
|
||||
return match entry.id {
|
||||
0 => Self {
|
||||
id: 0,
|
||||
author: Author::from_id(0),
|
||||
title: "meow".parse().unwrap(),
|
||||
content: vec!["<h1>meow</h1>", "mrrp", "meow"]
|
||||
.iter()
|
||||
.map(|s| s.to_string())
|
||||
.collect(),
|
||||
},
|
||||
_ => Self {
|
||||
*Self::POSTS
|
||||
.get(entry.id as usize)
|
||||
.cloned()
|
||||
.unwrap_or(&Self {
|
||||
id: u8::MAX,
|
||||
author: Author::from_id(u8::MAX),
|
||||
title: "not found".parse().unwrap(),
|
||||
content: vec![],
|
||||
},
|
||||
};
|
||||
authors: &[u8::MAX],
|
||||
title: "not found",
|
||||
utcdate: "1970-01-01",
|
||||
content: "",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,10 +55,170 @@ impl Entry {
|
||||
Self { id: seed }
|
||||
}
|
||||
}
|
||||
|
||||
pub trait BlogEntry: Sized {
|
||||
fn from_entry(entry: &mut Entry) -> Self;
|
||||
fn from_id(id: u8) -> Self {
|
||||
Self::from_entry(&mut Entry::from_id(id))
|
||||
}
|
||||
|
||||
const AUTHORS: [&'static Author; 2] = [
|
||||
&Author {
|
||||
id: 0,
|
||||
image_url: "profile.avif",
|
||||
name: "lia",
|
||||
keywords: &[
|
||||
"certified catgirl™",
|
||||
"software engineer",
|
||||
"professional yapper",
|
||||
"neurospicy and disabled"
|
||||
],
|
||||
about: "",
|
||||
},
|
||||
&Author {
|
||||
id: 1,
|
||||
image_url: "",
|
||||
name: "mreowww",
|
||||
keywords: &["meow", "mrrp", "mew"],
|
||||
about: "",
|
||||
},
|
||||
];
|
||||
|
||||
const POSTS: [&'static Post; 1] = [
|
||||
/*&Post {
|
||||
id: 0,
|
||||
authors: &[0],
|
||||
title: "sweet little poison",
|
||||
utcdate: "1970-01-01",
|
||||
content: r#"
|
||||
### this will be a future write-up how i set up iocaine with caddy and docker.
|
||||
### here's my docker-compose.yml:
|
||||
|
||||
```yml
|
||||
services:
|
||||
caddy:
|
||||
image: caddy:alpine
|
||||
container_name: proxy.caddy
|
||||
hostname: proxy.caddy
|
||||
restart: unless-stopped
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "443:443/udp"
|
||||
networks:
|
||||
- nginx
|
||||
volumes:
|
||||
- ./socks:/run/iocaine:ro
|
||||
- ./nginx/pages:/var/www/html
|
||||
- ./caddy/data:/data
|
||||
- ./caddy/config:/config
|
||||
- ./caddy/proxy:/etc/caddy/Caddyfile:ro
|
||||
depends_on:
|
||||
- iocaine
|
||||
iocaine:
|
||||
image: git.madhouse-project.org/iocaine/iocaine:2
|
||||
container_name: proxy.iocaine
|
||||
hostname: proxy.iocaine
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "42069:42069"
|
||||
networks:
|
||||
- nginx
|
||||
volumes:
|
||||
- ./iocaine:/data
|
||||
- ./socks:/run/iocaine:rw
|
||||
# - iocainesocket:/run/iocaine/waow.socket:rw
|
||||
environment:
|
||||
# - IOCAINE__SERVER__BIND="0.0.0.0:42069"
|
||||
- IOCAINE__SERVER__BIND="/run/iocaine/waow.socket"
|
||||
- IOCAINE__SERVER__UNIX_LISTEN_ACCESS="everybody"
|
||||
- IOCAINE__SERVER__REQUEST_HANDLER__PATH="/data"
|
||||
- IOCAINE__SERVER__REQUEST_HANDLER__LANGUAGE="roto"
|
||||
- IOCAINE__SERVER__CONTROL__BIND="/run/iocaine/listen.socket"
|
||||
- IOCAINE__SERVER__CONTROL__UNIX_LISTEN_ACCESS="owner"
|
||||
- IOCAINE__SOURCES__WORDS="/data/words.txt"
|
||||
- IOCAINE__SOURCES__MARKOV=["/data/1984.txt", "/data/brave-new-world.txt"]
|
||||
- IOCAINE__METRICS__ENABLE=false
|
||||
command: --config-file /data/config.toml
|
||||
networks:
|
||||
nginx:
|
||||
external: true
|
||||
```
|
||||
|
||||
### my file-tree:
|
||||
|
||||
```sh
|
||||
services/proxy » tree iocaine
|
||||
iocaine
|
||||
├── 1984.txt
|
||||
├── brave-new-world.txt
|
||||
├── nam_shub_of_enki
|
||||
│ ├── classify
|
||||
│ │ └── mod.roto
|
||||
│ ├── config.roto
|
||||
│ ├── detect
|
||||
│ │ └── mod.roto
|
||||
│ ├── mod.roto
|
||||
│ └── tests
|
||||
│ └── mod.roto
|
||||
├── nam-shub-of-enki-20250711.0.tar.zst
|
||||
├── nam-shub-of-enki-latest.tar.zst
|
||||
├── pkg.roto
|
||||
├── robots.json
|
||||
└── words.txt
|
||||
```
|
||||
|
||||
### and my caddy-snippet with example:
|
||||
|
||||
|
||||
```txt
|
||||
(iocaine) {
|
||||
@read method GET HEAD
|
||||
@not-read not {
|
||||
method GET HEAD
|
||||
}
|
||||
reverse_proxy @read unix//run/iocaine/waow.socket {
|
||||
#reverse_proxy @read proxy.iocaine:42069 {
|
||||
@fallback status 421
|
||||
handle_response @fallback {
|
||||
{blocks.handler}
|
||||
}
|
||||
}
|
||||
handle @not-read {
|
||||
{blocks.default}
|
||||
}
|
||||
}
|
||||
|
||||
example.com {
|
||||
import iocaine {
|
||||
handler {
|
||||
reverse_proxy http://example:8080
|
||||
}
|
||||
default {
|
||||
respond 405
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
"#,
|
||||
},
|
||||
*/&Post {
|
||||
id: 0,
|
||||
authors: &[0],
|
||||
title: "haj, world!",
|
||||
utcdate: "2025-08-24",
|
||||
content: r#"
|
||||
### my first blogpost
|
||||
haj! and welcome to my first blogpost.
|
||||
this blogpost won't have that much content.
|
||||
fun fact: this post generates html from markdown :3
|
||||
so i can include images, formatted text, code and content much easier.
|
||||
i also added a too overcomplicated blog backend that allows authors and posts by u8::MAX, cause why not.
|
||||
won't post that much either way, so why bother with higher values. /srs
|
||||
nonetheless... have a great day, evening, whatever daytime it's for you rn and stay safe. ♡s
|
||||
"#,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user