Compare commits
2 commits
0663b7d4d5
...
f7ac4995ef
Author | SHA1 | Date | |
---|---|---|---|
f7ac4995ef | |||
bf6a7ade5a |
7 changed files with 739 additions and 704 deletions
1378
Cargo.lock
generated
1378
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
13
Cargo.toml
13
Cargo.toml
|
@ -33,25 +33,24 @@ chrono = { version = "0.4.37", features = [
|
|||
"serde",
|
||||
], default-features = false }
|
||||
color-eyre = "0.6.3"
|
||||
comrak = { version = "0.22.0", features = [
|
||||
comrak = { version = "0.32.0", features = [
|
||||
"syntect",
|
||||
], default-features = false }
|
||||
console-subscriber = { version = "0.2.0", optional = true }
|
||||
derive_more = "0.99.17"
|
||||
console-subscriber = { version = "0.4.1", optional = true }
|
||||
fronma = "0.2.0"
|
||||
futures = "0.3.31"
|
||||
handlebars = "6.0.0"
|
||||
include_dir = "0.7.4"
|
||||
indexmap = { version = "2.7.0", features = ["serde"] }
|
||||
mime_guess = "2.0.5"
|
||||
notify-debouncer-full = { version = "0.3.1", default-features = false }
|
||||
notify-debouncer-full = { version = "0.4.0", default-features = false }
|
||||
rss = "2.0.7"
|
||||
scc = { version = "2.1.0", features = ["serde"] }
|
||||
serde = { version = "1.0.197", features = ["derive", "rc"] }
|
||||
serde-value = "0.7.0"
|
||||
serde_json = { version = "1.0.124", features = ["preserve_order"] }
|
||||
syntect = "5.2.0"
|
||||
thiserror = "1.0.58"
|
||||
thiserror = "2.0.9"
|
||||
tokio = { version = "1.37.0", features = [
|
||||
"fs",
|
||||
"macros",
|
||||
|
@ -61,8 +60,8 @@ tokio = { version = "1.37.0", features = [
|
|||
] }
|
||||
tokio-util = { version = "0.7.10", default-features = false }
|
||||
toml = "0.8.12"
|
||||
tower = "0.4.13"
|
||||
tower-http = { version = "0.5.2", features = [
|
||||
tower = { version = "0.5.2", features = ["util"] }
|
||||
tower-http = { version = "0.6.2", features = [
|
||||
"compression-gzip",
|
||||
"fs",
|
||||
"trace",
|
||||
|
|
|
@ -39,10 +39,7 @@ pub fn render(markdown: &str, syntect: Option<&dyn SyntaxHighlighterAdapter>) ->
|
|||
let mut render_plugins = RenderPlugins::default();
|
||||
render_plugins.codefence_syntax_highlighter = syntect;
|
||||
|
||||
let plugins = comrak::PluginsBuilder::default()
|
||||
.render(render_plugins)
|
||||
.build()
|
||||
.unwrap();
|
||||
let plugins = comrak::Plugins::builder().render(render_plugins).build();
|
||||
|
||||
markdown_to_html_with_plugins(markdown, &options, &plugins)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ use serde_value::Value;
|
|||
use tokio::fs::OpenOptions;
|
||||
use tokio::io::{AsyncBufReadExt, AsyncReadExt, BufReader};
|
||||
use tokio::time::Instant;
|
||||
use tracing::{debug, error, info, instrument, warn};
|
||||
use tracing::{debug, error, info, instrument};
|
||||
|
||||
use crate::error::PostError;
|
||||
use crate::post::Filter;
|
||||
|
@ -281,8 +281,7 @@ impl PostManager for Blag {
|
|||
if !dont_cache && let Some(cache) = &self.cache {
|
||||
cache
|
||||
.insert(name, meta.clone(), mtime, Arc::clone(&body), query_hash)
|
||||
.await
|
||||
.unwrap_or_else(|err| warn!("failed to insert {:?} into cache", err.0));
|
||||
.await;
|
||||
}
|
||||
|
||||
let total = start.elapsed();
|
||||
|
|
|
@ -79,28 +79,17 @@ impl Cache {
|
|||
mtime: u64,
|
||||
rendered: Arc<str>,
|
||||
extra: u64,
|
||||
) -> Result<(), (CacheKey, (PostMetadata, Arc<str>))> {
|
||||
let key = CacheKey { name, extra };
|
||||
|
||||
let value = CacheValue {
|
||||
meta: metadata,
|
||||
body: rendered,
|
||||
mtime,
|
||||
};
|
||||
|
||||
if self
|
||||
.0
|
||||
.update_async(&key, |_, _| value.clone())
|
||||
) -> Option<CacheValue> {
|
||||
self.0
|
||||
.upsert_async(
|
||||
CacheKey { name, extra },
|
||||
CacheValue {
|
||||
meta: metadata,
|
||||
body: rendered,
|
||||
mtime,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.is_none()
|
||||
{
|
||||
self.0
|
||||
.insert_async(key, value)
|
||||
.await
|
||||
.map_err(|x| (x.0, (x.1.meta, x.1.body)))
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
|
|
|
@ -129,9 +129,8 @@ impl MarkdownPosts {
|
|||
Arc::clone(&post),
|
||||
self.render_hash,
|
||||
)
|
||||
.await
|
||||
.unwrap_or_else(|err| warn!("failed to insert {:?} into cache", err.0))
|
||||
};
|
||||
.await;
|
||||
}
|
||||
|
||||
Ok((metadata, post, (parsing, rendering)))
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ use std::sync::Arc;
|
|||
use std::time::Duration;
|
||||
|
||||
use handlebars::{Handlebars, Template};
|
||||
use notify_debouncer_full::notify::{self, Watcher};
|
||||
use notify_debouncer_full::notify::{self};
|
||||
use notify_debouncer_full::{new_debouncer, DebouncedEvent};
|
||||
use tokio::select;
|
||||
use tokio::sync::RwLock;
|
||||
|
@ -85,9 +85,7 @@ pub async fn watch_templates<'a>(
|
|||
.expect("failed to send message over channel")
|
||||
})?;
|
||||
|
||||
debouncer
|
||||
.watcher()
|
||||
.watch(path, notify::RecursiveMode::NonRecursive)?;
|
||||
debouncer.watch(path, notify::RecursiveMode::NonRecursive)?;
|
||||
|
||||
'event_loop: while let Some(events) = select! {
|
||||
_ = watcher_token.cancelled() => {
|
||||
|
|
Loading…
Reference in a new issue