feat(netlify): add an edge function for WebFinger

This commit is contained in:
Harsh Shandilya 2022-11-16 00:41:30 +05:30
parent e8f357a125
commit 1b8466c0b4
2 changed files with 33 additions and 0 deletions

View File

@ -8,3 +8,8 @@
[[edge_functions]]
path = "/*"
function = "root"
[[edge_functions]]
function = "webfinger"
path = "/.well-known/webfinger"

View File

@ -0,0 +1,28 @@
import type { Context } from "https://edge.netlify.com";
export default async (request: Request, context: Context) => {
context.log(request.url);
return context.json({
subject: "acct:msfjarvis@androiddev.social",
aliases: [
"https://androiddev.social/@msfjarvis",
"https://androiddev.social/users/msfjarvis",
],
links: [
{
rel: "http://webfinger.net/rel/profile-page",
type: "text/html",
href: "https://androiddev.social/@msfjarvis",
},
{
rel: "self",
type: "application/activity+json",
href: "https://androiddev.social/users/msfjarvis",
},
{
rel: "http://ostatus.org/schema/1.0/subscribe",
template: "https://androiddev.social/authorize_interaction?uri={uri}",
},
],
});
};