feat(server): clean populated channels
This commit is contained in:
parent
f0b86e7bd8
commit
d0e458bd3a
3 changed files with 16 additions and 2 deletions
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -18,6 +18,7 @@
|
||||||
"ijmap",
|
"ijmap",
|
||||||
"nestjs",
|
"nestjs",
|
||||||
"tsviewer",
|
"tsviewer",
|
||||||
"uglifycss"
|
"uglifycss",
|
||||||
|
"cspacer0"
|
||||||
],
|
],
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ export class AppController {
|
||||||
@Get()
|
@Get()
|
||||||
@Render('index.hbs')
|
@Render('index.hbs')
|
||||||
async getIndex(): Promise<Record<string, unknown>> {
|
async getIndex(): Promise<Record<string, unknown>> {
|
||||||
const channels = await this.teamspeakService.getPopulatedChannelList();
|
const channels = await this.teamspeakService.getCleanedPopulatedChannelList();
|
||||||
return { title: 'Cliffbreak.de TS-Viewer', channels };
|
return { title: 'Cliffbreak.de TS-Viewer', channels };
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -78,4 +78,17 @@ export class TeamspeakService {
|
||||||
return channelList;
|
return channelList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getCleanedPopulatedChannelList(): Promise<IPopulatedChannel[]> {
|
||||||
|
const populatedChannels = await this.getPopulatedChannelList();
|
||||||
|
const channelList: IPopulatedChannel[] = [];
|
||||||
|
for(const channel of populatedChannels) {
|
||||||
|
if(channel.name.includes('[*spacer')) {
|
||||||
|
continue;
|
||||||
|
} else if(channel.name.includes('[cspacer0]')) {
|
||||||
|
channel.name = channel.name.replace('[cspacer0]', '');
|
||||||
|
}
|
||||||
|
channelList.push(channel);
|
||||||
|
}
|
||||||
|
return channelList;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue