Compare commits

...

2 Commits

Author SHA1 Message Date
Moon Man 5423bf31b7 use keyid builder 2024-01-01 07:50:00 -05:00
Moon Man c05d5a66c9 consistent key querying 2024-01-01 07:48:55 -05:00
2 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import fs from "node:fs";
import markdownit from 'markdown-it'
import { slugRegex } from "./article.js";
import { newUser, get as getUserByNickname, getFollowerInboxes } from "./user.js";
import { newUser, get as getUserByNickname, getFollowerInboxes, keyIdFromNickname } from "./user.js";
import { insert as insertArticle } from "./article.js";
import { add as addToOutbox } from "./outbox.js";
import { createArticleActivity, sendAll } from "./activity.js";
@ -62,7 +62,7 @@ ${rendered}
await addToOutbox(article.id);
const keyId = fillRoute("actor", user.nickname) + "#main-key";
const keyId = keyIdFromNickname(user.nickname);
const inboxes = await getFollowerInboxes(user.id);
const activity = createArticleActivity(article, user);
const success = await sendAll(keyId, user.private_key, activity, inboxes);

View File

@ -107,4 +107,4 @@ export const getFollowerInboxes = async (userId: number): Promise<string[]> =>
return [...inboxes];
});
export const getKeyId = (nickname: string) => fillRoute("actor", nickname) + "#main-key";
export const keyIdFromNickname = (nickname: string) => fillRoute("actor", nickname) + "#main-key";