Files
discord-decomp/sources/stores/MaskedLinkStore.tsx
T
2026-07-28 01:06:53 +03:00

198 lines
10 KiB
TypeScript

/* Metro module 8874; source: stores/MaskedLinkStore.tsx; dependencies: [6, 7, 15, 17, 18, 6868, 8875, 1471, 587, 566, 694, 2] */
import ClassCallCheck from '../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import Dispatcher from '../Dispatcher.tsx'; /* Metro dependency 694 */
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as StorageModule from '../external/discord_common/js/packages/storage/Storage.tsx'; /* Metro dependency 587 */
import * as SpotifyConstantsModule from '../modules/spotify/SpotifyConstants.tsx'; /* Metro dependency 6868 */
import * as MaskedLinkStoreMethodsAdditionalNativeModule from './MaskedLinkStoreMethodsAdditional.native.tsx'; /* Metro dependency 8875 */
function _fun69166(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#69166, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9059:6, offset: 0x01c6be61, size: 451 bytes, params: 8, frame: 21
var value6;
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const value = undefined;
let Set = global.Set;
let set = new Set();
Set = global.Set;
set = new Set();
const GLOBAL_ENV = global.window.GLOBAL_ENV;
const MEDIA_PROXY_ENDPOINT = GLOBAL_ENV.MEDIA_PROXY_ENDPOINT;
if (MEDIA_PROXY_ENDPOINT != null) {
value6 = MEDIA_PROXY_ENDPOINT.replace('//', '');
}
const Store = (Flux).Store;
const value7 = _fun69172(Store);
value7.displayName = 'MaskedLinkStore';
const value10 = new value7(Dispatcher,
{MASKED_LINK_ADD_TRUSTED_DOMAIN: MASKED_LINK_ADD_TRUSTED_DOMAIN,
MASKED_LINK_ADD_TRUSTED_PROTOCOL: MASKED_LINK_ADD_TRUSTED_PROTOCOL});
(FileImportTrackerModule).fileFinishedImporting('stores/MaskedLinkStore.tsx');
exports.default = value10;
return value;
function _isNativeReflectConstruct_69167() { // fn#69167, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9059:182, offset: 0x01c6c024, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_69167_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _isTrustedDomain(a0) { // fn#69170, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9059:496, offset: 0x01c6c086, size: 205 bytes, params: 2, frame: 15
const hostname = (MaskedLinkStoreMethodsAdditionalNativeModule).getHostname(a0);
let GLOBAL_ENV = global.window.GLOBAL_ENV;
const INVITE_HOST = GLOBAL_ENV.INVITE_HOST;
if (INVITE_HOST === hostname) {
return true;
}
GLOBAL_ENV = global.window.GLOBAL_ENV;
const GIFT_CODE_HOST = GLOBAL_ENV.GIFT_CODE_HOST;
if (GIFT_CODE_HOST === hostname) {
return true;
}
GLOBAL_ENV = global.window.GLOBAL_ENV;
const GUILD_TEMPLATE_HOST = GLOBAL_ENV.GUILD_TEMPLATE_HOST;
if (GUILD_TEMPLATE_HOST === hostname) {
return true;
}
if (env0_11 === hostname) {
return true;
}
if (global.location.hostname === hostname) {
return true;
}
let r0 = SPOTIFY_HOSTNAMES.includes(hostname) || (importDefault(1471) /* metro dependency 1471: URLUtils */).isDiscordHostname(hostname);
r0 = !r0 ? env0_9.has(hostname) : r0;
return r0;
}
function _isTrustedProtocol(a0) { // fn#69171, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9059:789, offset: 0x01c6c153, size: 55 bytes, params: 2, frame: 12
return env0_10.has((MaskedLinkStoreMethodsAdditionalNativeModule).getProtocol(a0));
}
function _fun69172(a0) { // fn#69172, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9059:871, offset: 0x01c6c18a, size: 126 bytes, params: 2, frame: 16
const MaskedLinkStore2 = MaskedLinkStore;
Inherits(MaskedLinkStore2, a0);
return CreateClass(MaskedLinkStore2, [{key: 'initialize', value: value_69174}, {key: 'isTrustedDomain',
value: function(a0) {
return _isTrustedDomain(a0);
}}, {key: 'isTrustedProtocol', value: function(a0) {
return _isTrustedProtocol(a0);
}}]);
function MaskedLinkStore() { // fn#69173, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9059:883, offset: 0x0108afcb, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_3(this, MaskedLinkStore);
const value3 = env1_6(MaskedLinkStore);
return env1_5(this, _isNativeReflectConstruct_69167() ? global.Reflect.construct(value3, arguments,
env1_6(this).constructor) : value3.apply(this, arguments));
}
function value_69174() { // fn#69174, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9059:1176, offset: 0x01c6c208, size: 302 bytes, params: 1, frame: 19
var r3;
var r5;
var trustedDomains;
var trustedProtocols;
var Set;
var prototype;
var value5;
var set;
var value6;
var value8;
var value9;
var value11;
var value12;
var value13;
var value14;
const Storage = (StorageModule).Storage;
const value2 = Storage.get('MaskedLinkStore');
const value3 = null;
const r4 = value3 != value2 ? value2 : {};
const Array = global.Array;
if (Array.isArray(r4)) {
Set = global.Set;
r5 = value3 != r4 ? global.Array.from(r4) : value3;
prototype = Set.prototype;
value11 = Object.create(prototype, {constructor: {value: Set}});
set = new Set();
value12 = set instanceof Object ? set : value11;
Set = global.Set;
prototype = Set.prototype;
value13 = Object.create(prototype, {constructor: {value: Set}});
set = new Set();
value14 = set instanceof Object ? set : value13;
} else {
trustedDomains = r4.trustedDomains;
trustedProtocols = r4.trustedProtocols;
Set = global.Set;
r3 = value3 != trustedDomains ? global.Array.from(trustedDomains) : value3;
prototype = Set.prototype;
value5 = Object.create(prototype, {constructor: {value: Set}});
set = new Set();
value6 = set instanceof Object ? set : value5;
Set = global.Set;
r3 = value3 != trustedProtocols ? global.Array.from(trustedProtocols) : value3;
prototype = Set.prototype;
value8 = Object.create(prototype, {constructor: {value: Set}});
set = new Set();
value9 = set instanceof Object ? set : value8;
}
}
}
function MASKED_LINK_ADD_TRUSTED_DOMAIN({url}) { // fn#69177, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9059:1676, offset: 0x01c6c349, size: 131 bytes, params: 2, frame: 18
if (_isTrustedDomain(url)) {
return false;
}
const binding = env0_9;
const add = binding.add;
const getHostname = MaskedLinkStoreMethodsAdditionalNativeModule.getHostname;
Reflect.apply(add, binding, [Reflect.apply(getHostname, MaskedLinkStoreMethodsAdditionalNativeModule, [url])]);
const Storage = (StorageModule).Storage;
Storage.set('MaskedLinkStore', {trustedDomains: env0_9, trustedProtocols: env0_10});
}
function MASKED_LINK_ADD_TRUSTED_PROTOCOL({url}) { // fn#69178, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9059:1874, offset: 0x01c6c3cc, size: 131 bytes, params: 2, frame: 18
if (_isTrustedProtocol(url)) {
return false;
}
const binding = env0_10;
const add = binding.add;
const getProtocol = MaskedLinkStoreMethodsAdditionalNativeModule.getProtocol;
Reflect.apply(add, binding, [Reflect.apply(getProtocol, MaskedLinkStoreMethodsAdditionalNativeModule, [url])]);
const Storage = (StorageModule).Storage;
Storage.set('MaskedLinkStore', {trustedDomains: env0_9, trustedProtocols: env0_10});
}
}
global.__d(_fun69166, 8874, [6, 7, 15, 17, 18, 6868, 8875, 1471, 587, 566, 694,
2]) /* metro module 8874, dependencies: [6, 7, 15, 17, 18, 6868, 8875, 1471, 587, 566, 694, 2] */;