add online locations and geo coords to ics export

This commit is contained in:
lesion 2023-04-25 21:41:53 +02:00
parent 1f0ae33e83
commit 6d034f18d9
No known key found for this signature in database
GPG key ID: 352918250B012177

View file

@ -100,6 +100,7 @@ const exportController = {
const tmpStart = DateTime.fromSeconds(e.start_datetime, { zone: 'UTC' })
const start = [ tmpStart.year, tmpStart.month, tmpStart.day, tmpStart.hour, tmpStart.minute ]
const location = e.place.name !== 'online' ? `${e.place.name} - ${e.place.address}` : `${e.place.name} - ${e?.online_locations[0]}`
const ret = {
uid: `${e.id}@${settings.hostname}`,
start,
@ -107,14 +108,18 @@ const exportController = {
endInputType: 'utc',
title: `[${settings.title}] ${e.title}`,
description: htmlToText(e.description),
htmlContent: e.description.replaceAll("\n","\n\t"),
location: `${e.place.name} - ${e.place.address}`,
htmlContent: e.description.replaceAll("\n","<br>"),
location,
url: `${settings.baseurl}/event/${e.slug || e.id}`,
status: 'CONFIRMED',
categories: e.tags.map(t => t.tag),
alarms
}
if (e.place.latitude && e.place.longitude) {
ret.geo = { lat: e.place.latitude, lon: e.place.longitude }
}
if (e.end_datetime) {
const tmpEnd = DateTime.fromSeconds(e.end_datetime, { zone: 'UTC' })
const end = [ tmpEnd.year, tmpEnd.month, tmpEnd.day, tmpEnd.hour, tmpEnd.minute ]