chore: refactor code

This commit is contained in:
Rudra Saraswat 2025-04-23 15:44:57 +01:00
parent fd25400633
commit fce7c69dc7
13 changed files with 23 additions and 1306 deletions

View file

@ -160,10 +160,15 @@ function loadTerminalWindow(title, cmd) {
if (!terminalWindow.isDestroyed()) {
terminalWindow.webContents.send("terminal.reset")
terminalWindow.hide()
if (title.startsWith('Creating container: ')) {
mainWindow.webContents.send("container-created")
} else if (title.startsWith('Package installation')) {
packageWindow.webContents.send("installation-complete")
try {
if (title.startsWith('Creating container: ')) {
mainWindow.webContents.send("container-created")
} else if (title.startsWith('Package installation')) {
packageWindow.webContents.send("installation-complete")
}
} catch (err) {
console.log(err)
app.quit()
}
}
})
@ -178,10 +183,8 @@ function loadTerminalWindow(title, cmd) {
app.whenReady().then(() => {
app.allowRendererProcessReuse = false
if (process.argv.length > 2) {
if (process.argv[2] == 'package') {
createPackageWindow()
}
if (process.argv.includes('package')) {
createPackageWindow()
} else {
createWindow()
}
@ -196,4 +199,4 @@ app.whenReady().then(() => {
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
})

View file

@ -18,7 +18,7 @@
Containers</button>
<button class="btn btn-outline-light shadow-none d-none" id="android-button" onclick="page('android')">Android
Apps</button>
<button class="btn btn-outline-light shadow-none" id="system-button" onclick="page('system')">System Updates</button>
<button class="btn btn-outline-light shadow-none d-none" id="system-button" onclick="page('system')">System Updates</button>
</div>
</div>
@ -43,6 +43,14 @@
if (fs.existsSync('/usr/bin/waydroid')) {
document.getElementById('android-button').classList.remove('d-none')
} else {
document.getElementById('android-button').remove()
}
if (fs.existsSync('/usr/bin/akshara')) {
document.getElementById('system-button').classList.remove('d-none')
} else {
document.getElementById('system-button').remove()
}
function page(page) {