home: wip news
This commit is contained in:
parent
f360250b57
commit
a753fd3497
9 changed files with 507 additions and 19 deletions
|
|
@ -1,8 +1,10 @@
|
|||
use chrono::NaiveDate;
|
||||
use serde::Deserialize;
|
||||
|
||||
pub struct AppState {
|
||||
pub mp_tracks: Vec<Track>,
|
||||
pub p_tracks: Vec<Track>,
|
||||
pub website_news: Vec<WebsiteArticle>,
|
||||
}
|
||||
|
||||
impl AppState {
|
||||
|
|
@ -18,13 +20,25 @@ impl AppState {
|
|||
.expect("p-tracks.json non trouvé"),
|
||||
)
|
||||
.expect("JSON invalide"),
|
||||
website_news: serde_json::from_str(
|
||||
&std::fs::read_to_string("content/web-articles.json")
|
||||
.expect("web-articles.json non trouvé"),
|
||||
)
|
||||
.expect("JSON invalide"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone)]
|
||||
#[derive(Deserialize)]
|
||||
pub struct Track {
|
||||
pub title: String,
|
||||
pub artist: String,
|
||||
pub src: String,
|
||||
pub album: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct WebsiteArticle {
|
||||
pub date: NaiveDate,
|
||||
pub body: String,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue