aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2023-05-30 21:48:26 +0100
committerLibravatar cel 🌸 <cel@blos.sm>2023-05-30 21:48:26 +0100
commit4e24495b159df0dbc4f503843c08ccd452af616a (patch)
tree9834c93fe714713b5305dbb46561d8e7154c142a
parentc6378ca77f08a8aaf30fa25c4c02d151bf69edfa (diff)
downloadblossom-4e24495b159df0dbc4f503843c08ccd452af616a.tar.gz
blossom-4e24495b159df0dbc4f503843c08ccd452af616a.tar.bz2
blossom-4e24495b159df0dbc4f503843c08ccd452af616a.zip
WIP: blog
Diffstat (limited to '')
-rw-r--r--Cargo.lock35
-rw-r--r--Cargo.toml1
-rw-r--r--db/blossom.sqlitebin0 -> 4096 bytes
-rw-r--r--db/blossom.sqlite-shmbin0 -> 32768 bytes
-rw-r--r--db/blossom.sqlite-walbin0 -> 86552 bytes
-rw-r--r--migrations/20230218162011_blossom.sql14
-rw-r--r--src/main.rs5
-rw-r--r--src/posts/mod.rs33
-rw-r--r--src/posts/note.rs1
-rw-r--r--static/style.css5
10 files changed, 80 insertions, 14 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 8c72e2f..07a19f9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -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",
@@ -2750,6 +2754,17 @@ dependencies = [
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53250a3b3fed8ff8fd988587d8925d26a83ac3845d9e03b220b37f34c2b8d6c2"
@@ -3176,6 +3191,12 @@ dependencies = [
[[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"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
diff --git a/Cargo.toml b/Cargo.toml
index 417dd4a..37d5e82 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -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"
diff --git a/db/blossom.sqlite b/db/blossom.sqlite
new file mode 100644
index 0000000..3d1e885
--- /dev/null
+++ b/db/blossom.sqlite
Binary files differ
diff --git a/db/blossom.sqlite-shm b/db/blossom.sqlite-shm
new file mode 100644
index 0000000..a276541
--- /dev/null
+++ b/db/blossom.sqlite-shm
Binary files differ
diff --git a/db/blossom.sqlite-wal b/db/blossom.sqlite-wal
new file mode 100644
index 0000000..9b36685
--- /dev/null
+++ b/db/blossom.sqlite-wal
Binary files differ
diff --git a/migrations/20230218162011_blossom.sql b/migrations/20230218162011_blossom.sql
index 188bbf8..c8ed09d 100644
--- a/migrations/20230218162011_blossom.sql
+++ b/migrations/20230218162011_blossom.sql
@@ -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 (
@@ -58,4 +66,4 @@ create table notes_media (
foreign key (note_id) references notes(note_id),
foreign key (media_id) references media(id),
primary key (note_id, media_id)
-); \ No newline at end of file
+);
diff --git a/src/main.rs b/src/main.rs
index 8ad4bf4..833a7ae 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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;
diff --git a/src/posts/mod.rs b/src/posts/mod.rs
index e69de29..b0c3749 100644
--- a/src/posts/mod.rs
+++ b/src/posts/mod.rs
@@ -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> {
+// }
+// }
diff --git a/src/posts/note.rs b/src/posts/note.rs
index e69de29..95655d4 100644
--- a/src/posts/note.rs
+++ b/src/posts/note.rs
@@ -0,0 +1 @@
+struct note
diff --git a/static/style.css b/static/style.css
index 934041a..035c404 100644
--- a/static/style.css
+++ b/static/style.css
@@ -51,7 +51,8 @@ a.active {
color: #311f20;
}
-img, video {
+img,
+video {
max-width: 100%;
border: 4px solid #311f20;
}
@@ -388,4 +389,4 @@ iframe {
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
z-index: 4;
-}
+} \ No newline at end of file