Skip to content

Commit 057f166

Browse files
authored
add: chillerbot-ux client
Merge pull request #3 from ChillerDragon/pr_chillerbot-ux
2 parents 32cb992 + a7df52b commit 057f166

File tree

6 files changed

+54
-19
lines changed

6 files changed

+54
-19
lines changed

main.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ async function getGamePath(gameId) {
127127
'tw': { clientName: 'Teeworlds', executable: process.platform === 'linux' ? 'teeworlds' : 'teeworlds.exe' },
128128
'ddnet': { clientName: 'DDraceNetwork', executable: process.platform === 'linux' ? 'DDNet' : 'DDNet.exe' },
129129
'tclient': { clientName: 'TClient', executable: process.platform === 'linux' ? 'DDNet' : 'DDNet.exe' },
130-
'cactus': { clientName: 'Cactus', executable: process.platform === 'linux' ? 'DDNet' : 'DDNet.exe' }
130+
'cactus': { clientName: 'Cactus', executable: process.platform === 'linux' ? 'DDNet' : 'DDNet.exe' },
131+
'chillerbot-ux': { clientName: 'chillerbot-ux', executable: process.platform === 'linux' ? 'chillerbot-ux' : 'chillerbot-ux.exe' }
131132
};
132133

133134
const gameData = games[gameId];
@@ -138,7 +139,7 @@ async function getGamePath(gameId) {
138139
}
139140

140141
async function getAllGameStatuses() {
141-
const gameIds = ['tw', 'ddnet', 'tclient', 'cactus'];
142+
const gameIds = ['tw', 'ddnet', 'tclient', 'cactus', 'chillerbot-ux'];
142143
const statuses = {};
143144
for (const gameId of gameIds) {
144145
const isInstalled = await getGamePath(gameId);
@@ -226,7 +227,8 @@ ipcMain.on('launch-game', async (event, gameId) => {
226227
'tw': { executable: process.platform === 'linux' ? 'teeworlds' : 'teeworlds.exe' },
227228
'ddnet': { executable: process.platform === 'linux' ? 'DDNet' : 'DDNet.exe' },
228229
'tclient': { executable: process.platform === 'linux' ? 'DDNet' : 'DDNet.exe' },
229-
'cactus': { executable: process.platform === 'linux' ? 'DDNet' : 'DDNet.exe' }
230+
'cactus': { executable: process.platform === 'linux' ? 'DDNet' : 'DDNet.exe' },
231+
'chillerbot-ux': { executable: process.platform === 'linux' ? 'chillerbot-ux' : 'chillerbot-ux.exe' }
230232
};
231233

232234
const gameData = games[gameId];
@@ -374,4 +376,4 @@ app.on('activate', () => {
374376

375377
app.on('window-all-closed', (event) => {
376378
event.preventDefault();
377-
});
379+
});

src/assets/bgs/chillerbot-ux.png

23 KB
Loading
74.5 KB
Loading

src/assets/logos/chillerbot-ux.png

27.4 KB
Loading

src/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
<div class="sidebar-icon-status"></div>
3535
<img src="assets/logos/cactus.png" id="Cactus" draggable="false" class="sidebar-icon" data-id="cactus">
3636
</div>
37+
<div class="sidebar-icon-main">
38+
<div class="sidebar-icon-status"></div>
39+
<img src="assets/logos/chillerbot-ux.png" id="chillerbot-ux" draggable="false" class="sidebar-icon" data-id="chillerbot-ux">
40+
</div>
3741
</div>
3842
<div class="add-icon"><i class="fas fa-plus"></i></div>
3943
<div class="help-icon">?</div>

src/scripts/script.js

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,24 @@ document.addEventListener('DOMContentLoaded', () => {
247247
}
248248
}
249249

250+
const chillerbotUxData = games['chillerbot-ux'];
251+
const chillerbotUxPath = path.join(installPath, tclientData.clientName);
252+
if (fs.existsSync(chillerbotUxPath)) {
253+
const currentChillerbotUxVersion = await getClientVersion(chillerbotUxPath);
254+
const release = await getLatestGitHubRelease(chillerbotUxData.githubRepo);
255+
const latestChillerbotUxVersion = release.tag_name;
256+
257+
if (currentChillerbotUxVersion && currentChillerbotUxVersion !== latestChillerbotUxVersion && !notifiedUpdates.has('chillerbot-ux')) {
258+
console.log(`chillerbot-ux update available: ${currentChillerbotUxVersion} -> ${latestChillerbotUxVersion}`);
259+
ipcRenderer.send('show-update-notification', {
260+
clientName: chillerbotUxData.clientName,
261+
currentVersion: currentChillerbotUxVersion,
262+
latestVersion: latestChillerbotUxVersion
263+
});
264+
notifiedUpdates.add('chillerbot-ux');
265+
}
266+
}
267+
250268
const cactusData = games['cactus'];
251269
const cactusPath = path.join(installPath, cactusData.clientName);
252270
if (fs.existsSync(cactusPath)) {
@@ -550,11 +568,11 @@ document.addEventListener('DOMContentLoaded', () => {
550568
return fs.existsSync(versionFile) ? fs.readFileSync(versionFile, 'utf8').trim() : null;
551569
}
552570

553-
async function downloadAndInstallTClient(button) {
554-
const gameData = games['tclient'];
571+
async function downloadAndInstallFromGithub(button, clientName, folderName) {
572+
const gameData = games[clientName];
555573
const installPath = await ipcRenderer.invoke('get-install-path');
556574
const clientPath = path.join(installPath, gameData.clientName);
557-
const tempZipPath = path.join(os.tmpdir(), process.platform === 'linux' ? 'TClient-ubuntu.tar.xz' : 'TClient-windows.zip');
575+
const tempZipPath = path.join(os.tmpdir(), process.platform === 'linux' ? `${folderName}-ubuntu.tar.xz` : `${folderName}-windows.zip`);
558576

559577
button.innerHTML = '<i class="fas fa-spinner fa-spin"></i> INSTALLING...';
560578
button.disabled = true;
@@ -569,8 +587,8 @@ document.addEventListener('DOMContentLoaded', () => {
569587
const release = await getLatestGitHubRelease(gameData.githubRepo);
570588
const version = release.tag_name;
571589
const downloadUrl = process.platform === 'linux'
572-
? `https://github.com/${gameData.githubRepo}/releases/download/${version}/TClient-ubuntu.tar.xz`
573-
: `https://github.com/${gameData.githubRepo}/releases/download/${version}/TClient-windows.zip`;
590+
? `https://github.com/${gameData.githubRepo}/releases/download/${version}/${folderName}-ubuntu.tar.xz`
591+
: `https://github.com/${gameData.githubRepo}/releases/download/${version}/${folderName}-windows.zip`;
574592

575593
statusText.textContent = 'Downloading...';
576594
progressBar.style.width = '0%';
@@ -610,7 +628,7 @@ document.addEventListener('DOMContentLoaded', () => {
610628
const extractedFiles = fs.readdirSync(installPath).filter(file =>
611629
fs.statSync(path.join(installPath, file)).isDirectory()
612630
);
613-
extractedFolder = extractedFiles.find(file => file !== gameData.clientName) || 'TClient';
631+
extractedFolder = extractedFiles.find(file => file !== gameData.clientName) || folderName;
614632
console.log('Extracted folders:', extractedFiles);
615633
} else {
616634
extractedFolder = new AdmZip(tempZipPath).getEntries()[0].entryName.split('/')[0];
@@ -628,8 +646,8 @@ document.addEventListener('DOMContentLoaded', () => {
628646
fs.writeFileSync(path.join(clientPath, 'clientver.txt'), version);
629647
progressBar.style.width = '100%';
630648

631-
notifiedUpdates.delete('tclient');
632-
setTimeout(() => updateGameContent('tclient'), 500);
649+
notifiedUpdates.delete(clientName);
650+
setTimeout(() => updateGameContent(clientName), 500);
633651
} catch (err) {
634652
console.error('Install error:', err);
635653
statusText.textContent = 'Installation Failed';
@@ -640,6 +658,14 @@ document.addEventListener('DOMContentLoaded', () => {
640658
}
641659
}
642660

661+
async function downloadAndInstallTClient(button) {
662+
downloadAndInstallFromGithub(button, 'tclient', 'TClient')
663+
}
664+
665+
async function downloadAndInstallChillerbotUx(button) {
666+
downloadAndInstallFromGithub(button, 'chillerbot-ux', 'chillerbot-ux')
667+
}
668+
643669
async function downloadAndInstallCactus(button) {
644670
const gameData = games['cactus'];
645671
const installPath = await ipcRenderer.invoke('get-install-path');
@@ -1227,8 +1253,10 @@ document.addEventListener('DOMContentLoaded', () => {
12271253
await downloadAndInstallDDNet(actionButton);
12281254
} else if (gameId === 'tw') {
12291255
await downloadAndInstallTeeworlds(actionButton);
1230-
} else if (gameData.githubRepo) {
1256+
} else if (gameId === 'tclient') {
12311257
await downloadAndInstallTClient(actionButton);
1258+
} else if (gameId === 'chillerbot-ux') {
1259+
await downloadAndInstallChillerbotUx(actionButton);
12321260
}
12331261
} else if (buttonClass === 'launch-btn' && hasFolder) {
12341262
console.log(`Sending launch request for ${gameId}`);
@@ -1309,13 +1337,14 @@ document.addEventListener('DOMContentLoaded', () => {
13091337
clientName: 'Cactus',
13101338
executable: process.platform === 'linux' ? 'DDNet' : 'DDNet.exe'
13111339
},
1312-
'cbux': {
1313-
logo: 'assets/fulllogos/cbux.png',
1314-
image: 'assets/bgs/cbux.png',
1315-
smallName: 'cbux',
1340+
'chillerbot-ux': {
1341+
logo: 'assets/fulllogos/chillerbot-ux.png',
1342+
image: 'assets/bgs/chillerbot-ux.png',
1343+
smallName: 'ux',
13161344
icon: 'https://avatars.githubusercontent.com/u/45486474',
1317-
clientName: 'ChillerBoxUX',
1318-
executable: process.platform === 'linux' ? 'DDNet' : 'DDNet.exe'
1345+
clientName: 'chillerbot-ux',
1346+
githubRepo: 'chillerbot/chillerbot-ux',
1347+
executable: process.platform === 'linux' ? 'chillerbot-ux' : 'chillerbot-ux.exe'
13191348
}
13201349
};
13211350

0 commit comments

Comments
 (0)