pretty up the page and allow for local calendars
This commit is contained in:
parent
5310f19383
commit
1717b3ab70
2 changed files with 68 additions and 10 deletions
29
src/main.rs
29
src/main.rs
|
@ -26,7 +26,7 @@ struct ConfigIcal {
|
|||
short_name: String,
|
||||
|
||||
/// URL to scrape to download the ics file
|
||||
ics_url: url::Url,
|
||||
ics_url: Option<url::Url>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
@ -371,13 +371,10 @@ impl ICal {
|
|||
return true;
|
||||
}
|
||||
|
||||
let uid = ev
|
||||
.ev
|
||||
.get_uid()
|
||||
.context(
|
||||
"Every recurring event should have a UID so we can apply recurrence exceptions",
|
||||
)
|
||||
.unwrap();
|
||||
let Some(uid) = ev.ev.get_uid() else {
|
||||
// If there's no UID, we can't apply recurrence exceptions
|
||||
return true;
|
||||
};
|
||||
let key = RecurrenceKey {
|
||||
recurrence_id: ev.dtstart,
|
||||
uid,
|
||||
|
@ -542,6 +539,10 @@ fn output_html(
|
|||
line-height: 1.6;
|
||||
max-width: 700px;
|
||||
}
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
.past {
|
||||
color: #888;
|
||||
}
|
||||
|
@ -552,6 +553,7 @@ fn output_html(
|
|||
let title = &config.title;
|
||||
|
||||
let s = maud::html! {
|
||||
(maud::PreEscaped("<!DOCTYPE html>"))
|
||||
html lang="en" {
|
||||
head {
|
||||
meta http-equiv="Content-Type" content="text/html; charset=utf-8" {}
|
||||
|
@ -561,6 +563,7 @@ fn output_html(
|
|||
meta property="og:locale" content="en" {}
|
||||
meta property="og:type" content="website" {}
|
||||
|
||||
meta name="description" content=(description) {}
|
||||
meta property="description" content=(description) {}
|
||||
meta property="og:description" content=(description) {}
|
||||
|
||||
|
@ -569,6 +572,7 @@ fn output_html(
|
|||
}
|
||||
body {
|
||||
h1 { (title) }
|
||||
img src="hero.webp" width="700" height="233" {}
|
||||
p { "Written at: " (now.to_rfc3339()) }
|
||||
@for entry in html_list {
|
||||
(entry)
|
||||
|
@ -600,8 +604,11 @@ async fn do_everything(cli: &CliAuto) -> Result<()> {
|
|||
.user_agent(APP_USER_AGENT)
|
||||
.build()?;
|
||||
for ical in &config.icals {
|
||||
tracing::info!(url = ical.ics_url.to_string(), "requesting...");
|
||||
let resp = client.get(ical.ics_url.clone()).send().await?;
|
||||
let Some(ics_url) = &ical.ics_url else {
|
||||
continue;
|
||||
};
|
||||
tracing::info!(url = ics_url.to_string(), "requesting...");
|
||||
let resp = client.get(ics_url.clone()).send().await?;
|
||||
if resp.status() != 200 {
|
||||
bail!("Bad status {}", resp.status());
|
||||
}
|
||||
|
@ -639,6 +646,8 @@ fn main_auto(cli: CliAuto) -> Result<()> {
|
|||
}
|
||||
|
||||
fn main_ics_debug(cli: CliIcsDebug) -> Result<()> {
|
||||
tracing_subscriber::fmt::init();
|
||||
tracing::info!("Started tracing");
|
||||
let config = std::fs::read_to_string(&cli.config)?;
|
||||
let config: Config = toml::from_str(&config)?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue