WIP: blog
This commit is contained in:
parent
c6378ca77f
commit
4e24495b15
|
@ -284,8 +284,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
|
||||
dependencies = [
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"time 0.1.45",
|
||||
"wasm-bindgen",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
|
@ -345,7 +348,7 @@ dependencies = [
|
|||
"rand",
|
||||
"sha2",
|
||||
"subtle",
|
||||
"time",
|
||||
"time 0.3.19",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
|
@ -859,7 +862,7 @@ checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
|
|||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"wasi",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1348,7 +1351,7 @@ dependencies = [
|
|||
"static_assertions",
|
||||
"tap-reader",
|
||||
"thiserror",
|
||||
"time",
|
||||
"time 0.3.19",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"url",
|
||||
|
@ -1366,7 +1369,7 @@ dependencies = [
|
|||
"serde",
|
||||
"static_assertions",
|
||||
"thiserror",
|
||||
"time",
|
||||
"time 0.3.19",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1442,7 +1445,7 @@ checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"wasi",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
|
@ -2140,7 +2143,7 @@ dependencies = [
|
|||
"serde_json",
|
||||
"state",
|
||||
"tempfile",
|
||||
"time",
|
||||
"time 0.3.19",
|
||||
"tokio",
|
||||
"tokio-stream",
|
||||
"tokio-util",
|
||||
|
@ -2222,7 +2225,7 @@ dependencies = [
|
|||
"smallvec",
|
||||
"stable-pattern",
|
||||
"state",
|
||||
"time",
|
||||
"time 0.3.19",
|
||||
"tokio",
|
||||
"uncased",
|
||||
]
|
||||
|
@ -2432,6 +2435,7 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
|
|||
name = "site"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"listenbrainz",
|
||||
"mastodon-async",
|
||||
"reqwest",
|
||||
|
@ -2748,6 +2752,17 @@ dependencies = [
|
|||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi 0.10.0+wasi-snapshot-preview1",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.19"
|
||||
|
@ -3174,6 +3189,12 @@ dependencies = [
|
|||
"try-lock",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
|
|
|
@ -15,3 +15,4 @@ tokio = { version = "1", features = ["full"] }
|
|||
serde = { version = "1.0", features = ["derive"] }
|
||||
rocket_dyn_templates = { version = "0.1.0-rc.2", features = ["tera"] }
|
||||
listenbrainz = "0.7"
|
||||
chrono = "0.4.23"
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -33,10 +33,18 @@ create table articles (
|
|||
foreign key (post_id) references posts(id)
|
||||
);
|
||||
|
||||
create table text_formats (
|
||||
name varchar(16) not null primary key
|
||||
);
|
||||
|
||||
insert into text_formats (name) values ('plaintext'), ('markdown'), ('html');
|
||||
|
||||
create table notes (
|
||||
post_id integer not null,
|
||||
content text,
|
||||
foreign key (post_id) references posts(id)
|
||||
text_format varchar(16) not null default ('plaintext');
|
||||
text_content text,
|
||||
foreign key (post_id) references posts(id),
|
||||
foreign key (text_format) references text_formats(name)
|
||||
);
|
||||
|
||||
create table media_types (
|
||||
|
|
|
@ -3,11 +3,12 @@ use rocket::fs::{relative, FileServer};
|
|||
use rocket::http::Status;
|
||||
use rocket::State;
|
||||
use rocket::{Build, Request, Rocket};
|
||||
use rocket_db_pools::sqlx::{self, database};
|
||||
use rocket_db_pools::{Connection, Database};
|
||||
use rocket_db_pools::sqlx;
|
||||
use rocket_db_pools::Database;
|
||||
use rocket_dyn_templates::{context, Template};
|
||||
use std::borrow::Cow;
|
||||
|
||||
mod posts;
|
||||
mod scrobbles;
|
||||
mod skweets;
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use std::path::Path;
|
||||
|
||||
enum PostType {
|
||||
Article,
|
||||
Note,
|
||||
}
|
||||
|
||||
enum TextFormat {
|
||||
Markdown,
|
||||
Plaintext,
|
||||
Html,
|
||||
}
|
||||
|
||||
pub struct Post<T: Content> {
|
||||
id: i64,
|
||||
created_at: DateTime<Utc>,
|
||||
updated_at: Option<DateTime<Utc>>,
|
||||
post_type: PostType,
|
||||
media: Option<Vec<Box<Path>>>,
|
||||
content: Option<T>,
|
||||
tags: Vec<String>,
|
||||
}
|
||||
|
||||
pub trait Content {
|
||||
fn render(&self) -> String;
|
||||
}
|
||||
|
||||
// impl<T> Post<T> {
|
||||
// // renders as internal html (must sanitize)
|
||||
// fn new(type: PostType, ) -> Post<T> {
|
||||
// }
|
||||
// }
|
|
@ -0,0 +1 @@
|
|||
struct note
|
|
@ -51,7 +51,8 @@ a.active {
|
|||
color: #311f20;
|
||||
}
|
||||
|
||||
img, video {
|
||||
img,
|
||||
video {
|
||||
max-width: 100%;
|
||||
border: 4px solid #311f20;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue