This commit is contained in:
parent
94387f02bf
commit
21785bbead
3 changed files with 103 additions and 11 deletions
76
Cargo.lock
generated
76
Cargo.lock
generated
|
@ -548,6 +548,28 @@ dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono-tz"
|
||||||
|
version = "0.8.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cf9cc2b23599e6d7479755f3594285efb3f74a1bdca7a7374948bc831e23a552"
|
||||||
|
dependencies = [
|
||||||
|
"chrono",
|
||||||
|
"chrono-tz-build",
|
||||||
|
"phf",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "chrono-tz-build"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d9998fb9f7e9b2111641485bf8beb32f92945f97f92a3d061f744cfef335f751"
|
||||||
|
dependencies = [
|
||||||
|
"parse-zoneinfo",
|
||||||
|
"phf",
|
||||||
|
"phf_codegen",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.2.4"
|
version = "4.2.4"
|
||||||
|
@ -910,6 +932,7 @@ dependencies = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"cached",
|
"cached",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
"chrono-tz",
|
||||||
"comrak",
|
"comrak",
|
||||||
"glob",
|
"glob",
|
||||||
"minify-html",
|
"minify-html",
|
||||||
|
@ -1696,6 +1719,15 @@ dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "parse-zoneinfo"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c705f256449c60da65e11ff6626e0c16a0a0b96aaa348de61376b249bc340f41"
|
||||||
|
dependencies = [
|
||||||
|
"regex",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "paste"
|
name = "paste"
|
||||||
version = "1.0.12"
|
version = "1.0.12"
|
||||||
|
@ -1708,6 +1740,44 @@ version = "2.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "phf"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c"
|
||||||
|
dependencies = [
|
||||||
|
"phf_shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "phf_codegen"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a56ac890c5e3ca598bbdeaa99964edb5b0258a583a9eb6ef4e89fc85d9224770"
|
||||||
|
dependencies = [
|
||||||
|
"phf_generator",
|
||||||
|
"phf_shared",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "phf_generator"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b1181c94580fa345f50f19d738aaa39c0ed30a600d95cb2d3e23f94266f14fbf"
|
||||||
|
dependencies = [
|
||||||
|
"phf_shared",
|
||||||
|
"rand",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "phf_shared"
|
||||||
|
version = "0.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676"
|
||||||
|
dependencies = [
|
||||||
|
"siphasher",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project-lite"
|
name = "pin-project-lite"
|
||||||
version = "0.2.9"
|
version = "0.2.9"
|
||||||
|
@ -2158,6 +2228,12 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "siphasher"
|
||||||
|
version = "0.3.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.8"
|
version = "0.4.8"
|
||||||
|
|
|
@ -23,4 +23,5 @@ glob = "0.3.1"
|
||||||
comrak = "0.18"
|
comrak = "0.18"
|
||||||
reqwest = { version = "0.11", features = ["json"] }
|
reqwest = { version = "0.11", features = ["json"] }
|
||||||
chrono = "0.4.24"
|
chrono = "0.4.24"
|
||||||
|
chrono-tz = "0.8.2"
|
||||||
rss = "2.0.3"
|
rss = "2.0.3"
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
use ::rss::{Category, Channel, Image};
|
use ::rss::{Category, Channel, Image, Item};
|
||||||
use actix_web::{dev::ConnectionInfo, get, web, HttpRequest, HttpResponse, Responder};
|
use actix_web::{dev::ConnectionInfo, get, web, HttpRequest, HttpResponse, Responder};
|
||||||
use cached::proc_macro::once;
|
use cached::proc_macro::once;
|
||||||
use chrono::{DateTime, Datelike, Utc};
|
use chrono::{DateTime, Datelike, Local, NaiveDateTime, Utc};
|
||||||
|
use chrono_tz::Europe;
|
||||||
use comrak::{parse_document, Arena};
|
use comrak::{parse_document, Arena};
|
||||||
use ramhorns::Content;
|
use ramhorns::Content;
|
||||||
|
|
||||||
|
@ -180,11 +181,11 @@ fn build_rss(config: Config, info: ConnectionInfo) -> String {
|
||||||
let channel = Channel {
|
let channel = Channel {
|
||||||
title: "Blog d'Anri".into(),
|
title: "Blog d'Anri".into(),
|
||||||
link: link_to_site.to_owned(),
|
link: link_to_site.to_owned(),
|
||||||
description: "Un fil qui parle d'infos".into(),
|
description: "Un fil qui parle d'informatique notamment".into(),
|
||||||
language: Some("fr".into()),
|
language: Some("fr".into()),
|
||||||
managing_editor: config.fc.mail.to_owned(),
|
managing_editor: config.fc.mail.to_owned(),
|
||||||
webmaster: config.fc.mail,
|
webmaster: config.fc.mail,
|
||||||
pub_date: Some(chrono::Utc::now().to_rfc2822().replace("+0000", "GMT")),
|
pub_date: Some(Local::now().to_rfc2822()),
|
||||||
categories: ["blog", "blogging", "write", "writing"]
|
categories: ["blog", "blogging", "write", "writing"]
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&c| Category {
|
.map(|&c| Category {
|
||||||
|
@ -195,16 +196,30 @@ fn build_rss(config: Config, info: ConnectionInfo) -> String {
|
||||||
generator: Some("ewp with rss crate".into()),
|
generator: Some("ewp with rss crate".into()),
|
||||||
docs: Some("https://www.rssboard.org/rss-specification".into()),
|
docs: Some("https://www.rssboard.org/rss-specification".into()),
|
||||||
image: Some(Image {
|
image: Some(Image {
|
||||||
url: format!(
|
url: format!("{}/icons/favicon-32x32.png", link_to_site),
|
||||||
"{}://{}/icons/favicon-32x32.png",
|
|
||||||
info.scheme(),
|
|
||||||
info.host()
|
|
||||||
),
|
|
||||||
title: "Favicon".into(),
|
title: "Favicon".into(),
|
||||||
link: link_to_site,
|
link: link_to_site.to_owned(),
|
||||||
..Image::default()
|
..Image::default()
|
||||||
}),
|
}),
|
||||||
items: vec![],
|
items: posts
|
||||||
|
.iter()
|
||||||
|
.map(|p| Item {
|
||||||
|
title: Some(p.title.to_owned()),
|
||||||
|
link: Some(format!("{}/blog/p/{}", link_to_site, p.url)),
|
||||||
|
description: p.desc.to_owned(),
|
||||||
|
pub_date: Some(
|
||||||
|
NaiveDateTime::parse_from_str(
|
||||||
|
&format!("{}-{}-{} 13:12:00", p.date.day, p.date.month, p.date.year),
|
||||||
|
"%d-%m-%Y %H:%M:%S",
|
||||||
|
)
|
||||||
|
.unwrap()
|
||||||
|
.and_local_timezone(Europe::Paris)
|
||||||
|
.unwrap()
|
||||||
|
.to_rfc2822(),
|
||||||
|
),
|
||||||
|
..Item::default()
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
..Channel::default()
|
..Channel::default()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue