decord/source/modules/messages/native/renderer/ExplicitMediaUtils.tsx

142 lines
5.4 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 8378
// Function ID: 8379
2026-07-29 08:29:29 +00:00
// Name: getAttachmentObscurityProps
2026-08-24 06:08:38 +00:00
// Dependencies: [676, 1403, 5024, 5027, 4997, 1236, 2]
2026-07-20 16:05:17 +00:00
// Exports: getAttachmentObscurityDefaults, getAttachmentObscurityProps, getUnfurledMediaItemObscurityProps
2026-08-24 06:08:38 +00:00
// Module 8378 (getAttachmentObscurityProps)
import set from "set" /* 2 */;
import ME from "ME" /* 676 */;
import hasFlag from "hasFlag" /* 1403 */;
import getEligibleHarmTypesConfigsForContext from "getEligibleHarmTypesConfigsForContext" /* 5024 */;
import ContentHarmTypeChannel from "ContentHarmTypeChannel" /* 5027 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
const MessageAttachmentFlags = ME.MessageAttachmentFlags;
const result = set.fileFinishedImporting("modules/messages/native/renderer/ExplicitMediaUtils.tsx");
2026-07-20 16:05:17 +00:00
export const getAttachmentObscurityProps = function getAttachmentObscurityProps(shouldAgeVerify) {
({ attachment, shouldObscureSpoiler, enabledContentHarmTypeFlags } = shouldAgeVerify);
2026-08-24 06:08:38 +00:00
let obj = hasFlag;
2026-07-29 08:29:29 +00:00
let num = attachment.flags;
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
const hasFlagResult = obj.hasFlag(num, MessageAttachmentFlags.IS_SPOILER);
2026-07-29 08:29:29 +00:00
if (undefined !== attachment.content_scan_version) {
let num2 = attachment.content_scan_version;
} else if (undefined !== attachment.contentScanVersion) {
num2 = attachment.contentScanVersion;
}
if (num2 == null) {
num2 = 0;
}
obj = { contentScanVersion: num2, flags: null };
let num3 = attachment.flags;
if (num3 == null) {
num3 = 0;
}
obj[1] = num3;
2026-08-24 06:08:38 +00:00
let tmpResult = tmp(5024);
obj = { type: tmp(5027).ObscuredMediaTypes.Attachment, media: obj };
2026-07-29 08:29:29 +00:00
const mediaObscuredReasonFromBitmask = tmpResult.getMediaObscuredReasonFromBitmask(obj, enabledContentHarmTypeFlags);
2026-08-24 06:08:38 +00:00
tmpResult = tmp(5024);
2026-07-29 08:29:29 +00:00
let isVerifiedTeenResult = tmp5;
2026-08-24 06:08:38 +00:00
obj1 = { type: ContentHarmTypeChannel.ObscuredMediaTypes.Attachment, media: obj };
2026-07-20 16:05:17 +00:00
if (mediaObscuredReasonFromBitmask.length > 0) {
2026-08-24 06:08:38 +00:00
isVerifiedTeenResult = tmp(4997).isVerifiedTeen();
const tmpResult1 = tmp(4997);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp7 = shouldObscureSpoiler;
2026-07-20 16:05:17 +00:00
if (shouldObscureSpoiler) {
2026-07-29 08:29:29 +00:00
tmp7 = hasFlagResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj2 = { isSpoiler: tmp7, spoiler: null, obscure: null, obscureDescription: null, obscureAwaitingScan: null, verifyAge: null, obscureHideControls: null, obscureIsOpaque: null };
2026-07-20 16:05:17 +00:00
let str = "";
let str2 = "";
if (shouldObscureSpoiler) {
str2 = str;
if (hasFlagResult) {
2026-07-29 08:29:29 +00:00
const intl = tmp(1236).intl;
str2 = intl.string(tmp(1236).t["F+x38C"]).toUpperCase();
const str3 = intl.string(tmp(1236).t["F+x38C"]);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
obj2[1] = str2;
obj2[2] = mediaObscuredReasonFromBitmask.length > 0;
2026-07-20 16:05:17 +00:00
if (mediaObscuredReasonFromBitmask.length > 0) {
2026-07-29 08:29:29 +00:00
const intl2 = tmp(1236).intl;
str = intl2.string(tmp(1236).t.SpxcUR);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj2[3] = str;
2026-08-24 06:08:38 +00:00
obj2[4] = tmpResult.isMediaScanPending({ type: ContentHarmTypeChannel.ObscuredMediaTypes.Attachment, media: obj }, enabledContentHarmTypeFlags);
2026-07-29 08:29:29 +00:00
shouldAgeVerify = tmp5;
2026-07-20 16:05:17 +00:00
if (mediaObscuredReasonFromBitmask.length > 0) {
shouldAgeVerify = shouldAgeVerify.shouldAgeVerify;
}
2026-07-29 08:29:29 +00:00
obj2[5] = shouldAgeVerify;
obj2[6] = isVerifiedTeenResult;
obj2[7] = mediaObscuredReasonFromBitmask.length > 0;
2026-07-20 16:05:17 +00:00
return obj2;
};
export const getUnfurledMediaItemObscurityProps = function getUnfurledMediaItemObscurityProps(arg0) {
2026-07-29 08:29:29 +00:00
({ type, mediaItem, isSpoilered, isAuthorBot, enabledContentHarmTypeFlags } = arg0);
({ shouldObscureSpoiler, shouldAgeVerify } = arg0);
2026-08-24 06:08:38 +00:00
let obj = getEligibleHarmTypesConfigsForContext;
obj = { type: ContentHarmTypeChannel.ObscuredMediaTypes.GenericMedia, media: mediaItem };
2026-07-20 16:05:17 +00:00
let isMediaScanPendingResult = !isAuthorBot;
const mediaObscuredReasonFromBitmask = obj.getMediaObscuredReasonFromBitmask(obj, enabledContentHarmTypeFlags);
2026-07-29 08:29:29 +00:00
if (!isAuthorBot) {
2026-08-24 06:08:38 +00:00
let tmpResult = tmp(5024);
2026-07-29 08:29:29 +00:00
obj = { type: null, media: null };
2026-08-24 06:08:38 +00:00
obj[0] = tmp(5027).ObscuredMediaTypes.GenericMedia;
2026-07-29 08:29:29 +00:00
obj[1] = mediaItem;
isMediaScanPendingResult = tmpResult.isMediaScanPending(obj, enabledContentHarmTypeFlags);
2026-07-20 16:05:17 +00:00
}
if (isSpoilered) {
isSpoilered = shouldObscureSpoiler;
}
let isVerifiedTeenResult = tmp4;
if (mediaObscuredReasonFromBitmask.length > 0) {
2026-08-24 06:08:38 +00:00
tmpResult = tmp(4997);
2026-07-29 08:29:29 +00:00
isVerifiedTeenResult = tmpResult.isVerifiedTeen();
}
2026-08-24 06:08:38 +00:00
obj1 = { isSpoiler: isSpoilered, spoilerDescription: null, isObscured: null, obscureDescription: null, obscureAwaitingScan: null, verifyAge: null, obscureHideControls: null, obscureIsOpaque: null };
2026-07-29 08:29:29 +00:00
if (!isSpoilered) {
obj1[1] = null;
obj1[2] = tmp4;
let stringResult = null;
if (tmp4) {
const intl4 = tmp(1236).intl;
stringResult = intl4.string(tmp(1236).t.SpxcUR);
}
obj1[3] = stringResult;
obj1[4] = isMediaScanPendingResult;
let tmp9 = tmp4;
if (tmp4) {
tmp9 = shouldAgeVerify;
}
obj1[5] = tmp9;
obj1[6] = isVerifiedTeenResult;
obj1[7] = tmp4;
return obj1;
} else if ("image" === type) {
const intl3 = tmp(1236).intl;
let stringResult1 = intl3.string(tmp(1236).t.sb2W2J);
} else {
if ("video" === type) {
const intl2 = tmp(1236).intl;
stringResult1 = intl2.string(tmp(1236).t.ehBaMc);
} else if ("file" !== type) {
if ("generic" === type) {
const intl5 = tmp(1236).intl;
stringResult1 = intl5.string(tmp(1236).t.G71b77);
}
}
const intl = tmp(1236).intl;
stringResult1 = intl.string(tmp(1236).t["3Gc2XP"]);
2026-07-20 16:05:17 +00:00
}
};
export function getAttachmentObscurityDefaults() {
2026-07-23 10:11:24 +00:00
return { isSpoiler: false, spoiler: "" };
2026-07-20 16:05:17 +00:00
}