690 lines
33 KiB
TypeScript
690 lines
33 KiB
TypeScript
/* Metro module 8081; source: modules/rpc/RPCHelpers.tsx; dependencies: [5, 4234, 4235, 1383, 1885, 1379, 1867, 4259, 4814, 4396, 1878, 4297, 4135, 661, 1471, 4100, 672, 22, 7067, 6622, 4634, 8082, 4617, 1473, 4122, 507, 8076, 8067, 8083, 2] */
|
|
import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */
|
|
import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */
|
|
import Durations from '../../utils/Durations.tsx'; /* Metro dependency 672 */
|
|
import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */
|
|
import URLUtils from '../../utils/URLUtils.tsx'; /* Metro dependency 1471 */
|
|
import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
|
|
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import UserRecord from '../../records/UserRecord.tsx'; /* Metro dependency 1885 */
|
|
import RegexUtils from '../../utils/RegexUtils.tsx'; /* Metro dependency 4100 */
|
|
import ApplicationStore from '../applications/ApplicationStore.tsx'; /* Metro dependency 4234 */
|
|
import ApplicationRecord from '../../records/ApplicationRecord.tsx'; /* Metro dependency 4235 */
|
|
import MediaEngineStore from '../../stores/MediaEngineStore.tsx'; /* Metro dependency 4259 */
|
|
import VoiceStateStore from '../../stores/VoiceStateStore.tsx'; /* Metro dependency 4297 */
|
|
import PresenceStore from '../../stores/PresenceStore.tsx'; /* Metro dependency 4396 */
|
|
import MessageStore from '../../stores/MessageStore.tsx'; /* Metro dependency 4814 */
|
|
import MarkupUtils from '../markup/MarkupUtils.tsx'; /* Metro dependency 6622 */
|
|
import MessageActionCreators from '../../actions/MessageActionCreators.tsx'; /* Metro dependency 7067 */
|
|
import RPCError from './RPCError.tsx'; /* Metro dependency 8076 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as HTTPUtilsModule from '../../external/discord_common/js/packages/http-utils/HTTPUtils.tsx'; /* Metro dependency 507 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as ChannelRecordModule from '../../records/ChannelRecord.tsx'; /* Metro dependency 1383 */
|
|
import * as ConstantsModule2 from './Constants.tsx'; /* Metro dependency 4135 */
|
|
|
|
function _fun64757(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#64757, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:6, offset: 0x01bb43b5, size: 1047 bytes, params: 8, frame: 31
|
|
var value7;
|
|
var property2;
|
|
var regexp;
|
|
var RegExp;
|
|
const env0_0 = require;
|
|
const closure = function(a0) {
|
|
var r0;
|
|
var protocol;
|
|
var host;
|
|
var value2;
|
|
var value3;
|
|
var value = a0;
|
|
if (RegExp('^http', '').test(value)) {
|
|
r0 = value;
|
|
} else {
|
|
protocol = global.location.protocol;
|
|
host = global.location.host;
|
|
value2 = value.charAt(0);
|
|
value3 = '/';
|
|
value = '' + protocol + '//' + host + (value3 !== value2 ? value3 : '') + value;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
};
|
|
const closure2 = function(a0) {
|
|
var value = a1;
|
|
return (value !== undefined ? value : []).indexOf(a0) > -1;
|
|
};
|
|
const transformInternalTextMessage2 = transformInternalTextMessage;
|
|
const transformVoiceState2 = transformVoiceState;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = undefined;
|
|
const constantsModule = ConstantsModule2;
|
|
const env0_15 = constantsModule.RPC_LOCAL_SCOPE;
|
|
const env0_16 = constantsModule.TransportTypes;
|
|
const constantsModule2 = ConstantsModule;
|
|
const env0_17 = constantsModule2.ActivityActionTypes;
|
|
const env0_18 = constantsModule2.ChannelTypes;
|
|
const env0_19 = constantsModule2.Endpoints;
|
|
const env0_20 = constantsModule2.MAX_MESSAGES_PER_CHANNEL;
|
|
const env0_21 = constantsModule2.RPCCloseCodes;
|
|
const env0_22 = constantsModule2.RPCErrors;
|
|
const env0_23 = constantsModule2.RTCConnectionStates;
|
|
const toURLSafe = URLUtils.toURLSafe;
|
|
const GLOBAL_ENV = global.window.GLOBAL_ENV;
|
|
const API_ENDPOINT = GLOBAL_ENV.API_ENDPOINT;
|
|
const value5 = Reflect.apply(toURLSafe, URLUtils, [API_ENDPOINT]);
|
|
let r16 = (value5 == null ? value : value5.host) ?? 'localhost';
|
|
const property = r16.split(':')[0];
|
|
if (property.includes('.')) {
|
|
value7 = property.split('.');
|
|
property2 = value7[value7.length - 1];
|
|
regexp = RegExp('^\\d+$', '');
|
|
r16 = regexp.test(property2) ? property : value7.slice(-2).join('.');
|
|
} else {
|
|
r16 = property;
|
|
}
|
|
RegExp = global.RegExp;
|
|
const regExp = new RegExp('^' + (RegexUtils).escape('https://') + '(?:[a-z]+\\.)?(' + (RegexUtils).escape(r16) + '|discordapp.com|discord.com)$');
|
|
const Millis = (Durations).Millis;
|
|
const MINUTE = Millis.MINUTE;
|
|
const value17 = 1 * MINUTE;
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/rpc/RPCHelpers.tsx');
|
|
exports.VALIDATE_SOCKET_CALLS_PER_PERIOD_LOW = 2;
|
|
exports.VALIDATE_SOCKET_CALLS_PER_PERIOD_HIGH = 60;
|
|
exports.VALIDATE_SOCKET_PERIOD_MS = value17;
|
|
exports.VALIDATE_SOCKET_THROTTLERS = {};
|
|
exports.getRemoteIconURL = closure;
|
|
exports.containsSameValues = containsSameValues;
|
|
exports.validateOrigin = closure2;
|
|
exports.transformChannel = transformChannel;
|
|
exports.transformInternalTextMessage = transformInternalTextMessage2;
|
|
exports.transformVoiceState = transformVoiceState2;
|
|
exports.transformBaseRelationship = function(a0, a1) {
|
|
var object = {type: a0};
|
|
object.user = importDefault(dependencyMap[21])(a1);
|
|
var object2 = {};
|
|
object2.status = PresenceStore.getStatus(a1.id, null);
|
|
object2.activity = null;
|
|
object.presence = object2;
|
|
return object;
|
|
};
|
|
exports.transformApplicationRelationship = transformApplicationRelationship;
|
|
exports.isMatchingOrigin = isMatchingOrigin;
|
|
exports.hasMessageReadPermission = hasMessageReadPermission;
|
|
exports.getVoiceConnectionState = function(a0) {
|
|
if (RTCConnectionStates.RTC_CONNECTED === a0) {
|
|
return a0.replace(RegExp('^RTC_', ''), 'VOICE_');
|
|
}
|
|
if (RTCConnectionStates.RTC_CONNECTING === a0) {
|
|
return a0.replace(RegExp('^RTC_', ''), 'VOICE_');
|
|
}
|
|
if (RTCConnectionStates.RTC_DISCONNECTED === a0) {
|
|
return a0.replace(RegExp('^RTC_', ''), 'VOICE_');
|
|
}
|
|
return a0;
|
|
};
|
|
exports.validateActivityInvite = validateActivityInvite;
|
|
exports.validateSocketApplication = function() {
|
|
return _validateSocketApplication.apply(this, arguments);
|
|
};
|
|
exports.processSocketThrottlers = function() {
|
|
return _processSocketThrottlers.apply(this, arguments);
|
|
};
|
|
exports.validateOriginAndUpdateSocket = validateOriginAndUpdateSocket;
|
|
exports.getDeprecatedVoiceSettingsWithShortcut = getDeprecatedVoiceSettingsWithShortcut;
|
|
exports.getVoiceSettingsWithShortcut = getVoiceSettingsWithShortcut;
|
|
exports.validatePostMessageTransport = validatePostMessageTransport;
|
|
exports.validateApplication = validateApplication;
|
|
return value;
|
|
function recurseReplaceContentTree(a0) { // fn#64758, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:891, offset: 0x01bb47cc, size: 133 bytes, params: 2, frame: 12
|
|
if (a0.type === 'customEmoji') {
|
|
a0.type = 'emoji';
|
|
}
|
|
if (a0.type === 'emoji' && a0.src) {
|
|
a0.src = getRemoteIconURL(a0.src);
|
|
}
|
|
const Array = global.Array;
|
|
const isArray = Array.isArray;
|
|
let content = a0.content;
|
|
if (Reflect.apply(isArray, Array, [content])) {
|
|
content = a0.content;
|
|
a0.content = content.map(recurseReplaceContentTree);
|
|
}
|
|
return a0;
|
|
}
|
|
|
|
function transformInternalTextMessage(a0) { // fn#64761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:1294, offset: 0x01bb48f3, size: 466 bytes, params: 2, frame: 21
|
|
var r4;
|
|
var userRecord2;
|
|
const value2 = undefined;
|
|
const defaultImport = MarkupUtils;
|
|
const toAST = defaultImport.parseToAST(a0.content, true, {channelId: a0.channel_id});
|
|
const value3 = toAST.map(recurseReplaceContentTree);
|
|
const channel = ChannelStore.getChannel(a0.channel_id);
|
|
if (a0.author != null) {
|
|
userRecord2 = new UserRecord(a0.author);
|
|
} else {
|
|
r4 = value2;
|
|
}
|
|
const r7 = a0.author != null ? (require(4634) /* metro dependency 4634: useMessageAuthor */).getUserAuthor(r4,
|
|
channel) : value2;
|
|
object = {};
|
|
object.id = a0.id;
|
|
object.blocked = a0.blocked;
|
|
object.bot = a0.bot;
|
|
object.content = a0.content;
|
|
object.content_parsed = value3.length ? value3 : value2;
|
|
object.nick = r7 == null ? value2 : r7.nick;
|
|
object.author_color = r7 == null ? value2 : r7.colorString;
|
|
object.edited_timestamp = a0.edited_timestamp || a0.editedTimestamp;
|
|
object.timestamp = a0.timestamp;
|
|
object.tts = a0.tts;
|
|
object.mentions = a0.mentions;
|
|
object.mention_everyone = a0.mention_everyone || a0.mentionEveryone;
|
|
object.mention_roles = a0.mention_roles || a0.mentionRoles;
|
|
object.embeds = a0.embeds;
|
|
object.attachments = a0.attachments;
|
|
object.author = r4 != null ? (importDefault(8082) /* metro dependency 8082: transformUser */)(r4) : value2;
|
|
object.pinned = a0.pinned;
|
|
object.type = a0.type;
|
|
return object;
|
|
}
|
|
|
|
function transformVoiceState(a0, a1, {mute, deaf, selfMute, selfDeaf, suppress, userId}) { // fn#64762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:2031, offset: 0x01bb4ac5, size: 299 bytes, params: 4, frame: 26
|
|
var Error;
|
|
var value;
|
|
const user = UserStore.getUser(userId);
|
|
if (user == null) {
|
|
Error = global.Error;
|
|
value = 'Invalid user id: ' + userId;
|
|
throw new Error();
|
|
}
|
|
const object = {};
|
|
object.nick = (importDefault(4617) /* metro dependency 4617: NicknameUtils */).getName(a0, a1, user);
|
|
const mediaEngineStoreBinding = MediaEngineStore;
|
|
object.mute = mediaEngineStoreBinding.isLocalMute(user.id);
|
|
object.volume = MediaEngineStore.getLocalVolume(user.id);
|
|
object.pan = MediaEngineStore.getLocalPan(user.id);
|
|
object.voice_state = {mute: mute, deaf: deaf, self_mute: selfMute, self_deaf: selfDeaf, suppress: suppress};
|
|
object.user = (importDefault(8082) /* metro dependency 8082: transformUser */)(user);
|
|
return object;
|
|
}
|
|
|
|
function fetchApplicationRPC(a0) { // fn#64763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:2392, offset: 0x01bb4bf0, size: 103 bytes, params: 2, frame: 16
|
|
const HTTP = (HTTPUtilsModule).HTTP;
|
|
const get = HTTP.get;
|
|
const object = {'url': null, 'oldFormErrors': true, 'retries': 3, 'rejectWithError': true};
|
|
object.url = Endpoints.APPLICATION_RPC(a0);
|
|
return Reflect.apply(get, HTTP, [object]).then(function(a0) {
|
|
return a0.body;
|
|
}, _fun64765);
|
|
function _fun64765() { // fn#64765, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:2546, offset: 0x01bb4c57, size: 73 bytes, params: 1, frame: 13
|
|
const value = environment.__proto__;
|
|
const defaultImport = RPCError;
|
|
const INVALID_CLIENTID = RPCCloseCodes.INVALID_CLIENTID;
|
|
throw new defaultImport({closeCode: INVALID_CLIENTID}, 'Invalid Client ID');
|
|
}
|
|
|
|
}
|
|
|
|
function _validateSocketApplication() { // fn#64766, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:2627, offset: 0x01bb4ca0, size: 48 bytes, params: 1, frame: 14
|
|
return Module00005(_fun64768).apply(this, arguments);
|
|
function* _fun64768(a0, a1, a2) { // fn#64768, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:2702, offset: 0x01bb4cd9, size: 453 bytes, params: 4, frame: 21
|
|
var r3;
|
|
var createFromServer;
|
|
var value8;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
let binding = env2_4;
|
|
const application = binding.getApplication(a1);
|
|
if (typeof a2 !== 'string') {
|
|
r3 = application;
|
|
if (r3 != null) {
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon, coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
createFromServer = binding.createFromServer;
|
|
yield env2_32(a1);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
value = Reflect.apply(createFromServer, binding, [value]);
|
|
r3 = value;
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon, coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
const transport = a0.transport;
|
|
const POST_MESSAGE = env2_16.POST_MESSAGE;
|
|
if (transport === POST_MESSAGE) {
|
|
binding = env2_1;
|
|
value8 = binding(env2_2[27])(a1);
|
|
if (value8 == null) {
|
|
throw new env2_1(env2_2[26])({closeCode: env2_21.INVALID_ORIGIN}, 'Invalid Origin');
|
|
}
|
|
binding = env2_29;
|
|
if (binding(a2, [value8])) {
|
|
r3 = application;
|
|
if (r3 != null) {
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon,
|
|
coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
createFromServer = binding.createFromServer;
|
|
yield env2_32(a1);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
value = Reflect.apply(createFromServer, binding, [value]);
|
|
r3 = value;
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon, coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
binding = env2_1;
|
|
throw new binding(env2_2[26])({closeCode: env2_21.INVALID_ORIGIN}, 'Invalid Origin');
|
|
}
|
|
yield env2_32(a1);
|
|
const value4 = undefined;
|
|
if (false) {
|
|
return value4;
|
|
}
|
|
const fromServer = env2_5.createFromServer(value4);
|
|
binding = env2_29;
|
|
if (binding(a2, value4.rpc_origins)) {
|
|
r3 = fromServer;
|
|
if (r3 != null) {
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon, coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
binding = env2_5;
|
|
createFromServer = binding.createFromServer;
|
|
yield env2_32(a1);
|
|
value = undefined;
|
|
if (false) {
|
|
return value;
|
|
}
|
|
value = Reflect.apply(createFromServer, binding, [value]);
|
|
r3 = value;
|
|
a0.application = {id: r3.id, parentId: r3.parentId, name: r3.name, icon: r3.icon, coverImage: r3.coverImage,
|
|
flags: r3.flags};
|
|
return undefined;
|
|
}
|
|
const value6 = env2_1(env2_2[26]);
|
|
const INVALID_ORIGIN = env2_21.INVALID_ORIGIN;
|
|
throw new value6({closeCode: INVALID_ORIGIN}, 'Invalid Origin');
|
|
}
|
|
|
|
}
|
|
|
|
function _processSocketThrottlers() { // fn#64769, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:3316, offset: 0x01bb4e9e, size: 48 bytes, params: 1, frame: 14
|
|
return Module00005(_fun64771).apply(this, arguments);
|
|
function* _fun64771(a0, a1, a2) { // fn#64771, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:3387, offset: 0x01bb4ed7, size: 215 bytes, params: 4, frame: 19
|
|
var r9;
|
|
var r3;
|
|
var binding;
|
|
var value5;
|
|
var prototype;
|
|
var value6;
|
|
var value7;
|
|
var value8;
|
|
var process;
|
|
var value9;
|
|
var value10;
|
|
var value11;
|
|
var error;
|
|
var value12;
|
|
var object;
|
|
var CLOSE_ABNORMAL;
|
|
var value13;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const property = env2_26[a0];
|
|
if (property == null) {
|
|
r9 = a1 ? 2 : 60;
|
|
binding = env2_1;
|
|
value5 = binding(env2_2[28]);
|
|
binding = env2_25;
|
|
prototype = value5.prototype;
|
|
value6 = Object.create(prototype, {constructor: {value: value5}});
|
|
value7 = new value5();
|
|
value8 = value7 instanceof Object ? value7 : value6;
|
|
env2_26[a0] = value8;
|
|
r3 = value8;
|
|
} else {
|
|
r3 = property;
|
|
}
|
|
try {
|
|
process = r3.process;
|
|
} catch (error) {
|
|
binding = env2_1;
|
|
value12 = binding(env2_2[26]);
|
|
object = {};
|
|
CLOSE_ABNORMAL = env2_21.CLOSE_ABNORMAL;
|
|
object.closeCode = CLOSE_ABNORMAL;
|
|
prototype = value12.prototype;
|
|
value = Object.create(prototype, {constructor: {value: value12}});
|
|
value13 = new value12(object, 'Socket closed during throttle');
|
|
value = value13 instanceof Object ? value13 : value;
|
|
throw value;
|
|
}
|
|
try {
|
|
value9 = Reflect.apply(process, r3, [a2]);
|
|
} catch (error) {
|
|
binding = env2_1;
|
|
value12 = binding(env2_2[26]);
|
|
object = {};
|
|
CLOSE_ABNORMAL = env2_21.CLOSE_ABNORMAL;
|
|
object.closeCode = CLOSE_ABNORMAL;
|
|
prototype = value12.prototype;
|
|
value = Object.create(prototype, {constructor: {value: value12}});
|
|
value13 = new value12(object, 'Socket closed during throttle');
|
|
value = value13 instanceof Object ? value13 : value;
|
|
throw value;
|
|
}
|
|
yield value9;
|
|
try {
|
|
value10 = undefined;
|
|
value11 = false;
|
|
} catch (error) {
|
|
binding = env2_1;
|
|
value12 = binding(env2_2[26]);
|
|
object = {};
|
|
CLOSE_ABNORMAL = env2_21.CLOSE_ABNORMAL;
|
|
object.closeCode = CLOSE_ABNORMAL;
|
|
prototype = value12.prototype;
|
|
value = Object.create(prototype, {constructor: {value: value12}});
|
|
value13 = new value12(object, 'Socket closed during throttle');
|
|
value = value13 instanceof Object ? value13 : value;
|
|
throw value;
|
|
}
|
|
return value11 ? value10 : undefined;
|
|
}
|
|
|
|
}
|
|
|
|
function containsSameValues(a0, a1) { // fn#64772, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:3881, offset: 0x01bb4fae, size: 84 bytes, params: 3, frame: 16
|
|
const isEqual = Module00022.isEqual;
|
|
const defaultImport = Module00022;
|
|
const pick = defaultImport.pick;
|
|
const Object = global.Object;
|
|
return Reflect.apply(isEqual, Module00022, [a0, Reflect.apply(pick, defaultImport, [a1, Object.keys(a0)])]);
|
|
}
|
|
|
|
function transformChannel(a0, a1) { // fn#64773, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:4029, offset: 0x01bb5002, size: 166 bytes, params: 3, frame: 16
|
|
const env0_0 = a0;
|
|
const env0_1 = a1;
|
|
const items3 = [];
|
|
const env0_2 = a0.getGuildId();
|
|
const GUILD_CATEGORY = ChannelTypes.GUILD_CATEGORY;
|
|
const items2 = [GUILD_CATEGORY];
|
|
arraySpread(items2, GUILD_VOCAL_CHANNEL_TYPES, 1, GUILD_CATEGORY);
|
|
if (!items2.includes(a0.type)) {
|
|
items3.push(new global.Promise(_fun64774));
|
|
}
|
|
const Promise = global.Promise;
|
|
return Promise.all(items3).then(_fun64776);
|
|
function _fun64774(a0) { // fn#64774, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:4154, offset: 0x01bb50a8, size: 99 bytes, params: 2, frame: 15
|
|
const env0_0 = a0;
|
|
const messageStoreBinding = MessageStore;
|
|
const whenReady = messageStoreBinding.whenReady;
|
|
const binding = env0_0;
|
|
Reflect.apply(whenReady, messageStoreBinding, [binding.id, _fun64775]);
|
|
(MessageActionCreators).fetchMessages({channelId: binding.id,
|
|
limit: MAX_MESSAGES_PER_CHANNEL});
|
|
function _fun64775() { // fn#64775, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:4176, offset: 0x00cefeb4, size: 15 bytes, params: 1, frame: 9
|
|
return env0_0();
|
|
}
|
|
|
|
}
|
|
|
|
function _fun64776() { // fn#64776, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:4261, offset: 0x01bb510b, size: 276 bytes, params: 1, frame: 16
|
|
var environment;
|
|
var r2;
|
|
var value2;
|
|
var value5;
|
|
var messageStoreBinding;
|
|
var value7;
|
|
let binding = env0_0;
|
|
if (binding.isNSFW()) {
|
|
value2 = environment.__proto__;
|
|
if (UserStore.getCurrentUser()?.nsfwAllowed !== true) {
|
|
r2 = [];
|
|
} else if (require) {
|
|
value5 = environment.__proto__;
|
|
messageStoreBinding = MessageStore;
|
|
value7 = messageStoreBinding.getMessages(env0_0.id).toArray();
|
|
r2 = value7.map(transformInternalTextMessage);
|
|
} else {
|
|
r2 = [];
|
|
}
|
|
} else if (require) {
|
|
value5 = environment.__proto__;
|
|
messageStoreBinding = MessageStore;
|
|
value7 = messageStoreBinding.getMessages(env0_0.id).toArray();
|
|
r2 = value7.map(transformInternalTextMessage);
|
|
} else {
|
|
r2 = [];
|
|
}
|
|
const Object = global.Object;
|
|
const values = Object.values;
|
|
const voiceStateStoreBinding = VoiceStateStore;
|
|
const getVoiceStatesForChannel = voiceStateStoreBinding.getVoiceStatesForChannel;
|
|
binding = env0_0;
|
|
const value11 = Reflect.apply(values, Object, [Reflect.apply(getVoiceStatesForChannel, voiceStateStoreBinding,
|
|
[binding.id])]).map(_fun64777);
|
|
const userLimit = binding.userLimit;
|
|
return {id: binding.id, name: binding.name, type: binding.type, topic: binding.topic, bitrate: binding.bitrate,
|
|
user_limit: userLimit, guild_id: env0_2, position: binding.position, messages: r2, voice_states: value11};
|
|
function _fun64777(a0) { // fn#64777, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:4471, offset: 0x01bb521f, size: 37 bytes, params: 2, frame: 15
|
|
return transformVoiceState(env1_2, env1_0.id, a0);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function transformApplicationRelationship(a0, a1) { // fn#64779, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:4960, offset: 0x01bb529b, size: 106 bytes, params: 3, frame: 17
|
|
var r0;
|
|
var object;
|
|
var object2;
|
|
var presenceStoreBinding;
|
|
let value = a0;
|
|
const value2 = null;
|
|
if (value2 == a1) {
|
|
r0 = value;
|
|
} else {
|
|
object = {};
|
|
copyDataProperties(object, value, a1);
|
|
object2 = {};
|
|
copyDataProperties(object2, value.presence, a1);
|
|
presenceStoreBinding = PresenceStore;
|
|
value = presenceStoreBinding.getApplicationActivity(value.user.id, a1);
|
|
object2['activity'] = value2 != value ? value : value2;
|
|
object['presence'] = object2;
|
|
r0 = object;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function isMatchingOrigin(a0) { // fn#64780, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:5147, offset: 0x01bb5305, size: 237 bytes, params: 2, frame: 18
|
|
var r0;
|
|
var value;
|
|
var property;
|
|
var defaultImport;
|
|
var value2;
|
|
var hostname;
|
|
var value5;
|
|
var value6;
|
|
var error;
|
|
if (a0 == null) {
|
|
return false;
|
|
}
|
|
const origin = global.window.location.origin;
|
|
if (a0 === origin) {
|
|
return true;
|
|
}
|
|
try {
|
|
value = environment;
|
|
property = dependencyMap[23];
|
|
defaultImport = importDefault(property);
|
|
value2 = defaultImport.parse(a0);
|
|
hostname = value2.hostname;
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
let r1 = global.window.location.hostname === hostname && hostname === 'localhost';
|
|
if (r1) {
|
|
r0 = r1;
|
|
} else {
|
|
value5 = a0.match('staging') == null;
|
|
if (value5) {
|
|
value6 = env0_24.test(a0);
|
|
r1 = !(value6 ? !env0_24.test(origin) : !value6);
|
|
} else {
|
|
r1 = value5;
|
|
}
|
|
r0 = r1;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function hasMessageReadPermission(a0, a1, a2) { // fn#64781, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:5432, offset: 0x01bb53f2, size: 125 bytes, params: 4, frame: 14
|
|
var r0;
|
|
var value;
|
|
const guildStoreBinding = GuildStore;
|
|
const getGuild = guildStoreBinding.getGuild;
|
|
const getGuildId = a0.getGuildId;
|
|
const value2 = Reflect.apply(getGuild, guildStoreBinding, [Reflect.apply(getGuildId, a0, [])]);
|
|
const value4 = (value2 != null ? value2.application_id : a0.getApplicationId()) === a1;
|
|
if (value4) {
|
|
r0 = value4;
|
|
} else {
|
|
value = a2.indexOf((require(4122) /* metro dependency 4122: OAuth2Scopes */).OAuth2Scopes.MESSAGES_READ);
|
|
value = value > -1;
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function validateActivityInvite(a0, a1, a2) { // fn#64783, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:5837, offset: 0x01bb54c2, size: 64 bytes, params: 4, frame: 5
|
|
var r1;
|
|
var r0;
|
|
const JOIN = ActivityActionTypes.JOIN;
|
|
const value = a0 === JOIN;
|
|
if (value) {
|
|
r1 = a1 != null && a1.id != null;
|
|
r1 = r1 && a2.join != null;
|
|
r0 = r1;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function validateOriginAndUpdateSocket(a0, a1) { // fn#64786, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:6205, offset: 0x01bb5502, size: 43 bytes, params: 3, frame: 3
|
|
if (a1 == null) {
|
|
a0.authorization.scopes = [RPC_LOCAL_SCOPE];
|
|
}
|
|
}
|
|
|
|
function getDeprecatedVoiceSettingsWithShortcut(a0) { // fn#64787, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:6330, offset: 0x01bb552d, size: 296 bytes, params: 2, frame: 17
|
|
const settings = MediaEngineStore.getSettings();
|
|
const closure = function(a0) {
|
|
var Object = global.Object;
|
|
var value = Object.values(a0);
|
|
value = value.sort(_fun64789);
|
|
return value.map(_fun64790);
|
|
};
|
|
const value3 = a0(settings);
|
|
const object = {};
|
|
const object2 = {};
|
|
mediaEngineStoreBinding = MediaEngineStore;
|
|
const getInputDevices = mediaEngineStoreBinding.getInputDevices;
|
|
object2.available_devices = closure(Reflect.apply(getInputDevices, mediaEngineStoreBinding, []));
|
|
object2.device_id = settings.inputDeviceId;
|
|
object2.volume = settings.inputVolume;
|
|
object.input = object2;
|
|
const object3 = {};
|
|
mediaEngineStoreBinding = MediaEngineStore;
|
|
const getOutputDevices = mediaEngineStoreBinding.getOutputDevices;
|
|
object3.available_devices = closure(Reflect.apply(getOutputDevices, mediaEngineStoreBinding, []));
|
|
object3.device_id = settings.outputDeviceId;
|
|
object3.volume = settings.outputVolume;
|
|
object.output = object3;
|
|
object.mode = {type: settings.mode, auto_threshold: settings.modeOptions.autoThreshold,
|
|
threshold: settings.modeOptions.threshold, shortcut: value3, delay: settings.modeOptions.delay};
|
|
object.automatic_gain_control = settings.automaticGainControl;
|
|
object.echo_cancellation = settings.echoCancellation;
|
|
object.noise_suppression = settings.noiseSuppression;
|
|
object.qos = settings.qos;
|
|
object.silence_warning = settings.silenceWarning;
|
|
object.deaf = settings.deaf;
|
|
object.mute = settings.mute;
|
|
return object;
|
|
function formatDevices(a0) { // fn#64788, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:6417, owner: getDeprecatedVoiceSettingsWithShortcut.formatDevices, offset: 0x01bb5655, size: 56 bytes, params: 2, frame: 12
|
|
const Object = global.Object;
|
|
let value = Object.values(a0);
|
|
value = value.sort(function({index}, a1) {
|
|
return index - a1.index;
|
|
});
|
|
return value.map(function(a0) {
|
|
return {id: a0.id, name: a0.name};
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
function getVoiceSettingsWithShortcut(a0, a1) { // fn#64791, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:7090, offset: 0x01bb56bc, size: 124 bytes, params: 3, frame: 13
|
|
const settings = MediaEngineStore.getSettings(a0);
|
|
const value2 = a1(settings);
|
|
const Object = global.Object;
|
|
return {input_mode: {type: settings.mode, shortcut: value2}, local_mutes: Object.keys(settings.localMutes),
|
|
local_volumes: settings.localVolumes, self_mute: settings.mute, self_deaf: settings.deaf};
|
|
}
|
|
|
|
function validatePostMessageTransport(a0) { // fn#64792, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:7341, offset: 0x01bb5738, size: 119 bytes, params: 2, frame: 15
|
|
var defaultImport;
|
|
var value;
|
|
const POST_MESSAGE = TransportTypes.POST_MESSAGE;
|
|
if (a0 !== POST_MESSAGE) {
|
|
defaultImport = importDefault(8076) /* metro dependency 8076: RPCError */;
|
|
({}).errorCode = RPCErrors.INVALID_COMMAND;
|
|
value = 'command not available from "' + a0 + ' transport';
|
|
value = new defaultImport();
|
|
throw value;
|
|
}
|
|
}
|
|
|
|
function validateApplication(a0) { // fn#64793, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:7525, offset: 0x01bb57af, size: 94 bytes, params: 2, frame: 13
|
|
if (a0.id == null) {
|
|
throw new (importDefault(8076) /* metro dependency 8076: RPCError */)({errorCode: RPCErrors.INVALID_COMMAND},
|
|
'Invalid application');
|
|
}
|
|
return a0.id;
|
|
}
|
|
|
|
}
|
|
|
|
function _fun64789({index}, {index}) { // fn#64789, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:6443, offset: 0x01bb568d, size: 22 bytes, params: 3, frame: 2
|
|
return index - index;
|
|
}
|
|
|
|
function _fun64790({id, name}) { // fn#64790, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8266:6473, offset: 0x01bb56a3, size: 25 bytes, params: 2, frame: 3
|
|
return {id: id, name: name};
|
|
}
|
|
|
|
global.__d(_fun64757, 8081, [5, 4234, 4235, 1383, 1885, 1379, 1867, 4259, 4814, 4396, 1878, 4297, 4135, 661, 1471,
|
|
4100, 672, 22, 7067, 6622, 4634, 8082, 4617, 1473, 4122, 507, 8076, 8067, 8083,
|
|
2]) /* metro module 8081, dependencies: [5, 4234, 4235, 1383, 1885, 1379, 1867, 4259, 4814, 4396, 1878, 4297, 4135, 661, 1471, 4100, 672, 22, 7067, 6622, 4634, 8082, 4617, 1473, 4122, 507, 8076, 8067, 8083, 2] */;
|