social-butterfly
Version:
Incorporate federated social network protocols easily. Used with Hello, world federated blog.
25 lines (22 loc) • 787 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = hostMeta;
var _url_factory = require("./util/url_factory");
function hostMeta(req, res) {
const webFingerUrl = (0, _url_factory.buildUrl)({
req,
pathname: `/.well-known/webfinger`
});
res.type('application/xrd+xml');
res.send(`<?xml version="1.0" encoding="UTF-8"?>
<XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xmlns:hm="http://host-meta.net/xrd/1.0">
<hm:Host>${(0, _url_factory.buildUrl)({
req,
pathname: ''
})}</hm:Host>
<Link rel="lrdd" type="application/json" template="${webFingerUrl}?resource={uri}" />
<Link rel="lrdd" type="application/xrd+xml" template="${webFingerUrl}?format=xml&resource={uri}" />
</XRD>`);
}