Files
discord-decomp/lib/uploader/native/CloudUploaderUtils.tsx
T
2026-11-01 12:12:55 +02:00

58 lines
1.6 KiB
TypeScript

// Metro module 4762 (f4763).
import LocaleStore from "../../../modules/user_settings/LocaleStore";
import AuthenticationStore from "../../../stores/AuthenticationStore";
import DeveloperOptionsStore from "../../../stores/DeveloperOptionsStore";
import { getAttachmentPayload } from "../../../utils/UploadUtils";
import Module12 from "../../../_bundle/Module12";
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
export function getUploadPayload(a0) {
return {
filename: a0.filename,
file_size: a0.currentSize,
id: Module12.uniqueId(),
original_content_type: void 0
};
}
const r19 = {
getUploadPayload
};
export default r19;
export function prepareMessagePayload(a0, a1, a2, a3) {
let body;
const attachments = [];
let c14426_0 = attachments;
a1.forEach((item, index) => {
c14426_0.push({
...getAttachmentPayload(item, index)
});
});
if (a3 != null && a2 != null) {
const r8 = {
...a2
};
body = Module12.set(r8, a3, [...Module12.get(r8, a3, []), ...attachments]);
} else {
body = {
...a2,
attachments
};
}
const headers = {
Authorization: a0,
"X-Debug-Options": DeveloperOptionsStore.getDebugOptionsHeaderValue(),
"Accept-Language": LocaleStore.locale
};
const superPropertiesBase64 = AnalyticsUtils.getSuperPropertiesBase64();
if (superPropertiesBase64 != null) {
headers["X-Super-Properties"] = superPropertiesBase64;
}
const fingerprint = AuthenticationStore.getFingerprint();
if (fingerprint != null) {
headers["X-Fingerprint"] = fingerprint;
}
return {
headers,
body
};
}