Compare commits

...

7 Commits

Author SHA1 Message Date
1b51bafee1 ss 2025-02-09 12:51:21 +00:00
0a8601279e s 2025-02-09 12:35:36 +00:00
40883ac425 s 2025-02-09 12:01:27 +00:00
c371e69d19 s 2025-02-09 11:59:18 +00:00
a3709f0cb1 s 2025-02-09 11:57:57 +00:00
899dcb9efe s 2025-02-09 11:52:46 +00:00
2f877fe36b s 2025-02-09 11:51:01 +00:00
5 changed files with 26 additions and 13 deletions

View File

@ -11,13 +11,13 @@ export default async function (req: VercelRequest, res: VercelResponse) {
res.status(200).setHeader("Content-Type", "application/activity+json").json({ res.status(200).setHeader("Content-Type", "application/activity+json").json({
"@context": ["https://www.w3.org/ns/activitystreams", { "@language": "en-US" }], "@context": ["https://www.w3.org/ns/activitystreams", { "@language": "en-US" }],
"type": "Person", "type": "Person",
"id": "https://coderrrrr.site/coder", "id": "https://coderrrrr.site/blog",
"outbox": "https://coderrrrr.site/api/activitypub/outbox", "outbox": "https://coderrrrr.site/api/activitypub/outbox",
"following": "https://coderrrrr.site/api/activitypub/following", "following": "https://coderrrrr.site/api/activitypub/following",
"followers": "https://coderrrrr.site/api/activitypub/followers", "followers": "https://coderrrrr.site/api/activitypub/followers",
"sharedInbox": "https://coderrrrr.site/api/activitypub/sharedInbox", "sharedInbox": "https://coderrrrr.site/api/activitypub/sharedInbox",
"inbox": "https://coderrrrr.site/api/activitypub/inbox", "inbox": "https://coderrrrr.site/api/activitypub/inbox",
"preferredUsername": "coder", "preferredUsername": "blog",
"name": "Deva Midhun's blog", "name": "Deva Midhun's blog",
"discoverable": true, "discoverable": true,
"indexable": true, "indexable": true,
@ -50,8 +50,8 @@ export default async function (req: VercelRequest, res: VercelResponse) {
"publicKey": { "publicKey": {
"@context": "https://w3id.org/security/v1", "@context": "https://w3id.org/security/v1",
"@type": "Key", "@type": "Key",
"id": "https://coderrrrr.site/coder#main-key", "id": "https://coderrrrr.site/blog#main-key",
"owner": "https://coderrrrr.site/coder", "owner": "https://coderrrrr.site/blog",
"publicKeyPem": process.env.ACTIVITYPUB_PUBLIC_KEY || "MISSING_PUBLIC_KEY" "publicKeyPem": process.env.ACTIVITYPUB_PUBLIC_KEY || "MISSING_PUBLIC_KEY"
} }
}); });

7
api/activitypub/old.ts Normal file
View File

@ -0,0 +1,7 @@
import type { VercelRequest, VercelResponse } from "@vercel/node";
export default function (req: VercelRequest, res: VercelResponse) {
res.status(410).json({
error: "This account no longer exists."
});
};

View File

@ -5,21 +5,21 @@ export default function (req: VercelRequest, res: VercelResponse) {
res.statusCode = 200; res.statusCode = 200;
res.setHeader("Content-Type", `application/jrd+json`); res.setHeader("Content-Type", `application/jrd+json`);
res.end(`{ res.end(`{
"subject": "acct:coder@coderrrrr.site", "subject": "acct:blog@coderrrrr.site",
"aliases": [ "aliases": [
"https://coderrrrr.site/coder", "https://coderrrrr.site/blog",
"https://coderrrrr.site/@coder" "https://coderrrrr.site/@blog"
], ],
"links": [ "links": [
{ {
"rel": "http://webfinger.net/rel/profile-page", "rel": "http://webfinger.net/rel/profile-page",
"type": "text/html", "type": "text/html",
"href": "https://coderrrrr.site/coder" "href": "https://coderrrrr.site/blog"
}, },
{ {
"rel": "self", "rel": "self",
"type": "application/activity+json", "type": "application/activity+json",
"href": "https://coderrrrr.site/coder" "href": "https://coderrrrr.site/blog"
}, },
{ {
"rel": "http://ostatus.org/schema/1.0/subscribe", "rel": "http://ostatus.org/schema/1.0/subscribe",

View File

@ -1,4 +1,4 @@
function verifySignature(signature:any, publicKeyJson:any) { function verifySignature(signature, publicKeyJson) {
let signatureValid; let signatureValid;
try { try {
@ -12,3 +12,5 @@ function verifySignature(signature:any, publicKeyJson:any) {
return signatureValid; return signatureValid;
} }
module.exports = { verifySignature };

View File

@ -1,12 +1,12 @@
{ {
"functions": { "functions": {
"api/**/*": { "api/**/*": {
"maxDuration": 240 "maxDuration": 60
} }
}, },
"crons": [{ "crons": [{
"path": "/api/activitypub/sendNote.ts", "path": "/api/activitypub/sendNote.ts",
"schedule": "0 * * * *" "schedule": "0 0 * * *"
}], }],
"redirects": [ "redirects": [
{ {
@ -32,9 +32,13 @@
"destination": "/api/activitypub/authorize_interaction.ts" "destination": "/api/activitypub/authorize_interaction.ts"
}, },
{ {
"source": "/coder", "source": "/blog",
"destination": "/api/activitypub/actor.ts" "destination": "/api/activitypub/actor.ts"
}, },
{
"source": "/coder",
"destination": "/api/activitypub/old.ts"
},
{ {
"source": "/followers", "source": "/followers",
"destination": "/api/activitypub/followers.ts" "destination": "/api/activitypub/followers.ts"