From 017a34d5d4ee8b3435d30d6cddb348c98d21d867 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 13 May 2023 14:27:49 -0500 Subject: [PATCH] Stub out missing Elk endpoints --- src/app.ts | 6 ++++++ src/controllers/api/preferences.ts | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/controllers/api/preferences.ts diff --git a/src/app.ts b/src/app.ts index 245c837..26f0925 100644 --- a/src/app.ts +++ b/src/app.ts @@ -13,6 +13,7 @@ import { emptyArrayController, emptyObjectController } from './controllers/api/f import { homeController } from './controllers/api/timelines.ts'; import instanceController from './controllers/api/instance.ts'; import { createTokenController, oauthAuthorizeController, oauthController } from './controllers/api/oauth.ts'; +import { preferencesController } from './controllers/api/preferences.ts'; import { contextController, createStatusController, @@ -61,6 +62,8 @@ app.post('/api/v1/statuses', requireAuth, createStatusController); app.get('/api/v1/timelines/home', requireAuth, homeController); +app.get('/api/v1/preferences', preferencesController); + // Not (yet) implemented. app.get('/api/v1/notifications', emptyArrayController); app.get('/api/v1/bookmarks', emptyArrayController); @@ -73,6 +76,9 @@ app.get('/api/v1/mutes', emptyArrayController); app.get('/api/v1/domain_blocks', emptyArrayController); app.get('/api/v1/markers', emptyObjectController); app.get('/api/v1/timelines/public', emptyArrayController); +app.get('/api/v1/conversations', emptyArrayController); +app.get('/api/v1/favourites', emptyArrayController); +app.get('/api/v1/lists', emptyArrayController); app.get('/', indexController); diff --git a/src/controllers/api/preferences.ts b/src/controllers/api/preferences.ts new file mode 100644 index 0000000..386e2b5 --- /dev/null +++ b/src/controllers/api/preferences.ts @@ -0,0 +1,19 @@ +import { AppController } from '@/app.ts'; + +/** + * Return a default set of preferences for compatibilty purposes. + * Clients like Soapbox do not use this. + * + * https://docs.joinmastodon.org/methods/preferences/ + */ +const preferencesController: AppController = (c) => { + return c.json({ + 'posting:default:visibility': 'public', + 'posting:default:sensitive': false, + 'posting:default:language': null, + 'reading:expand:media': 'default', + 'reading:expand:spoilers': false, + }); +}; + +export { preferencesController };