Move host-meta to its own file

This commit is contained in:
Alex Gleason 2023-07-09 18:50:47 -05:00
parent be6aa89c39
commit 19d7d1ae52
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 18 additions and 11 deletions

View File

@ -27,8 +27,9 @@ import {
} from './controllers/api/statuses.ts';
import { streamingController } from './controllers/api/streaming.ts';
import { indexController } from './controllers/site.ts';
import { hostMetaController } from './controllers/well-known/host-meta.ts';
import { nostrController } from './controllers/well-known/nostr.ts';
import { hostMetaController, webfingerController } from './controllers/well-known/webfinger.ts';
import { webfingerController } from './controllers/well-known/webfinger.ts';
import { auth19, requireAuth } from './middleware/auth19.ts';
import { auth98 } from './middleware/auth98.ts';

View File

@ -0,0 +1,15 @@
import { Conf } from '@/config.ts';
import type { AppController } from '@/app.ts';
const hostMetaController: AppController = (c) => {
const template = Conf.local('/.well-known/webfinger?resource={uri}');
c.header('content-type', 'application/xrd+xml');
return c.body(
`<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><Link rel="lrdd" template="${template}" type="application/xrd+xml" /></XRD>`,
);
};
export { hostMetaController };

View File

@ -91,13 +91,4 @@ function renderWebfinger({ pubkey, username, subject }: RenderWebfingerOpts): We
};
}
const hostMetaController: AppController = (c) => {
const template = Conf.local('/.well-known/webfinger?resource={uri}');
c.header('content-type', 'application/xrd+xml');
return c.body(
`<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><Link rel="lrdd" template="${template}" type="application/xrd+xml" /></XRD>`,
);
};
export { hostMetaController, webfingerController };
export { webfingerController };