Merge remote-tracking branch 'origin/develop' into fix/failed-follow

This commit is contained in:
Kaity A 2024-02-24 05:05:25 +00:00
commit def2e8dff0
No known key found for this signature in database
GPG key ID: E18FEFAE47FF0ACB
1872 changed files with 6613 additions and 4661 deletions

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
@ -58,6 +58,8 @@ type Source = {
scope?: 'local' | 'global' | string[];
};
publishTarballInsteadOfProvideRepositoryUrl?: boolean;
proxy?: string;
proxySmtp?: string;
proxyBypassHosts?: string[];
@ -153,6 +155,7 @@ export type Config = {
checkActivityPubGetSignature: boolean | undefined;
version: string;
publishTarballInsteadOfProvideRepositoryUrl: boolean;
host: string;
hostname: string;
scheme: string;
@ -224,6 +227,7 @@ export function loadConfig(): Config {
return {
version,
publishTarballInsteadOfProvideRepositoryUrl: !!config.publishTarballInsteadOfProvideRepositoryUrl,
url: url.origin,
port: config.port ?? parseInt(process.env.PORT ?? '', 10),
socket: config.socket,

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
@ -16,10 +16,10 @@ import type { OnApplicationShutdown } from '@nestjs/common';
@Injectable()
export class CacheService implements OnApplicationShutdown {
public userByIdCache: MemoryKVCache<MiUser, MiUser | string>;
public localUserByNativeTokenCache: MemoryKVCache<MiLocalUser | null, string | null>;
public userByIdCache: MemoryKVCache<MiUser>;
public localUserByNativeTokenCache: MemoryKVCache<MiLocalUser | null>;
public localUserByIdCache: MemoryKVCache<MiLocalUser>;
public uriPersonCache: MemoryKVCache<MiUser | null, string | null>;
public uriPersonCache: MemoryKVCache<MiUser | null>;
public userProfileCache: RedisKVCache<MiUserProfile>;
public userMutingsCache: RedisKVCache<Set<string>>;
public userBlockingCache: RedisKVCache<Set<string>>;
@ -56,41 +56,10 @@ export class CacheService implements OnApplicationShutdown {
) {
//this.onMessage = this.onMessage.bind(this);
const localUserByIdCache = new MemoryKVCache<MiLocalUser>(1000 * 60 * 60 * 6 /* 6h */);
this.localUserByIdCache = localUserByIdCache;
// ローカルユーザーならlocalUserByIdCacheにデータを追加し、こちらにはid(文字列)だけを追加する
const userByIdCache = new MemoryKVCache<MiUser, MiUser | string>(1000 * 60 * 60 * 6 /* 6h */, {
toMapConverter: user => {
if (user.host === null) {
localUserByIdCache.set(user.id, user as MiLocalUser);
return user.id;
}
return user;
},
fromMapConverter: userOrId => typeof userOrId === 'string' ? localUserByIdCache.get(userOrId) : userOrId,
});
this.userByIdCache = userByIdCache;
this.localUserByNativeTokenCache = new MemoryKVCache<MiLocalUser | null, string | null>(Infinity, {
toMapConverter: user => {
if (user === null) return null;
localUserByIdCache.set(user.id, user);
return user.id;
},
fromMapConverter: id => id === null ? null : localUserByIdCache.get(id),
});
this.uriPersonCache = new MemoryKVCache<MiUser | null, string | null>(Infinity, {
toMapConverter: user => {
if (user === null) return null;
userByIdCache.set(user.id, user);
return user.id;
},
fromMapConverter: id => id === null ? null : userByIdCache.get(id),
});
this.userByIdCache = new MemoryKVCache<MiUser>(Infinity);
this.localUserByNativeTokenCache = new MemoryKVCache<MiLocalUser | null>(Infinity);
this.localUserByIdCache = new MemoryKVCache<MiLocalUser>(Infinity);
this.uriPersonCache = new MemoryKVCache<MiUser | null>(Infinity);
this.userProfileCache = new RedisKVCache<MiUserProfile>(this.redisClient, 'userProfile', {
lifetime: 1000 * 60 * 30, // 30m
@ -160,16 +129,25 @@ export class CacheService implements OnApplicationShutdown {
switch (type) {
case 'userChangeSuspendedState':
case 'remoteUserUpdated': {
const user = await this.usersRepository.findOneByOrFail({ id: body.id });
this.userByIdCache.set(user.id, user);
for (const [k, v] of this.uriPersonCache.cache.entries()) {
if (v.value === user.id) {
this.uriPersonCache.set(k, user);
const user = await this.usersRepository.findOneBy({ id: body.id });
if (user == null) {
this.userByIdCache.delete(body.id);
for (const [k, v] of this.uriPersonCache.cache.entries()) {
if (v.value?.id === body.id) {
this.uriPersonCache.delete(k);
}
}
} else {
this.userByIdCache.set(user.id, user);
for (const [k, v] of this.uriPersonCache.cache.entries()) {
if (v.value?.id === user.id) {
this.uriPersonCache.set(k, user);
}
}
if (this.userEntityService.isLocalUser(user)) {
this.localUserByNativeTokenCache.set(user.token!, user);
this.localUserByIdCache.set(user.id, user);
}
}
if (this.userEntityService.isLocalUser(user)) {
this.localUserByNativeTokenCache.set(user.token!, user);
this.localUserByIdCache.set(user.id, user);
}
break;
}

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
@ -96,6 +96,7 @@ export interface MainEventTypes {
announcementCreated: {
announcement: Packed<'Announcement'>;
};
edited: Packed<'Note'>;
}
export interface DriveEventTypes {

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
@ -438,10 +438,8 @@ export class NoteCreateService implements OnApplicationShutdown {
}
}
if (!user.host) {
if (this.utilityService.isKeyWordIncluded(data.cw ?? data.text ?? '', meta.prohibitedWords)) {
throw new NoteCreateService.ContainsProhibitedWordsError();
}
if (this.utilityService.isKeyWordIncluded(data.cw ?? data.text ?? '', meta.prohibitedWords)) {
throw new NoteCreateService.ContainsProhibitedWordsError();
}
const inSilencedInstance = this.utilityService.isSilencedHost(meta.silencedHosts, user.host);

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -52,7 +52,7 @@ import { isReply } from '@/misc/is-reply.js';
import { trackPromise } from '@/misc/promise-tracker.js';
import { isUserRelated } from '@/misc/is-user-related.js';
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention';
type NotificationType = 'reply' | 'renote' | 'quote' | 'mention' | 'edited';
class NotificationManager {
private notifier: { id: MiUser['id']; };
@ -241,6 +241,14 @@ export class NoteEditService implements OnApplicationShutdown {
throw new Error('not the author');
}
// we never want to change the replyId, so fetch the original "parent"
if (oldnote.replyId) {
data.reply = await this.notesRepository.findOneBy({ id: oldnote.replyId });
}
else {
data.reply = undefined;
}
// チャンネル外にリプライしたら対象のスコープに合わせる
// (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで)
if (data.reply && data.channel && data.reply.channelId !== data.channel.id) {
@ -275,6 +283,10 @@ export class NoteEditService implements OnApplicationShutdown {
}
}
if (this.utilityService.isKeyWordIncluded(data.cw ?? data.text ?? '', meta.prohibitedWords)) {
throw new NoteEditService.ContainsProhibitedWordsError();
}
const inSilencedInstance = this.utilityService.isSilencedHost((meta).silencedHosts, user.host);
if (data.visibility === 'public' && inSilencedInstance && user.host !== null) {
@ -431,7 +443,7 @@ export class NoteEditService implements OnApplicationShutdown {
id: oldnote.id,
updatedAt: data.updatedAt ? data.updatedAt : new Date(),
fileIds: data.files ? data.files.map(file => file.id) : [],
replyId: data.reply ? data.reply.id : null,
replyId: oldnote.replyId,
renoteId: data.renote ? data.renote.id : null,
channelId: data.channel ? data.channel.id : null,
threadId: data.reply
@ -582,7 +594,7 @@ export class NoteEditService implements OnApplicationShutdown {
}
// Pack the note
const noteObj = await this.noteEntityService.pack(note, null, { skipHide: true });
const noteObj = await this.noteEntityService.pack(note, null, { skipHide: true, withReactionAndUserPairCache: true });
if (data.poll != null) {
this.globalEventService.publishNoteStream(note.id, 'updated', {
cw: note.cw,
@ -608,7 +620,7 @@ export class NoteEditService implements OnApplicationShutdown {
const nm = new NotificationManager(this.mutingsRepository, this.notificationService, user, note);
await this.createMentionedEvents(mentionedUsers, note, nm);
//await this.createMentionedEvents(mentionedUsers, note, nm);
// If has in reply to note
if (data.reply) {
@ -630,12 +642,12 @@ export class NoteEditService implements OnApplicationShutdown {
const muted = isUserRelated(note, userIdsWhoMeMuting);
if (!isThreadMuted && !muted) {
nm.push(data.reply.userId, 'reply');
this.globalEventService.publishMainStream(data.reply.userId, 'reply', noteObj);
nm.push(data.reply.userId, 'edited');
this.globalEventService.publishMainStream(data.reply.userId, 'edited', noteObj);
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === data.reply!.userId && x.on.includes('reply'));
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === data.reply!.userId && x.on.includes('edited'));
for (const webhook of webhooks) {
this.queueService.webhookDeliver(webhook, 'reply', {
this.queueService.webhookDeliver(webhook, 'edited', {
note: noteObj,
});
}
@ -643,45 +655,6 @@ export class NoteEditService implements OnApplicationShutdown {
}
}
// If it is renote
if (data.renote) {
const type = this.isQuote(data) ? 'quote' : 'renote';
// Notify
if (data.renote.userHost === null) {
const isThreadMuted = await this.noteThreadMutingsRepository.exists({
where: {
userId: data.renote.userId,
threadId: data.renote.threadId ?? data.renote.id,
},
});
const [
userIdsWhoMeMuting,
] = data.renote.userId ? await Promise.all([
this.cacheService.userMutingsCache.fetch(data.renote.userId),
]) : [new Set<string>()];
const muted = isUserRelated(note, userIdsWhoMeMuting);
if (!isThreadMuted && !muted) {
nm.push(data.renote.userId, type);
}
}
// Publish event
if ((user.id !== data.renote.userId) && data.renote.userHost === null) {
this.globalEventService.publishMainStream(data.renote.userId, 'renote', noteObj);
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === data.renote!.userId && x.on.includes('renote'));
for (const webhook of webhooks) {
this.queueService.webhookDeliver(webhook, 'renote', {
note: noteObj,
});
}
}
}
nm.notify();
//#region AP deliver
@ -776,17 +749,17 @@ export class NoteEditService implements OnApplicationShutdown {
detail: true,
});
this.globalEventService.publishMainStream(u.id, 'mention', detailPackedNote);
this.globalEventService.publishMainStream(u.id, 'edited', detailPackedNote);
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === u.id && x.on.includes('mention'));
const webhooks = (await this.webhookService.getActiveWebhooks()).filter(x => x.userId === u.id && x.on.includes('edited'));
for (const webhook of webhooks) {
this.queueService.webhookDeliver(webhook, 'mention', {
this.queueService.webhookDeliver(webhook, 'edited', {
note: detailPackedNote,
});
}
// Create notification
nm.push(u.id, 'mention');
nm.push(u.id, 'edited');
}
}

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
@ -66,7 +66,11 @@ export class NoteReadService implements OnApplicationShutdown {
noteUserId: note.userId,
};
await this.noteUnreadsRepository.insert(unread);
/* we may be called from NoteEditService, for a note that's
already present in the `note_unread` table: `upsert` makes sure
we don't throw a "duplicate key" error, while still updating
the other columns if they've changed */
await this.noteUnreadsRepository.upsert(unread,['userId', 'noteId']);
// 2秒経っても既読にならなかったら「未読の投稿がありますよ」イベントを発行する
setTimeout(2000, 'unread note', { signal: this.#shutdownController.signal }).then(async () => {

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
@ -30,12 +30,12 @@ import { RoleService } from '@/core/RoleService.js';
import { FeaturedService } from '@/core/FeaturedService.js';
import { trackPromise } from '@/misc/promise-tracker.js';
const FALLBACK = '';
const FALLBACK = '\u2764';
const PER_NOTE_REACTION_USER_PAIR_CACHE_MAX = 16;
const legacies: Record<string, string> = {
'like': '👍',
'love': '❤', // ここに記述する場合は異体字セレクタを入れない
'love': '\u2764', // ハート、異体字セレクタを入れない
'laugh': '😆',
'hmm': '🤔',
'surprise': '😮',
@ -123,7 +123,7 @@ export class ReactionService {
let reaction = _reaction ?? FALLBACK;
if (note.reactionAcceptance === 'likeOnly' || ((note.reactionAcceptance === 'likeOnlyForRemote' || note.reactionAcceptance === 'nonSensitiveOnlyForLocalLikeOnlyForRemote') && (user.host != null))) {
reaction = '❤️';
reaction = '\u2764';
} else if (_reaction) {
const custom = reaction.match(isCustomEmojiRegexp);
if (custom) {

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
@ -26,7 +26,7 @@ import type {
PublicKeyCredentialDescriptorFuture,
PublicKeyCredentialRequestOptionsJSON,
RegistrationResponseJSON,
} from '@simplewebauthn/typescript-types';
} from '@simplewebauthn/types';
@Injectable()
export class WebAuthnService {

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
@ -106,12 +106,12 @@ export class ApDbResolverService implements OnApplicationShutdown {
return await this.cacheService.userByIdCache.fetchMaybe(
parsed.id,
() => this.usersRepository.findOneBy({ id: parsed.id }).then(x => x ?? undefined),
() => this.usersRepository.findOneBy({ id: parsed.id, isDeleted: false }).then(x => x ?? undefined),
) as MiLocalUser | undefined ?? null;
} else {
return await this.cacheService.uriPersonCache.fetch(
parsed.uri,
() => this.usersRepository.findOneBy({ uri: parsed.uri }),
() => this.usersRepository.findOneBy({ uri: parsed.uri, isDeleted: false }),
) as MiRemoteUser | null;
}
}
@ -136,8 +136,12 @@ export class ApDbResolverService implements OnApplicationShutdown {
if (key == null) return null;
const user = await this.cacheService.findUserById(key.userId).catch(() => null) as MiRemoteUser | null;
if (user == null) return null;
if (user.isDeleted) return null;
return {
user: await this.cacheService.findUserById(key.userId) as MiRemoteUser,
user,
key,
};
}
@ -151,6 +155,7 @@ export class ApDbResolverService implements OnApplicationShutdown {
key: MiUserPublickey | null;
} | null> {
const user = await this.apPersonService.resolvePerson(uri) as MiRemoteUser;
if (user.isDeleted) return null;
const key = await this.publicKeyByUserIdCache.fetch(
user.id,

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
@ -35,6 +35,8 @@ import { ApResolverService } from './ApResolverService.js';
import { ApAudienceService } from './ApAudienceService.js';
import { ApPersonService } from './models/ApPersonService.js';
import { ApQuestionService } from './models/ApQuestionService.js';
import { CacheService } from '@/core/CacheService.js';
import { GlobalEventService } from '@/core/GlobalEventService.js';
import type { Resolver } from './ApResolverService.js';
import type { IAccept, IAdd, IAnnounce, IBlock, ICreate, IDelete, IFlag, IFollow, ILike, IObject, IReject, IRemove, IUndo, IUpdate, IMove } from './type.js';
@ -82,6 +84,8 @@ export class ApInboxService {
private apPersonService: ApPersonService,
private apQuestionService: ApQuestionService,
private queueService: QueueService,
private cacheService: CacheService,
private globalEventService: GlobalEventService,
) {
this.logger = this.apLoggerService.logger;
}
@ -479,6 +483,8 @@ export class ApInboxService {
isDeleted: true,
});
this.globalEventService.publishInternalEvent('remoteUserUpdated', { id: actor.id });
return `ok: queued ${job.name} ${job.id}`;
}

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

View file

@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: syuilo and other misskey contributors
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/

Some files were not shown because too many files have changed in this diff Show more