mirror of
https://github.com/DerTyp7/teamspeak-obs-overlay.git
synced 2025-10-30 05:07:12 +01:00
Merge pull request #23 from DerTyp876/6-set-a-show-clients-limit
6 set a show clients limit
This commit is contained in:
11
README.md
11
README.md
@@ -43,14 +43,15 @@ Start by adding a `?` to the end of the URL and then add the parameters.
|
|||||||
To add multiple parameters, you have to seperate them with a `&`.
|
To add multiple parameters, you have to seperate them with a `&`.
|
||||||
|
|
||||||
Like this: `file://C:/Users/.../index.html?parameter1=value1¶meter2=value2`
|
Like this: `file://C:/Users/.../index.html?parameter1=value1¶meter2=value2`
|
||||||
Real example: `file://C:/Users/.../index.html?remoteAppPort=5899`
|
Real example: `file://C:/Users/.../index.html?remoteAppPort=5899&hideNonTalking=true&clientLimit=5`
|
||||||
|
|
||||||
This is a list of all available parameters (all parameters are optional):
|
This is a list of all available parameters (all parameters are optional):
|
||||||
|
|
||||||
| Parameter | Description | Type | Default |
|
| Parameter | Description | Type | Default |
|
||||||
| ---------------- | -------------------------------------- | ------- | ------- |
|
| ---------------- | ---------------------------------------- | ------- | --------------- |
|
||||||
| `remoteAppPort` | The port of the Teamspeak 5 remote app | number | `5899` |
|
| `remoteAppPort` | The port of the Teamspeak 5 remote app | number | `5899` |
|
||||||
| `hideNonTalking` | Hide all non-talking clients | boolean | `false` |
|
| `hideNonTalking` | Hide all non-talking clients | boolean | `false` |
|
||||||
|
| `clientLimit` | Count of how many client should be shown | number | `0` (unlimited) |
|
||||||
|
|
||||||
## Setup (Developer)
|
## Setup (Developer)
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ export default function App() {
|
|||||||
<div className="App">
|
<div className="App">
|
||||||
<Viewer
|
<Viewer
|
||||||
hideNonTalking={searchParams.get("hideNonTalking") === "true"}
|
hideNonTalking={searchParams.get("hideNonTalking") === "true"}
|
||||||
|
clientLimit={searchParams.get("clientLimit") ? parseInt(searchParams.get("clientLimit") ?? "0") : 0}
|
||||||
clients={
|
clients={
|
||||||
clients.map((client) => {
|
clients.map((client) => {
|
||||||
if (client.channel?.id === currentChannel?.id && client.channel.connection.id === activeConnectionId) {
|
if (client.channel?.id === currentChannel?.id && client.channel.connection.id === activeConnectionId) {
|
||||||
|
|||||||
@@ -6,16 +6,23 @@ export default function Viewer({
|
|||||||
channel,
|
channel,
|
||||||
showChannelName = false,
|
showChannelName = false,
|
||||||
hideNonTalking = false,
|
hideNonTalking = false,
|
||||||
|
clientLimit = 0,
|
||||||
}: {
|
}: {
|
||||||
clients: IClient[] | undefined;
|
clients: IClient[] | undefined;
|
||||||
channel: IChannel | undefined;
|
channel: IChannel | undefined;
|
||||||
showChannelName?: boolean;
|
showChannelName?: boolean;
|
||||||
hideNonTalking?: boolean;
|
hideNonTalking?: boolean;
|
||||||
|
clientLimit?: number;
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="viewer">
|
<div className="viewer">
|
||||||
{showChannelName ? <h3>{channel?.properties.name}</h3> : null}
|
{showChannelName ? <h3>{channel?.properties.name}</h3> : null}
|
||||||
{clients?.map((client) => {
|
{clients?.map((client, i) => {
|
||||||
|
//* Client limit
|
||||||
|
if (clientLimit != 0 && i >= clientLimit) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (client) {
|
if (client) {
|
||||||
//* Non-talking client
|
//* Non-talking client
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user