Skip to content

Commit 2a533cd

Browse files
committed
update webui interface
1 parent 8966446 commit 2a533cd

4 files changed

Lines changed: 273 additions & 199 deletions

File tree

module.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

webui/src/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
<svg class="cardsvg" fill="currentColor" height="64px" width="64px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 472.616 472.616" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <g> <path fill="currentColor" d="M464.923,85.602l-14.934,14.935l-59.8,59.801l-63.796-14.115L312.28,82.426l59.8-59.801l14.934-14.933 c-45.791-16.479-98.959-6.514-135.65,30.177c-33.283,33.282-44.543,80.128-34.075,122.728l-0.2-0.199L19.702,357.784 c-26.27,26.27-26.27,68.861,0,95.131c26.27,26.269,68.86,26.269,95.13,0L312.218,255.53l-0.202-0.202 c42.6,10.468,89.446-0.791,122.73-34.073C471.438,184.564,481.4,131.392,464.923,85.602z M89.377,425.645 c-11.709,11.709-30.694,11.709-42.404,0c-11.71-11.711-11.71-30.696,0-42.406c11.71-11.709,30.695-11.709,42.404,0 C101.087,394.948,101.087,413.934,89.377,425.645z"></path> </g> </g> </g></svg>
135135
<h2 class="cardTitle text-onSurface" data-lang="settingsMore.title"></h2>
136136
</div>
137+
<div class="divider3"></div>
137138
<div id="show-additional-settings" class="sth flex items-center justify-between">
138139
<div>
139140
<p class="text-label text-onSurface" data-lang="settingsMore.additional.title"></p>
@@ -179,6 +180,7 @@ <h2 class="cardTitle text-onSurface" data-lang="settingsMore.title"></h2>
179180
<svg class="cardsvg" width="64px" height="64px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M4.09 8.08C4.04 8.38 4 8.68 4 9C4 8.69 4.04 8.38 4.09 8.08ZM4 15C4 15.32 4.04 15.62 4.09 15.92C4.04 15.62 4 15.31 4 15ZM8.09 19.91C8.38 19.96 8.69 20 9 20C8.69 20 8.39 19.96 8.09 19.91ZM8.09 4.09C8.39 4.04 8.69 4 9 4C8.69 4 8.38 4.04 8.09 4.09ZM15.92 4.09C15.62 4.04 15.32 4 15 4C15.31 4 15.62 4.04 15.92 4.09ZM19.91 8.08C19.96 8.38 20 8.69 20 9C20 8.68 19.96 8.38 19.91 8.08Z" fill="currentColor"></path> <path d="M22 8.3C22 8.72 21.67 9.05 21.25 9.05H20V10.8871C20 11.2207 19.638 11.4284 19.35 11.26C18.92 11.01 18.42 10.93 17.94 11.06C17.6321 11.1339 17.26 10.9349 17.26 10.6183V9.74C17.26 8.09 15.91 6.74 14.26 6.74H9.74C8.09 6.74 6.74 8.09 6.74 9.74V14.26C6.74 15.91 8.09 17.26 9.74 17.26H10.19C10.306 17.26 10.4 17.354 10.4 17.47C10.4 18.4335 11.0982 19.2436 12.0175 19.4298C12.1904 19.4648 12.3073 19.6716 12.25 19.8383C12.2172 19.9337 12.1302 20 12.0293 20H9.06V21.25C9.06 21.66 8.72 22 8.31 22C7.89 22 7.56 21.66 7.56 21.25V19.78C5.96 19.29 4.71 18.04 4.23 16.45H2.75C2.34 16.45 2 16.11 2 15.7C2 15.28 2.34 14.95 2.75 14.95H4V12.75H2.75C2.34 12.75 2 12.41 2 12C2 11.58 2.34 11.25 2.75 11.25H4V9.05H2.75C2.34 9.05 2 8.72 2 8.3C2 7.89 2.34 7.55 2.75 7.55H4.23C4.71 5.96 5.96 4.71 7.56 4.22V2.75C7.56 2.34 7.89 2 8.31 2C8.72 2 9.06 2.34 9.06 2.75V4H11.25V2.75C11.25 2.34 11.59 2 12 2C12.41 2 12.75 2.34 12.75 2.75V4H14.95V2.75C14.95 2.34 15.29 2 15.7 2C16.11 2 16.45 2.34 16.45 2.75V4.23C18.04 4.71 19.29 5.96 19.77 7.55H21.25C21.67 7.55 22 7.89 22 8.3Z" fill="currentColor"></path> <path d="M20.9904 15.5315C20.3104 15.5315 19.9204 15.1915 19.9204 14.6915C19.9204 14.4915 19.9804 14.2615 20.1204 14.0215C20.4004 13.5415 20.2304 12.9215 19.7504 12.6515L18.8404 12.1215C18.4204 11.8715 17.8804 12.0215 17.6304 12.4415L17.5704 12.5415C17.0904 13.3715 16.3104 13.3715 15.8304 12.5415L15.7704 12.4415C15.5304 12.0215 14.9804 11.8715 14.5704 12.1215L13.6504 12.6515C13.3304 12.8315 13.1404 13.1715 13.1404 13.5215C13.1404 13.6915 13.1904 13.8615 13.2804 14.0215C13.4204 14.2615 13.4904 14.4915 13.4904 14.6915C13.4904 15.1915 13.0904 15.5315 12.4104 15.5315C11.8604 15.5315 11.4004 15.9815 11.4004 16.5315V17.4715C11.4004 18.0215 11.8604 18.4715 12.4104 18.4715C13.0904 18.4715 13.4904 18.8115 13.4904 19.3115C13.4904 19.5115 13.4204 19.7415 13.2804 19.9815C13.0004 20.4615 13.1704 21.0815 13.6504 21.3515L14.5704 21.8815C14.9804 22.1315 15.5304 21.9815 15.7704 21.5615L15.8304 21.4615C16.3104 20.6315 17.0904 20.6315 17.5704 21.4615L17.6304 21.5615C17.8804 21.9815 18.4204 22.1315 18.8404 21.8815L19.7504 21.3515C20.0704 21.1715 20.2604 20.8315 20.2604 20.4815C20.2604 20.3115 20.2104 20.1415 20.1204 19.9815C19.9804 19.7415 19.9204 19.5115 19.9204 19.3115C19.9204 18.8115 20.3104 18.4715 20.9904 18.4715C21.5504 18.4715 22.0004 18.0215 22.0004 17.4715V16.5315C22.0004 15.9815 21.5504 15.5315 20.9904 15.5315ZM16.7004 18.7215C15.7504 18.7215 14.9804 17.9515 14.9804 17.0015C14.9804 16.0515 15.7504 15.2815 16.7004 15.2815C17.6504 15.2815 18.4204 16.0515 18.4204 17.0015C18.4204 17.9515 17.6504 18.7215 16.7004 18.7215Z" fill="currentColor"></path> <path d="M16.25 10.02V10.5925C16.25 10.9266 15.8047 11.1384 15.48 11.06C14.98 10.93 14.48 11 14.07 11.25L13.16 11.78C12.53 12.13 12.14 12.8 12.14 13.52C12.14 13.5796 12.1425 13.6396 12.1475 13.6996C12.1803 14.0858 11.9103 14.5545 11.5593 14.7191C11.0767 14.9454 10.6979 15.3577 10.5165 15.8624C10.4389 16.0785 10.2496 16.25 10.02 16.25C8.76 16.25 7.75 15.24 7.75 13.98V10.02C7.75 8.76 8.76 7.75 10.02 7.75H13.98C15.24 7.75 16.25 8.76 16.25 10.02Z" fill="currentColor"></path> </g></svg>
180181
<h2 class="cardTitle text-onSurface" data-lang="cpu.title"></h2>
181182
</div>
183+
<div class="divider3"></div>
182184
<div class="flex items-center justify-between mb-3">
183185
<div>
184186
<p class="text-label text-onSurface" data-lang="cpu.default.title"></p>
@@ -242,6 +244,7 @@ <h2 class="cardTitle text-onSurface" data-lang="cpu.title"></h2>
242244
<svg class="cardsvg" width="64px" height="64px" viewBox="-1.68 -1.68 27.36 27.36" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M7 21H17M6.2 17H17.8C18.9201 17 19.4802 17 19.908 16.782C20.2843 16.5903 20.5903 16.2843 20.782 15.908C21 15.4802 21 14.9201 21 13.8V6.2C21 5.0799 21 4.51984 20.782 4.09202C20.5903 3.71569 20.2843 3.40973 19.908 3.21799C19.4802 3 18.9201 3 17.8 3H6.2C5.0799 3 4.51984 3 4.09202 3.21799C3.71569 3.40973 3.40973 3.71569 3.21799 4.09202C3 4.51984 3 5.07989 3 6.2V13.8C3 14.9201 3 15.4802 3.21799 15.908C3.40973 16.2843 3.71569 16.5903 4.09202 16.782C4.51984 17 5.07989 17 6.2 17Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path> </g></svg>
243245
<h2 class="cardTitle text-onSurface" data-lang="gpumali.title"></h2>
244246
</div>
247+
<div class="divider3"></div>
245248
<div class="flex items-center justify-between mb-3">
246249
<div>
247250
<p class="text-label text-onSurface" data-lang="gpumali.default.title"></p>
@@ -281,6 +284,7 @@ <h2 class="cardTitle text-onSurface" data-lang="gpumali.title"></h2>
281284
<svg class="cardsvg" fill="currentColor" width="64px" height="64px" viewBox="0 0 56 56" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path fill="currentColor" d="M 27.9999 51.9063 C 41.0546 51.9063 51.9063 41.0781 51.9063 28 C 51.9063 14.9453 41.0312 4.0937 27.9765 4.0937 C 14.8983 4.0937 4.0937 14.9453 4.0937 28 C 4.0937 41.0781 14.9218 51.9063 27.9999 51.9063 Z M 27.9999 47.9219 C 16.9374 47.9219 8.1014 39.0625 8.1014 28 C 8.1014 16.9609 16.9140 8.0781 27.9765 8.0781 C 39.0155 8.0781 47.8983 16.9609 47.9219 28 C 47.9454 39.0625 39.0390 47.9219 27.9999 47.9219 Z M 28.0234 13.0469 C 27.4843 13.0469 27.0858 13.2812 26.6405 13.7266 L 18.6952 21.6484 C 18.3905 21.9531 18.2030 22.3750 18.2030 22.8672 C 18.2030 23.8281 18.9765 24.5547 19.9140 24.5547 C 20.4296 24.5547 20.8514 24.3672 21.1796 24.0156 L 24.0624 21.0859 L 26.4530 18.25 L 26.2655 23.2188 L 26.2655 32.8047 L 26.4530 37.7734 L 24.0624 34.9375 L 21.1796 32.0078 C 20.8514 31.6563 20.4296 31.4688 19.9140 31.4688 C 18.9765 31.4688 18.2030 32.1953 18.2030 33.1563 C 18.2030 33.6484 18.3905 34.0703 18.6952 34.3750 L 26.6405 42.2969 C 27.0858 42.7422 27.4843 42.9766 28.0234 42.9766 C 28.5155 42.9766 28.8905 42.7656 29.3827 42.2969 L 37.3280 34.3750 C 37.6327 34.0703 37.7968 33.6484 37.7968 33.1563 C 37.7968 32.1953 37.0702 31.4688 36.1093 31.4688 C 35.5936 31.4688 35.1718 31.6797 34.8671 32.0078 L 31.9374 34.9375 L 29.5936 37.75 L 29.7812 32.8047 L 29.7812 23.2188 L 29.5936 18.2734 L 31.9374 21.0859 L 34.8671 24.0156 C 35.1718 24.3437 35.5936 24.5547 36.1093 24.5547 C 37.0702 24.5547 37.7968 23.8281 37.7968 22.8672 C 37.7968 22.3750 37.6327 21.9531 37.3280 21.6484 L 29.3827 13.7266 C 28.8905 13.2578 28.5155 13.0469 28.0234 13.0469 Z"></path></g></svg>
282285
<h2 class="cardTitle text-onSurface" data-lang="io.title"></h2>
283286
</div>
287+
<div class="divider3"></div>
284288
<div class="flex items-center justify-between mb-3">
285289
<div>
286290
<p class="text-label text-onSurface" data-lang="io.default.title"></p>

webui/src/scripts/webui_utils.js

Lines changed: 88 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -462,60 +462,71 @@ const updateGameStatus = async () => {
462462
const aiResult = await executeCommand(
463463
"getprop persist.sys.azenithconf.AIenabled"
464464
);
465-
const aiEnabled = aiResult.stdout?.trim() !== "0";
465+
const aiEnabled = aiResult.stdout?.trim() === "1";
466466

467-
let statusText = "";
467+
const gameRaw = await executeCommand(
468+
"cat /data/adb/.config/AZenith/API/gameinfo"
469+
);
468470

469-
if (aiEnabled) {
470-
statusText = getTranslation("serviceStatus.noApps");
471-
} else {
472-
const gameRaw = await executeCommand(
473-
"cat /data/adb/.config/AZenith/API/gameinfo"
474-
);
475-
let gameLine = (gameRaw.stdout || "").trim();
476-
477-
if (
478-
!gameLine ||
479-
["null", "(null)", "NULL"].includes(gameLine.toUpperCase()) ||
480-
gameLine.toUpperCase().startsWith("NULL 0 0")
481-
) {
482-
gameLine = null;
471+
const rawLine = gameRaw.stdout?.trim();
472+
let gamePkg = null;
473+
474+
if (rawLine) {
475+
const parts = rawLine.split(/\s+/);
476+
const name = parts[0];
477+
478+
if (!/^\(?null\)?$/i.test(name)) {
479+
gamePkg = name;
483480
}
481+
}
484482

485-
if (!gameLine) {
486-
statusText = getTranslation("serviceStatus.idleMode");
487-
} else {
488-
const pkg = gameLine.split(" ")[0]?.trim() || "";
489-
let label = pkg;
483+
let statusText = "";
490484

491-
try {
492-
const infoList = JSON.parse(ksu.getPackagesInfo(JSON.stringify([pkg])));
493-
if (Array.isArray(infoList) && infoList.length > 0) {
494-
label = infoList[0].appLabel || infoList[0].label || infoList[0].appName || pkg;
495-
}
496-
} catch {
497-
if (typeof window.$packageManager !== "undefined") {
498-
try {
499-
const appInfo = await window.$packageManager.getApplicationInfo(pkg, 0, 0);
500-
if (appInfo) {
501-
label = (typeof appInfo.getLabel === "function" ? appInfo.getLabel() : appInfo.label)
502-
|| appInfo.appName
503-
|| pkg;
504-
}
505-
} catch {}
506-
}
507-
}
485+
if (!gamePkg) {
486+
statusText = aiEnabled
487+
? getTranslation("serviceStatus.noApps")
488+
: getTranslation("serviceStatus.idleMode");
489+
} else {
490+
const pkg = gamePkg;
491+
let label = pkg;
508492

509-
statusText = getTranslation("serviceStatus.activeIdle", label);
493+
try {
494+
const infoList = JSON.parse(
495+
ksu.getPackagesInfo(JSON.stringify([pkg]))
496+
);
497+
const info = infoList?.[0];
498+
if (info) {
499+
label =
500+
info.appLabel ||
501+
info.label ||
502+
info.appName ||
503+
pkg;
504+
}
505+
} catch {
506+
if (window.$packageManager) {
507+
try {
508+
const appInfo =
509+
await window.$packageManager.getApplicationInfo(pkg, 0, 0);
510+
if (appInfo) {
511+
label =
512+
(typeof appInfo.getLabel === "function"
513+
? appInfo.getLabel()
514+
: appInfo.label) ||
515+
appInfo.appName ||
516+
pkg;
517+
}
518+
} catch {}
519+
}
510520
}
521+
522+
statusText = getTranslation("serviceStatus.active", label);
511523
}
512524

513525
if (lastGameCheck.status !== statusText) {
514526
banner.textContent = statusText;
515527
lastGameCheck.status = statusText;
516528
}
517-
} catch (e) {
518-
console.warn("updateGameStatus error:", e);
529+
} catch {
519530
banner.textContent = getTranslation("serviceStatus.error");
520531
}
521532
};
@@ -669,9 +680,36 @@ const getSupportedRefreshRates = async () => {
669680

670681
const openPerAppSettings = async (pkg, gamelist) => {
671682
const modal = document.getElementById("appSettingsModal");
683+
const content = modal.querySelector(".app-modal-content");
672684
const list = document.getElementById("appModalSettings");
685+
if (!modal || !content || !list) return;
673686

674687
document.body.classList.add("modal-open");
688+
modal.classList.remove("hidden", "closing");
689+
690+
// reset (no animation)
691+
content.style.transition = "none";
692+
content.style.opacity = "0";
693+
content.style.transform = "translateY(20px) scale(.98)";
694+
void content.offsetHeight;
695+
696+
// animate in
697+
content.style.transition =
698+
"opacity .25s ease, transform .25s cubic-bezier(0.16,1,0.3,1)";
699+
content.style.opacity = "1";
700+
content.style.transform = "translateY(0) scale(1)";
701+
702+
const baseH = window.innerHeight;
703+
const resize = () => {
704+
content.style.transform =
705+
window.innerHeight < baseH - 150
706+
? "translateY(-8px) scale(1)"
707+
: "translateY(0) scale(1)";
708+
};
709+
710+
window.addEventListener("resize", resize, { passive: true });
711+
modal._resizeHandler = resize;
712+
675713
const cfg = gamelist[pkg];
676714
if (!cfg) return;
677715

@@ -691,7 +729,7 @@ const openPerAppSettings = async (pkg, gamelist) => {
691729
<div class="optionGroup" data-key="${s.key}">
692730
${["false","default","true"].map(v => `
693731
<button class="optionBtn ${value === v ? "active" : ""}" data-value="${v}">
694-
${v.charAt(0).toUpperCase() + v.slice(1)}
732+
${v[0].toUpperCase() + v.slice(1)}
695733
</button>
696734
`).join("")}
697735
</div>
@@ -744,8 +782,6 @@ const openPerAppSettings = async (pkg, gamelist) => {
744782
};
745783
});
746784
});
747-
748-
modal.classList.remove("hidden");
749785
};
750786

751787
let cachedPkgList = [];
@@ -2140,7 +2176,6 @@ const hidecolorscheme = () => {
21402176
if (!c) return; // exit if modal not found
21412177

21422178
c.classList.remove("show");
2143-
document.body.classList.remove("modal-open");
21442179
const colorSchemeSavedToast = getTranslation("toast.colorSchemeSaved");
21452180
toast(colorSchemeSavedToast);
21462181

@@ -2547,6 +2582,7 @@ const showAdditionalSettings = async () => {
25472582
// jalan berurutan = stabil + no spike
25482583
for (const fn of [
25492584
hideBypassIfUnsupported,
2585+
checkGPreload,
25502586
checkDND,
25512587
checkfstrim,
25522588
checkBypassChargeStatus,
@@ -2603,7 +2639,7 @@ const showPreferenceSettings = async () => {
26032639

26042640
for (const fn of [
26052641
checkfpsged, checkDThermal, checkiosched,
2606-
checkGPreload, checkmalisched, checkjit,
2642+
checkmalisched, checkjit,
26072643
checkdtrace, checkKillLog, checkschedtunes,
26082644
checkwalt, checkSFL
26092645
]) {
@@ -2624,7 +2660,6 @@ const hidePreferenceSettings = () => {
26242660
const hideSchemeSettings = () => {
26252661
const c = document.getElementById("schemeModal");
26262662
c.classList.remove("show");
2627-
document.body.classList.remove("modal-open");
26282663
if (c._resizeHandler) {
26292664
window.removeEventListener("resize", c._resizeHandler);
26302665
delete c._resizeHandler;
@@ -2894,7 +2929,6 @@ const showCustomResolution = async () => {
28942929
const hideResoSettings = () => {
28952930
const c = document.getElementById("resomodal");
28962931
c.classList.remove("show");
2897-
document.body.classList.remove("modal-open");
28982932
if (c._resizeHandler) {
28992933
window.removeEventListener("resize", c._resizeHandler);
29002934
delete c._resizeHandler;
@@ -3344,6 +3378,10 @@ const heavyInit = async () => {
33443378
const loader = document.getElementById("loading-screen");
33453379
if (loader) loader.classList.remove("hidden");
33463380
document.body.classList.add("no-scroll");
3381+
3382+
await checkWebUISupport();
3383+
await checkServiceRunning();
3384+
await checkModuleVersion();
33473385

33483386
await Promise.all([
33493387
checkProfile(),
@@ -3352,8 +3390,8 @@ const heavyInit = async () => {
33523390
]);
33533391

33543392
[
3355-
checkWebUISupport, checkServiceStatus, checkServiceRunning,
3356-
checkModuleVersion, checkCPUInfo, checkDeviceInfo, checkKernelVersion, getAndroidVersion
3393+
checkServiceStatus,
3394+
checkCPUInfo, checkDeviceInfo, checkKernelVersion, getAndroidVersion
33573395
].forEach(fn => fn().catch(()=>{}));
33583396

33593397
await Promise.all([

0 commit comments

Comments
 (0)