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"
|
checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
|
"js-sys",
|
||||||
"num-integer",
|
"num-integer",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
"time 0.1.45",
|
||||||
|
"wasm-bindgen",
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -345,7 +348,7 @@ dependencies = [
|
||||||
"rand",
|
"rand",
|
||||||
"sha2",
|
"sha2",
|
||||||
"subtle",
|
"subtle",
|
||||||
"time",
|
"time 0.3.19",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -859,7 +862,7 @@ checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"libc",
|
"libc",
|
||||||
"wasi",
|
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1348,7 +1351,7 @@ dependencies = [
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
"tap-reader",
|
"tap-reader",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time",
|
"time 0.3.19",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
"url",
|
"url",
|
||||||
|
@ -1366,7 +1369,7 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"static_assertions",
|
"static_assertions",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"time",
|
"time 0.3.19",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1442,7 +1445,7 @@ checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"wasi",
|
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||||
"windows-sys 0.45.0",
|
"windows-sys 0.45.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2140,7 +2143,7 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"state",
|
"state",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"time",
|
"time 0.3.19",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-stream",
|
"tokio-stream",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
|
@ -2222,7 +2225,7 @@ dependencies = [
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"stable-pattern",
|
"stable-pattern",
|
||||||
"state",
|
"state",
|
||||||
"time",
|
"time 0.3.19",
|
||||||
"tokio",
|
"tokio",
|
||||||
"uncased",
|
"uncased",
|
||||||
]
|
]
|
||||||
|
@ -2432,6 +2435,7 @@ checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
|
||||||
name = "site"
|
name = "site"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"chrono",
|
||||||
"listenbrainz",
|
"listenbrainz",
|
||||||
"mastodon-async",
|
"mastodon-async",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
@ -2748,6 +2752,17 @@ dependencies = [
|
||||||
"once_cell",
|
"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]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.19"
|
version = "0.3.19"
|
||||||
|
@ -3174,6 +3189,12 @@ dependencies = [
|
||||||
"try-lock",
|
"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]]
|
[[package]]
|
||||||
name = "wasi"
|
name = "wasi"
|
||||||
version = "0.11.0+wasi-snapshot-preview1"
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
|
|
@ -15,3 +15,4 @@ tokio = { version = "1", features = ["full"] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
rocket_dyn_templates = { version = "0.1.0-rc.2", features = ["tera"] }
|
rocket_dyn_templates = { version = "0.1.0-rc.2", features = ["tera"] }
|
||||||
listenbrainz = "0.7"
|
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)
|
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 (
|
create table notes (
|
||||||
post_id integer not null,
|
post_id integer not null,
|
||||||
content text,
|
text_format varchar(16) not null default ('plaintext');
|
||||||
foreign key (post_id) references posts(id)
|
text_content text,
|
||||||
|
foreign key (post_id) references posts(id),
|
||||||
|
foreign key (text_format) references text_formats(name)
|
||||||
);
|
);
|
||||||
|
|
||||||
create table media_types (
|
create table media_types (
|
||||||
|
@ -58,4 +66,4 @@ create table notes_media (
|
||||||
foreign key (note_id) references notes(note_id),
|
foreign key (note_id) references notes(note_id),
|
||||||
foreign key (media_id) references media(id),
|
foreign key (media_id) references media(id),
|
||||||
primary key (note_id, media_id)
|
primary key (note_id, media_id)
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,11 +3,12 @@ use rocket::fs::{relative, FileServer};
|
||||||
use rocket::http::Status;
|
use rocket::http::Status;
|
||||||
use rocket::State;
|
use rocket::State;
|
||||||
use rocket::{Build, Request, Rocket};
|
use rocket::{Build, Request, Rocket};
|
||||||
use rocket_db_pools::sqlx::{self, database};
|
use rocket_db_pools::sqlx;
|
||||||
use rocket_db_pools::{Connection, Database};
|
use rocket_db_pools::Database;
|
||||||
use rocket_dyn_templates::{context, Template};
|
use rocket_dyn_templates::{context, Template};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
|
mod posts;
|
||||||
mod scrobbles;
|
mod scrobbles;
|
||||||
mod skweets;
|
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;
|
color: #311f20;
|
||||||
}
|
}
|
||||||
|
|
||||||
img, video {
|
img,
|
||||||
|
video {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
border: 4px solid #311f20;
|
border: 4px solid #311f20;
|
||||||
}
|
}
|
||||||
|
@ -388,4 +389,4 @@ iframe {
|
||||||
-webkit-transform: scaleX(-1);
|
-webkit-transform: scaleX(-1);
|
||||||
transform: scaleX(-1);
|
transform: scaleX(-1);
|
||||||
z-index: 4;
|
z-index: 4;
|
||||||
}
|
}
|
Loading…
Reference in New Issue