decord/source/modules/rpc/server/commands/application.tsx
github-actions ecf26fc058 chore: update source for alpha 347.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
2026-09-16 07:03:15 +00:00

88 lines
3.7 KiB
TypeScript

// Module ID: 14583
// Function ID: 14584
// Name: application
// Dependencies: [4866, 4542, 1074, 9700, 9702, 14584, 8995, 9697, 9661, 1241, 1271, 8993, 2]
// Module 14583 (application)
import HTTPUtils from "HTTPUtils" /* 1271 */;
import TestModeUtils from "TestModeUtils" /* 8993 */;
import ApplicationFlagUtils from "ApplicationFlagUtils" /* 8995 */;
import RPCErrorDefault from "RPCError" /* 9697 */;
import createRpcJoiSchemaObjectDefault from "createRpcJoiSchemaObject" /* 9700 */;
import RPCHelpers from "RPCHelpers" /* 9702 */;
import getCurrentEmbeddedActivityChannelDefault from "getCurrentEmbeddedActivityChannel" /* 14584 */;
import ApplicationStore from "ApplicationStore" /* 4866 */;
require = fn;
const Constants = fn(1074);
({ ApplicationFlags: closure_4, Endpoints: hasOwnProperty, RPCCommands, RPCErrors: metroRequire } = Constants);
const size = fn(2);
let result = size.fileFinishedImporting("modules/rpc/server/commands/application.tsx");
export default {
[RPCCommands.SEND_ANALYTICS_EVENT]: {
validation(string) {
const obj = createRpcJoiSchemaObjectDefault(string);
const obj2 = { event_name: null, event_properties: null };
const requiredResult = createRpcJoiSchemaObjectDefault(string).required();
obj2.event_name = string.string().required();
const stringResult = string.string();
obj2.event_properties = createRpcJoiSchemaObjectDefault(string).required();
return requiredResult.keys(obj2);
},
handler(arg0) {
({ socket, args } = arg0);
const event_properties = args.event_properties;
const result = RPCHelpers.validatePostMessageTransport(socket.transport);
RPCHelpers.validateApplication(socket.application);
const id = socket.application.id;
const obj3 = getCurrentEmbeddedActivityChannelDefault();
if (obj3 != null) {
const guildId = obj3.getGuildId();
}
const application = ApplicationStore.getApplication(id);
if (tmpResult.hasApplicationFlag(application, constants.EMBEDDED_FIRST_PARTY)) {
const activeAnalyticsSessionIDs = tmp(9661).getActiveAnalyticsSessionIDs(id);
const obj4 = { activity_application_id: id, activity_channel_type: null, activity_guild_id: null, activity_user_session_id: null };
let type;
if (obj3 != null) {
type = obj3.type;
}
obj4.activity_channel_type = type;
obj4.activity_guild_id = guildId;
let prop;
if (activeAnalyticsSessionIDs != null) {
prop = activeAnalyticsSessionIDs.activityUserSessionId;
}
obj4.activity_user_session_id = prop;
const tmpResult2 = tmp(9661);
const obj5 = {};
const merged = Object.assign(obj4);
const merged1 = Object.assign(event_properties);
tmp5(1241).track(args.event_name, obj5);
} else {
const obj6 = { errorCode: constants2.INVALID_COMMAND };
const tmp12 = new tmp5(9697)(obj6, "This application cannot access this API");
throw tmp12;
}
tmpResult = ApplicationFlagUtils;
}
},
[RPCCommands.GET_APPLICATION_TICKET]: {
scope: fn(4542).RPC_LOCAL_SCOPE,
handler(socket) {
const id = socket.socket.application.id;
if (null == id) {
const obj = { errorCode: constants2.INVALID_COMMAND };
const tmp10 = new RPCErrorDefault(obj, "No application.");
throw tmp10;
} else {
const HTTP = HTTPUtils.HTTP;
const request = { url: hasOwnProperty.APPLICATION_TICKET(id), body: null, retries: 3, oldFormErrors: true, rejectWithError: false };
const obj2 = { test_mode: TestModeUtils.isTestModeForApplication(id) };
request.body = obj2;
return HTTP.post(request).then((body) => body.body);
}
}
}
};