diff options
| author | ShittyKopper <shittykopper@w.on-t.work> | 2023-11-05 15:43:16 +0300 |
|---|---|---|
| committer | ShittyKopper <shittykopper@w.on-t.work> | 2023-11-05 16:28:55 +0300 |
| commit | 36c136cfd25e3166434705bd747312942c2b8bc0 (patch) | |
| tree | a92bd462c336b23637df2fb69de3eb7bdfd5e071 /packages/backend/src/core/DriveService.ts | |
| parent | upd: rip out AiService (diff) | |
| download | sharkey-36c136cfd25e3166434705bd747312942c2b8bc0.tar.gz sharkey-36c136cfd25e3166434705bd747312942c2b8bc0.tar.bz2 sharkey-36c136cfd25e3166434705bd747312942c2b8bc0.zip | |
upd: remove more traces of sensitiveMediaDetection
kept the api endpoint props just to stay compatible with clients that
expect them to be there. they are unused and won't get saved
Diffstat (limited to 'packages/backend/src/core/DriveService.ts')
| -rw-r--r-- | packages/backend/src/core/DriveService.ts | 27 |
1 files changed, 1 insertions, 26 deletions
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<MiDriveFile> { - 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) { |