From f604b358c38984cc6520c9f0e943b7b6219fe927 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 10 Oct 2024 23:35:58 +0300 Subject: vnext: `/api/v2/instance` Mastodon API endpoint --- vnext/server/index.js | 5 +++++ vnext/server/middleware/mastodon.js | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 vnext/server/middleware/mastodon.js (limited to 'vnext/server') diff --git a/vnext/server/index.js b/vnext/server/index.js index 692fbd76..eaf1ae8a 100644 --- a/vnext/server/index.js +++ b/vnext/server/index.js @@ -10,6 +10,7 @@ import event from './middleware/event' import oembed from './middleware/oembed' import urlExpand from './middleware/urlexpand' import releases from './middleware/android' +import { instance } from './middleware/mastodon' const PORT = process.env.LISTEN_PORT || 8081 import path from 'path' @@ -26,6 +27,10 @@ router.get('/api/v2/oembed', oembed) router.get('/api/v2/urlexpand', urlExpand) router.get('/api/apps/android/releases', releases) +// Mastodon API + +router.get('/api/v2/instance', instance) + const durov_webhook = webhookPath() if (durov_webhook) { router.post(`/api/v2/${durov_webhook}`, webhook) diff --git a/vnext/server/middleware/mastodon.js b/vnext/server/middleware/mastodon.js new file mode 100644 index 00000000..3bbad3c4 --- /dev/null +++ b/vnext/server/middleware/mastodon.js @@ -0,0 +1,15 @@ +/** + * Return content for embedding + * @type {import('express').RequestParamHandler} + */ +export const instance = async (req, res) => { + res.json({ + 'domain': 'juick.com', + 'title': 'Microblogging service', + 'description': 'Juick', + 'version': '2.x', + 'contact': { + 'email': 'support@juick.com' + } + }) +} -- cgit v1.2.3