feat: add UI for v4 updates
This commit is contained in:
parent
0413532282
commit
d467fe4fea
3 changed files with 95 additions and 51 deletions
|
@ -1,7 +1,7 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>Linux Containers</title>
|
||||
<title>System Settings</title>
|
||||
|
||||
<!-- Import bootstrap v5.0. -->
|
||||
<link href="external/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
|
|
@ -1,53 +1,96 @@
|
|||
|
||||
function check_app_grouping() {
|
||||
if (require('fs').existsSync(`${require('os').homedir()}/.config/categorize_apps_gnome_disable`)) {
|
||||
document.getElementById('app-grouping-toggle').setAttribute('checked', '')
|
||||
function update_system() {
|
||||
let start_update_worker = new Worker(
|
||||
`data:text/javascript,
|
||||
let s = require('child_process').spawnSync('pkexec', ['systemctl', 'start', 'akshara-system-update']).status
|
||||
if (s === 0) {
|
||||
postMessage('success')
|
||||
} else {
|
||||
postMessage('failure')
|
||||
}
|
||||
`
|
||||
)
|
||||
start_update_worker.onmessage = e => {
|
||||
if (e.data == 'success') {
|
||||
document.getElementById('update-btn').textContent = 'Updating...'
|
||||
document.getElementById('update-btn').disabled = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
check_app_grouping()
|
||||
|
||||
$('#app-grouping-toggle').on('change', () => {
|
||||
if (!document.getElementById('app-grouping-toggle').checked) {
|
||||
let enable_autogrouping_worker = new Worker(
|
||||
`data:text/javascript,
|
||||
let s = require('child_process').spawnSync('rm', ['-f', '${require('os').homedir()}/.config/categorize_apps_gnome_disable']).status
|
||||
if (s === 0) {
|
||||
postMessage('success')
|
||||
} else {
|
||||
postMessage('failure')
|
||||
}
|
||||
`
|
||||
)
|
||||
enable_autogrouping_worker.onmessage = e => {
|
||||
if (e.data == 'success') {
|
||||
document.getElementById('app-grouping-toggle').checked = false
|
||||
} else {
|
||||
document.getElementById('app-grouping-toggle').checked = true
|
||||
}
|
||||
function check_system_update() {
|
||||
let start_update_worker = new Worker(
|
||||
`data:text/javascript,
|
||||
let s = require('child_process').spawnSync('systemctl', ['is-active', '--quiet', 'akshara-system-update']).status
|
||||
if (s === 0) {
|
||||
postMessage('success')
|
||||
} else {
|
||||
postMessage('failure')
|
||||
}
|
||||
} else {
|
||||
let disable_autogrouping_worker = new Worker(
|
||||
`data:text/javascript,
|
||||
require('child_process').spawnSync('mkdir', ['-p', '${require('os').homedir()}/.config']).status
|
||||
let s = require('child_process').spawnSync('touch', ['${require('os').homedir()}/.config/categorize_apps_gnome_disable']).status
|
||||
if (s === 0) {
|
||||
postMessage('success')
|
||||
} else {
|
||||
postMessage('failure')
|
||||
}
|
||||
`
|
||||
)
|
||||
disable_autogrouping_worker.onmessage = e => {
|
||||
if (e.data == 'success') {
|
||||
document.getElementById('app-grouping-toggle').checked = true
|
||||
} else {
|
||||
document.getElementById('app-grouping-toggle').checked = false
|
||||
}
|
||||
`
|
||||
)
|
||||
start_update_worker.onmessage = e => {
|
||||
if (e.data == 'success') {
|
||||
document.getElementById('update-btn').textContent = 'Updating...'
|
||||
document.getElementById('update-btn').disabled = true
|
||||
} else {
|
||||
document.getElementById('update-btn').textContent = 'Update'
|
||||
document.getElementById('update-btn').disabled = false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (require('process').env.XDG_CURRENT_DESKTOP.includes('GNOME')) {
|
||||
$('#app-grouping-item').removeClass('d-none')
|
||||
}
|
||||
|
||||
check_system_update()
|
||||
setInterval(check_system_update, 5000)
|
||||
|
||||
// function check_app_grouping() {
|
||||
// if (require('fs').existsSync(`${require('os').homedir()}/.config/categorize_apps_gnome_disable`)) {
|
||||
// document.getElementById('app-grouping-toggle').setAttribute('checked', '')
|
||||
// }
|
||||
// }
|
||||
|
||||
// check_app_grouping()
|
||||
|
||||
// $('#app-grouping-toggle').on('change', () => {
|
||||
// if (!document.getElementById('app-grouping-toggle').checked) {
|
||||
// let enable_autogrouping_worker = new Worker(
|
||||
// `data:text/javascript,
|
||||
// let s = require('child_process').spawnSync('rm', ['-f', '${require('os').homedir()}/.config/categorize_apps_gnome_disable']).status
|
||||
// if (s === 0) {
|
||||
// postMessage('success')
|
||||
// } else {
|
||||
// postMessage('failure')
|
||||
// }
|
||||
// `
|
||||
// )
|
||||
// enable_autogrouping_worker.onmessage = e => {
|
||||
// if (e.data == 'success') {
|
||||
// document.getElementById('app-grouping-toggle').checked = false
|
||||
// } else {
|
||||
// document.getElementById('app-grouping-toggle').checked = true
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// let disable_autogrouping_worker = new Worker(
|
||||
// `data:text/javascript,
|
||||
// require('child_process').spawnSync('mkdir', ['-p', '${require('os').homedir()}/.config']).status
|
||||
// let s = require('child_process').spawnSync('touch', ['${require('os').homedir()}/.config/categorize_apps_gnome_disable']).status
|
||||
// if (s === 0) {
|
||||
// postMessage('success')
|
||||
// } else {
|
||||
// postMessage('failure')
|
||||
// }
|
||||
// `
|
||||
// )
|
||||
// disable_autogrouping_worker.onmessage = e => {
|
||||
// if (e.data == 'success') {
|
||||
// document.getElementById('app-grouping-toggle').checked = true
|
||||
// } else {
|
||||
// document.getElementById('app-grouping-toggle').checked = false
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// if (require('process').env.XDG_CURRENT_DESKTOP.includes('GNOME')) {
|
||||
// $('#app-grouping-item').removeClass('d-none')
|
||||
// }
|
|
@ -3,17 +3,18 @@
|
|||
<strong class="mb-0">System Updates</strong>
|
||||
<div style="height: 0.75rem;"></div>
|
||||
<div class="list-group mb-3 shadow">
|
||||
<div class="list-group-item d-none" id="app-grouping-item">
|
||||
<div class="list-group-item" id="system-update-item">
|
||||
<div class="row align-items-center">
|
||||
<div class="col">
|
||||
<strong class="mb-0">Disable app grouping</strong>
|
||||
<strong class="mb-0">Update system</strong>
|
||||
<p class="text-muted mb-0">
|
||||
Do not automatically group apps of different categories/web apps/Android apps.
|
||||
Checks for updates, and updates your computer if they're available.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div class="form-check form-switch align-middle">
|
||||
<input class="form-check-input align-middle" type="checkbox" role="switch" id="app-grouping-toggle">
|
||||
<button type="button" id="update-btn" onclick="update_system()"
|
||||
class="btn btn-primary" disabled>Checking...</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue