248 lines
11 KiB
TypeScript
248 lines
11 KiB
TypeScript
/* Metro module 4102; source: modules/build_overrides/BuildOverrideUtils.tsx; dependencies: [4103, 661, 1582, 477, 1471, 507, 1473, 4104, 2] */
|
|
import URLUtils from '../../utils/URLUtils.tsx'; /* Metro dependency 1471 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as PlatformUtilsModule from '../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as ClientInfoUtilsModule from '../../utils/native/ClientInfoUtils.tsx'; /* Metro dependency 1582 */
|
|
import * as BuildOverrideConstantsModule from './BuildOverrideConstants.tsx'; /* Metro dependency 4103 */
|
|
|
|
function _fun33617(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#33617, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4260:6, offset: 0x01035f18, size: 525 bytes, params: 8, frame: 24
|
|
var Version;
|
|
var r6;
|
|
var value5;
|
|
const env0_0 = require;
|
|
const closure = function(a0) {
|
|
return '' + global.location.protocol + '//' + global.location.host + a0;
|
|
};
|
|
const isManualBuildOverrideLink2 = isManualBuildOverrideLink;
|
|
const manualOverrideLinkMeta2 = manualOverrideLinkMeta;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const value = undefined;
|
|
(ConstantsModule).PRIMARY_DOMAIN;
|
|
const constants = (ClientInfoUtilsModule).getConstants();
|
|
if (PlatformUtilsModule.isAndroid()) {
|
|
Version = constants.Version;
|
|
r6 = Version.split(' - ')[0];
|
|
} else {
|
|
value5 = PlatformUtilsModule;
|
|
r6 = value5.isIOS() ? constants.Version : value;
|
|
}
|
|
let RegExp = global.RegExp;
|
|
let regExp = new RegExp('^https://(?:ptb\\.|canary\\.)?(discordapp|discord)\\.com/__development/link?[\\S]+$', 'i');
|
|
RegExp = global.RegExp;
|
|
regExp = new RegExp('^dev://branch/([\\w-./]+)$', 'i');
|
|
let Set = global.Set;
|
|
let set = new Set(['canary.discord.com', 'ptb.discord.com', 'discord.com', 'canary.discordapp.com',
|
|
'ptb.discordapp.com', 'discordapp.com']);
|
|
Set = global.Set;
|
|
set = new Set(['/__development/link', '/__development/link/']);
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/build_overrides/BuildOverrideUtils.tsx');
|
|
exports.APP_VERSION = r6;
|
|
exports.getAPIEndpoint = closure;
|
|
exports.getBuildOverride = getBuildOverride;
|
|
exports.getBuildOverrideMeta = getBuildOverrideMeta;
|
|
exports.probablyHasBuildOverride = probablyHasBuildOverride;
|
|
exports.getBuildOverrideExperiments = getBuildOverrideExperiments;
|
|
exports.isBuildOverrideLink = isBuildOverrideLink;
|
|
exports.isManualBuildOverrideLink = isManualBuildOverrideLink2;
|
|
exports.manualOverrideLinkMeta = manualOverrideLinkMeta2;
|
|
exports.validateURL = validateURL;
|
|
return value;
|
|
function isManualBuildOverrideLink(a0) { // fn#33619, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4260:503, offset: 0x0103615d, size: 31 bytes, params: 2, frame: 12
|
|
return a0 != null && env0_7.test(a0);
|
|
}
|
|
|
|
function manualOverrideLinkMeta(a0) { // fn#33620, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4260:567, offset: 0x0103617c, size: 157 bytes, params: 2, frame: 15
|
|
const value2 = a0.match(env0_7);
|
|
if (value2 == null) {
|
|
return null;
|
|
}
|
|
if (value2.length !== 2) {
|
|
return null;
|
|
}
|
|
let value = PlatformUtilsModule;
|
|
value = value.getNativePlatform();
|
|
const property = value2[1];
|
|
value = 'discord_' + value;
|
|
return {targetBuildOverride: {[value]: {type: 'branch', id: property}}, validForUserIds: [],
|
|
expiresAt: 'Mon, 1 Jan 2038 00:00:00 GMT'};
|
|
}
|
|
|
|
function getBuildOverride() { // fn#33621, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4260:1165, offset: 0x01036219, size: 211 bytes, params: 1, frame: 19
|
|
var r0;
|
|
var HTTP;
|
|
var get;
|
|
var object;
|
|
var value;
|
|
const defaultImport = URLUtils;
|
|
const value2 = defaultImport.safeParseWithQuery(getAPIEndpoint('/__development/build_overrides'));
|
|
if (value2 == null) {
|
|
r0 = global.Promise.resolve(null);
|
|
} else {
|
|
value2.search = null;
|
|
if (env0_5) {
|
|
value2.query.version = env0_5;
|
|
}
|
|
HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
|
|
get = HTTP.get;
|
|
object = {'url': null, 'oldFormErrors': true, 'rejectWithError': false};
|
|
value = importAll(1473) /* metro dependency 1473 */;
|
|
object.url = value.format(value2);
|
|
value = Reflect.apply(get, HTTP, [object]);
|
|
value = value.then(function({body}) {
|
|
return body || null;
|
|
}, _fun33623);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getBuildOverrideMeta(a0) { // fn#33624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4260:1490, offset: 0x010362fb, size: 284 bytes, params: 2, frame: 21
|
|
var r1;
|
|
var HTTP;
|
|
var get;
|
|
var object;
|
|
var Promise;
|
|
var value;
|
|
if (isManualBuildOverrideLink(a0)) {
|
|
Promise = global.Promise;
|
|
return Promise.resolve(manualOverrideLinkMeta(a0));
|
|
}
|
|
const value2 = (URLUtils).safeParseWithQuery(a0);
|
|
if (value2 == null) {
|
|
r1 = global.Promise.resolve(null);
|
|
} else {
|
|
value2.search = null;
|
|
value2.query.meta = 'true';
|
|
if (env0_5) {
|
|
value2.query.version = env0_5;
|
|
}
|
|
value2.host = global.window.location.host;
|
|
HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
|
|
get = HTTP.get;
|
|
object = {'url': null, 'oldFormErrors': true, 'rejectWithError': false};
|
|
value = importAll(1473) /* metro dependency 1473 */;
|
|
object.url = value.format(value2);
|
|
value = Reflect.apply(get, HTTP, [object]);
|
|
value = value.then(function({body}) {
|
|
return body || null;
|
|
}, _fun33626);
|
|
r1 = value;
|
|
}
|
|
return r1;
|
|
}
|
|
|
|
function probablyHasBuildOverride() { // fn#33627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4260:1907, offset: 0x01036417, size: 75 bytes, params: 1, frame: 15
|
|
return global.window.document.cookie.indexOf('' + BUILD_OVERRIDE_COOKIE_NAME + '=') !== -1;
|
|
}
|
|
|
|
function getBuildOverrideExperiments() { // fn#33628, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4260:2026, offset: 0x01036462, size: 181 bytes, params: 1, frame: 18
|
|
var r0;
|
|
var value;
|
|
var property;
|
|
var defaultImport;
|
|
var parse;
|
|
var window;
|
|
var document;
|
|
var cookie;
|
|
var value2;
|
|
var JSON;
|
|
var atob;
|
|
var substring;
|
|
var $meta;
|
|
var experiments;
|
|
var error;
|
|
try {
|
|
value = environment;
|
|
property = dependencyMap[7];
|
|
defaultImport = importDefault(property);
|
|
parse = defaultImport.parse;
|
|
window = global.window;
|
|
document = window.document;
|
|
cookie = document.cookie;
|
|
value2 = Reflect.apply(parse, defaultImport, [cookie]);
|
|
property = value2[BUILD_OVERRIDE_COOKIE_NAME];
|
|
value = property == null;
|
|
if (value) {
|
|
r0 = {};
|
|
} else {
|
|
JSON = global.JSON;
|
|
parse = JSON.parse;
|
|
atob = global.atob;
|
|
substring = property.substring;
|
|
value = property.indexOf('.');
|
|
value += 1;
|
|
value = Reflect.apply(substring, property, [value]);
|
|
value = atob(value);
|
|
value = Reflect.apply(parse, JSON, [value]);
|
|
$meta = value.$meta;
|
|
experiments = $meta.experiments;
|
|
value = experiments != null;
|
|
r0 = value ? experiments : {};
|
|
}
|
|
} catch (error) {
|
|
return {};
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function isBuildOverrideLink(a0) { // fn#33629, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4260:2260, offset: 0x00e5680b, size: 31 bytes, params: 2, frame: 12
|
|
return a0 != null && env0_6.test(a0);
|
|
}
|
|
|
|
function validateURL(a0) { // fn#33630, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4260:2438, offset: 0x01036517, size: 241 bytes, params: 2, frame: 21
|
|
var r7;
|
|
var query;
|
|
var propertyName;
|
|
var propertyName2;
|
|
var query2;
|
|
var object;
|
|
if (isManualBuildOverrideLink(a0)) {
|
|
return {payload: null, url: a0};
|
|
}
|
|
const value2 = (URLUtils).safeParseWithQuery(a0);
|
|
if (value2 != null) {
|
|
var binding = env0_8;
|
|
if (binding.has(value2.hostname)) {
|
|
query = value2.query;
|
|
if ('s' in query) {
|
|
binding = env0_9;
|
|
if (binding.has(value2.pathname)) {
|
|
query = value2.query;
|
|
for (propertyName in query) {
|
|
if (propertyName === 's') {
|
|
r7 = propertyName2;
|
|
continue;
|
|
}
|
|
query2 = value2.query;
|
|
delete query2[propertyName];
|
|
r7 = propertyName2;
|
|
}
|
|
object = {};
|
|
query = value2.query;
|
|
object.payload = query.s;
|
|
object.url = (importAll(1473) /* metro dependency 1473 */).format(value2);
|
|
return object;
|
|
}
|
|
return null;
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
}
|
|
|
|
function _fun33623() { // fn#33623, offset: 0x00c58c16, size: 4 bytes, params: 1, frame: 1
|
|
return null;
|
|
}
|
|
|
|
function _fun33626() { // fn#33626, offset: 0x00c58c16, size: 4 bytes, params: 1, frame: 1
|
|
return null;
|
|
}
|
|
|
|
global.__d(_fun33617, 4102, [4103, 661, 1582, 477, 1471, 507, 1473, 4104,
|
|
2]) /* metro module 4102, dependencies: [4103, 661, 1582, 477, 1471, 507, 1473, 4104, 2] */;
|