mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-09 11:41:30 -07:00
parent
16708be874
commit
4ebfd2360c
1 changed files with 2 additions and 40 deletions
|
@ -24,7 +24,6 @@ import type { UserPublickey } from "@/models/entities/user-publickey.js";
|
|||
import { shouldBlockInstance } from "@/misc/should-block-instance.js";
|
||||
import { verifySignature } from "@/remote/activitypub/check-fetch.js";
|
||||
import { tickInbox } from "@/metrics.js";
|
||||
import punycode from "punycode/";
|
||||
|
||||
const logger = new Logger("inbox");
|
||||
|
||||
|
@ -187,8 +186,8 @@ export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
|
|||
}
|
||||
}
|
||||
|
||||
// Update stats and get instance metadata
|
||||
const softwareName = await registerOrFetchInstanceDoc(authUser.user.host).then((i) => {
|
||||
// Update stats
|
||||
registerOrFetchInstanceDoc(authUser.user.host).then((i) => {
|
||||
Instances.update(i.id, {
|
||||
latestRequestReceivedAt: new Date(),
|
||||
lastCommunicatedAt: new Date(),
|
||||
|
@ -200,45 +199,8 @@ export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
|
|||
instanceChart.requestReceived(i.host);
|
||||
apRequestChart.inbox();
|
||||
federationChart.inbox(i.host);
|
||||
|
||||
return i.softwareName;
|
||||
});
|
||||
|
||||
if (activity.type === 'Like' && ["sharkey", "cutiekey"].includes(softwareName!)) {
|
||||
const emoji = activity._misskey_reaction || activity.content || activity.name;
|
||||
const custom = emoji.match(/^:([\w+-]+)(?:@\.)?:$/);
|
||||
let remove;
|
||||
if (custom) {
|
||||
const name = (custom[1] as string).replaceAll("_", "").toLowerCase();
|
||||
remove = name.includes("heart");
|
||||
} else {
|
||||
const root = punycode.ucs2.decode(emoji)[0];
|
||||
remove = [
|
||||
0x02661, // suit
|
||||
0x02665, // suit black
|
||||
0x02764, // heavy
|
||||
0x1f496, // sparkling
|
||||
0x1f497, // glowing
|
||||
0x1f499, // blue
|
||||
0x1f49a, // green
|
||||
0x1f49b, // yellow
|
||||
0x1f49c, // purple
|
||||
0x1f5a4, // black
|
||||
0x1f90d, // white
|
||||
0x1f90e, // brown
|
||||
0x1f9e1, // orange
|
||||
0x1fa75, // light blue
|
||||
0x1fa76, // grey
|
||||
0x1fa77, // pink
|
||||
].includes(root);
|
||||
}
|
||||
if (remove) {
|
||||
activity._misskey_reaction = undefined;
|
||||
activity.content = undefined;
|
||||
activity.name = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
const inbox = authUser.user.sharedInbox ?? authUser.user.inbox;
|
||||
if (inbox !== null) {
|
||||
const { host: inboxHost } = new URL(inbox);
|
||||
|
|
Loading…
Reference in a new issue