Compare commits
2 Commits
5e298ce255
...
d8911be6ea
Author | SHA1 | Date |
---|---|---|
Moon Man | d8911be6ea | |
Moon Man | 677e8c9b27 |
|
@ -161,7 +161,7 @@ export const deleteArticleActivity = (article: Article, user: User) => {
|
|||
const canonicalUrl = `https://${process.env.blog_host}/${article.slug}.html`;
|
||||
|
||||
const activity: Record<string, any> = {
|
||||
id: fillRoute("activity", article.id + 1_000_000_000),
|
||||
id: fillRoute("activity", article.id) + "/delete",
|
||||
"@context": CONTEXT,
|
||||
summary: `${user.nickname} deleted article ${canonicalUrl}`,
|
||||
type: "Delete",
|
||||
|
@ -177,8 +177,7 @@ export const deleteArticleActivity = (article: Article, user: User) => {
|
|||
|
||||
export const createArticleActivity = (article: Article, user: User) => {
|
||||
const actor = fillRoute("actor", user.nickname);
|
||||
const published = typeof article.created_at === "number" ? new Date(article.created_at) : article.created_at;
|
||||
const canonicalUrl = `https://${process.env.blog_host}/${article.slug}.html`;
|
||||
const published = article.created_at;
|
||||
const context = fillRoute("context", article.id);
|
||||
const followers = fillRoute("followers", user.nickname);
|
||||
const activity: Record<string, any> = {
|
||||
|
@ -192,29 +191,7 @@ export const createArticleActivity = (article: Article, user: User) => {
|
|||
published
|
||||
};
|
||||
|
||||
const objectId = fillRoute("object", article.id);
|
||||
const content = readFileSync(article.file as string, "utf-8") + `
|
||||
|
||||
[Read on site](${canonicalUrl})
|
||||
`;
|
||||
|
||||
activity.object = {
|
||||
id: objectId,
|
||||
actor,
|
||||
attributedTo: actor,
|
||||
type: "Note",
|
||||
context,
|
||||
content: md.render(content),
|
||||
to: [PUBLIC],
|
||||
cc: [followers],
|
||||
url: canonicalUrl,
|
||||
mediaType: "text/html",
|
||||
source: {
|
||||
mediaType: "text/markdown",
|
||||
content
|
||||
},
|
||||
published
|
||||
};
|
||||
activity.object = createArticleObject(article, user.nickname);
|
||||
|
||||
return activity;
|
||||
};
|
||||
|
@ -230,7 +207,7 @@ export const createArticleObject = (article: Article, nickname: string) => {
|
|||
[Read on site](${canonicalUrl})
|
||||
`;
|
||||
|
||||
const published = typeof article.created_at === "number" ? new Date(article.created_at) : article.created_at;
|
||||
const published = article.created_at;
|
||||
|
||||
const followers = fillRoute("followers", nickname);
|
||||
|
||||
|
|
Loading…
Reference in New Issue