From c3a18c610f364383e5b991de08e7104899d3d1c5 Mon Sep 17 00:00:00 2001 From: paspo Date: Sat, 5 Oct 2024 09:27:26 +0200 Subject: [PATCH 1/2] CRLF --- layouts/_default/home.calendar.ics | 166 ++++++++++++++--------------- 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/layouts/_default/home.calendar.ics b/layouts/_default/home.calendar.ics index 4d20c12..beac4cc 100644 --- a/layouts/_default/home.calendar.ics +++ b/layouts/_default/home.calendar.ics @@ -1,83 +1,83 @@ -{{- $numcaratteri := 66 }} -BEGIN:VCALENDAR -VERSION:2.0 -PRODID:-//BgLUG//BgLUG Events Calendar//EN -X-WR-CALNAME:BgLUG Events Calendar -X-WR-TIMEZONE:Europe/Rome -CALSCALE:GREGORIAN -METHOD:PUBLISH -BEGIN:VTIMEZONE -TZID:Europe/Rome -LAST-MODIFIED:20240422T053451Z -TZURL:https://www.tzurl.org/zoneinfo-outlook/Europe/Rome -X-LIC-LOCATION:Europe/Rome -BEGIN:DAYLIGHT -TZNAME:CEST -TZOFFSETFROM:+0100 -TZOFFSETTO:+0200 -DTSTART:19700329T020000 -RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU -END:DAYLIGHT -BEGIN:STANDARD -TZNAME:CET -TZOFFSETFROM:+0200 -TZOFFSETTO:+0100 -DTSTART:19701025T030000 -RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU -END:STANDARD -END:VTIMEZONE -{{- range where .Site.Pages ".Page.Params.add_to_ics" true -}} - {{- $location := "" -}} - {{- $locations := .Params.locations -}} - {{- with (eq (printf "%T" $locations ) "string" ) -}} - {{- $location = $locations -}} - {{- end -}} - {{- with (eq (printf "%T" $locations ) "[]string" ) -}} - {{- $location = (index $locations 0) -}} - {{- end -}} - {{- if .Params.location_ics }} - {{- $location = .Params.location_ics }} - {{- end }} - {{- $description := "" }} - {{- with .Description }} - {{- $description = . }} - {{- end }} - {{- with .Summary }} - {{- $description = . }} - {{- end }} -BEGIN:VEVENT -SUMMARY:{{.Title}} -ORGANIZER;{{ .Site.Param "ics.organizer" }} -UID:{{ md5 .Permalink }}@bglug.it -SEQUENCE:0 -STATUS:CONFIRMED -TRANSP:TRANSPARENT - {{- if ne $description "" }} - {{- $description = replace $description "\n" " " }} - {{- $description = (print "DESCRIPTION:" $description ) | truncate 400 }} - {{- $i := 0 }} - {{- range seq 0 $numcaratteri ($description | len) }} -{{ strings.Repeat $i " " }}{{- substr $description . $numcaratteri }} - {{- $i = add $i 1 }} - {{- end }} - {{- end }} -LOCATION:{{ $location }} -URL:{{ .Permalink }} - {{- with (.Page.Resources.GetMatch .Params.image ) -}} - {{- $image := print "IMAGE;VALUE=URI;DISPLAY=BADGE;FMTTYPE=" .MediaType.String ":" .Permalink }} - {{- $i := 0 }} - {{- range seq 0 $numcaratteri ($image | len) }} -{{ strings.Repeat $i " " }}{{- substr $image . $numcaratteri }} - {{- $i = add $i 1 }} - {{- end }} -{{ end -}} -{{ with .Lastmod }}DTSTAMP:{{dateFormat "20060102T150405Z" . }} -{{ end -}} -{{ if .Date }}DTSTART;TZID=Europe/Rome:{{dateFormat "20060102T150405" .Date }} -{{- $d := time.AsTime .Date }} -{{- $duration := .Params.duration | default "1h" }} -DTEND;TZID=Europe/Rome:{{dateFormat "20060102T150405" ($d.Add (time.ParseDuration $duration) ) }} -{{- end }} -END:VEVENT -{{- end }} -END:VCALENDAR +{{- $numcaratteri := 66 -}} +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//BgLUG//BgLUG Events Calendar//EN +X-WR-CALNAME:BgLUG Events Calendar +X-WR-TIMEZONE:Europe/Rome +CALSCALE:GREGORIAN +METHOD:PUBLISH +BEGIN:VTIMEZONE +TZID:Europe/Rome +LAST-MODIFIED:20240422T053451Z +TZURL:https://www.tzurl.org/zoneinfo-outlook/Europe/Rome +X-LIC-LOCATION:Europe/Rome +BEGIN:DAYLIGHT +TZNAME:CEST +TZOFFSETFROM:+0100 +TZOFFSETTO:+0200 +DTSTART:19700329T020000 +RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU +END:DAYLIGHT +BEGIN:STANDARD +TZNAME:CET +TZOFFSETFROM:+0200 +TZOFFSETTO:+0100 +DTSTART:19701025T030000 +RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU +END:STANDARD +END:VTIMEZONE +{{- range where .Site.Pages ".Page.Params.add_to_ics" true -}} + {{- $location := "" -}} + {{- $locations := .Params.locations -}} + {{- with (eq (printf "%T" $locations ) "string" ) -}} + {{- $location = $locations -}} + {{- end -}} + {{- with (eq (printf "%T" $locations ) "[]string" ) -}} + {{- $location = (index $locations 0) -}} + {{- end -}} + {{- if .Params.location_ics }} + {{- $location = .Params.location_ics }} + {{- end }} + {{- $description := "" }} + {{- with .Description }} + {{- $description = . }} + {{- end }} + {{- with .Summary }} + {{- $description = . }} + {{- end }} +BEGIN:VEVENT +SUMMARY:{{.Title}} +ORGANIZER;{{ .Site.Param "ics.organizer" }} +UID:{{ md5 .Permalink }}@bglug.it +SEQUENCE:0 +STATUS:CONFIRMED +TRANSP:TRANSPARENT + {{- if ne $description "" }} + {{- $description = replace $description "\n" " " }} + {{- $description = (print "DESCRIPTION:" $description ) | truncate 400 }} + {{- $i := 0 }} + {{- range seq 0 $numcaratteri ($description | len) }} +{{ strings.Repeat $i " " }}{{- substr $description . $numcaratteri }} + {{- $i = add $i 1 }} + {{- end }} + {{- end }} +LOCATION:{{ $location }} +URL:{{ .Permalink }} + {{- with (.Page.Resources.GetMatch .Params.image ) -}} + {{- $image := print "IMAGE;VALUE=URI;DISPLAY=BADGE;FMTTYPE=" .MediaType.String ":" .Permalink }} + {{- $i := 0 }} + {{- range seq 0 $numcaratteri ($image | len) }} +{{ strings.Repeat $i " " }}{{- substr $image . $numcaratteri }} + {{- $i = add $i 1 }} + {{- end }} +{{ end -}} +{{ with .Lastmod }}DTSTAMP:{{dateFormat "20060102T150405Z" . }} +{{ end -}} +{{ if .Date }}DTSTART;TZID=Europe/Rome:{{dateFormat "20060102T150405" .Date }} +{{- $d := time.AsTime .Date }} +{{- $duration := .Params.duration | default "1h" }} +DTEND;TZID=Europe/Rome:{{dateFormat "20060102T150405" ($d.Add (time.ParseDuration $duration) ) }} +{{- end }} +END:VEVENT +{{- end }} +END:VCALENDAR -- 2.47.2 From 07825673e390ce0ce048bc074196b18cbbab14d3 Mon Sep 17 00:00:00 2001 From: paspo Date: Sat, 5 Oct 2024 09:35:38 +0200 Subject: [PATCH 2/2] fix content type for calendar --- docker/rootfs/etc/nginx/http.d/default.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker/rootfs/etc/nginx/http.d/default.conf b/docker/rootfs/etc/nginx/http.d/default.conf index e481363..f8b8a6d 100644 --- a/docker/rootfs/etc/nginx/http.d/default.conf +++ b/docker/rootfs/etc/nginx/http.d/default.conf @@ -13,9 +13,14 @@ server { } location ~ /events/elenco/ { + default_type "text/calendar"; try_files $uri /it/index.ics; } + location ~ \.ics$ { + default_type "text/calendar"; + } + location ~ ^/wp\-content/uploads/2008/02/Statuto\.pdf$ { return 301 https://bglug.it/it/chi-siamo/Statuto.pdf; } -- 2.47.2