198 lines
6.7 KiB
JavaScript
198 lines
6.7 KiB
JavaScript
// Metro module 664 (f665).
|
|
import { getSystemLocale } from "./Module665";
|
|
import { usesClientMods } from "./Module667";
|
|
import { clientLaunchId } from "./Module668";
|
|
import Module669 from "./Module669";
|
|
import * as _Module670 from "./Module670";
|
|
import { Platform, NativeModules } from "react-native";
|
|
import * as _Module671 from "./Module671";
|
|
import * as _Module672 from "./Module672";
|
|
import { DesignIds } from "./Module673";
|
|
import { Storage } from "./Module595";
|
|
import { SessionStorage } from "./Module674";
|
|
import { encodeProperties } from "./Module662";
|
|
let cachedSuperProperties, c580_4, c580_6, c580_7, DiscordNative, getDevice, getDeviceProperties, c580_12;
|
|
const getOS = function getOS() {
|
|
window.navigator.userAgent;
|
|
return (_Module670.default == null ? void 0 : _Module670.default.isMetaQuest()) === true ? "Horizon OS" : "Android";
|
|
};
|
|
getDevice = function getDevice() {
|
|
window.navigator.userAgent;
|
|
return Platform.OS === "android" ? _Module671.default.getConstants().device : NativeModules.DCDDeviceManager.device;
|
|
};
|
|
getDeviceProperties = function getDeviceProperties() {
|
|
const oS = getOS();
|
|
const r0 = {
|
|
os: oS,
|
|
browser: (function getBrowser() {
|
|
const navigator2 = window.navigator;
|
|
navigator2.userAgent;
|
|
navigator2.vendor;
|
|
window.opera;
|
|
return (_Module670.default == null ? void 0 : _Module670.default.isMetaQuest()) === true ? "Discord VR" : "Discord Android";
|
|
})(),
|
|
device: getDevice(),
|
|
system_locale: getSystemLocale(),
|
|
has_client_mods: usesClientMods()
|
|
};
|
|
try {
|
|
const r30 = Platform.OS === "android" ? _Module672.default.getConstants() : NativeModules.InfoDictionaryManager.getConstants();
|
|
const { Version, ReleaseChannel, DeviceVendorID } = r30;
|
|
r0.client_version = Version + (oS === "Android" ? " - rn" : "");
|
|
r0.release_channel = ReleaseChannel;
|
|
r0.device_vendor_id = DeviceVendorID;
|
|
r0.design_id = DesignIds.DESIGN_TABS_IA;
|
|
} catch ($e) {}
|
|
return r0;
|
|
};
|
|
c580_6 = "deviceProperties";
|
|
c580_7 = "referralProperties";
|
|
DiscordNative = window.DiscordNative;
|
|
if (DiscordNative != null) {
|
|
const version = DiscordNative.app.getVersion();
|
|
const platform2 = DiscordNative.process.platform;
|
|
const release = DiscordNative.os.release;
|
|
const arch = DiscordNative.os.arch;
|
|
const appArch = DiscordNative.os.appArch;
|
|
let release_channel = DiscordNative.app.getReleaseChannel();
|
|
const systemLocale = getSystemLocale();
|
|
const os = platform2 !== "win32" ? platform2 === "darwin" ? "Mac OS X" : platform2 === "linux" ? "Linux" : platform2 : "Windows";
|
|
if (!release_channel) {
|
|
release_channel = "unknown";
|
|
}
|
|
cachedSuperProperties = {
|
|
os,
|
|
browser: "Discord Client",
|
|
release_channel,
|
|
client_version: version,
|
|
os_version: release,
|
|
os_arch: arch,
|
|
app_arch: appArch,
|
|
system_locale: systemLocale,
|
|
has_client_mods: usesClientMods(),
|
|
client_launch_id: clientLaunchId
|
|
};
|
|
if ((Module669.name == null ? void 0 : Module669.name.toLocaleLowerCase()) === "electron") {
|
|
cachedSuperProperties.browser_user_agent = Module669.ua || "";
|
|
cachedSuperProperties.browser_version = Module669.version || "";
|
|
}
|
|
if (platform2 === "linux") {
|
|
const metadata = DiscordNative.crashReporter.getMetadata();
|
|
cachedSuperProperties.window_manager = metadata.wm;
|
|
cachedSuperProperties.distro = metadata.distro;
|
|
cachedSuperProperties.runtime_environment = metadata.runtime_environment;
|
|
cachedSuperProperties.display_server = metadata.display_server;
|
|
} else if (platform2 === "darwin") {
|
|
cachedSuperProperties.os_sdk_version = release == null ? void 0 : release.split(".")[0];
|
|
} else if (platform2 === "win32") {
|
|
cachedSuperProperties.os_sdk_version = release == null ? void 0 : release.split(".")[2];
|
|
}
|
|
}
|
|
c580_12 = "utm_source utm_medium utm_campaign utm_content utm_term".split(" ");
|
|
if (cachedSuperProperties == null) {
|
|
try {
|
|
cachedSuperProperties = (function getCachedSuperProperties() {
|
|
let r7 = Storage.get(c580_6);
|
|
if (r7 == null) {
|
|
const deviceProperties = getDeviceProperties();
|
|
Storage.set(c580_6, deviceProperties);
|
|
r7 = deviceProperties;
|
|
}
|
|
let r29 = Storage.get(c580_7);
|
|
if (r29 == null) {
|
|
const r30 = {};
|
|
Storage.set(c580_7, r30);
|
|
r29 = r30;
|
|
}
|
|
let r40 = SessionStorage.get(c580_7);
|
|
if (r40 == null) {
|
|
const r14 = {};
|
|
let c12439_0 = r14;
|
|
const r42 = {};
|
|
let c12439_1 = r42;
|
|
Object.keys(r14).map((item) => {
|
|
const r8 = `${item}_current`;
|
|
const r10 = c12439_0[item];
|
|
c12439_1[r8] = r10;
|
|
return r10;
|
|
});
|
|
SessionStorage.set(c580_7, r42);
|
|
r40 = r42;
|
|
}
|
|
return {
|
|
...r7,
|
|
...{
|
|
...{
|
|
browser_user_agent: window.navigator.userAgent || "",
|
|
browser_version: Module669.version || ""
|
|
},
|
|
os_version: (Platform.OS === "android" ? _Module671.default.getConstants().systemVersion : NativeModules.DCDDeviceManager.systemVersion) || ""
|
|
},
|
|
...r29,
|
|
...r40
|
|
};
|
|
})();
|
|
} catch ($e) {
|
|
cachedSuperProperties = {};
|
|
}
|
|
}
|
|
export function extendSuperProperties(a0) {
|
|
cachedSuperProperties = {
|
|
...cachedSuperProperties,
|
|
...a0
|
|
};
|
|
c580_4 = encodeProperties(cachedSuperProperties);
|
|
}
|
|
extendSuperProperties((function getContextualSuperProperties() {
|
|
window.GLOBAL_ENV.RELEASE_CHANNEL;
|
|
const r4 = {
|
|
client_build_number: parseInt("6099", 10)
|
|
};
|
|
const native_build_number = DiscordNative == null ? void 0 : DiscordNative.app.getBuildNumber();
|
|
if (!(native_build_number == null || isNaN(native_build_number))) {
|
|
r4.native_build_number = native_build_number;
|
|
}
|
|
r4.client_event_source = null;
|
|
r4.has_client_mods = usesClientMods();
|
|
r4.client_launch_id = clientLaunchId;
|
|
return r4;
|
|
})());
|
|
export { getOS };
|
|
export { getDevice };
|
|
export function getCampaignParams(c12440_0) {
|
|
const r4 = {};
|
|
let c12440_1 = r4;
|
|
c580_12.forEach((item) => {
|
|
let r30;
|
|
const r2 = c12440_0 == null;
|
|
let r4 = "";
|
|
if (!r2) {
|
|
L5: {
|
|
const r29 = new RegExp(`[\\?&]${item.replace(/[[]/, "\\[").replace(/[\]]/, "\\]")}=([^&#]*)`).exec(c12440_0);
|
|
r30 = "";
|
|
if (r29 !== null) {
|
|
if (typeof r29[1] !== "string") {
|
|
const length = r29[1].length;
|
|
r30 = "";
|
|
if (length) {
|
|
break L5;
|
|
}
|
|
}
|
|
r30 = decodeURIComponent(r29[1]).replace(/\+/g, " ");
|
|
}
|
|
}
|
|
r4 = r30;
|
|
}
|
|
if (r4.length > 0) {
|
|
c12440_1[item] = r4;
|
|
}
|
|
});
|
|
return r4;
|
|
}
|
|
export function getSuperProperties() {
|
|
return cachedSuperProperties;
|
|
}
|
|
export function getSuperPropertiesBase64() {
|
|
return c580_4;
|
|
}
|