From 6b623725a27c6465712fd19b9088d19c7e93e6ff Mon Sep 17 00:00:00 2001 From: lesion Date: Mon, 31 Jul 2023 10:20:14 +0200 Subject: [PATCH] WIP: caldav --- server/api/controller/caldav.js | 15 +++++++++++++++ server/helpers.js | 7 +++++++ server/routes.js | 5 +++++ 3 files changed, 27 insertions(+) create mode 100644 server/api/controller/caldav.js diff --git a/server/api/controller/caldav.js b/server/api/controller/caldav.js new file mode 100644 index 00000000..13dbc879 --- /dev/null +++ b/server/api/controller/caldav.js @@ -0,0 +1,15 @@ +const { Collection, Filter, Event, Tag, Place } = require('../models/models') + +const log = require('../../log') +const { col: Col, queryParamToBool } = require('../../helpers') +const { Op, Sequelize } = require('sequelize') + +const caldavController = { + + async wellknown (req, res) { + + } + +} + +module.exports = caldavController \ No newline at end of file diff --git a/server/helpers.js b/server/helpers.js index 77598eca..8b920663 100644 --- a/server/helpers.js +++ b/server/helpers.js @@ -287,6 +287,13 @@ module.exports = { next() }, + async caldav (req, res, next) { + if (req.method === 'PRODFIND') { + return res.sendStatus(400) + } + next() + }, + async isGeocodingEnabled(req, res, next) { if (res.locals.settings.allow_geolocation) { next() diff --git a/server/routes.js b/server/routes.js index 183ebc39..e03b7814 100644 --- a/server/routes.js +++ b/server/routes.js @@ -38,9 +38,11 @@ async function main () { const placeController = require('./api/controller/place') const collectionController = require('./api/controller/collection') const authController = require('./api/controller/oauth') + const caldavController = require('./api/controller/caldav') // rss / ics feed app.use(helpers.feedRedirect) + app.use(helpers.caldav) app.get('/feed/:format/tag/:tag', cors(), tagController.getEvents) app.get('/feed/:format/place/:placeName', cors(), placeController.getEvents) app.get('/feed/:format/collection/:name', cors(), collectionController.getEvents) @@ -48,6 +50,9 @@ async function main () { app.use('/event/:slug', helpers.APRedirect) + // caldav + app.use('/.well-known/caldav', caldavController.wellknown) + // federation api / activitypub / webfinger / nodeinfo app.use('/federation', federation) app.use('/.well-known', webfinger)