diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts index 3f38cf4a22..9b6187be4f 100644 --- a/packages/backend/src/core/DriveService.ts +++ b/packages/backend/src/core/DriveService.ts @@ -461,36 +461,12 @@ export class DriveService { requestHeaders = null, ext = null, }: AddFileArgs): Promise { - let skipNsfwCheck = false; const instance = await this.metaService.fetch(); const userRoleNSFW = user && (await this.roleService.getUserPolicies(user.id)).alwaysMarkNsfw; - if (user == null) { - skipNsfwCheck = true; - } else if (userRoleNSFW) { - skipNsfwCheck = true; - } - if (instance.sensitiveMediaDetection === 'none') skipNsfwCheck = true; - if (user && instance.sensitiveMediaDetection === 'local' && this.userEntityService.isRemoteUser(user)) skipNsfwCheck = true; - if (user && instance.sensitiveMediaDetection === 'remote' && this.userEntityService.isLocalUser(user)) skipNsfwCheck = true; - const info = await this.fileInfoService.getFileInfo(path, { - skipSensitiveDetection: skipNsfwCheck, - sensitiveThreshold: // 感度が高いほどしきい値は低くすることになる - instance.sensitiveMediaDetectionSensitivity === 'veryHigh' ? 0.1 : - instance.sensitiveMediaDetectionSensitivity === 'high' ? 0.3 : - instance.sensitiveMediaDetectionSensitivity === 'low' ? 0.7 : - instance.sensitiveMediaDetectionSensitivity === 'veryLow' ? 0.9 : - 0.5, - sensitiveThresholdForPorn: 0.75, - enableSensitiveMediaDetectionForVideos: instance.enableSensitiveMediaDetectionForVideos, - }); + const info = await this.fileInfoService.getFileInfo(path); this.registerLogger.info(`${JSON.stringify(info)}`); - // 現状 false positive が多すぎて実用に耐えない - //if (info.porn && instance.disallowUploadWhenPredictedAsPorn) { - // throw new IdentifiableError('282f77bf-5816-4f72-9264-aa14d8261a21', 'Detected as porn.'); - //} - // detect name const detectedName = correctFilename( // DriveFile.nameは256文字, validateFileNameは200文字制限であるため、 @@ -586,7 +562,6 @@ export class DriveService { : false; if (info.sensitive && profile!.autoSensitive) file.isSensitive = true; - if (info.sensitive && instance.setSensitiveFlagAutomatically) file.isSensitive = true; if (userRoleNSFW) file.isSensitive = true; if (url !== null) { diff --git a/packages/backend/src/core/FileInfoService.ts b/packages/backend/src/core/FileInfoService.ts index 25487fa0fa..803f6908de 100644 --- a/packages/backend/src/core/FileInfoService.ts +++ b/packages/backend/src/core/FileInfoService.ts @@ -50,13 +50,7 @@ export class FileInfoService { * Get file information */ @bindThis - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public async getFileInfo(path: string, _opts: { - skipSensitiveDetection: boolean; - sensitiveThreshold?: number; - sensitiveThresholdForPorn?: number; - enableSensitiveMediaDetectionForVideos?: boolean; - }): Promise { + public async getFileInfo(path: string): Promise { const warnings = [] as string[]; const size = await this.getFileSize(path); diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 915021601a..efb6695d35 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -292,22 +292,6 @@ export default class extends Endpoint { // eslint- set.turnstileSecretKey = ps.turnstileSecretKey; } - if (ps.sensitiveMediaDetection !== undefined) { - set.sensitiveMediaDetection = ps.sensitiveMediaDetection; - } - - if (ps.sensitiveMediaDetectionSensitivity !== undefined) { - set.sensitiveMediaDetectionSensitivity = ps.sensitiveMediaDetectionSensitivity; - } - - if (ps.setSensitiveFlagAutomatically !== undefined) { - set.setSensitiveFlagAutomatically = ps.setSensitiveFlagAutomatically; - } - - if (ps.enableSensitiveMediaDetectionForVideos !== undefined) { - set.enableSensitiveMediaDetectionForVideos = ps.enableSensitiveMediaDetectionForVideos; - } - if (ps.enableBotTrending !== undefined) { set.enableBotTrending = ps.enableBotTrending; } diff --git a/packages/frontend/src/pages/admin/security.vue b/packages/frontend/src/pages/admin/security.vue index 1ff38548c9..f02fa1024d 100644 --- a/packages/frontend/src/pages/admin/security.vue +++ b/packages/frontend/src/pages/admin/security.vue @@ -20,49 +20,6 @@ SPDX-License-Identifier: AGPL-3.0-only - - - - - - - - -
- {{ i18n.ts._sensitiveMediaDetection.description }} - - - - - - - - - - - - - - - - - - - - - - - - - - {{ i18n.ts.save }} -
-
- @@ -126,10 +83,6 @@ let summalyProxy: string = $ref(''); let enableHcaptcha: boolean = $ref(false); let enableRecaptcha: boolean = $ref(false); let enableTurnstile: boolean = $ref(false); -let sensitiveMediaDetection: string = $ref('none'); -let sensitiveMediaDetectionSensitivity: number = $ref(0); -let setSensitiveFlagAutomatically: boolean = $ref(false); -let enableSensitiveMediaDetectionForVideos: boolean = $ref(false); let enableIpLogging: boolean = $ref(false); let enableActiveEmailValidation: boolean = $ref(false); @@ -139,15 +92,6 @@ async function init() { enableHcaptcha = meta.enableHcaptcha; enableRecaptcha = meta.enableRecaptcha; enableTurnstile = meta.enableTurnstile; - sensitiveMediaDetection = meta.sensitiveMediaDetection; - sensitiveMediaDetectionSensitivity = - meta.sensitiveMediaDetectionSensitivity === 'veryLow' ? 0 : - meta.sensitiveMediaDetectionSensitivity === 'low' ? 1 : - meta.sensitiveMediaDetectionSensitivity === 'medium' ? 2 : - meta.sensitiveMediaDetectionSensitivity === 'high' ? 3 : - meta.sensitiveMediaDetectionSensitivity === 'veryHigh' ? 4 : 0; - setSensitiveFlagAutomatically = meta.setSensitiveFlagAutomatically; - enableSensitiveMediaDetectionForVideos = meta.enableSensitiveMediaDetectionForVideos; enableIpLogging = meta.enableIpLogging; enableActiveEmailValidation = meta.enableActiveEmailValidation; } @@ -155,16 +99,6 @@ async function init() { function save() { os.apiWithDialog('admin/update-meta', { summalyProxy, - sensitiveMediaDetection, - sensitiveMediaDetectionSensitivity: - sensitiveMediaDetectionSensitivity === 0 ? 'veryLow' : - sensitiveMediaDetectionSensitivity === 1 ? 'low' : - sensitiveMediaDetectionSensitivity === 2 ? 'medium' : - sensitiveMediaDetectionSensitivity === 3 ? 'high' : - sensitiveMediaDetectionSensitivity === 4 ? 'veryHigh' : - 0, - setSensitiveFlagAutomatically, - enableSensitiveMediaDetectionForVideos, enableIpLogging, enableActiveEmailValidation, }).then(() => {