diff --git a/src/routes/index.ts b/src/routes/index.ts index c68c704..3a2cda3 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -1,12 +1,14 @@ import { FastifyPluginAsync } from 'fastify'; import deleter from './delete.js'; import upload from './upload.js'; +import index from './indexpage.js'; import list from './list.js'; import get from './get.js'; export default (async function (fastify) { await fastify.register(deleter); await fastify.register(upload); + await fastify.register(index); await fastify.register(list); await fastify.register(get); } as FastifyPluginAsync); diff --git a/src/routes/indexpage.ts b/src/routes/indexpage.ts new file mode 100644 index 0000000..13720bf --- /dev/null +++ b/src/routes/indexpage.ts @@ -0,0 +1,29 @@ +import { FastifyPluginAsync } from 'fastify'; + +const page = ` + + + Backup server + + + +

You have reached the backup server!

+

This is the backup server! If you are a regular user, you wouldn't find this place very interesting and might as well close this page now.

+

If you are a sysadmin, please refer to API docs for more info

+ + +` + .replaceAll('\n', '') + .replaceAll(/ +/gm, ' ') + .replaceAll(' <', '<'); + +export default (async function (fastify) { + fastify.get('/', async (_req, rep) => { + rep.type('text/html; charset=utf8'); + return page; + }); + fastify.get('/favicon.ico', async (req, rep) => { + rep.status(404); + return ''; + }); +} as FastifyPluginAsync);