92 lines
5.9 KiB
TypeScript
92 lines
5.9 KiB
TypeScript
/* Metro module 13017; source: modules/rpc/server/commands/application.tsx; dependencies: [4234, 4135, 661, 8079, 8081, 13018, 7504, 8076, 8097, 683, 507, 7502, 2] */
|
|
import ApplicationStore from '../../../applications/ApplicationStore.tsx'; /* Metro dependency 4234 */
|
|
import RPCError from '../../RPCError.tsx'; /* Metro dependency 8076 */
|
|
import GetCurrentEmbeddedActivityChannel from '../../helpers/getCurrentEmbeddedActivityChannel.tsx'; /* Metro dependency 13018 */
|
|
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 ConstantsModule2 from '../../Constants.tsx'; /* Metro dependency 4135 */
|
|
import * as ApplicationFlagUtilsModule from '../../../applications/utils/ApplicationFlagUtils.tsx'; /* Metro dependency 7504 */
|
|
import * as RPCHelpersModule from '../../RPCHelpers.tsx'; /* Metro dependency 8081 */
|
|
|
|
function _fun99372(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99372, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13207:6, offset: 0x021c5ddb, size: 246 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const RPC_LOCAL_SCOPE = (ConstantsModule2).RPC_LOCAL_SCOPE;
|
|
const RPCCommands = ConstantsModule.RPCCommands;
|
|
object = {};
|
|
const SEND_ANALYTICS_EVENT = RPCCommands.SEND_ANALYTICS_EVENT;
|
|
object[SEND_ANALYTICS_EVENT] = {validation: validation, handler: handler_99374};
|
|
const GET_APPLICATION_TICKET = RPCCommands.GET_APPLICATION_TICKET;
|
|
object[GET_APPLICATION_TICKET] = {scope: RPC_LOCAL_SCOPE, handler: handler_99375};
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/rpc/server/commands/application.tsx');
|
|
exports.default = object;
|
|
function validation(a0) { // fn#99373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13207:247, offset: 0x021c5ed1, size: 110 bytes, params: 2, frame: 18
|
|
let value = (importDefault(8079) /* metro dependency 8079: createRpcJoiSchemaObject */)(a0);
|
|
value = value.required();
|
|
const keys = value.keys;
|
|
const object = {};
|
|
object.event_name = a0.string().required();
|
|
object.event_properties = (importDefault(8079) /* metro dependency 8079: createRpcJoiSchemaObject */)(a0).required();
|
|
return Reflect.apply(keys, value, [object]);
|
|
}
|
|
|
|
function handler_99374({socket, args}) { // fn#99374, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13207:352, offset: 0x021c5f3f, size: 416 bytes, params: 2, frame: 21
|
|
var object;
|
|
var activeAnalyticsSessionIDs;
|
|
var track;
|
|
var object2;
|
|
const event_name = args.event_name;
|
|
const event_properties = args.event_properties;
|
|
var value;
|
|
RPCHelpersModule.validatePostMessageTransport(socket.transport);
|
|
RPCHelpersModule.validateApplication(socket.application);
|
|
const id = socket.application.id;
|
|
const value3 = (GetCurrentEmbeddedActivityChannel)();
|
|
const guildId = value3?.getGuildId();
|
|
const application = ApplicationStore.getApplication(id);
|
|
const hasApplicationFlag = ApplicationFlagUtilsModule.hasApplicationFlag;
|
|
const EMBEDDED_FIRST_PARTY = ApplicationFlags.EMBEDDED_FIRST_PARTY;
|
|
if (Reflect.apply(hasApplicationFlag, ApplicationFlagUtilsModule, [application, EMBEDDED_FIRST_PARTY])) {
|
|
activeAnalyticsSessionIDs = (require(8097) /* metro dependency 8097: EmbeddedActivitiesManager */).getActiveAnalyticsSessionIDs(id);
|
|
object = {activity_application_id: id};
|
|
object.activity_channel_type = value3?.type;
|
|
object.activity_guild_id = guildId;
|
|
object.activity_user_session_id = activeAnalyticsSessionIDs?.activityUserSessionId;
|
|
value = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
track = value.track;
|
|
object2 = {};
|
|
copyDataProperties(object2, object, application);
|
|
copyDataProperties(object2, event_properties, application);
|
|
Reflect.apply(track, value, [event_name, object2]);
|
|
return undefined;
|
|
}
|
|
const defaultImport = RPCError;
|
|
const INVALID_COMMAND = RPCErrors.INVALID_COMMAND;
|
|
throw new defaultImport({errorCode: INVALID_COMMAND}, 'This application cannot access this API');
|
|
}
|
|
|
|
function handler_99375({socket}) { // fn#99375, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13207:1013, offset: 0x021c60df, size: 234 bytes, params: 2, frame: 18
|
|
const id = socket.application.id;
|
|
if (id == null) {
|
|
throw new (importDefault(8076) /* metro dependency 8076: RPCError */)({errorCode: RPCErrors.INVALID_COMMAND},
|
|
'No application.');
|
|
}
|
|
const HTTP = (HTTPUtilsModule).HTTP;
|
|
const post = HTTP.post;
|
|
const object = {'url': null, 'body': null, 'retries': 3, 'oldFormErrors': true, 'rejectWithError': false};
|
|
object.url = Endpoints.APPLICATION_TICKET(id);
|
|
const object2 = {};
|
|
object2.test_mode = (require(7502) /* metro dependency 7502: TestModeUtils */).isTestModeForApplication(id);
|
|
object.body = object2;
|
|
return Reflect.apply(post, HTTP, [object]).then(function(a0) {
|
|
return a0.body;
|
|
});
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun99372, 13017, [4234, 4135, 661, 8079, 8081, 13018, 7504, 8076, 8097, 683, 507, 7502,
|
|
2]) /* metro module 13017, dependencies: [4234, 4135, 661, 8079, 8081, 13018, 7504, 8076, 8097, 683, 507, 7502, 2] */;
|