decord/source/stores/RTCConnectionDesyncStore.tsx

214 lines
7.4 KiB
TypeScript
Raw Normal View History

2026-08-12 06:57:52 +00:00
// Module ID: 13082
// Function ID: 13083
2026-07-29 08:29:29 +00:00
// Name: retryFailedUsers
2026-08-12 06:57:52 +00:00
// Dependencies: [4361, 1391, 4415, 1922, 4360, 4416, 676, 4362, 4378, 4533, 8858, 4440, 589, 709, 2]
2026-07-20 16:05:17 +00:00
2026-08-12 06:57:52 +00:00
// Module 13082 (retryFailedUsers)
2026-07-29 08:29:29 +00:00
import isVoiceMuted from "isVoiceMuted";
import ensureGuildLoaded from "ensureGuildLoaded";
import createRTCConnection from "createRTCConnection";
import mergeGuildAvatar from "mergeGuildAvatar";
import updateVoiceState from "updateVoiceState";
import { makeSortedVoiceState } from "getVoiceStatesForGuild";
2026-07-23 10:11:24 +00:00
import ME from "ME";
import { ParticipantTypes } from "ParticipantTypes";
2026-07-29 08:29:29 +00:00
import { Store } from "initialize";
import set from "createRTCConnection";
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
let c10;
let c9;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function retryFailedUsers() {
const channelId = store.getChannelId();
if (null == channelId) {
return false;
} else {
2026-07-23 10:11:24 +00:00
channel = channel.getChannel(channelId);
2026-07-20 16:05:17 +00:00
let guildId;
2026-07-29 08:29:29 +00:00
if (channel != null) {
2026-07-20 16:05:17 +00:00
guildId = channel.getGuildId();
}
2026-07-23 10:11:24 +00:00
let c2 = false;
2026-07-29 08:29:29 +00:00
const item = set.forEach((userId) => {
if (null == outer1_7.getVoiceStateForChannel(channelId, userId)) {
const user = outer1_6.getUser(userId);
2026-07-20 16:05:17 +00:00
if (null != user) {
2026-07-29 08:29:29 +00:00
const dependencyMap = true;
outer1_14.delete(userId);
let obj = { userId: null, channelId: null };
obj[0] = user.id;
obj[1] = tmp;
const tmp23 = new outer1_3(obj);
let tmp6 = guildId;
if (guildId == null) {
tmp6 = outer1_9;
}
const result = outer1_12.set(user.id, outer1_8(tmp23, tmp6, user.id));
obj = { type: null, user: null, id: null, streamId: null, voiceState: null, voicePlatform: null, speaking: false, lastSpoke: 0, soundsharing: false, ringing: false, userNick: null, userAvatarDecoration: null, localVideoDisabled: false, isPoppedOut: false };
obj[0] = outer1_11.USER;
obj[1] = user;
obj[2] = user.id;
obj[4] = tmp23;
2026-08-12 06:57:52 +00:00
obj[10] = guildId(4533).getName(guildId, tmp, user);
const obj2 = guildId(4533);
2026-07-29 08:29:29 +00:00
const tmp24 = outer1_8;
2026-08-12 06:57:52 +00:00
obj[11] = channelId(8858).getAvatarDecoration(user, guildId);
2026-07-29 08:29:29 +00:00
const result1 = outer1_13.set(user.id, obj);
2026-08-12 06:57:52 +00:00
const obj3 = channelId(8858);
2026-07-20 16:05:17 +00:00
}
} else {
2026-07-29 08:29:29 +00:00
outer1_14.delete(userId);
2026-07-20 16:05:17 +00:00
}
});
2026-07-23 10:11:24 +00:00
return c2;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
({ ME: c9, RTCConnectionStates: c10 } = ME);
let closure_12 = new require("keys")();
const tmp3 = new require("keys")();
2026-07-23 10:11:24 +00:00
let set = new Set();
2026-07-29 08:29:29 +00:00
class RTCConnectionDesyncStore extends Store {
}
const prototype = RTCConnectionDesyncStore.prototype;
prototype["initialize"] = function initialize() {
this.waitFor(updateVoiceState, mergeGuildAvatar, ensureGuildLoaded, createRTCConnection);
const items = [mergeGuildAvatar];
this.syncWith(items, retryFailedUsers);
};
Object.defineProperty(prototype, "desyncedVoiceStatesCount", {
get: function desyncedVoiceStatesCount() {
return tmp3.size();
},
set: undefined
});
prototype["getDesyncedUserIds"] = function getDesyncedUserIds() {
return tmp3.keys();
};
prototype["getDesyncedVoiceStates"] = function getDesyncedVoiceStates() {
return tmp3.values();
};
prototype["getDesyncedParticipants"] = function getDesyncedParticipants() {
return tmp4.values();
};
RTCConnectionDesyncStore.displayName = "RTCConnectionDesyncStore";
const rTCConnectionDesyncStore = new RTCConnectionDesyncStore(require("dispatcher"), {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: function handleConnectionOpen() {
2026-07-29 08:29:29 +00:00
tmp3.clear();
tmp4.clear();
set.clear();
},
VOICE_CHANNEL_SELECT: function handleReset() {
tmp3.clear();
tmp4.clear();
set.clear();
2026-07-20 16:05:17 +00:00
},
RTC_CONNECTION_STATE: function handleRTCConnectionState(arg0) {
let context;
let state;
({ state, context } = arg0);
2026-08-12 06:57:52 +00:00
let tmp = context === require(4440) /* BaseConnectionEvent */.MediaEngineContextTypes.DEFAULT;
2026-07-20 16:05:17 +00:00
if (tmp) {
if (state === constants.DISCONNECTED) {
2026-07-29 08:29:29 +00:00
tmp3.clear();
tmp3.clear();
set.clear();
2026-07-20 16:05:17 +00:00
}
tmp = tmp3;
}
return tmp;
},
VOICE_STATE_UPDATES: function handleVoiceStateUpdates(voiceStates) {
voiceStates = voiceStates.voiceStates;
2026-07-29 08:29:29 +00:00
let channelId;
channelId = store.getChannelId();
2026-07-20 16:05:17 +00:00
let reduced = null != channelId;
if (reduced) {
2026-07-29 08:29:29 +00:00
reduced = voiceStates.reduce((arg0, userId) => {
userId = userId.userId;
let tmp = userId.channelId === channelId;
if (tmp) {
let deleteResult = outer1_12.delete(userId);
const deleteResult1 = outer1_13.delete(userId);
if (!deleteResult) {
deleteResult = deleteResult1;
}
if (!deleteResult) {
deleteResult = deleteResult2;
}
tmp = deleteResult;
deleteResult2 = outer1_14.delete(userId);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp) {
tmp = arg0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp;
2026-07-20 16:05:17 +00:00
}, false);
}
return reduced;
},
RTC_CONNECTION_CLIENT_CONNECT: function handleRTCConnectionClientConnect(context) {
2026-07-23 10:11:24 +00:00
let importDefault;
let require;
2026-07-20 16:05:17 +00:00
let userIds;
2026-07-23 10:11:24 +00:00
({ userIds, guildId: require, channelId: importDefault } = context);
2026-08-12 06:57:52 +00:00
let reduced = context.context === require(4440) /* BaseConnectionEvent */.MediaEngineContextTypes.DEFAULT;
2026-07-20 16:05:17 +00:00
if (reduced) {
2026-07-29 08:29:29 +00:00
reduced = userIds.reduce((arg0, userId) => {
if (null != outer1_7.getVoiceStateForChannel(closure_1, userId)) {
2026-07-20 16:05:17 +00:00
return arg0;
} else {
2026-07-29 08:29:29 +00:00
const user = outer1_6.getUser(userId);
2026-07-20 16:05:17 +00:00
if (null == user) {
2026-07-29 08:29:29 +00:00
outer1_14.add(userId);
2026-07-20 16:05:17 +00:00
let flag = arg0;
} else {
2026-07-29 08:29:29 +00:00
let obj = { userId: null, channelId: null };
obj[0] = user.id;
obj[1] = tmp;
const tmp21 = new outer1_3(obj);
let tmp2 = closure_0;
if (closure_0 == null) {
tmp2 = outer1_9;
}
const result = outer1_12.set(user.id, outer1_8(tmp21, tmp2, user.id));
obj = { type: null, user: null, id: null, streamId: null, voiceState: null, voicePlatform: null, speaking: false, lastSpoke: 0, soundsharing: false, ringing: false, userNick: null, userAvatarDecoration: null, localVideoDisabled: false, isPoppedOut: false };
obj[0] = outer1_11.USER;
obj[1] = user;
obj[2] = user.id;
obj[4] = tmp21;
obj[10] = outer1_1(outer1_2[9]).getName(closure_0, tmp, user);
const obj2 = outer1_1(outer1_2[9]);
const tmp22 = outer1_8;
obj[11] = outer1_0(outer1_2[10]).getAvatarDecoration(user, closure_0);
const result1 = outer1_13.set(user.id, obj);
2026-07-20 16:05:17 +00:00
flag = true;
2026-07-29 08:29:29 +00:00
const obj3 = outer1_0(outer1_2[10]);
2026-07-20 16:05:17 +00:00
}
return flag;
}
}, false);
}
return reduced;
},
2026-07-29 08:29:29 +00:00
RTC_CONNECTION_CLIENT_DISCONNECT: function handleRTCConnectionClientDisconnect(userId) {
userId = userId.userId;
2026-08-12 06:57:52 +00:00
let tmp = userId.context === require(4440) /* BaseConnectionEvent */.MediaEngineContextTypes.DEFAULT;
2026-07-20 16:05:17 +00:00
if (tmp) {
2026-07-29 08:29:29 +00:00
let deleteResult = tmp3.delete(userId);
const deleteResult1 = tmp4.delete(userId);
if (!deleteResult) {
deleteResult = deleteResult1;
}
if (!deleteResult) {
deleteResult = deleteResult2;
}
tmp = deleteResult;
deleteResult2 = set.delete(userId);
2026-07-20 16:05:17 +00:00
}
return tmp;
}
});
2026-07-23 10:11:24 +00:00
let result = set.fileFinishedImporting("stores/RTCConnectionDesyncStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default rTCConnectionDesyncStore;