Merge branch 'develop' into room

This commit is contained in:
syuilo
2026-06-11 20:12:32 +09:00
70 changed files with 3476 additions and 2565 deletions
@@ -56,6 +56,10 @@ export default class PerUserDriveChart extends Chart<typeof schema> { // eslint-
@bindThis
public async update(file: MiDriveFile, isAdditional: boolean): Promise<void> {
// MiDriveFile.userId is nullable (system-owned files such as the instance
// icon/banner, fetched system avatars, custom emoji image uploads, etc.).
// Per-user drive accounting is not defined for ownerless files, so skip.
if (file.userId == null) return;
const fileSizeKb = file.size / 1000;
await this.commit({
'totalCount': isAdditional ? 1 : -1,
+1 -5
View File
@@ -299,12 +299,8 @@ export class MemoryKVCache<T> {
const now = Date.now();
for (const [key, { date }] of this.cache.entries()) {
// The map is ordered from oldest to youngest.
// We can stop once we find an entry that's still active, because all following entries must *also* be active.
const age = now - date;
if (age < this.lifetime) break;
this.cache.delete(key);
if (age >= this.lifetime) this.cache.delete(key);
}
}
@@ -3,9 +3,9 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import cd from 'content-disposition';
import { create } from 'content-disposition';
export function contentDisposition(type: 'inline' | 'attachment', filename: string): string {
const fallback = filename.replace(/[^\w.-]/g, '_');
return cd(filename, { type, fallback });
return create(filename, { type, fallback });
}
@@ -8,7 +8,7 @@ import { Inject, Injectable } from '@nestjs/common';
import { IsNull } from 'typeorm';
import { format as dateFormat } from 'date-fns';
import mime from 'mime-types';
import archiver from 'archiver';
import { ZipArchive } from 'archiver';
import { DI } from '@/di-symbols.js';
import type { EmojisRepository, UsersRepository } from '@/models/_.js';
import type { Config } from '@/config.js';
@@ -126,7 +126,7 @@ export class ExportCustomEmojisProcessorService {
const [archivePath, archiveCleanup] = await createTemp();
await new Promise<void>((resolve) => {
const archiveStream = fs.createWriteStream(archivePath);
const archive = archiver('zip', {
const archive = new ZipArchive({
zlib: { level: 0 },
});
archiveStream.on('close', async () => {
@@ -777,6 +777,8 @@ export class ActivityPubServerService {
}
const acct = Acct.parse(request.params.acct);
// normalize acct host
if (this.utilityService.isSelfHost(acct.host)) acct.host = null;
const user = await this.usersRepository.findOneBy({
usernameLower: acct.username.toLowerCase(),