forked from mirrors/misskey
Compare commits
3 commits
bf4a017647
...
d99d116c02
Author | SHA1 | Date | |
---|---|---|---|
d99d116c02 | |||
4b9179a4c4 | |||
dadba96935 |
5 changed files with 57 additions and 4 deletions
|
@ -641,7 +641,6 @@
|
||||||
- nsfwjs のモデルロードを排他することで、重複ロードによってメモリ使用量が増加しないように
|
- nsfwjs のモデルロードを排他することで、重複ロードによってメモリ使用量が増加しないように
|
||||||
- 連合の配送ジョブのパフォーマンスを向上(ロック機構の見直し、Redisキャッシュの活用)
|
- 連合の配送ジョブのパフォーマンスを向上(ロック機構の見直し、Redisキャッシュの活用)
|
||||||
- featuredノートのsignedGet回数を減らしました
|
- featuredノートのsignedGet回数を減らしました
|
||||||
- ActivityPubの署名用鍵長を2048bitに変更しパフォーマンスを向上(新規アカウントのみ)
|
|
||||||
- リモートサーバーのセンシティブなファイルのキャッシュだけを無効化できるオプションを追加
|
- リモートサーバーのセンシティブなファイルのキャッシュだけを無効化できるオプションを追加
|
||||||
- MeilisearchにIndexするノートの範囲を設定できるように
|
- MeilisearchにIndexするノートの範囲を設定できるように
|
||||||
- Export notes with file detail
|
- Export notes with file detail
|
||||||
|
|
|
@ -93,6 +93,10 @@ type Source = {
|
||||||
perUserNotificationsMaxCount?: number;
|
perUserNotificationsMaxCount?: number;
|
||||||
deactivateAntennaThreshold?: number;
|
deactivateAntennaThreshold?: number;
|
||||||
pidFile: string;
|
pidFile: string;
|
||||||
|
|
||||||
|
// BEGIN comfy.social
|
||||||
|
noteFilterPlugin?: string;
|
||||||
|
// END comfy.social
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Config = {
|
export type Config = {
|
||||||
|
@ -170,6 +174,10 @@ export type Config = {
|
||||||
perUserNotificationsMaxCount: number;
|
perUserNotificationsMaxCount: number;
|
||||||
deactivateAntennaThreshold: number;
|
deactivateAntennaThreshold: number;
|
||||||
pidFile: string;
|
pidFile: string;
|
||||||
|
|
||||||
|
// BEGIN comfy.social
|
||||||
|
noteFilterPlugin?: string;
|
||||||
|
// END comfy.social
|
||||||
};
|
};
|
||||||
|
|
||||||
const _filename = fileURLToPath(import.meta.url);
|
const _filename = fileURLToPath(import.meta.url);
|
||||||
|
@ -265,6 +273,9 @@ export function loadConfig(): Config {
|
||||||
perUserNotificationsMaxCount: config.perUserNotificationsMaxCount ?? 500,
|
perUserNotificationsMaxCount: config.perUserNotificationsMaxCount ?? 500,
|
||||||
deactivateAntennaThreshold: config.deactivateAntennaThreshold ?? (1000 * 60 * 60 * 24 * 7),
|
deactivateAntennaThreshold: config.deactivateAntennaThreshold ?? (1000 * 60 * 60 * 24 * 7),
|
||||||
pidFile: config.pidFile,
|
pidFile: config.pidFile,
|
||||||
|
// BEGIN comfy.social
|
||||||
|
noteFilterPlugin: config.noteFilterPlugin,
|
||||||
|
// END comfy.social
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ export class CreateSystemUserService {
|
||||||
// Generate secret
|
// Generate secret
|
||||||
const secret = generateNativeUserToken();
|
const secret = generateNativeUserToken();
|
||||||
|
|
||||||
const keyPair = await genRsaKeyPair();
|
const keyPair = await genRsaKeyPair(4096);
|
||||||
|
|
||||||
let account!: MiUser;
|
let account!: MiUser;
|
||||||
|
|
||||||
|
|
|
@ -147,11 +147,29 @@ type Option = {
|
||||||
app?: MiApp | null;
|
app?: MiApp | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// BEGIN comfy.social
|
||||||
|
type NoteFilterResult = {
|
||||||
|
verdict: boolean; // true = block
|
||||||
|
reason?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type NoteFilterPluginContext = {
|
||||||
|
data: Option;
|
||||||
|
user: MiUser;
|
||||||
|
mentionedUsers: MiUser[];
|
||||||
|
remoteUserResolveService: RemoteUserResolveService;
|
||||||
|
idService: IdService;
|
||||||
|
}
|
||||||
|
// END comfy.social
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class NoteCreateService implements OnApplicationShutdown {
|
export class NoteCreateService implements OnApplicationShutdown {
|
||||||
#shutdownController = new AbortController();
|
#shutdownController = new AbortController();
|
||||||
|
|
||||||
public static ContainsProhibitedWordsError = class extends Error {};
|
public static ContainsProhibitedWordsError = class extends Error {};
|
||||||
|
// BEGIN comfy.social
|
||||||
|
private noteFilterPluginFn?: (context: NoteFilterPluginContext) => Promise<NoteFilterResult> = null;
|
||||||
|
// END comfy.social
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(DI.config)
|
@Inject(DI.config)
|
||||||
|
@ -219,7 +237,15 @@ export class NoteCreateService implements OnApplicationShutdown {
|
||||||
private instanceChart: InstanceChart,
|
private instanceChart: InstanceChart,
|
||||||
private utilityService: UtilityService,
|
private utilityService: UtilityService,
|
||||||
private userBlockingService: UserBlockingService,
|
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
|
@bindThis
|
||||||
public async create(user: {
|
public async create(user: {
|
||||||
|
@ -379,6 +405,23 @@ 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,
|
||||||
|
idService: this.idService,
|
||||||
|
});
|
||||||
|
|
||||||
|
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);
|
const note = await this.insertNote(user, data, tags, emojis, mentionedUsers);
|
||||||
|
|
||||||
setImmediate('post created', { signal: this.#shutdownController.signal }).then(
|
setImmediate('post created', { signal: this.#shutdownController.signal }).then(
|
||||||
|
|
|
@ -95,7 +95,7 @@ export class SignupService {
|
||||||
|
|
||||||
const keyPair = await new Promise<string[]>((res, rej) =>
|
const keyPair = await new Promise<string[]>((res, rej) =>
|
||||||
generateKeyPair('rsa', {
|
generateKeyPair('rsa', {
|
||||||
modulusLength: 2048,
|
modulusLength: 4096,
|
||||||
publicKeyEncoding: {
|
publicKeyEncoding: {
|
||||||
type: 'spki',
|
type: 'spki',
|
||||||
format: 'pem',
|
format: 'pem',
|
||||||
|
|
Loading…
Add table
Reference in a new issue