mirror of
https://codeberg.org/icewind/docker-hub-rss.git
synced 2026-06-03 10:14:07 +02:00
chrono -> time
This commit is contained in:
parent
a7bd4e81cd
commit
36034c6b97
4 changed files with 24 additions and 22 deletions
34
Cargo.lock
generated
34
Cargo.lock
generated
|
|
@ -127,12 +127,8 @@ version = "0.4.19"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"serde",
|
||||
"time",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -279,13 +275,13 @@ dependencies = [
|
|||
name = "docker-hub-rss"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"color-eyre",
|
||||
"dotenv",
|
||||
"reqwest",
|
||||
"rss",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"time",
|
||||
"tokio",
|
||||
"warp",
|
||||
]
|
||||
|
|
@ -400,7 +396,7 @@ checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6"
|
|||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -668,7 +664,7 @@ checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"wasi",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
|
|
@ -725,6 +721,15 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_threads"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.29.0"
|
||||
|
|
@ -1168,13 +1173,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.44"
|
||||
version = "0.3.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
|
||||
checksum = "72c91f41dcb2f096c05f0873d667dceec1087ce5bcf984ec8ffb19acddbb3217"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"libc",
|
||||
"wasi 0.10.0+wasi-snapshot-preview1",
|
||||
"winapi",
|
||||
"num_threads",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1481,12 +1487,6 @@ dependencies = [
|
|||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ serde_json = "1.0.82"
|
|||
color-eyre = "0.6.2"
|
||||
dotenv = "0.15.0"
|
||||
rss = { version = "2.0.1", features = ["builders"] }
|
||||
chrono = { version = "0.4.19", features = ["serde"] }
|
||||
time = { version = "0.3.11", features = ["serde", "formatting", "serde-well-known"] }
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use color_eyre::eyre::WrapErr;
|
||||
use color_eyre::{eyre::ensure, Result};
|
||||
use reqwest::Client;
|
||||
use serde::Deserialize;
|
||||
use time::OffsetDateTime;
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
pub struct Hub {
|
||||
|
|
@ -44,6 +44,7 @@ pub struct HubTagResponse {
|
|||
#[derive(Debug, Deserialize)]
|
||||
pub struct HubTag {
|
||||
pub id: u64,
|
||||
pub last_updated: DateTime<Utc>,
|
||||
#[serde(with = "time::serde::rfc3339")]
|
||||
pub last_updated: OffsetDateTime,
|
||||
pub name: String,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ mod hub;
|
|||
use crate::hub::Hub;
|
||||
use color_eyre::{Report, Result};
|
||||
use rss::{Channel, ChannelBuilder, GuidBuilder, ItemBuilder};
|
||||
use time::format_description::well_known::Rfc2822;
|
||||
use tokio::signal::unix::{signal, SignalKind};
|
||||
use warp::reject::Reject;
|
||||
use warp::{Filter, Rejection};
|
||||
|
|
@ -62,11 +63,11 @@ async fn feed_inner(user: String, repo: String, hub: Hub) -> Result<impl warp::R
|
|||
))
|
||||
.guid(
|
||||
GuidBuilder::default()
|
||||
.value(format!("{}-{}", tag.id, tag.last_updated.timestamp()))
|
||||
.value(format!("{}-{}", tag.id, tag.last_updated.unix_timestamp()))
|
||||
.permalink(false)
|
||||
.build(),
|
||||
)
|
||||
.pub_date(tag.last_updated.to_rfc2822())
|
||||
.pub_date(tag.last_updated.format(&Rfc2822).unwrap())
|
||||
.build()
|
||||
})
|
||||
.collect();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue