aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXe Iaso <me@christine.website>2022-07-10 20:54:37 +0000
committerXe Iaso <me@christine.website>2022-07-10 20:54:37 +0000
commit7dd708c6613b8e617fe77a6a8ad177485b39c258 (patch)
treeb3d3589e20f260d0c63d40abf94f9d02ec45a100
parent95016c89eb7707a476501f96327dcad11831b1a0 (diff)
downloadxesite-7dd708c6613b8e617fe77a6a8ad177485b39c258.tar.xz
xesite-7dd708c6613b8e617fe77a6a8ad177485b39c258.zip
fix
Signed-off-by: Xe Iaso <me@christine.website>
-rw-r--r--Cargo.lock59
-rw-r--r--Cargo.toml6
-rw-r--r--src/app/mod.rs8
-rw-r--r--src/handlers/mod.rs15
-rw-r--r--src/handlers/notes.rs7
5 files changed, 10 insertions, 85 deletions
diff --git a/Cargo.lock b/Cargo.lock
index a2d1948..588ee33 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -265,31 +265,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]]
-name = "bb8"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e9f4fa9768efd269499d8fba693260cfc670891cf6de3adc935588447a77cc8"
-dependencies = [
- "async-trait",
- "futures-channel",
- "futures-util",
- "parking_lot 0.11.2",
- "tokio",
-]
-
-[[package]]
-name = "bb8-rusqlite"
-version = "0.1.0"
-source = "git+https://github.com/pleshevskiy/bb8-rusqlite?branch=bump-rusqlite#fa3da425ce060a20bb09bdd3313ed1b5e8a5f89d"
-dependencies = [
- "async-trait",
- "bb8",
- "rusqlite",
- "thiserror",
- "tokio",
-]
-
-[[package]]
name = "bincode"
version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1728,37 +1703,12 @@ checksum = "decf7381921fea4dcb2549c5667eda59b3ec297ab7e2b5fc33eac69d2e7da87b"
[[package]]
name = "parking_lot"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
-dependencies = [
- "instant",
- "lock_api",
- "parking_lot_core 0.8.5",
-]
-
-[[package]]
-name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
- "parking_lot_core 0.9.3",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
-dependencies = [
- "cfg-if",
- "instant",
- "libc",
- "redox_syscall",
- "smallvec",
- "winapi",
+ "parking_lot_core",
]
[[package]]
@@ -2075,7 +2025,7 @@ dependencies = [
"lazy_static",
"libc",
"memchr",
- "parking_lot 0.12.1",
+ "parking_lot",
"procfs",
"thiserror",
]
@@ -2769,7 +2719,7 @@ dependencies = [
"mio",
"num_cpus",
"once_cell",
- "parking_lot 0.12.1",
+ "parking_lot",
"pin-project-lite",
"signal-hook-registry",
"socket2",
@@ -3352,8 +3302,6 @@ dependencies = [
"axum 0.5.11",
"axum-extra",
"axum-macros",
- "bb8",
- "bb8-rusqlite",
"cfcache",
"chrono",
"color-eyre",
@@ -3399,6 +3347,7 @@ dependencies = [
"tracing",
"tracing-futures",
"tracing-subscriber",
+ "ts_localapi",
"url",
"uuid 0.8.2",
"xe_jsonfeed",
diff --git a/Cargo.toml b/Cargo.toml
index b7427f0..e8094a4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,6 @@ repository = "https://github.com/Xe/site"
axum = { version = "0.5", features = ["headers"] }
axum-macros = "0.2"
axum-extra = "0.3"
-bb8 = "0.7"
color-eyre = "0.6"
chrono = "0.4"
comrak = "0.13.2"
@@ -52,12 +51,11 @@ uuid = { version = "0.8", features = ["serde", "v4"] }
# workspace dependencies
cfcache = { path = "./lib/cfcache" }
-xe_jsonfeed = { path = "./lib/jsonfeed" }
mi = { path = "./lib/mi" }
patreon = { path = "./lib/patreon" }
+ts_localapi = { path = "./lib/ts_localapi" }
xesite_types = { path = "./lib/xesite_types" }
-
-bb8-rusqlite = { git = "https://github.com/pleshevskiy/bb8-rusqlite", branch = "bump-rusqlite" }
+xe_jsonfeed = { path = "./lib/jsonfeed" }
[dependencies.rusqlite]
version = "0.26"
diff --git a/src/app/mod.rs b/src/app/mod.rs
index 24eabc5..4b52a90 100644
--- a/src/app/mod.rs
+++ b/src/app/mod.rs
@@ -1,6 +1,4 @@
use crate::{post::Post, signalboost::Person};
-use bb8::Pool;
-use bb8_rusqlite::RusqliteConnectionManager;
use chrono::prelude::*;
use color_eyre::eyre::Result;
use std::{env, fs, path::PathBuf, sync::Arc};
@@ -60,7 +58,6 @@ pub struct State {
pub sitemap: Vec<u8>,
pub patrons: Option<patreon::Users>,
pub mi: mi::Client,
- pub pool: Pool<RusqliteConnectionManager>,
}
pub async fn init(cfg: PathBuf) -> Result<State> {
@@ -76,10 +73,6 @@ pub async fn init(cfg: PathBuf) -> Result<State> {
let gallery = crate::post::load(cfg.clone(), "gallery").await?;
let talks = crate::post::load(cfg.clone(), "talks").await?;
let mut everything: Vec<Post> = vec![];
- let mgr = RusqliteConnectionManager::new(
- env::var("DATABASE_URL").unwrap_or("./var/waifud.db".to_string()),
- );
- let pool = bb8::Pool::builder().build(mgr).await?;
{
let blog = blog.clone();
@@ -157,7 +150,6 @@ pub async fn init(cfg: PathBuf) -> Result<State> {
jf: jfb.build(),
sitemap: sm,
patrons: patrons().await?,
- pool,
})
}
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs
index 87175ca..97939fb 100644
--- a/src/handlers/mod.rs
+++ b/src/handlers/mod.rs
@@ -168,21 +168,6 @@ pub enum Error {
#[error("database error: {0}")]
SQLite(#[from] rusqlite::Error),
-
- #[error("database pool error: {0}")]
- SQLitePool(#[from] bb8_rusqlite::Error),
-
- #[error("other error: {0}")]
- Catchall(String),
-}
-
-impl<E> From<bb8::RunError<E>> for Error
-where
- E: std::error::Error + Send + 'static,
-{
- fn from(err: bb8::RunError<E>) -> Self {
- Self::Catchall(format!("{}", err))
- }
}
pub type Result<T = Html<Vec<u8>>> = std::result::Result<T, Error>;
diff --git a/src/handlers/notes.rs b/src/handlers/notes.rs
index feb2129..f49ee39 100644
--- a/src/handlers/notes.rs
+++ b/src/handlers/notes.rs
@@ -20,12 +20,13 @@ impl Note {
pub fn to_html(&self) -> Markup {
html! {
article."h-entry" {
- time."dt-published" datetime=(self.created_at) {
- {(self.detrytemci())}
- }
a href={"/notes/" (self.id)} {
"🔗"
}
+ " "
+ time."dt-published" datetime=(self.created_at) {
+ {(self.detrytemci())}
+ }
@if let Some(reply_to) = &self.reply_to {
p {