Compare commits

..

No commits in common. "4b9179a4c4e6ccd55f3bc91a1982ca9ec5284696" and "96c7c85ad008a71fb03198a708c8531aacbb39e0" have entirely different histories.

5 changed files with 4 additions and 55 deletions

View file

@ -641,6 +641,7 @@
- nsfwjs のモデルロードを排他することで、重複ロードによってメモリ使用量が増加しないように
- 連合の配送ジョブのパフォーマンスを向上ロック機構の見直し、Redisキャッシュの活用
- featuredートのsignedGet回数を減らしました
- ActivityPubの署名用鍵長を2048bitに変更しパフォーマンスを向上(新規アカウントのみ)
- リモートサーバーのセンシティブなファイルのキャッシュだけを無効化できるオプションを追加
- MeilisearchにIndexするートの範囲を設定できるように
- Export notes with file detail

View file

@ -93,10 +93,6 @@ type Source = {
perUserNotificationsMaxCount?: number;
deactivateAntennaThreshold?: number;
pidFile: string;
// BEGIN comfy.social
noteFilterPlugin?: string;
// END comfy.social
};
export type Config = {
@ -174,10 +170,6 @@ export type Config = {
perUserNotificationsMaxCount: number;
deactivateAntennaThreshold: number;
pidFile: string;
// BEGIN comfy.social
noteFilterPlugin?: string;
// END comfy.social
};
const _filename = fileURLToPath(import.meta.url);
@ -273,9 +265,6 @@ export function loadConfig(): Config {
perUserNotificationsMaxCount: config.perUserNotificationsMaxCount ?? 500,
deactivateAntennaThreshold: config.deactivateAntennaThreshold ?? (1000 * 60 * 60 * 24 * 7),
pidFile: config.pidFile,
// BEGIN comfy.social
noteFilterPlugin: config.noteFilterPlugin,
// END comfy.social
};
}

View file

@ -38,7 +38,7 @@ export class CreateSystemUserService {
// Generate secret
const secret = generateNativeUserToken();
const keyPair = await genRsaKeyPair(4096);
const keyPair = await genRsaKeyPair();
let account!: MiUser;

View file

@ -147,28 +147,11 @@ type Option = {
app?: MiApp | null;
};
// BEGIN comfy.social
type NoteFilterResult = {
verdict: boolean; // true = block
reason?: string;
};
type NoteFilterPluginContext = {
data: Option;
user: MiUser;
mentionedUsers: MiUser[];
usersRepository: UsersRepository;
}
// END comfy.social
@Injectable()
export class NoteCreateService implements OnApplicationShutdown {
#shutdownController = new AbortController();
public static ContainsProhibitedWordsError = class extends Error {};
// BEGIN comfy.social
private noteFilterPluginFn?: (context: NoteFilterPluginContext) => Promise<NoteFilterResult> = null;
// END comfy.social
constructor(
@Inject(DI.config)
@ -236,15 +219,7 @@ export class NoteCreateService implements OnApplicationShutdown {
private instanceChart: InstanceChart,
private utilityService: UtilityService,
private userBlockingService: UserBlockingService,
) {
// BEGIN comfy.social
if (this.config.noteFilterPlugin != null) {
import(this.config.noteFilterPlugin).then((m) => {
this.noteFilterPluginFn = m.default;
});
}
// END comfy.social
}
) { }
@bindThis
public async create(user: {
@ -404,22 +379,6 @@ export class NoteCreateService implements OnApplicationShutdown {
}
}
// BEGIN comfy.social
// Invoke customizable filter policy
if (this.noteFilterPluginFn != null) {
const filterResult = await this.noteFilterPluginFn({
data: data,
user: user,
mentionedUsers: mentionedUsers,
remoteUserResolveService: this.remoteUserResolveService,
});
if (filterResult.verdict) {
throw new Error(`Blocked by custom filter policy, reason: ${filterResult.reason}`);
}
}
// END comfy.social
const note = await this.insertNote(user, data, tags, emojis, mentionedUsers);
setImmediate('post created', { signal: this.#shutdownController.signal }).then(

View file

@ -95,7 +95,7 @@ export class SignupService {
const keyPair = await new Promise<string[]>((res, rej) =>
generateKeyPair('rsa', {
modulusLength: 4096,
modulusLength: 2048,
publicKeyEncoding: {
type: 'spki',
format: 'pem',