blob: 0bca925a00ac0fd16cd03af5eec160468c0b2ed9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
import config from 'config'
const baseURL = config.get('service.baseURL')
/**
* host-meta endpoint
* @type {import('express').RequestParamHandler}
*/
export const xmlMeta = async (_req, res) => {
return res.set('Content-Type', 'text/xml')
.send(`<?xml version="1.0" encoding="UTF-8"?><XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0"><Link rel="lrdd" template="${baseURL}/.well-known/webfinger?resource={uri}"/></XRD>`)
}
/**
* host-meta.json endpoint
* @type {import('express').RequestParamHandler}
*/
export const jsonMeta = async (_req, res) => {
return res.json({
'links': [
{
'rel': 'lrdd',
'template': `${baseURL}/.well-known/webfinger?resource={uri}`
}
]
})
}
/**
* nodeinfo endpoint
* @type {import('express').RequestParamHandler}
*/
export const nodeinfo = async (_req, res) => {
return res.json({
'links': [
{
'rel': 'https://nodeinfo.diaspora.software/ns/schema/2.0',
'href': `${baseURL}/.well-known/nodeinfo/2.0`
}
]
})
}
|