Minor tweaks
This commit is contained in:
parent
7cfe1ff6ff
commit
87b9b713b2
5 changed files with 14 additions and 5 deletions
|
@ -17,7 +17,7 @@ anyway here's a new todo list:
|
||||||
- [x] page aliases (gotta keep all those old links working)
|
- [x] page aliases (gotta keep all those old links working)
|
||||||
- [x] rss/atom (tera is useful here too)
|
- [x] rss/atom (tera is useful here too)
|
||||||
- [x] code hilighting (syntact)
|
- [x] code hilighting (syntact)
|
||||||
- [x] cache headers (pages uses etags, some others timestamps. it works)
|
- [x] cache headers (pages uses etags, feeds uses timestamps. it works)
|
||||||
- [x] docker from-scratch image (it's small!)
|
- [x] docker from-scratch image (it's small!)
|
||||||
- [x] ~~opentelemetry (metrics, traces)~~ (ripped it our for now)
|
- [x] ~~opentelemetry (metrics, traces)~~ (ripped it our for now)
|
||||||
- [ ] opentelemetry logs? (don't know if I'm gonna need it? can probably just make the collector grab them from the docker logs?)
|
- [ ] opentelemetry logs? (don't know if I'm gonna need it? can probably just make the collector grab them from the docker logs?)
|
||||||
|
|
|
@ -57,10 +57,10 @@ impl IntoResponse for WebsiteError {
|
||||||
WebsiteError::InternalError(e) => {
|
WebsiteError::InternalError(e) => {
|
||||||
match e.source() {
|
match e.source() {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
error!("internal error: {}: {}", e, s);
|
error!("internal error: {e}: {s}");
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
error!("internal error: {}", e);
|
error!("internal error: {e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(StatusCode::INTERNAL_SERVER_ERROR, "internal error").into_response()
|
(StatusCode::INTERNAL_SERVER_ERROR, "internal error").into_response()
|
||||||
|
|
|
@ -34,7 +34,7 @@ async fn main() -> Result<()> {
|
||||||
let app = init_app(cfg).await?;
|
let app = init_app(cfg).await?;
|
||||||
|
|
||||||
let listener = TcpListener::bind(&addr).await.unwrap();
|
let listener = TcpListener::bind(&addr).await.unwrap();
|
||||||
info!("Bind address: {:?}, Base Url: {:?}", addr, url);
|
info!("Bind address: {addr:?}, Base Url: {url:?}");
|
||||||
axum::serve(listener, app.into_make_service())
|
axum::serve(listener, app.into_make_service())
|
||||||
.with_graceful_shutdown(shutdown_signal())
|
.with_graceful_shutdown(shutdown_signal())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
@ -4,6 +4,7 @@ use std::{
|
||||||
fs,
|
fs,
|
||||||
hash::{Hash, Hasher},
|
hash::{Hash, Hasher},
|
||||||
path::Path,
|
path::Path,
|
||||||
|
time::Instant,
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
@ -118,9 +119,15 @@ impl Page {
|
||||||
|
|
||||||
#[instrument(skip(state))]
|
#[instrument(skip(state))]
|
||||||
pub fn load_all(state: &AppState, root: &Path, folder: &Path) -> Result<HashMap<String, Page>> {
|
pub fn load_all(state: &AppState, root: &Path, folder: &Path) -> Result<HashMap<String, Page>> {
|
||||||
|
let start = Instant::now();
|
||||||
let pages = load_recursive(state, root, folder, None)?;
|
let pages = load_recursive(state, root, folder, None)?;
|
||||||
|
let duration = start.elapsed();
|
||||||
|
|
||||||
info!("{} pages loaded", pages.len());
|
info!(
|
||||||
|
"{} pages loaded in {:.2}ms",
|
||||||
|
pages.len(),
|
||||||
|
duration.as_secs_f32() * 1000.0
|
||||||
|
);
|
||||||
|
|
||||||
Ok(pages)
|
Ok(pages)
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ pub fn render_to_html(base_uri: Option<&Uri>, markdown: &str) -> RenderResult {
|
||||||
opt.insert(Options::ENABLE_TASKLISTS);
|
opt.insert(Options::ENABLE_TASKLISTS);
|
||||||
opt.insert(Options::ENABLE_SMART_PUNCTUATION);
|
opt.insert(Options::ENABLE_SMART_PUNCTUATION);
|
||||||
opt.insert(Options::ENABLE_PLUSES_DELIMITED_METADATA_BLOCKS);
|
opt.insert(Options::ENABLE_PLUSES_DELIMITED_METADATA_BLOCKS);
|
||||||
|
opt.insert(Options::ENABLE_SUPERSCRIPT);
|
||||||
|
opt.insert(Options::ENABLE_SUBSCRIPT);
|
||||||
|
|
||||||
let mut content_html = String::with_capacity(markdown.len());
|
let mut content_html = String::with_capacity(markdown.len());
|
||||||
let parser = Parser::new_ext(markdown, opt);
|
let parser = Parser::new_ext(markdown, opt);
|
||||||
|
|
Loading…
Add table
Reference in a new issue