improve: use module name, not module id; add: show Android/Kernel version in WebUI

This commit improves the WebUI module listing by listing the module name rather than the module id, and also adds 2 fields in the WebUI, so that it shows the Android version and Kernel release string.
This commit is contained in:
ThePedroo
2025-04-23 02:27:10 -03:00
parent 128104a590
commit d8c0310053
16 changed files with 88 additions and 37 deletions
+1 -1
View File
@@ -89,7 +89,7 @@ a {
justify-content: space-between;
left: 0;
right: 0;
padding: 20px 35px;
padding: 20px 25px;
font-size: 20px;
border-bottom: #585b5d solid 1px;
z-index: 5;
+31 -9
View File
@@ -72,21 +72,43 @@
<!-- INFO: Info card -->
<div class="dim card">
<div class="dimc" style="margin-bottom: 8px;">
<div class="dimc" style="font-size: 0.7em">ROM/Kernel</div>
</div>
<div id="android_version" class="dimc">
<div class="dimc" style="font-size: 1.1em;">Android</div>
<div class="dimc desc" id="android_version_div" style="font-size: 0.9em; line-height: 1.05em;">Unknown</div>
</div>
<div id="kernel_version" class="dimc" style="margin-top: 4px;">
<div class="dimc" style="font-size: 1.1em;">Kernel</div>
<div class="dimc desc" id="kernel_version_div" style="font-size: 0.9em; line-height: 1.05em;">Unknown</div>
</div>
<div class="dimc" style="margin-top: 16px; margin-bottom: 14px;">
<div class="dimc" style="font-size: 0.7em">Root/ReZygisk</div>
</div>
<div class="dimc content">
<div id="version_info_title" class="dimc" style="font-size: 1.1em">Version</div>
<div class="dimc desc" id="version_code" style="font-size: 0.9em; margin-top: 3px;">Unknown</div>
<div id="version_info_title" class="dimc" style="font-size: 1.1em;">Version</div>
<div class="dimc desc" id="version_code" style="font-size: 0.9em; line-height: 1.05em;">Unknown</div>
</div>
<div class="dimc content" style="margin-top: 4px;">
<div id="root_info_title" class="dimc" style="font-size: 1.1em">Root Implementation</div>
<div class="dimc desc" id="root_impl" style="font-size: 0.9em; margin-top: 3px;">Unknown</div>
<div id="root_info_title" class="dimc" style="font-size: 1.1em;">Root Implementation</div>
<div class="dimc desc" id="root_impl" style="font-size: 0.9em; line-height: 1.05em;">Unknown</div>
</div>
<div id="zygote32" class="dimc content" style="margin-top: 4px;">
<div class="dimc" style="font-size: 1.1em">Zygote32</div>
<div class="dimc desc" id="zygote32_status" style="font-size: 0.9em; margin-top: 3px;">Unknown</div>
<div class="dimc" style="margin-top: 16px; margin-bottom: 14px;">
<div class="dimc" style="font-size: 0.7em">Zygotes</div>
</div>
<div id="zygote32" class="dimc content">
<div class="dimc" style="font-size: 1.1em;">Zygote32</div>
<div class="dimc desc" id="zygote32_status" style="font-size: 0.9em; line-height: 1.05em;">Unknown</div>
</div>
<div id="zygote64" class="dimc" style="margin-top: 4px;">
<div class="dimc" style="font-size: 1.1em">Zygote64</div>
<div class="dimc desc" id="zygote64_status" style="font-size: 0.9em; margin-top: 3px;">Unknown</div>
<div class="dimc" style="font-size: 1.1em;">Zygote64</div>
<div class="dimc desc" id="zygote64_status" style="font-size: 0.9em; line-height: 1.05em;">Unknown</div>
</div>
</div>
</div>
+45 -12
View File
@@ -5,6 +5,7 @@ import { setNewLanguage, getTranslations } from './language.js'
export function setError(place, issue) {
const fullErrorLog = setErrorData(`${place}: ${issue}`)
document.getElementById('errorh_panel').innerHTML = fullErrorLog
toast(`${place}: ${issue}`)
}
@@ -19,9 +20,27 @@ export function setErrorData(errorLog) {
const finalLog = getPrevious && getPrevious.length !== 0 ? getPrevious + `\n` + errorLog : errorLog
localStorage.setItem('/system/error', finalLog)
return finalLog
}
async function getModuleNames(moduleIds) {
const fullCommand = moduleIds.map(modId => {
let propPath = `/data/adb/modules/${modId}/module.prop`
return `printf % ; if test -f "${propPath}"; then /system/bin/grep '^name=' "${propPath}" | /system/bin/cut -d '=' -f 2- 2>/dev/null || true; else true; fi ; printf "\\n"`
}).join(' ; ')
const result = await exec(fullCommand)
if (result.errno !== 0) {
setError('getModuleNames', 'Failed to execute command to retrieve module list names')
return null
}
return result.stdout.split('\n\n')
}
(async () => {
const EXPECTED = 1
const UNEXPECTED_FAIL = 2
@@ -60,11 +79,21 @@ export function setErrorData(errorLog) {
let zygote64_status = EXPECTED
let zygote32_status = EXPECTED
const lscpuCmd = await exec('/system/bin/getprop ro.product.cpu.abilist')
if (lscpuCmd.errno !== 0) return setError('WebUI', lscpuCmd.stderr)
const androidVersionCmd = await exec('/system/bin/getprop ro.build.version.release')
if (androidVersionCmd.errno !== 0) return setError('WebUI', androidVersionCmd.stderr)
const has64BitSupport = lscpuCmd.stdout.includes('arm64-v8a') || lscpuCmd.stdout.includes('x86_64')
const has32BitSupport = lscpuCmd.stdout.includes('armeabi-v7a') || lscpuCmd.stdout.includes('armeabi') || lscpuCmd.stdout.includes('x86')
document.getElementById('android_version_div').innerHTML = androidVersionCmd.stdout
const unameCmd = await exec('/system/bin/uname -r')
if (unameCmd.errno !== 0) return setError('WebUI', unameCmd.stderr)
document.getElementById('kernel_version_div').innerHTML = unameCmd.stdout
const cpuAbilistCmd = await exec('/system/bin/getprop ro.product.cpu.abilist')
if (cpuAbilistCmd.errno !== 0) return setError('WebUI', cpuAbilistCmd.stderr)
const has64BitSupport = cpuAbilistCmd.stdout.includes('arm64-v8a') || cpuAbilistCmd.stdout.includes('x86_64')
const has32BitSupport = cpuAbilistCmd.stdout.includes('armeabi-v7a') || cpuAbilistCmd.stdout.includes('armeabi') || cpuAbilistCmd.stdout.includes('x86')
if (!has64BitSupport) {
zygote64_div.style.display = 'none'
@@ -190,18 +219,22 @@ export function setErrorData(errorLog) {
const all_modules = []
modules_64.forEach((module) => all_modules.push({
name: module,
bitsUsed: [ '64 bit' ]
const module_64_names = await getModuleNames(modules_64)
modules_64.forEach((module_id, i) => all_modules.push({
id: module_id,
name: module_64_names[i],
bitsUsed: [ '64 bits' ]
}))
modules_32.forEach((module) => {
const module_index = all_modules.findIndex((module_64_32) => module_64_32.name === module)
const module_32_names = await getModuleNames(modules_32)
modules_32.forEach((module_id, i) => {
const module_index = all_modules.findIndex((module_64_32) => module_64_32.id === module_id)
if (module_index !== -1) all_modules[module_index].bitsUsed.push('32 bit')
if (module_index !== -1) all_modules[module_index].bitsUsed.push('32 bits')
else all_modules.push({
name: module,
bitsUsed: [ '32 bit' ]
id: module_id,
name: module_32_names[i],
bitsUsed: [ '32 bits' ]
})
})
+11 -3
View File
@@ -21,7 +21,7 @@ export function translateHomePage(old_translations, new_translations) {
break
}
case old_translations.page.home.status.unknown: {
rezygisk_state.innerHTML = new_translations.page.home.status.unknown
rezygisk_state.innerHTML = new_translations.global.unknown
break
}
@@ -40,7 +40,7 @@ export function translateHomePage(old_translations, new_translations) {
break
}
case old_translations.page.home.info.zygote.unknown: {
zygote32_status_div.innerHTML = new_translations.page.home.info.zygote.unknown
zygote32_status_div.innerHTML = new_translations.global.unknown
break
}
@@ -60,13 +60,21 @@ export function translateHomePage(old_translations, new_translations) {
break
}
case old_translations.page.home.info.zygote.unknown: {
zygote64_status_div.innerHTML = new_translations.page.home.info.zygote.unknown
zygote64_status_div.innerHTML = new_translations.global.unknown
break
}
}
}
const android_version_div = document.getElementById('android_version_div')
if (android_version_div.innerHTML === old_translations.global.unknown)
android_version_div.innerHTML = new_translations.global.unknown
const kernel_version_div = document.getElementById('kernel_version_div')
if (kernel_version_div.innerHTML === old_translations.global.unknown)
kernel_version_div.innerHTML = new_translations.global.unknown
/* INFO: info card */
document.getElementById('version_info_title').innerHTML = new_translations.page.home.info.version
document.getElementById('root_info_title').innerHTML = new_translations.page.home.info.root
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "Startseite",
"status": {
"unknown": "Unbekannt",
"notWorking": "Funktioniert nicht",
"ok": "Funktioniert",
"partially": "Funktioniert zum Teil"
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "Home",
"status": {
"unknown": "Unknown",
"notWorking": "Not Working",
"ok": "Working",
"partially": "Partially Working"
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "Beranda",
"status": {
"unknown": "Tidak diketahui",
"notWorking": "Tidak Bekerja",
"ok": "Bekerja",
"partially": "Bekerja Sebagian"
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "Home",
"status": {
"unknown": "Unknown",
"notWorking": "Not Working",
"ok": "Working",
"partially": "Partially Working"
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "Início",
"status": {
"unknown": "Desconhecido",
"notWorking": "Não funcionando",
"ok": "Funcionando",
"partially": "Funcionando parcialmente"
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "Acasă",
"status": {
"unknown": "Necunoscut",
"notWorking": "Nu funcționează",
"ok": "Funcționează",
"partially": "Funcționează parțial"
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "Главная",
"status": {
"unknown": "Неизвестно",
"notWorking": "Не работает",
"ok": "Работает",
"partially": "Частично работает"
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "Anasayfa",
"status": {
"unknown": "Bilinmiyor",
"notWorking": "Aktif Değil",
"ok": "Aktif",
"partially": "Yarı-Aktif"
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "Головна",
"status": {
"unknown": "Невідомо",
"notWorking": "Не працює",
"ok": "Працює",
"partially": "Частково працює"
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "Trang Chủ",
"status": {
"unknown": "Không xác định",
"notWorking": "Không hoạt động",
"ok": "Đang hoạt động",
"partially": "Đang hoạt động một phần"
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "主页",
"status": {
"unknown": "未知",
"notWorking": "未运行",
"ok": "运行中",
"partially": "部分运行"
-1
View File
@@ -26,7 +26,6 @@
"home": {
"header": "首頁",
"status": {
"unknown": "未知",
"notWorking": "未運作",
"ok": "運作中",
"partially": "部分運作"