diff --git a/package.json b/package.json
index 78e39e69f..d31b74313 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "calckey",
- "version": "13.2.0-dev41",
+ "version": "13.2.0-dev42",
"codename": "aqua",
"repository": {
"type": "git",
diff --git a/packages/backend/src/server/activitypub.ts b/packages/backend/src/server/activitypub.ts
index d47e6f300..042ab446c 100644
--- a/packages/backend/src/server/activitypub.ts
+++ b/packages/backend/src/server/activitypub.ts
@@ -10,7 +10,13 @@ import { renderPerson } from "@/remote/activitypub/renderer/person.js";
import renderEmoji from "@/remote/activitypub/renderer/emoji.js";
import { inbox as processInbox } from "@/queue/index.js";
import { isSelfHost, toPuny } from "@/misc/convert-host.js";
-import { Notes, Users, Emojis, NoteReactions, FollowRequests } from "@/models/index.js";
+import {
+ Notes,
+ Users,
+ Emojis,
+ NoteReactions,
+ FollowRequests,
+} from "@/models/index.js";
import type { ILocalUser, User } from "@/models/entities/user.js";
import { renderLike } from "@/remote/activitypub/renderer/like.js";
import { getUserKeypair } from "@/misc/keypair-store.js";
@@ -330,40 +336,43 @@ router.get("/likes/:like", async (ctx) => {
});
// follow
-router.get("/follows/:follower/:followee", async (ctx: Router.RouterContext) => {
- const verify = await checkFetch(ctx.req);
- if (verify !== 200) {
- ctx.status = verify;
- return;
- }
- // This may be used before the follow is completed, so we do not
- // check if the following exists.
+router.get(
+ "/follows/:follower/:followee",
+ async (ctx: Router.RouterContext) => {
+ const verify = await checkFetch(ctx.req);
+ if (verify !== 200) {
+ ctx.status = verify;
+ return;
+ }
+ // This may be used before the follow is completed, so we do not
+ // check if the following exists.
- const [follower, followee] = await Promise.all([
- Users.findOneBy({
- id: ctx.params.follower,
- host: IsNull(),
- }),
- Users.findOneBy({
- id: ctx.params.followee,
- host: Not(IsNull()),
- }),
- ]);
+ const [follower, followee] = await Promise.all([
+ Users.findOneBy({
+ id: ctx.params.follower,
+ host: IsNull(),
+ }),
+ Users.findOneBy({
+ id: ctx.params.followee,
+ host: Not(IsNull()),
+ }),
+ ]);
- if (follower == null || followee == null) {
- ctx.status = 404;
- return;
- }
+ if (follower == null || followee == null) {
+ ctx.status = 404;
+ return;
+ }
- ctx.body = renderActivity(renderFollow(follower, followee));
- const meta = await fetchMeta();
- if (meta.secureMode || meta.privateMode) {
- ctx.set("Cache-Control", "private, max-age=0, must-revalidate");
- } else {
- ctx.set("Cache-Control", "public, max-age=180");
- }
- setResponseType(ctx);
-});
+ ctx.body = renderActivity(renderFollow(follower, followee));
+ const meta = await fetchMeta();
+ if (meta.secureMode || meta.privateMode) {
+ ctx.set("Cache-Control", "private, max-age=0, must-revalidate");
+ } else {
+ ctx.set("Cache-Control", "public, max-age=180");
+ }
+ setResponseType(ctx);
+ },
+);
// follow request
router.get("/follows/:followRequestId", async (ctx: Router.RouterContext) => {
diff --git a/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts b/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts
index 0c59b38f4..df85f2162 100644
--- a/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts
+++ b/packages/backend/src/server/api/mastodon/ApiMastodonCompatibleService.ts
@@ -70,7 +70,9 @@ export function apiMastodonCompatible(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.getInstanceAnnouncements();
- ctx.body = data.data.map(announcement => convertAnnouncement(announcement));
+ ctx.body = data.data.map((announcement) =>
+ convertAnnouncement(announcement),
+ );
} catch (e: any) {
console.error(e);
ctx.status = 401;
@@ -104,7 +106,7 @@ export function apiMastodonCompatible(router: Router): void {
// displayed without being logged in
try {
const data = await client.getFilters();
- ctx.body = data.data.map(filter => convertFilter(filter));
+ ctx.body = data.data.map((filter) => convertFilter(filter));
} catch (e: any) {
console.error(e);
ctx.status = 401;
diff --git a/packages/backend/src/server/api/mastodon/converters.ts b/packages/backend/src/server/api/mastodon/converters.ts
index d9a4f90ef..825d0f518 100644
--- a/packages/backend/src/server/api/mastodon/converters.ts
+++ b/packages/backend/src/server/api/mastodon/converters.ts
@@ -6,11 +6,21 @@ function simpleConvert(data: any) {
return data;
}
-export function convertAccount(account: Entity.Account) { return simpleConvert(account); }
-export function convertAnnouncement(announcement: Entity.Announcement) { return simpleConvert(announcement); }
-export function convertAttachment(attachment: Entity.Attachment) { return simpleConvert(attachment); }
-export function convertFilter(filter: Entity.Filter) { return simpleConvert(filter); }
-export function convertList(list: Entity.List) { return simpleConvert(list); }
+export function convertAccount(account: Entity.Account) {
+ return simpleConvert(account);
+}
+export function convertAnnouncement(announcement: Entity.Announcement) {
+ return simpleConvert(announcement);
+}
+export function convertAttachment(attachment: Entity.Attachment) {
+ return simpleConvert(attachment);
+}
+export function convertFilter(filter: Entity.Filter) {
+ return simpleConvert(filter);
+}
+export function convertList(list: Entity.List) {
+ return simpleConvert(list);
+}
export function convertNotification(notification: Entity.Notification) {
notification.account = convertAccount(notification.account);
@@ -20,25 +30,32 @@ export function convertNotification(notification: Entity.Notification) {
return notification;
}
-export function convertPoll(poll: Entity.Poll) { return simpleConvert(poll); }
-export function convertRelationship(relationship: Entity.Relationship) { return simpleConvert(relationship); }
+export function convertPoll(poll: Entity.Poll) {
+ return simpleConvert(poll);
+}
+export function convertRelationship(relationship: Entity.Relationship) {
+ return simpleConvert(relationship);
+}
export function convertStatus(status: Entity.Status) {
status.account = convertAccount(status.account);
status.id = convertId(status.id, IdType.MastodonId);
if (status.in_reply_to_account_id)
- status.in_reply_to_account_id = convertId(status.in_reply_to_account_id, IdType.MastodonId);
+ status.in_reply_to_account_id = convertId(
+ status.in_reply_to_account_id,
+ IdType.MastodonId,
+ );
if (status.in_reply_to_id)
status.in_reply_to_id = convertId(status.in_reply_to_id, IdType.MastodonId);
- status.media_attachments = status.media_attachments.map(attachment => convertAttachment(attachment));
- status.mentions = status.mentions.map(mention => ({
+ status.media_attachments = status.media_attachments.map((attachment) =>
+ convertAttachment(attachment),
+ );
+ status.mentions = status.mentions.map((mention) => ({
...mention,
id: convertId(mention.id, IdType.MastodonId),
}));
- if (status.poll)
- status.poll = convertPoll(status.poll);
- if (status.reblog)
- status.reblog = convertStatus(status.reblog);
+ if (status.poll) status.poll = convertPoll(status.poll);
+ if (status.reblog) status.reblog = convertStatus(status.reblog);
return status;
}
diff --git a/packages/backend/src/server/api/mastodon/endpoints/account.ts b/packages/backend/src/server/api/mastodon/endpoints/account.ts
index 2984c20e3..deb5dac30 100644
--- a/packages/backend/src/server/api/mastodon/endpoints/account.ts
+++ b/packages/backend/src/server/api/mastodon/endpoints/account.ts
@@ -5,7 +5,12 @@ import { FindOptionsWhere, IsNull } from "typeorm";
import { getClient } from "../ApiMastodonCompatibleService.js";
import { argsToBools, convertTimelinesArgsId, limitToInt } from "./timeline.js";
import { convertId, IdType } from "../../index.js";
-import { convertAccount, convertList, convertRelationship, convertStatus } from "../converters.js";
+import {
+ convertAccount,
+ convertList,
+ convertRelationship,
+ convertStatus,
+} from "../converters.js";
const relationshipModel = {
id: "",
@@ -112,7 +117,9 @@ export function apiAccountMastodon(router: Router): void {
}
const data = await client.getRelationships(reqIds);
- ctx.body = data.data.map(relationship => convertRelationship(relationship));
+ ctx.body = data.data.map((relationship) =>
+ convertRelationship(relationship),
+ );
} catch (e: any) {
console.error(e);
let data = e.response.data;
@@ -148,7 +155,7 @@ export function apiAccountMastodon(router: Router): void {
convertId(ctx.params.id, IdType.CalckeyId),
convertTimelinesArgsId(argsToBools(limitToInt(ctx.query as any))),
);
- ctx.body = data.data.map(status => convertStatus(status));
+ ctx.body = data.data.map((status) => convertStatus(status));
} catch (e: any) {
console.error(e);
console.error(e.response.data);
@@ -168,7 +175,7 @@ export function apiAccountMastodon(router: Router): void {
convertId(ctx.params.id, IdType.CalckeyId),
convertTimelinesArgsId(limitToInt(ctx.query as any)),
);
- ctx.body = data.data.map(account => convertAccount(account));
+ ctx.body = data.data.map((account) => convertAccount(account));
} catch (e: any) {
console.error(e);
console.error(e.response.data);
@@ -188,7 +195,7 @@ export function apiAccountMastodon(router: Router): void {
convertId(ctx.params.id, IdType.CalckeyId),
convertTimelinesArgsId(limitToInt(ctx.query as any)),
);
- ctx.body = data.data.map(account => convertAccount(account));
+ ctx.body = data.data.map((account) => convertAccount(account));
} catch (e: any) {
console.error(e);
console.error(e.response.data);
@@ -205,9 +212,9 @@ export function apiAccountMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.getAccountLists(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
- ctx.body = data.data.map(list => convertList(list));
+ ctx.body = data.data.map((list) => convertList(list));
} catch (e: any) {
console.error(e);
console.error(e.response.data);
@@ -340,10 +347,10 @@ export function apiAccountMastodon(router: Router): void {
const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens);
try {
- const data = (await client.getBookmarks(
+ const data = await client.getBookmarks(
convertTimelinesArgsId(limitToInt(ctx.query as any)),
- ));
- ctx.body = data.data.map(status => convertStatus(status));
+ );
+ ctx.body = data.data.map((status) => convertStatus(status));
} catch (e: any) {
console.error(e);
console.error(e.response.data);
@@ -356,8 +363,10 @@ export function apiAccountMastodon(router: Router): void {
const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens);
try {
- const data = await client.getFavourites(convertTimelinesArgsId(limitToInt(ctx.query as any)));
- ctx.body = data.data.map(status => convertStatus(status));
+ const data = await client.getFavourites(
+ convertTimelinesArgsId(limitToInt(ctx.query as any)),
+ );
+ ctx.body = data.data.map((status) => convertStatus(status));
} catch (e: any) {
console.error(e);
console.error(e.response.data);
@@ -370,8 +379,10 @@ export function apiAccountMastodon(router: Router): void {
const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens);
try {
- const data = await client.getMutes(convertTimelinesArgsId(limitToInt(ctx.query as any)));
- ctx.body = data.data.map(account => convertAccount(account));
+ const data = await client.getMutes(
+ convertTimelinesArgsId(limitToInt(ctx.query as any)),
+ );
+ ctx.body = data.data.map((account) => convertAccount(account));
} catch (e: any) {
console.error(e);
console.error(e.response.data);
@@ -384,8 +395,10 @@ export function apiAccountMastodon(router: Router): void {
const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens);
try {
- const data = await client.getBlocks(convertTimelinesArgsId(limitToInt(ctx.query as any)));
- ctx.body = data.data.map(account => convertAccount(account));
+ const data = await client.getBlocks(
+ convertTimelinesArgsId(limitToInt(ctx.query as any)),
+ );
+ ctx.body = data.data.map((account) => convertAccount(account));
} catch (e: any) {
console.error(e);
console.error(e.response.data);
@@ -401,7 +414,7 @@ export function apiAccountMastodon(router: Router): void {
const data = await client.getFollowRequests(
((ctx.query as any) || { limit: 20 }).limit,
);
- ctx.body = data.data.map(account => convertAccount(account));
+ ctx.body = data.data.map((account) => convertAccount(account));
} catch (e: any) {
console.error(e);
console.error(e.response.data);
diff --git a/packages/backend/src/server/api/mastodon/endpoints/filter.ts b/packages/backend/src/server/api/mastodon/endpoints/filter.ts
index 7343fc337..c99031b0c 100644
--- a/packages/backend/src/server/api/mastodon/endpoints/filter.ts
+++ b/packages/backend/src/server/api/mastodon/endpoints/filter.ts
@@ -12,7 +12,7 @@ export function apiFilterMastodon(router: Router): void {
const body: any = ctx.request.body;
try {
const data = await client.getFilters();
- ctx.body = data.data.map(filter => convertFilter(filter));
+ ctx.body = data.data.map((filter) => convertFilter(filter));
} catch (e: any) {
console.error(e);
ctx.status = 401;
@@ -27,7 +27,7 @@ export function apiFilterMastodon(router: Router): void {
const body: any = ctx.request.body;
try {
const data = await client.getFilter(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = convertFilter(data.data);
} catch (e: any) {
@@ -78,7 +78,7 @@ export function apiFilterMastodon(router: Router): void {
const body: any = ctx.request.body;
try {
const data = await client.deleteFilter(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = data.data;
} catch (e: any) {
diff --git a/packages/backend/src/server/api/mastodon/endpoints/notifications.ts b/packages/backend/src/server/api/mastodon/endpoints/notifications.ts
index 868377b78..ac091855f 100644
--- a/packages/backend/src/server/api/mastodon/endpoints/notifications.ts
+++ b/packages/backend/src/server/api/mastodon/endpoints/notifications.ts
@@ -17,7 +17,9 @@ export function apiNotificationsMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
const body: any = ctx.request.body;
try {
- const data = await client.getNotifications(convertTimelinesArgsId(toLimitToInt(ctx.query)));
+ const data = await client.getNotifications(
+ convertTimelinesArgsId(toLimitToInt(ctx.query)),
+ );
const notfs = data.data;
const ret = notfs.map((n) => {
n = convertNotification(n);
@@ -47,7 +49,7 @@ export function apiNotificationsMastodon(router: Router): void {
const body: any = ctx.request.body;
try {
const dataRaw = await client.getNotification(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
const data = convertNotification(dataRaw.data);
if (data.type !== "follow" && data.type !== "follow_request") {
@@ -85,7 +87,7 @@ export function apiNotificationsMastodon(router: Router): void {
const body: any = ctx.request.body;
try {
const data = await client.dismissNotification(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = data.data;
} catch (e: any) {
diff --git a/packages/backend/src/server/api/mastodon/endpoints/search.ts b/packages/backend/src/server/api/mastodon/endpoints/search.ts
index 98349cfd2..e1aec3488 100644
--- a/packages/backend/src/server/api/mastodon/endpoints/search.ts
+++ b/packages/backend/src/server/api/mastodon/endpoints/search.ts
@@ -32,14 +32,16 @@ export function apiSearchMastodon(router: Router): void {
const type = query.type;
if (type) {
const data = await client.search(query.q, type, query);
- ctx.body = data.data.accounts.map(account => convertAccount(account));
+ ctx.body = data.data.accounts.map((account) => convertAccount(account));
} else {
const acct = await client.search(query.q, "accounts", query);
const stat = await client.search(query.q, "statuses", query);
const tags = await client.search(query.q, "hashtags", query);
ctx.body = {
- accounts: acct.data.accounts.map(account => convertAccount(account)),
- statuses: stat.data.statuses.map(status => convertStatus(status)),
+ accounts: acct.data.accounts.map((account) =>
+ convertAccount(account),
+ ),
+ statuses: stat.data.statuses.map((status) => convertStatus(status)),
hashtags: tags.data.hashtags,
};
}
@@ -58,7 +60,7 @@ export function apiSearchMastodon(router: Router): void {
ctx.request.hostname,
accessTokens,
);
- ctx.body = data.map(status => convertStatus(status));
+ ctx.body = data.map((status) => convertStatus(status));
} catch (e: any) {
console.error(e);
ctx.status = 401;
@@ -76,7 +78,7 @@ export function apiSearchMastodon(router: Router): void {
accessTokens,
query.limit || 20,
);
- data = data.map(suggestion => {
+ data = data.map((suggestion) => {
suggestion.account = convertAccount(suggestion.account);
return suggestion;
});
diff --git a/packages/backend/src/server/api/mastodon/endpoints/status.ts b/packages/backend/src/server/api/mastodon/endpoints/status.ts
index 27b30d113..a479140e0 100644
--- a/packages/backend/src/server/api/mastodon/endpoints/status.ts
+++ b/packages/backend/src/server/api/mastodon/endpoints/status.ts
@@ -6,7 +6,12 @@ import querystring from "node:querystring";
import qs from "qs";
import { convertTimelinesArgsId, limitToInt } from "./timeline.js";
import { convertId, IdType } from "../../index.js";
-import { convertAccount, convertAttachment, convertPoll, convertStatus } from "../converters.js";
+import {
+ convertAccount,
+ convertAttachment,
+ convertPoll,
+ convertStatus,
+} from "../converters.js";
function normalizeQuery(data: any) {
const str = querystring.stringify(data);
@@ -86,7 +91,7 @@ export function apiStatusMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.deleteStatus(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = data.data;
} catch (e: any) {
@@ -134,8 +139,12 @@ export function apiStatusMastodon(router: Router): void {
text,
),
);
- data.data.ancestors = data.data.ancestors.map(status => convertStatus(status));
- data.data.descendants = data.data.descendants.map(status => convertStatus(status));
+ data.data.ancestors = data.data.ancestors.map((status) =>
+ convertStatus(status),
+ );
+ data.data.descendants = data.data.descendants.map((status) =>
+ convertStatus(status),
+ );
ctx.body = data.data;
} catch (e: any) {
console.error(e);
@@ -152,9 +161,9 @@ export function apiStatusMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.getStatusRebloggedBy(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
- ctx.body = data.data.map(account => convertAccount(account));
+ ctx.body = data.data.map((account) => convertAccount(account));
} catch (e: any) {
console.error(e);
ctx.status = 401;
@@ -200,7 +209,7 @@ export function apiStatusMastodon(router: Router): void {
try {
const data = await client.deleteEmojiReaction(
convertId(ctx.params.id, IdType.CalckeyId),
- react
+ react,
);
ctx.body = convertStatus(data.data);
} catch (e: any) {
@@ -219,7 +228,7 @@ export function apiStatusMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.reblogStatus(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = convertStatus(data.data);
} catch (e: any) {
@@ -238,7 +247,7 @@ export function apiStatusMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.unreblogStatus(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = convertStatus(data.data);
} catch (e: any) {
@@ -257,7 +266,7 @@ export function apiStatusMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.bookmarkStatus(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = convertStatus(data.data);
} catch (e: any) {
@@ -276,7 +285,7 @@ export function apiStatusMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.unbookmarkStatus(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = convertStatus(data.data);
} catch (e: any) {
@@ -295,7 +304,7 @@ export function apiStatusMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.pinStatus(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = convertStatus(data.data);
} catch (e: any) {
@@ -314,7 +323,7 @@ export function apiStatusMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.unpinStatus(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = convertStatus(data.data);
} catch (e: any) {
@@ -330,7 +339,7 @@ export function apiStatusMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.getMedia(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = convertAttachment(data.data);
} catch (e: any) {
@@ -361,7 +370,7 @@ export function apiStatusMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.getPoll(
- convertId(ctx.params.id, IdType.CalckeyId)
+ convertId(ctx.params.id, IdType.CalckeyId),
);
ctx.body = convertPoll(data.data);
} catch (e: any) {
diff --git a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts
index 268c6a161..b8ef0929e 100644
--- a/packages/backend/src/server/api/mastodon/endpoints/timeline.ts
+++ b/packages/backend/src/server/api/mastodon/endpoints/timeline.ts
@@ -109,9 +109,13 @@ export function apiTimelineMastodon(router: Router): void {
try {
const query: any = ctx.query;
const data = query.local
- ? await client.getLocalTimeline(convertTimelinesArgsId(argsToBools(limitToInt(query))))
- : await client.getPublicTimeline(convertTimelinesArgsId(argsToBools(limitToInt(query))));
- let resp = data.data.map(status => convertStatus(status));
+ ? await client.getLocalTimeline(
+ convertTimelinesArgsId(argsToBools(limitToInt(query))),
+ )
+ : await client.getPublicTimeline(
+ convertTimelinesArgsId(argsToBools(limitToInt(query))),
+ );
+ let resp = data.data.map((status) => convertStatus(status));
ctx.body = toTextWithReaction(resp, ctx.hostname);
} catch (e: any) {
console.error(e);
@@ -131,7 +135,7 @@ export function apiTimelineMastodon(router: Router): void {
ctx.params.hashtag,
convertTimelinesArgsId(argsToBools(limitToInt(ctx.query))),
);
- let resp = data.data.map(status => convertStatus(status));
+ let resp = data.data.map((status) => convertStatus(status));
ctx.body = toTextWithReaction(resp, ctx.hostname);
} catch (e: any) {
console.error(e);
@@ -146,8 +150,10 @@ export function apiTimelineMastodon(router: Router): void {
const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens);
try {
- const data = await client.getHomeTimeline(convertTimelinesArgsId(limitToInt(ctx.query)));
- let resp = data.data.map(status => convertStatus(status));
+ const data = await client.getHomeTimeline(
+ convertTimelinesArgsId(limitToInt(ctx.query)),
+ );
+ let resp = data.data.map((status) => convertStatus(status));
ctx.body = toTextWithReaction(resp, ctx.hostname);
} catch (e: any) {
console.error(e);
@@ -167,7 +173,7 @@ export function apiTimelineMastodon(router: Router): void {
convertId(ctx.params.listId, IdType.CalckeyId),
convertTimelinesArgsId(limitToInt(ctx.query)),
);
- let resp = data.data.map(status => convertStatus(status));
+ let resp = data.data.map((status) => convertStatus(status));
ctx.body = toTextWithReaction(resp, ctx.hostname);
} catch (e: any) {
console.error(e);
@@ -182,7 +188,9 @@ export function apiTimelineMastodon(router: Router): void {
const accessTokens = ctx.headers.authorization;
const client = getClient(BASE_URL, accessTokens);
try {
- const data = await client.getConversationTimeline(convertTimelinesArgsId(limitToInt(ctx.query)));
+ const data = await client.getConversationTimeline(
+ convertTimelinesArgsId(limitToInt(ctx.query)),
+ );
ctx.body = data.data;
} catch (e: any) {
console.error(e);
@@ -197,7 +205,7 @@ export function apiTimelineMastodon(router: Router): void {
const client = getClient(BASE_URL, accessTokens);
try {
const data = await client.getLists();
- ctx.body = data.data.map(list => convertList(list));
+ ctx.body = data.data.map((list) => convertList(list));
} catch (e: any) {
console.error(e);
console.error(e.response.data);
@@ -247,7 +255,7 @@ export function apiTimelineMastodon(router: Router): void {
try {
const data = await client.updateList(
convertId(ctx.params.id, IdType.CalckeyId),
- (ctx.request.body as any).title
+ (ctx.request.body as any).title,
);
ctx.body = convertList(data.data);
} catch (e: any) {
@@ -288,7 +296,7 @@ export function apiTimelineMastodon(router: Router): void {
convertId(ctx.params.id, IdType.CalckeyId),
convertTimelinesArgsId(ctx.query as any),
);
- ctx.body = data.data.map(account => convertAccount(account));
+ ctx.body = data.data.map((account) => convertAccount(account));
} catch (e: any) {
console.error(e);
console.error(e.response.data);
@@ -306,7 +314,9 @@ export function apiTimelineMastodon(router: Router): void {
try {
const data = await client.addAccountsToList(
convertId(ctx.params.id, IdType.CalckeyId),
- (ctx.query.account_ids as string[]).map(id => convertId(id, IdType.CalckeyId)),
+ (ctx.query.account_ids as string[]).map((id) =>
+ convertId(id, IdType.CalckeyId),
+ ),
);
ctx.body = data.data;
} catch (e: any) {
@@ -326,7 +336,9 @@ export function apiTimelineMastodon(router: Router): void {
try {
const data = await client.deleteAccountsFromList(
convertId(ctx.params.id, IdType.CalckeyId),
- (ctx.query.account_ids as string[]).map(id => convertId(id, IdType.CalckeyId)),
+ (ctx.query.account_ids as string[]).map((id) =>
+ convertId(id, IdType.CalckeyId),
+ ),
);
ctx.body = data.data;
} catch (e: any) {
diff --git a/packages/backend/src/server/web/index.ts b/packages/backend/src/server/web/index.ts
index 270026dcc..f1e0ed692 100644
--- a/packages/backend/src/server/web/index.ts
+++ b/packages/backend/src/server/web/index.ts
@@ -402,8 +402,10 @@ router.get("/notes/:note", async (ctx, next) => {
try {
if (note) {
const _note = await Notes.pack(note);
-
- const profile = await UserProfiles.findOneByOrFail({ userId: note.userId });
+
+ const profile = await UserProfiles.findOneByOrFail({
+ userId: note.userId,
+ });
const meta = await fetchMeta();
await ctx.render("note", {
note: _note,
diff --git a/packages/client/src/components/MkPostForm.vue b/packages/client/src/components/MkPostForm.vue
index 1e8d363d8..60d5dee2f 100644
--- a/packages/client/src/components/MkPostForm.vue
+++ b/packages/client/src/components/MkPostForm.vue
@@ -462,18 +462,23 @@ if (
props.reply &&
["home", "followers", "specified"].includes(props.reply.visibility)
) {
- if (props.reply.visibility === 'home' && visibility === 'followers') {
- visibility = 'followers';
- } else if (['home', 'followers'].includes(props.reply.visibility) && visibility === 'specified') {
- visibility = 'specified';
+ if (props.reply.visibility === "home" && visibility === "followers") {
+ visibility = "followers";
+ } else if (
+ ["home", "followers"].includes(props.reply.visibility) &&
+ visibility === "specified"
+ ) {
+ visibility = "specified";
} else {
visibility = props.reply.visibility;
}
- if (visibility === 'specified') {
+ if (visibility === "specified") {
if (props.reply.visibleUserIds) {
- os.api('users/show', {
- userIds: props.reply.visibleUserIds.filter(uid => uid !== $i.id && uid !== props.reply.userId),
- }).then(users => {
+ os.api("users/show", {
+ userIds: props.reply.visibleUserIds.filter(
+ (uid) => uid !== $i.id && uid !== props.reply.userId
+ ),
+ }).then((users) => {
users.forEach(pushVisibleUser);
});
}
diff --git a/packages/client/src/components/MkShowMoreButton.vue b/packages/client/src/components/MkShowMoreButton.vue
index 3516d6f43..3e91d03fe 100644
--- a/packages/client/src/components/MkShowMoreButton.vue
+++ b/packages/client/src/components/MkShowMoreButton.vue
@@ -1,16 +1,8 @@
-
diff --git a/packages/client/src/components/MkSubNoteContent.vue b/packages/client/src/components/MkSubNoteContent.vue
index 1d505682b..0f4422ee1 100644
--- a/packages/client/src/components/MkSubNoteContent.vue
+++ b/packages/client/src/components/MkSubNoteContent.vue
@@ -115,7 +115,10 @@
v-on:focus="cwButton?.focus()"
>
-