merge upstream 2025-02-03

This commit is contained in:
Hazelnoot 2025-02-03 14:31:26 -05:00
commit a4e86758c1
264 changed files with 15775 additions and 4919 deletions

View file

@ -215,15 +215,10 @@ export class CheckModeratorsActivityProcessorService {
// -- SystemWebhook
const systemWebhooks = await this.systemWebhookService.fetchActiveSystemWebhooks()
.then(it => it.filter(it => it.on.includes('inactiveModeratorsWarning')));
for (const systemWebhook of systemWebhooks) {
this.systemWebhookService.enqueueSystemWebhook(
systemWebhook,
'inactiveModeratorsWarning',
{ remainingTime: remainingTime },
);
}
return this.systemWebhookService.enqueueSystemWebhook(
'inactiveModeratorsWarning',
{ remainingTime: remainingTime },
);
}
@bindThis
@ -253,15 +248,10 @@ export class CheckModeratorsActivityProcessorService {
// -- SystemWebhook
const systemWebhooks = await this.systemWebhookService.fetchActiveSystemWebhooks()
.then(it => it.filter(it => it.on.includes('inactiveModeratorsInvitationOnlyChanged')));
for (const systemWebhook of systemWebhooks) {
this.systemWebhookService.enqueueSystemWebhook(
systemWebhook,
'inactiveModeratorsInvitationOnlyChanged',
{},
);
}
return this.systemWebhookService.enqueueSystemWebhook(
'inactiveModeratorsInvitationOnlyChanged',
{},
);
}
@bindThis

View file

@ -48,6 +48,7 @@ export class CleanChartsProcessorService {
public async process(): Promise<void> {
this.logger.info('Clean charts...');
// DBへの同時接続を避けるためにPromise.allを使わずひとつずつ実行する
await this.federationChart.clean();
await this.notesChart.clean();
await this.usersChart.clean();

View file

@ -14,10 +14,10 @@ import { createTempDir } from '@/misc/create-temp.js';
import { DriveService } from '@/core/DriveService.js';
import { DownloadService } from '@/core/DownloadService.js';
import { bindThis } from '@/decorators.js';
import type { Config } from '@/config.js';
import { QueueLoggerService } from '../QueueLoggerService.js';
import type * as Bull from 'bullmq';
import type { DbUserImportJobData } from '../types.js';
import type { Config } from '@/config.js';
// TODO: 名前衝突時の動作を選べるようにする
@Injectable()
@ -92,6 +92,7 @@ export class ImportCustomEmojisProcessorService {
await this.emojisRepository.delete({
name: nameNfc,
});
try {
const driveFile = await this.driveService.addFile({
user: null,
@ -100,11 +101,13 @@ export class ImportCustomEmojisProcessorService {
force: true,
});
await this.customEmojiService.add({
originalUrl: driveFile.url,
publicUrl: driveFile.webpublicUrl ?? driveFile.url,
fileType: driveFile.webpublicType ?? driveFile.type,
name: nameNfc,
category: emojiInfo.category?.normalize('NFC'),
host: null,
aliases: emojiInfo.aliases?.map((a: string) => a.normalize('NFC')),
driveFile,
license: emojiInfo.license,
isSensitive: emojiInfo.isSensitive,
localOnly: emojiInfo.localOnly,

View file

@ -29,6 +29,7 @@ export class ResyncChartsProcessorService {
public async process(): Promise<void> {
this.logger.info('Resync charts...');
// DBへの同時接続を避けるためにPromise.allを使わずひとつずつ実行する
// TODO: ユーザーごとのチャートも更新する
// TODO: インスタンスごとのチャートも更新する
await this.driveChart.resync();

View file

@ -48,6 +48,7 @@ export class TickChartsProcessorService {
public async process(): Promise<void> {
this.logger.info('Tick charts...');
// DBへの同時接続を避けるためにPromise.allを使わずひとつずつ実行する
await this.federationChart.tick(false);
await this.notesChart.tick(false);
await this.usersChart.tick(false);

View file

@ -6,9 +6,12 @@
import type { Antenna } from '@/server/api/endpoints/i/import-antennas.js';
import type { MiDriveFile } from '@/models/DriveFile.js';
import type { MiNote } from '@/models/Note.js';
import type { SystemWebhookEventType } from '@/models/SystemWebhook.js';
import type { MiUser } from '@/models/User.js';
import type { MiWebhook } from '@/models/Webhook.js';
import type { MiWebhook, WebhookEventTypes } from '@/models/Webhook.js';
import type { IActivity } from '@/core/activitypub/type.js';
import type { SystemWebhookPayload } from '@/core/SystemWebhookService.js';
import type { UserWebhookPayload } from '@/core/UserWebhookService.js';
import type httpSignature from '@peertube/http-signature';
export type DeliverJobData = {
@ -131,9 +134,9 @@ export type EndedPollNotificationJobData = {
noteId: MiNote['id'];
};
export type SystemWebhookDeliverJobData = {
type: string;
content: unknown;
export type SystemWebhookDeliverJobData<T extends SystemWebhookEventType = SystemWebhookEventType> = {
type: T;
content: SystemWebhookPayload<T>;
webhookId: MiWebhook['id'];
to: string;
secret: string;
@ -141,9 +144,9 @@ export type SystemWebhookDeliverJobData = {
eventId: string;
};
export type UserWebhookDeliverJobData = {
type: string;
content: unknown;
export type UserWebhookDeliverJobData<T extends WebhookEventTypes = WebhookEventTypes> = {
type: T;
content: UserWebhookPayload<T>;
webhookId: MiWebhook['id'];
userId: MiUser['id'];
to: string;