decord/source/modules/rpc/server/commands/application.tsx

93 lines
3.6 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 13935
// Function ID: 13936
// Dependencies: [4421, 4282, 676, 10827, 10829, 13936, 7733, 10824, 10689, 698, 530, 7731, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 13935
2026-08-24 06:08:38 +00:00
import sendRequest from "sendRequest" /* 530 */;
2026-08-25 06:04:03 +00:00
import isTestModeForApplication from "isTestModeForApplication" /* 7731 */;
import prototypeDefault from "prototype" /* 10824 */;
import createRpcJoiSchemaObjectDefault from "createRpcJoiSchemaObject" /* 10827 */;
import recurseReplaceContentTree from "recurseReplaceContentTree" /* 10829 */;
import getCurrentEmbeddedActivityChannelDefault from "getCurrentEmbeddedActivityChannel" /* 13936 */;
import closure_3 from "addApplication" /* 4421 */;
2026-08-24 06:08:38 +00:00
import ME from "ME" /* 676 */;
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
({ ApplicationFlags: c4, Endpoints: c5, RPCCommands, RPCErrors: closure_6 } = ME);
2026-07-20 16:05:17 +00:00
let obj = {
validation(string) {
2026-08-24 06:08:38 +00:00
let obj = createRpcJoiSchemaObjectDefault(string);
2026-07-29 08:29:29 +00:00
obj = { event_name: null, event_properties: null };
2026-07-20 16:05:17 +00:00
const requiredResult = obj.required();
2026-07-29 08:29:29 +00:00
obj[0] = string.string().required();
2026-07-20 16:05:17 +00:00
const stringResult = string.string();
2026-08-24 06:08:38 +00:00
obj[1] = createRpcJoiSchemaObjectDefault(string).required();
2026-07-20 16:05:17 +00:00
return requiredResult.keys(obj);
},
handler(arg0) {
({ socket, args } = arg0);
const event_properties = args.event_properties;
2026-08-24 06:08:38 +00:00
let obj = recurseReplaceContentTree;
2026-07-20 16:05:17 +00:00
const result = obj.validatePostMessageTransport(socket.transport);
2026-08-24 06:08:38 +00:00
obj1 = recurseReplaceContentTree;
2026-07-20 16:05:17 +00:00
obj1.validateApplication(socket.application);
const id = socket.application.id;
2026-08-24 06:08:38 +00:00
const obj3 = getCurrentEmbeddedActivityChannelDefault();
2026-07-29 08:29:29 +00:00
if (obj3 != null) {
2026-07-20 16:05:17 +00:00
const guildId = obj3.getGuildId();
}
2026-07-23 10:11:24 +00:00
application = application.getApplication(id);
2026-08-25 06:04:03 +00:00
let tmpResult = tmp(7733);
2026-07-29 08:29:29 +00:00
if (tmpResult.hasApplicationFlag(application, constants.EMBEDDED_FIRST_PARTY)) {
2026-08-25 06:04:03 +00:00
tmpResult = tmp(10689);
2026-07-29 08:29:29 +00:00
const activeAnalyticsSessionIDs = tmpResult.getActiveAnalyticsSessionIDs(id);
obj = { activity_application_id: null, activity_channel_type: null, activity_guild_id: null, activity_user_session_id: null };
obj[0] = id;
2026-07-20 16:05:17 +00:00
let type;
2026-07-29 08:29:29 +00:00
if (obj3 != null) {
2026-07-20 16:05:17 +00:00
type = obj3.type;
}
2026-07-29 08:29:29 +00:00
obj[1] = type;
obj[2] = guildId;
2026-07-20 16:05:17 +00:00
let prop;
2026-07-29 08:29:29 +00:00
if (activeAnalyticsSessionIDs != null) {
2026-07-20 16:05:17 +00:00
prop = activeAnalyticsSessionIDs.activityUserSessionId;
}
2026-07-29 08:29:29 +00:00
obj[3] = prop;
2026-07-20 16:05:17 +00:00
obj = {};
const merged = Object.assign(obj);
const merged1 = Object.assign(event_properties);
2026-07-29 08:29:29 +00:00
tmp5(698).track(args.event_name, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj1 = { errorCode: null };
obj1[0] = constants2.INVALID_COMMAND;
2026-08-25 06:04:03 +00:00
const tmp12 = new tmp5(10824)(obj1, "This application cannot access this API");
2026-07-29 08:29:29 +00:00
throw tmp12;
2026-07-20 16:05:17 +00:00
}
}
};
obj = {
2026-07-23 10:11:24 +00:00
scope: require("RPC_SCOPE_CONFIG").RPC_LOCAL_SCOPE,
2026-07-20 16:05:17 +00:00
handler(socket) {
const id = socket.socket.application.id;
if (null == id) {
2026-07-29 08:29:29 +00:00
let obj = { errorCode: null };
obj[0] = constants2.INVALID_COMMAND;
2026-08-24 06:08:38 +00:00
const tmp10 = new prototypeDefault(obj, "No application.");
throw tmp10;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
const HTTP = sendRequest.HTTP;
2026-07-29 08:29:29 +00:00
obj = { url: null, body: null, retries: 3, oldFormErrors: true, rejectWithError: false };
obj[0] = closure_5.APPLICATION_TICKET(id);
obj = { test_mode: null };
2026-08-24 06:08:38 +00:00
obj[0] = isTestModeForApplication.isTestModeForApplication(id);
2026-07-29 08:29:29 +00:00
obj[1] = obj;
2026-08-24 06:08:38 +00:00
const obj3 = isTestModeForApplication;
2026-07-20 16:05:17 +00:00
return HTTP.post(obj).then((body) => body.body);
}
}
};
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/rpc/server/commands/application.tsx");
2026-07-20 16:05:17 +00:00
export default { [RPCCommands.SEND_ANALYTICS_EVENT]: obj, [RPCCommands.GET_APPLICATION_TICKET]: obj };