This commit is contained in:
parent
152ccf8ba5
commit
692e765561
11
src/main.rs
11
src/main.rs
|
@ -15,8 +15,9 @@ use axum::{
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use file_format::{FileFormat, Kind};
|
use file_format::{FileFormat, Kind};
|
||||||
use hyper::body::Bytes;
|
use hyper::body::Bytes;
|
||||||
use maud::{html, Markup, DOCTYPE, PreEscaped, Render};
|
use maud::{html, Markup, PreEscaped, Render, DOCTYPE};
|
||||||
use orgize::Org;
|
use orgize::Org;
|
||||||
|
use rss::ChannelBuilder;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use sqlx::sqlite::{SqliteConnectOptions, SqliteJournalMode, SqlitePoolOptions};
|
use sqlx::sqlite::{SqliteConnectOptions, SqliteJournalMode, SqlitePoolOptions};
|
||||||
use sqlx::{FromRow, Pool, Sqlite};
|
use sqlx::{FromRow, Pool, Sqlite};
|
||||||
|
@ -25,10 +26,9 @@ use std::fs::{self, File};
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
use time::{self, format_description, format_description::well_known::Rfc2822};
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
use tower_http::services::ServeDir;
|
use tower_http::services::ServeDir;
|
||||||
use rss::ChannelBuilder;
|
|
||||||
use time::{self, format_description, format_description::well_known::Rfc2822};
|
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref CACHE: Mutex<HashMap<String, CachedPage>> = Mutex::new(HashMap::new());
|
static ref CACHE: Mutex<HashMap<String, CachedPage>> = Mutex::new(HashMap::new());
|
||||||
|
@ -157,7 +157,8 @@ fn get_posts() -> Vec<Post> {
|
||||||
.find(|&x| x.contains("title:"))
|
.find(|&x| x.contains("title:"))
|
||||||
.unwrap_or(&"")
|
.unwrap_or(&"")
|
||||||
.split(":")
|
.split(":")
|
||||||
.collect::<Vec<&str>>()[1].trim();
|
.collect::<Vec<&str>>()[1]
|
||||||
|
.trim();
|
||||||
let date = date.trim();
|
let date = date.trim();
|
||||||
|
|
||||||
posts.push(Post {
|
posts.push(Post {
|
||||||
|
@ -420,7 +421,7 @@ async fn cached_page<T>(
|
||||||
.header("cache", "not")
|
.header("cache", "not")
|
||||||
.status(StatusCode::OK)
|
.status(StatusCode::OK)
|
||||||
.body(Full::from(bytes))
|
.body(Full::from(bytes))
|
||||||
.unwrap()
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
let content = String::from_utf8(res).unwrap();
|
let content = String::from_utf8(res).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue