decord/source/stores/MaskedLinkStore.tsx
2026-08-05 07:35:12 +00:00

151 lines
4.5 KiB
TypeScript

// Module ID: 8828
// Function ID: 8829
// Name: set
// Dependencies: [8797, 8829, 1467, 595, 589, 709, 2]
// Module 8828 (set)
import { SPOTIFY_HOSTNAMES } from "WEB_OPEN";
import { Store } from "initialize";
import set from "isDiscordProxiedAssetUrl";
const MaskedLinkStore = "MaskedLinkStore";
let set = new Set();
let set1 = new Set();
let replaced;
if (window.GLOBAL_ENV.MEDIA_PROXY_ENDPOINT != null) {
replaced = str.replace("//", "");
}
class MaskedLinkStore extends Store {
}
const prototype = MaskedLinkStore.prototype;
prototype["initialize"] = function initialize() {
let trustedDomains;
let trustedProtocols;
const Storage = require(595) /* Storage */.Storage;
let obj = Storage.get(MaskedLinkStore);
if (obj == null) {
obj = {};
}
if (Array.isArray(obj)) {
let arr = null;
if (null != obj) {
const _Array3 = Array;
arr = Array.from(obj);
}
const set = new Set(arr);
let set2 = set;
const _Set = Set;
const set1 = new Set();
let set3 = set1;
} else {
({ trustedDomains, trustedProtocols } = obj);
arr = null;
if (null != trustedDomains) {
const _Array = Array;
arr = Array.from(trustedDomains);
}
set2 = new Set(arr);
let arr1 = null;
if (null != trustedProtocols) {
const _Array2 = Array;
arr1 = Array.from(trustedProtocols);
}
set3 = new Set(arr1);
}
};
prototype["isTrustedDomain"] = function isTrustedDomain(arg0) {
const hostname = require(8829) /* getHostname */.getHostname(arg0);
let flag = true;
if (window.GLOBAL_ENV.INVITE_HOST !== hostname) {
const _window2 = window;
flag = true;
if (window.GLOBAL_ENV.GIFT_CODE_HOST !== hostname) {
const _window = window;
flag = true;
if (window.GLOBAL_ENV.GUILD_TEMPLATE_HOST !== hostname) {
flag = true;
if (replaced !== hostname) {
const _location = location;
flag = true;
if (location.hostname !== hostname) {
let hasItem = SPOTIFY_HOSTNAMES.includes(hostname);
if (!hasItem) {
hasItem = importDefault(1467).isDiscordHostname(hostname);
const obj2 = importDefault(1467);
}
if (!hasItem) {
hasItem = set.has(hostname);
}
flag = hasItem;
}
}
}
}
}
return flag;
};
prototype["isTrustedProtocol"] = function isTrustedProtocol(url) {
return set1.has(require(8829) /* getHostname */.getProtocol(url));
};
MaskedLinkStore.displayName = "MaskedLinkStore";
const maskedLinkStore = new MaskedLinkStore(require("dispatcher"), {
MASKED_LINK_ADD_TRUSTED_DOMAIN: function handleAddTrustedDomain(url) {
url = url.url;
let obj = require(8829) /* getHostname */;
const hostname = obj.getHostname(url);
let flag = true;
if (window.GLOBAL_ENV.INVITE_HOST !== hostname) {
const _window2 = window;
flag = true;
if (window.GLOBAL_ENV.GIFT_CODE_HOST !== hostname) {
const _window = window;
flag = true;
if (window.GLOBAL_ENV.GUILD_TEMPLATE_HOST !== hostname) {
flag = true;
if (replaced !== hostname) {
const _location = location;
flag = true;
if (location.hostname !== hostname) {
let hasItem = SPOTIFY_HOSTNAMES.includes(hostname);
if (!hasItem) {
hasItem = importDefault(1467).isDiscordHostname(hostname);
const obj2 = importDefault(1467);
}
if (!hasItem) {
hasItem = set.has(hostname);
}
flag = hasItem;
}
}
}
}
}
if (flag) {
return false;
} else {
set.add(tmp(8829).getHostname(url));
const Storage = tmp(595).Storage;
obj = { trustedDomains: null, trustedProtocols: null };
obj[0] = set;
obj[1] = set1;
const result = Storage.set(MaskedLinkStore, obj);
}
},
MASKED_LINK_ADD_TRUSTED_PROTOCOL: function handleAddTrustedProtocol(url) {
url = url.url;
let obj = require(8829) /* getHostname */;
if (set1.has(obj.getProtocol(url))) {
return false;
} else {
set1.add(tmp(8829).getProtocol(url));
const Storage = tmp(595).Storage;
obj = { trustedDomains: null, trustedProtocols: null };
obj[0] = set;
obj[1] = set1;
const result = Storage.set(MaskedLinkStore, obj);
}
}
});
let result = set.fileFinishedImporting("stores/MaskedLinkStore.tsx");
export default maskedLinkStore;