Merge pull request #13 from Jaggernaut555/master

Hide own name and hide non-talking clients
This commit is contained in:
Janis
2023-01-11 11:03:49 +01:00
committed by GitHub
6 changed files with 17 additions and 2 deletions

View File

@@ -7,4 +7,6 @@ const CONFIG = {
fontStrokeSize: "3px", fontStrokeSize: "3px",
fontStrokeColor: "#000000", fontStrokeColor: "#000000",
}, },
hideSelf: false,
hideSilent: false,
}; };

View File

@@ -15,6 +15,7 @@ function main() {
clientList.clear(); clientList.clear();
channelList.clear(); channelList.clear();
selfClient = null;
ws.onopen = (event) => { ws.onopen = (event) => {
// Send payload to TS5 client // Send payload to TS5 client

View File

@@ -4,7 +4,13 @@ function drawClients() {
result = ""; result = "";
if (thisClient) { if (thisClient) {
getClientsInChannel(thisClient.channel).forEach((c) => { getClientsInChannel(thisClient.channel).forEach((c) => {
result += `<div class="client-div" style="color:${CONFIG.style.fontColor}; font-size:${CONFIG.style.fontSize}">`; isHidden = CONFIG.hideSilent && (c.talkStatus == 0 || c.isMuted());
result += `<div class="client-div" ${
isHidden ? "hidden" : ""
} style="color:${CONFIG.style.fontColor}; font-size:${
CONFIG.style.fontSize
}">`;
result += '<div class="client-img-div">'; result += '<div class="client-img-div">';
if (c.outputMuted) { if (c.outputMuted) {
result += ' <img src="img/muted_output.svg" />'; result += ' <img src="img/muted_output.svg" />';

View File

@@ -6,6 +6,8 @@ function handleAuthMessage(data) {
parseClientInfos(data.payload.connections[0].clientInfos) parseClientInfos(data.payload.connections[0].clientInfos)
); );
thisClient = clientList.getById(data.payload.connections[0].clientId); thisClient = clientList.getById(data.payload.connections[0].clientId);
selfClient = data.payload.connections[0].clientInfos.find((client) => client.id == data.payload.connections[0].clientId);
} }
function handleClientMoved(data) { function handleClientMoved(data) {

View File

@@ -22,6 +22,10 @@ class Client {
this.talkStatus = talkStatus; this.talkStatus = talkStatus;
console.log(`Client created: ${this.id} - ${this.name}`); console.log(`Client created: ${this.id} - ${this.name}`);
} }
isMuted() {
return this.inputMuted == true || this.outputMuted == true;
}
} }
class List { class List {

View File

@@ -3,7 +3,7 @@ function getClientsInChannel(channel) {
clientList.items.forEach((e) => { clientList.items.forEach((e) => {
if (e.channel) { if (e.channel) {
if (e.channel.id == channel.id) { if (e.channel.id == channel.id && !(CONFIG.hideSelf && selfClient && e.id == selfClient.id)) {
result.push(e); result.push(e);
} }
} }