From cb8e78ab59309ba4b87c53267a26ec9125cce4fb Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 30 Apr 2023 14:51:56 -0500 Subject: [PATCH] Add landing page --- src/app.ts | 3 +++ src/controllers/site.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/controllers/site.ts diff --git a/src/app.ts b/src/app.ts index 537f563..01381ac 100644 --- a/src/app.ts +++ b/src/app.ts @@ -14,6 +14,7 @@ import instanceController from './controllers/api/instance.ts'; import { createTokenController, oauthAuthorizeController, oauthController } from './controllers/api/oauth.ts'; import { contextController, createStatusController, statusController } from './controllers/api/statuses.ts'; import { requireAuth, setAuth } from './middleware/auth.ts'; +import { indexController } from './controllers/site.ts'; interface AppEnv extends HonoEnv { Variables: { @@ -65,6 +66,8 @@ app.get('/api/v1/mutes', emptyArrayController); app.get('/api/v1/domain_blocks', emptyArrayController); app.get('/api/v1/markers', emptyObjectController); +app.get('/', indexController); + export default app; export type { AppContext, AppController, AppMiddleware }; diff --git a/src/controllers/site.ts b/src/controllers/site.ts new file mode 100644 index 0000000..8c0f4a9 --- /dev/null +++ b/src/controllers/site.ts @@ -0,0 +1,15 @@ +import { LOCAL_DOMAIN } from '@/config.ts'; + +import type { AppController } from '@/app.ts'; + +/** Landing page controller. */ +const indexController: AppController = (c) => { + return c.text(`Please connect with a Mastodon client: + + ${LOCAL_DOMAIN} + +Ditto +`); +}; + +export { indexController };