OrbolayBridge: Update

This commit is contained in:
thororen1234 2026-06-10 16:52:52 -04:00
parent 80db605323
commit 98ebb1eaa1
No known key found for this signature in database

View file

@ -20,8 +20,6 @@ interface ChannelState {
selfStream: boolean;
}
const liveUpdate = () => sendConfig();
const settings = definePluginSettings({
port: {
type: OptionType.NUMBER,
@ -29,80 +27,6 @@ const settings = definePluginSettings({
default: 6888,
restartNeeded: true
},
isKeybindEnabled: {
type: OptionType.BOOLEAN,
description: "Enable/disable the global keybind (Ctrl + `)",
default: true,
onChange: liveUpdate,
},
messageAlignment: {
type: OptionType.SELECT,
description: "Alignment of messages in the overlay",
options: [
{ label: "Top left", value: "topleft", default: true },
{ label: "Top right", value: "topright" },
{ label: "Bottom left", value: "bottomleft" },
{ label: "Bottom right", value: "bottomright" },
{ label: "Top center", value: "topcenter" },
{ label: "Bottom center", value: "bottomcenter" },
{ label: "Center left", value: "centerleft" },
{ label: "Center right", value: "centerright" },
],
default: "topright",
onChange: liveUpdate,
},
messageOffsetX: {
type: OptionType.NUMBER,
description: "Horizontal offset for messages, in pixels",
default: 0,
onChange: liveUpdate,
},
messageOffsetY: {
type: OptionType.NUMBER,
description: "Vertical offset for messages, in pixels",
default: 0,
onChange: liveUpdate,
},
userAlignment: {
type: OptionType.SELECT,
description: "Alignment of users in the overlay",
options: [
{ label: "Top left", value: "topleft", default: true },
{ label: "Top right", value: "topright" },
{ label: "Bottom left", value: "bottomleft" },
{ label: "Bottom right", value: "bottomright" },
{ label: "Top center", value: "topcenter" },
{ label: "Bottom center", value: "bottomcenter" },
{ label: "Center left", value: "centerleft" },
{ label: "Center right", value: "centerright" },
],
default: "topleft",
onChange: liveUpdate,
},
userOffsetX: {
type: OptionType.NUMBER,
description: "Horizontal offset for users, in pixels",
default: 0,
onChange: liveUpdate,
},
userOffsetY: {
type: OptionType.NUMBER,
description: "Vertical offset for users, in pixels",
default: 0,
onChange: liveUpdate,
},
voiceSemitransparent: {
type: OptionType.BOOLEAN,
description: "Make voice channel members transparent",
default: true,
onChange: liveUpdate,
},
messagesSemitransparent: {
type: OptionType.BOOLEAN,
description: "Make message notifications transparent",
default: false,
onChange: liveUpdate,
},
});
const sendConfig = () => {
@ -111,12 +35,7 @@ const sendConfig = () => {
const userId = UserStore.getCurrentUser()?.id;
if (!userId) return;
const config: Record<string, unknown> = { userId };
for (const key of Object.keys(settings.def)) {
config[key] = settings.store[key];
}
ws?.send(JSON.stringify({ cmd: "REGISTER_CONFIG", ...config }));
ws.send(JSON.stringify({ cmd: "REGISTER_CONFIG", userId }));
};
let ws: WebSocket | null = null;
@ -302,6 +221,7 @@ const createWebsocket = () => {
}
}, 1000);
// Use the configured port locally to open the websocket, but do not include it in REGISTER_CONFIG
ws = new WebSocket("ws://127.0.0.1:" + settings.store.port);
ws.onerror = e => {
ws?.close?.();
@ -326,6 +246,14 @@ const createWebsocket = () => {
sendConfig();
// Let the client know whether we are in streamer mode
ws?.send(
JSON.stringify({
cmd: "STREAMER_MODE",
enabled: StreamerModeStore.enabled,
})
);
const userVoiceState = VoiceStateStore.getVoiceStateForUser(userId);
if (!userVoiceState || !userVoiceState.channelId) return;
@ -343,13 +271,6 @@ const createWebsocket = () => {
})
);
ws?.send(
JSON.stringify({
cmd: "STREAMER_MODE",
enabled: StreamerModeStore.enabled,
})
);
currentChannel = userVoiceState.channelId;
};
};