ticker-serve: fix ics linebreaks, PRODID, DTSTAMP
This commit is contained in:
parent
262f3961cd
commit
4ff09652ab
|
@ -47,13 +47,15 @@ where
|
|||
// .into_iter().collect::<Vec<Event>>();
|
||||
let (template, content_type) = f(es);
|
||||
match template.render() {
|
||||
Ok(rendered) =>
|
||||
Ok(rendered) => {
|
||||
let ics = rendered.replace('\n', "\r\n");
|
||||
(
|
||||
[(HeaderName::from_static("content-type"), HeaderValue::from_static(content_type))]
|
||||
.iter().cloned()
|
||||
.collect::<HeaderMap>(),
|
||||
rendered
|
||||
).into_response(),
|
||||
ics
|
||||
).into_response()
|
||||
}
|
||||
Err(e) => (
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
format!("Failed to render template. Error: {}", e),
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
BEGIN:VCALENDAR
|
||||
VERSION:2.0
|
||||
PRODID:-//astro/ticker//NONSGML v1.0//DE
|
||||
METHOD:PUBLISH
|
||||
X-WR-TIMEZONE;VALUE=TEXT:Europe/Berlin
|
||||
|
||||
{% for e in events -%}
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:{{ e.summary }}
|
||||
DTSTAMP:{{ e.dtstart.format("%Y%m%dT%H%M%S").to_string() }}
|
||||
DTSTART:{{ e.dtstart.format("%Y%m%dT%H%M%S").to_string() }}
|
||||
{% if let Some(dtend) = e.dtend -%}
|
||||
DTEND:{{ dtend.format("%Y%m%dT%H%M%S") }}
|
||||
|
|
Loading…
Reference in New Issue