mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
feat: 升级至 V2.2,支持定时休眠折叠、自动刷新、Action 切换及默认备份恢复
This commit is contained in:
1 parent
106110d546
commit
7fd04e84bf
11 files changed
+108
-52
No files matched your search
@@ -0,0 +1,19 @@
|
||||
#!/system/bin/sh
|
||||
# 快速切换脚本
|
||||
|
||||
MODDIR="/data/adb/modules/LuminPro"
|
||||
PID_DIR="$MODDIR/pid"
|
||||
STOP_FLAG="$PID_DIR/stop.flag"
|
||||
UP_FLAG="$PID_DIR/up.flag"
|
||||
|
||||
# 切换逻辑
|
||||
if [ -f "$STOP_FLAG" ]; then
|
||||
rm -f "$STOP_FLAG"
|
||||
echo "LuminPro: 服务已启用"
|
||||
else
|
||||
touch "$STOP_FLAG"
|
||||
rm -f "$UP_FLAG"
|
||||
echo "LuminPro: 服务已暂停"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
+12
-9
@@ -155,7 +155,7 @@ IMPORT_OLD_CONFIG() {
|
||||
[ -s "$old_config/steps_num.txt" ] && cp -f "$old_config/steps_num.txt" "$mod_config/"
|
||||
[ -s "$old_config/log_max_size.txt" ] && cp -f "$old_config/log_max_size.txt" "$mod_config/"
|
||||
|
||||
# 版本迁移逻辑 (针对 2101 及更早版本)
|
||||
# 版本迁移逻辑
|
||||
local old_version_code
|
||||
old_version_code="$(grep_get_prop versionCode "/data/adb/modules/LuminPro/module.prop")"
|
||||
if [ "$old_version_code" = "2101" ] && [ ! -d "$old_config/.backup" ]; then
|
||||
@@ -178,15 +178,17 @@ IMPORT_OLD_CONFIG() {
|
||||
|
||||
# 初始化默认配置文件
|
||||
INIT_CONFIG() {
|
||||
mkdir -p "$mod_config"
|
||||
touch "$mod_config/ui_max_bri.txt"
|
||||
touch "$mod_config/max_bri.txt"
|
||||
touch "$mod_config/sleep_time.txt"
|
||||
touch "$mod_config/steps_num.txt"
|
||||
touch "$mod_config/log_max_size.txt"
|
||||
echo "1900-0600" >"$mod_config/sleep_time.txt"
|
||||
echo "1" >"$mod_config/auto_bri_sleep.txt"
|
||||
echo "50" >"$mod_config/steps_num.txt"
|
||||
echo "500" >"$mod_config/log_max_size.txt"
|
||||
}
|
||||
|
||||
# 补全缺失设置并设定默认值
|
||||
ENSURE_DEFAULTS() {
|
||||
[ ! -s "$mod_config/sleep_time.txt" ] && echo "1900-0600" >"$mod_config/sleep_time.txt"
|
||||
[ ! -s "$mod_config/auto_bri_sleep.txt" ] && echo "1" >"$mod_config/auto_bri_sleep.txt"
|
||||
[ ! -s "$mod_config/steps_num.txt" ] && echo "50" >"$mod_config/steps_num.txt"
|
||||
[ ! -s "$mod_config/log_max_size.txt" ] && echo "500" >"$mod_config/log_max_size.txt"
|
||||
}
|
||||
|
||||
# 创建备份 (用于 WebUI 恢复默认)
|
||||
@@ -207,8 +209,9 @@ MAIN() {
|
||||
INIT_CONFIG
|
||||
CHECK_FILES
|
||||
TEST_UI_MAX_BRI
|
||||
CREATE_BACKUP
|
||||
fi
|
||||
ENSURE_DEFAULTS
|
||||
CREATE_BACKUP
|
||||
END
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -139,8 +139,8 @@
|
||||
<span class="card-icon"><i data-lucide="activity"></i></span>
|
||||
<h2>实时状态</h2>
|
||||
<div class="header-actions">
|
||||
<button class="btn-text-s" id="btn-toggle-service">暂停</button>
|
||||
<button class="btn-text-s" id="btn-restart-service">重启</button>
|
||||
<button class="btn-text-s" id="btn-refresh-status">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -169,7 +169,6 @@
|
||||
<div class="card-header">
|
||||
<span class="card-icon"><i data-lucide="file-text"></i></span>
|
||||
<h2>运行日志</h2>
|
||||
<button class="btn-text-s" id="btn-refresh-log">刷新</button>
|
||||
</div>
|
||||
<pre class="log-output" id="log-output">加载中...</pre>
|
||||
</section>
|
||||
|
||||
+12
-1
@@ -5,12 +5,18 @@
|
||||
MODDIR="${0%/*/*}"
|
||||
CONFIG_DIR="$MODDIR/config"
|
||||
PID_DIR="$MODDIR/pid"
|
||||
|
||||
flag_file="$PID_DIR/up.flag"
|
||||
stop_file="$PID_DIR/stop.flag"
|
||||
log_file="$MODDIR/service.log"
|
||||
|
||||
# 日志函数
|
||||
_log() {
|
||||
# 如果 stop.flag 存在并且不是正在清理日志,我们仍允许记录停止状态,但此处先检查基础
|
||||
case "$1" in
|
||||
"日志过大"*) ;;
|
||||
*) if [ -f "$stop_file" ]; then return; fi ;;
|
||||
esac
|
||||
|
||||
local max_size
|
||||
max_size="$(cat "$CONFIG_DIR/log_max_size.txt" 2>/dev/null)"
|
||||
[ -z "$max_size" ] && max_size="500" # 默认 500 KB
|
||||
@@ -29,6 +35,11 @@ _log() {
|
||||
|
||||
_log "($$) 被 inotifyd 调用..."
|
||||
|
||||
if [ -f "$stop_file" ]; then
|
||||
_log "($$) 检测到 stop.flag, 停止本次调整 (服务已暂停)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 建立一个 flag, 避免重复执行; 如果已经有 flag, 则退出
|
||||
if [ -f "$flag_file" ]; then
|
||||
_log "($$) 重复执行, 这个进程退出, 将有其他进程接管"
|
||||
|
||||
+51
-26
@@ -5,6 +5,7 @@ const CONFIG_DIR = '/data/adb/modules/LuminPro/config';
|
||||
const BACKUP_DIR = '/data/adb/modules/LuminPro/config/.backup';
|
||||
const PID_FILE = '/data/adb/modules/LuminPro/pid/inotifyd.pid';
|
||||
const FLAG_FILE = '/data/adb/modules/LuminPro/pid/up.flag';
|
||||
const STOP_FLAG_FILE = '/data/adb/modules/LuminPro/pid/stop.flag';
|
||||
const LOG_FILE = '/data/adb/modules/LuminPro/service.log';
|
||||
const NOW_BRI_FILE = '/sys/class/backlight/panel0-backlight/brightness';
|
||||
const SYS_MAX_BRI_FILE = '/sys/class/backlight/panel0-backlight/max_brightness';
|
||||
@@ -229,30 +230,39 @@ async function handleReset() {
|
||||
|
||||
// 3. 刷新实时状态
|
||||
async function loadStatus() {
|
||||
const [curRes, sysRes, pidRes] = await Promise.all([
|
||||
const [curRes, sysRes, pidRes, stopRes] = await Promise.all([
|
||||
runCmd(`cat "${NOW_BRI_FILE}"`),
|
||||
runCmd(`cat "${SYS_MAX_BRI_FILE}"`),
|
||||
runCmd(`cat "${PID_FILE}"`)
|
||||
runCmd(`cat "${PID_FILE}"`),
|
||||
runCmd(`[ -f "${STOP_FLAG_FILE}" ] && echo "1" || echo "0"`)
|
||||
]);
|
||||
|
||||
document.getElementById('status-current-bri').textContent = curRes.errno === 0 ? curRes.stdout.trim() : 'N/A';
|
||||
document.getElementById('status-sys-max-bri').textContent = sysRes.errno === 0 ? sysRes.stdout.trim() : 'N/A';
|
||||
const isPaused = stopRes.stdout.trim() === '1';
|
||||
const running = pidRes.errno === 0 && pidRes.stdout.trim();
|
||||
|
||||
const pid = pidRes.errno === 0 ? pidRes.stdout.trim() : '';
|
||||
const pidEl = document.getElementById('status-inotifyd-pid');
|
||||
const dotEl = document.querySelector('.status-dot');
|
||||
const statusText = document.querySelector('.status-text');
|
||||
const statusDot = document.querySelector('.header-status .status-dot');
|
||||
const statusText = document.querySelector('.header-status .status-text');
|
||||
const toggleBtn = document.getElementById('btn-toggle-service');
|
||||
|
||||
if (pid) {
|
||||
pidEl.textContent = pid;
|
||||
dotEl.style.backgroundColor = '#4caf50'; // 绿色
|
||||
if (isPaused) {
|
||||
statusDot.style.backgroundColor = 'var(--md-sys-color-error)';
|
||||
statusText.textContent = '已暂停';
|
||||
toggleBtn.textContent = '启用';
|
||||
} else if (running) {
|
||||
statusDot.style.backgroundColor = '#4caf50';
|
||||
statusText.textContent = '运行中';
|
||||
toggleBtn.textContent = '暂停';
|
||||
} else {
|
||||
pidEl.textContent = '未运行';
|
||||
dotEl.style.backgroundColor = 'var(--md-sys-color-error)';
|
||||
statusText.textContent = '已停止';
|
||||
statusDot.style.backgroundColor = 'var(--md-sys-color-error)';
|
||||
statusText.textContent = '未运行';
|
||||
toggleBtn.textContent = '暂停';
|
||||
}
|
||||
|
||||
// 填入数值
|
||||
document.getElementById('status-current-bri').textContent = curRes.errno === 0 ? curRes.stdout.trim() : '—';
|
||||
document.getElementById('status-sys-max-bri').textContent = sysRes.errno === 0 ? sysRes.stdout.trim() : '—';
|
||||
document.getElementById('status-inotifyd-pid').textContent = running ? pidRes.stdout.trim() : '离线';
|
||||
|
||||
// 简易判断当前休眠状态 (只为了前端展示,不影响后端核心)
|
||||
const isEnabled = document.getElementById('input-sleep-mode').checked;
|
||||
const sH = document.getElementById('input-sleep-start-h').value;
|
||||
@@ -275,7 +285,16 @@ async function loadStatus() {
|
||||
document.getElementById('status-sleep').textContent = isSleep ? '休眠中' : '非休眠';
|
||||
}
|
||||
|
||||
// 5. 重启服务
|
||||
// 6. 暂停/启用服务
|
||||
async function toggleService() {
|
||||
const res = await runCmd(`sh /data/adb/modules/LuminPro/action.sh`);
|
||||
if (res.errno === 0) {
|
||||
showToast(res.stdout.trim() || '状态已切换');
|
||||
} else {
|
||||
showToast('操作失败: ' + res.stderr);
|
||||
}
|
||||
await loadStatus();
|
||||
}
|
||||
async function restartService() {
|
||||
const btn = document.getElementById('btn-restart-service');
|
||||
|
||||
@@ -301,13 +320,20 @@ async function loadLogs() {
|
||||
const logEl = document.getElementById('log-output');
|
||||
// 读取最后 50 行日志
|
||||
const res = await runCmd(`tail -n 50 "${LOG_FILE}"`);
|
||||
if (res.errno === 0 && res.stdout) {
|
||||
logEl.textContent = res.stdout;
|
||||
} else {
|
||||
logEl.textContent = '暂无日志或读取失败';
|
||||
if (res.errno === 0) {
|
||||
const freshLog = res.stdout.trim() || '暂无日志';
|
||||
// 只有当日志内容变化时才更新 DOM, 减少闪烁
|
||||
if(logEl.textContent !== freshLog) {
|
||||
logEl.textContent = freshLog;
|
||||
logEl.scrollTop = logEl.scrollHeight;
|
||||
}
|
||||
}
|
||||
// 滚动到底部
|
||||
logEl.scrollTop = logEl.scrollHeight;
|
||||
}
|
||||
|
||||
// 自动刷新循环
|
||||
async function startAutoRefresh() {
|
||||
await Promise.all([loadStatus(), loadLogs()]);
|
||||
setTimeout(startAutoRefresh, 500); // 0.5s 周期
|
||||
}
|
||||
|
||||
// ==========================
|
||||
@@ -330,9 +356,8 @@ async function init() {
|
||||
// 绑定事件
|
||||
document.getElementById('btn-save').addEventListener('click', saveConfig);
|
||||
document.getElementById('btn-reset').addEventListener('click', handleReset);
|
||||
document.getElementById('btn-toggle-service').addEventListener('click', toggleService);
|
||||
document.getElementById('btn-restart-service').addEventListener('click', restartService);
|
||||
document.getElementById('btn-refresh-status').addEventListener('click', loadStatus);
|
||||
document.getElementById('btn-refresh-log').addEventListener('click', loadLogs);
|
||||
|
||||
// 定时休眠折叠逻辑
|
||||
document.getElementById('input-sleep-mode').addEventListener('change', (e) => {
|
||||
@@ -344,10 +369,10 @@ async function init() {
|
||||
}
|
||||
});
|
||||
|
||||
// 初次加载数据
|
||||
// 初次加载配置
|
||||
await loadConfig();
|
||||
await loadStatus();
|
||||
await loadLogs();
|
||||
// 开启自动刷新状态和日志 (内置了已包含 loadStatus 和 loadLogs)
|
||||
startAutoRefresh();
|
||||
}
|
||||
|
||||
// DOM 加载完成后运行
|
||||
|
||||
+5
-5
@@ -225,25 +225,25 @@ body {
|
||||
.custom-time-picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.time-unit {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
gap: 2px;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
padding: 4px 8px;
|
||||
padding: 2px 6px;
|
||||
border-radius: var(--border-radius-s);
|
||||
border: 1px solid var(--md-sys-color-outline);
|
||||
}
|
||||
|
||||
.time-input {
|
||||
width: 42px;
|
||||
width: 32px;
|
||||
background-color: transparent;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
border: none;
|
||||
font-size: 1rem;
|
||||
font-size: 0.875rem;
|
||||
text-align: center;
|
||||
font-family: 'Google Sans Code', monospace;
|
||||
outline: none;
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
:root{--md-sys-color-background:#111318;--md-sys-color-on-background:#e2e2e9;--md-sys-color-surface:#1e1f25;--md-sys-color-surface-container:#212429;--md-sys-color-surface-container-high:#2b2930;--md-sys-color-on-surface:#e2e2e9;--md-sys-color-on-surface-variant:#c4c6d0;--md-sys-color-primary:#a8c7fa;--md-sys-color-on-primary:#062e6f;--md-sys-color-primary-container:#1b4b9b;--md-sys-color-on-primary-container:#d3e3fd;--md-sys-color-outline:#8e9099;--md-sys-color-outline-variant:#44474f;--md-sys-color-error:#ffb4ab;--md-sys-color-on-error:#690005;--border-radius-m:16px;--border-radius-s:8px;--spacing-s:8px;--spacing-m:16px;--spacing-l:24px}@font-face{font-family:Geist;src:url(/Geist-VariableFont_wght.ttf)format("truetype");font-weight:100 900;font-style:normal}@font-face{font-family:Google Sans Code;src:url(/GoogleSansCode-VariableFont_wght.ttf)format("truetype");font-weight:100 900;font-style:normal}*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}body{padding:0;padding-top:var(--safe-area-inset-top,0);padding-bottom:var(--safe-area-inset-bottom,0);background-color:var(--md-sys-color-background);color:var(--md-sys-color-on-background);margin:0;font-family:Geist,system-ui,-apple-system,sans-serif;line-height:1.5}#app{padding:var(--spacing-m);gap:var(--spacing-m);flex-direction:column;max-width:600px;margin:0 auto;display:flex}.app-header{padding:var(--spacing-m) 0;justify-content:space-between;align-items:center;display:flex}.header-content{align-items:center;gap:var(--spacing-m);display:flex}.header-icon{background:var(--md-sys-color-surface-container-high);border-radius:50%;justify-content:center;align-items:center;width:48px;height:48px;font-size:2rem;display:flex}.header-text h1{color:var(--md-sys-color-on-background);margin:0;font-size:1.25rem;font-weight:500}.header-subtitle{color:var(--md-sys-color-on-surface-variant);margin:0;font-size:.875rem}.header-status{background:var(--md-sys-color-surface-container);border-radius:100px;align-items:center;gap:6px;padding:4px 12px;font-size:.875rem;display:flex}.status-dot{background-color:var(--md-sys-color-error);border-radius:50%;width:8px;height:8px}.card{background-color:var(--md-sys-color-surface);border-radius:var(--border-radius-m);padding:var(--spacing-l);box-shadow:0 1px 3px #0000004d,0 4px 8px 3px #00000026}.card-header{align-items:center;gap:var(--spacing-s);margin-bottom:var(--spacing-l);display:flex}.card-header h2{color:var(--md-sys-color-on-surface);flex-grow:1;margin:0;font-size:1.125rem;font-weight:500}.config-group{margin-bottom:var(--spacing-l);padding:var(--spacing-m);background-color:var(--md-sys-color-surface-container);border-radius:var(--border-radius-s)}.group-title{margin:0 0 var(--spacing-m) 0;color:var(--md-sys-color-primary);text-transform:uppercase;letter-spacing:.5px;font-size:.875rem;font-weight:600}.config-item{justify-content:space-between;align-items:center;display:flex}.config-item+.config-item{margin-top:var(--spacing-m)}.config-label{flex-direction:column;display:flex}.config-name{color:var(--md-sys-color-on-surface);font-size:1rem}.config-desc{color:var(--md-sys-color-on-surface-variant);font-size:.875rem}.config-input{background-color:var(--md-sys-color-surface-container-high);color:var(--md-sys-color-on-surface);border:1px solid var(--md-sys-color-outline);border-radius:var(--border-radius-s);text-align:right;outline:none;width:100px;padding:8px 12px;font-family:inherit;font-size:1rem;transition:border-color .2s,box-shadow .2s}.config-input:focus{border-color:var(--md-sys-color-primary);box-shadow:0 0 0 2px #a8c7fa4d}.config-input-wide{width:140px}.config-item-expand{margin-top:var(--spacing-s);opacity:0;justify-content:flex-end;max-height:0;transition:all .3s;display:flex;overflow:hidden}.config-item-expand.show{opacity:1;max-height:100px;margin-bottom:var(--spacing-m)}.custom-time-picker{align-items:center;gap:12px;display:flex}.time-unit{background-color:var(--md-sys-color-surface-container-high);border-radius:var(--border-radius-s);border:1px solid var(--md-sys-color-outline);align-items:center;gap:4px;padding:4px 8px;display:flex}.time-input{width:42px;color:var(--md-sys-color-on-surface);text-align:center;-moz-appearance:textfield;background-color:#0000;border:none;outline:none;font-family:Google Sans Code,monospace;font-size:1rem}.time-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.time-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.time-sep{color:var(--md-sys-color-on-surface-variant);font-size:.875rem}.switch{width:52px;height:32px;display:inline-block;position:relative}.switch input{opacity:0;width:0;height:0}.slider{cursor:pointer;background-color:var(--md-sys-color-surface-container-high);border:2px solid var(--md-sys-color-outline);border-radius:34px;transition:all .4s;position:absolute;inset:0}.slider:before{content:"";background-color:var(--md-sys-color-outline);border-radius:50%;width:24px;height:24px;transition:all .4s;position:absolute;bottom:2px;lLine truncated
|
||||
@@ -1,4 +0,0 @@
|
||||
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=0;function t(t){return`${t}_callback_${Date.now()}_${e++}`}function n(e,n){return n===void 0&&(n={}),new Promise((r,i)=>{let a=t(`exec`);window[a]=(e,t,n)=>{r({errno:e,stdout:t,stderr:n}),o(a)};function o(e){delete window[e]}try{ksu.exec(e,JSON.stringify(n),a)}catch(e){i(e),o(a)}})}function r(){this.listeners={}}r.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},r.prototype.emit=function(e,...t){this.listeners[e]&&this.listeners[e].forEach(e=>e(...t))};function i(){this.listeners={},this.stdin=new r,this.stdout=new r,this.stderr=new r}i.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},i.prototype.emit=function(e,...t){this.listeners[e]&&this.listeners[e].forEach(e=>e(...t))};var a={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},o=([e,t,n])=>{let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);return Object.keys(t).forEach(e=>{r.setAttribute(e,String(t[e]))}),n?.length&&n.forEach(e=>{let t=o(e);r.appendChild(t)}),r},s=(e,t={})=>o([`svg`,{...a,...t},e]),c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},l=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),u=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),d=e=>{let t=u(e);return t.charAt(0).toUpperCase()+t.slice(1)},f=e=>Array.from(e.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{}),p=e=>typeof e==`string`?e:!e||!e.class?``:e.class&&typeof e.class==`string`?e.class.split(` `):e.class&&Array.isArray(e.class)?e.class:``,m=(e,{nameAttr:t,icons:n,attrs:r})=>{let i=e.getAttribute(t);if(i==null)return;let o=n[d(i)];if(!o)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);let u=f(e),m=c(u)?{}:{"aria-hidden":`true`},h={...a,"data-lucide":i,...m,...r,...u},g=p(u),_=p(r),v=l(`lucide`,`lucide-${i}`,...g,..._);v&&Object.assign(h,{class:v});let y=s(o,h);return e.parentNode?.replaceChild(y,e)},h=[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`}]],g=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 9H8`}],[`path`,{d:`M16 13H8`}],[`path`,{d:`M16 17H8`}]],_=[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}],[`path`,{d:`M21 3v5h-5`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}],[`path`,{d:`M8 16H3v5`}]],v=[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`}]],y=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]],b=[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]],x=({icons:e={},nameAttr:t=`data-lucide`,attrs:n={},root:r=document,inTemplates:i}={})=>{if(!Object.values(e).length)throw Error(`Please provide an icons object.
|
||||
If you want to use all the icons you can import it like:
|
||||
\`import { createIcons, icons } from 'lucide';
|
||||
lucide.createIcons({icons});\``);if(r===void 0)throw Error("`createIcons()` only works in a browser environment.");if(Array.from(r.querySelectorAll(`[${t}]`)).forEach(r=>m(r,{nameAttr:t,icons:e,attrs:n})),i&&Array.from(r.querySelectorAll(`template`)).forEach(r=>x({icons:e,nameAttr:t,attrs:n,root:r.content,inTemplates:i})),t===`data-lucide`){let t=r.querySelectorAll(`[icon-name]`);t.length>0&&(console.warn(`[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide`),Array.from(t).forEach(t=>m(t,{nameAttr:`icon-name`,icons:e,attrs:n})))}},S=`/data/adb/modules/LuminPro/config`,C=`/data/adb/modules/LuminPro/config/.backup`,w=`/data/adb/modules/LuminPro/pid/inotifyd.pid`,T=`/data/adb/modules/LuminPro/pid/up.flag`,E=`/data/adb/modules/LuminPro/service.log`,D=`/sys/class/backlight/panel0-backlight/brightness`,O=`/sys/class/backlight/panel0-backlight/max_brightness`;function k(e){let t=document.getElementById(`toast`);t.textContent=e,t.classList.add(`show`),setTimeout(()=>t.classList.remove(`show`),3e3)}async function A(e){try{return await n(e)}catch(e){return console.error(e),{errno:-1,stdout:``,stderr:String(e)}}}async function j(e,t){return A(`echo -n '${String(t).replace(/'/g,`'\\''`)}' > "${e}"`)}async function M(){let[e,t,n,r,i,a]=await Promise.all([A(`cat "${S}/ui_max_bri.txt"`),A(`cat "${S}/max_bri.txt"`),A(`cat "${S}/sleep_time.txt"`),A(`cat "${S}/auto_bri_sleep.txt"`),A(`cat "${S}/steps_num.txt"`),A(`cat "${S}/log_max_size.txt"`)]);if(e.errno===0&&(document.getElementById(`input-ui-max-bri`).value=e.stdout.trim()),t.errno===0&&(document.getElementById(`input-max-bri`).value=t.stdout.trim()),n.errno===0){let e=n.stdout.trim(),t=document.getElementById(`input-sleep-mode`),r=document.getElementById(`sleep-time-expand`);if(e&&e.includes(`-`)){t.checked=!0,r.classList.add(`show`);let[n,i]=e.split(`-`);n.length===4&&(document.getElementById(`input-sleep-start-h`).value=n.slice(0,2),document.getElementById(`input-sleep-start-m`).value=n.slice(2)),i.length===4&&(document.getElementById(`input-sleep-end-h`).value=i.slice(0,2),document.getElementById(`input-sleep-end-m`).value=i.slice(2))}else t.checked=!1,r.classList.remove(`show`),document.getElementById(`input-sleep-start-h`).value=`19`,document.getElementById(`input-sleep-start-m`).value=`00`,document.getElementById(`input-sleep-end-h`).value=`06`,document.getElementById(`input-sleep-end-m`).value=`00`}if(r.errno===0&&(document.getElementById(`input-auto-bri-sleep`).checked=r.stdout.trim()===`1`),i.errno===0){let e=i.stdout.trim();document.getElementById(`input-steps-num`).value=e||`50`}else document.getElementById(`input-steps-num`).value=`50`;if(a.errno===0){let e=a.stdout.trim();document.getElementById(`input-log-max-size`).value=e||`500`}else document.getElementById(`input-log-max-size`).value=`500`}async function N(){let e=document.getElementById(`input-ui-max-bri`).value,t=document.getElementById(`input-max-bri`).value,n=e=>String(e).padStart(2,`0`),r=document.getElementById(`input-sleep-mode`).checked,i=``;r&&(i=`${n(document.getElementById(`input-sleep-start-h`).value)}${n(document.getElementById(`input-sleep-start-m`).value)}-${n(document.getElementById(`input-sleep-end-h`).value)}${n(document.getElementById(`input-sleep-end-m`).value)}`);let a=document.getElementById(`input-auto-bri-sleep`).checked?`1`:`0`,o=document.getElementById(`input-steps-num`).value||`50`,s=document.getElementById(`input-log-max-size`).value||`500`;if(!e||!t){k(`亮度值不能为空`);return}k(`保存中...`),await j(`${S}/ui_max_bri.txt`,e),await j(`${S}/max_bri.txt`,t),await j(`${S}/sleep_time.txt`,i),await j(`${S}/auto_bri_sleep.txt`,a),await j(`${S}/steps_num.txt`,o),await j(`${S}/log_max_size.txt`,s),await A(`rm -f "${T}"`);let c=await A(`cat "${w}"`);c.errno===0&&c.stdout.trim()?k(`配置已保存 (可能需要在下次调整时生效)`):k(`配置已保存 (服务未运行)`)}var P=!1,F=null;function I(){let e=document.getElementById(`btn-reset`);e.textContent=`恢复默认`,e.classList.remove(`btn-danger`),P=!1,F&&clearTimeout(F)}async function L(){let e=document.getElementById(`btn-reset`);if(!P){P=!0,e.textContent=`确认`,e.classList.add(`btn-danger`),F=setTimeout(I,5e3);return}k(`正在恢复默认配置...`),I();let[t,n,r,i,a,o]=await Promise.all([A(`cat "${C}/ui_max_bri.txt"`),A(`cat "${C}/max_bri.txt"`),A(`cat "${C}/sleep_time.txt"`),A(`cat "${C}/auto_bri_sleep.txt"`),A(`cat "${C}/steps_num.txt"`),A(`cat "${C}/log_max_size.txt"`)]);if(t.errno===0&&(document.getElementById(`input-ui-max-bri`).value=t.stdout.trim()),n.errno===0&&(document.getElementById(`input-max-bri`).value=n.stdout.trim()),r.errno===0){let e=r.stdout.trim(),t=document.getElementById(`input-sleep-mode`),n=document.getElementById(`sleep-time-expand`);if(e.includes(`-`)){t.checked=!0,n.classList.add(`show`);let[r,i]=e.split(`-`);r.length===4&&(docLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
:root{--md-sys-color-background:#111318;--md-sys-color-on-background:#e2e2e9;--md-sys-color-surface:#1e1f25;--md-sys-color-surface-container:#212429;--md-sys-color-surface-container-high:#2b2930;--md-sys-color-on-surface:#e2e2e9;--md-sys-color-on-surface-variant:#c4c6d0;--md-sys-color-primary:#a8c7fa;--md-sys-color-on-primary:#062e6f;--md-sys-color-primary-container:#1b4b9b;--md-sys-color-on-primary-container:#d3e3fd;--md-sys-color-outline:#8e9099;--md-sys-color-outline-variant:#44474f;--md-sys-color-error:#ffb4ab;--md-sys-color-on-error:#690005;--border-radius-m:16px;--border-radius-s:8px;--spacing-s:8px;--spacing-m:16px;--spacing-l:24px}@font-face{font-family:Geist;src:url(/Geist-VariableFont_wght.ttf)format("truetype");font-weight:100 900;font-style:normal}@font-face{font-family:Google Sans Code;src:url(/GoogleSansCode-VariableFont_wght.ttf)format("truetype");font-weight:100 900;font-style:normal}*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}body{padding:0;padding-top:var(--safe-area-inset-top,0);padding-bottom:var(--safe-area-inset-bottom,0);background-color:var(--md-sys-color-background);color:var(--md-sys-color-on-background);margin:0;font-family:Geist,system-ui,-apple-system,sans-serif;line-height:1.5}#app{padding:var(--spacing-m);gap:var(--spacing-m);flex-direction:column;max-width:600px;margin:0 auto;display:flex}.app-header{padding:var(--spacing-m) 0;justify-content:space-between;align-items:center;display:flex}.header-content{align-items:center;gap:var(--spacing-m);display:flex}.header-icon{background:var(--md-sys-color-surface-container-high);border-radius:50%;justify-content:center;align-items:center;width:48px;height:48px;font-size:2rem;display:flex}.header-text h1{color:var(--md-sys-color-on-background);margin:0;font-size:1.25rem;font-weight:500}.header-subtitle{color:var(--md-sys-color-on-surface-variant);margin:0;font-size:.875rem}.header-status{background:var(--md-sys-color-surface-container);border-radius:100px;align-items:center;gap:6px;padding:4px 12px;font-size:.875rem;display:flex}.status-dot{background-color:var(--md-sys-color-error);border-radius:50%;width:8px;height:8px}.card{background-color:var(--md-sys-color-surface);border-radius:var(--border-radius-m);padding:var(--spacing-l);box-shadow:0 1px 3px #0000004d,0 4px 8px 3px #00000026}.card-header{align-items:center;gap:var(--spacing-s);margin-bottom:var(--spacing-l);display:flex}.card-header h2{color:var(--md-sys-color-on-surface);flex-grow:1;margin:0;font-size:1.125rem;font-weight:500}.config-group{margin-bottom:var(--spacing-l);padding:var(--spacing-m);background-color:var(--md-sys-color-surface-container);border-radius:var(--border-radius-s)}.group-title{margin:0 0 var(--spacing-m) 0;color:var(--md-sys-color-primary);text-transform:uppercase;letter-spacing:.5px;font-size:.875rem;font-weight:600}.config-item{justify-content:space-between;align-items:center;display:flex}.config-item+.config-item{margin-top:var(--spacing-m)}.config-label{flex-direction:column;display:flex}.config-name{color:var(--md-sys-color-on-surface);font-size:1rem}.config-desc{color:var(--md-sys-color-on-surface-variant);font-size:.875rem}.config-input{background-color:var(--md-sys-color-surface-container-high);color:var(--md-sys-color-on-surface);border:1px solid var(--md-sys-color-outline);border-radius:var(--border-radius-s);text-align:right;outline:none;width:100px;padding:8px 12px;font-family:inherit;font-size:1rem;transition:border-color .2s,box-shadow .2s}.config-input:focus{border-color:var(--md-sys-color-primary);box-shadow:0 0 0 2px #a8c7fa4d}.config-input-wide{width:140px}.config-item-expand{margin-top:var(--spacing-s);opacity:0;justify-content:flex-end;max-height:0;transition:all .3s;display:flex;overflow:hidden}.config-item-expand.show{opacity:1;max-height:100px;margin-bottom:var(--spacing-m)}.custom-time-picker{align-items:center;gap:8px;display:flex}.time-unit{background-color:var(--md-sys-color-surface-container-high);border-radius:var(--border-radius-s);border:1px solid var(--md-sys-color-outline);align-items:center;gap:2px;padding:2px 6px;display:flex}.time-input{width:32px;color:var(--md-sys-color-on-surface);text-align:center;-moz-appearance:textfield;background-color:#0000;border:none;outline:none;font-family:Google Sans Code,monospace;font-size:.875rem}.time-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.time-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.time-sep{color:var(--md-sys-color-on-surface-variant);font-size:.875rem}.switch{width:52px;height:32px;display:inline-block;position:relative}.switch input{opacity:0;width:0;height:0}.slider{cursor:pointer;background-color:var(--md-sys-color-surface-container-high);border:2px solid var(--md-sys-color-outline);border-radius:34px;transition:all .4s;position:absolute;inset:0}.slider:before{content:"";background-color:var(--md-sys-color-outline);border-radius:50%;width:24px;height:24px;transition:all .4s;position:absolute;bottom:2pxLine truncated
|
||||
@@ -0,0 +1,4 @@
|
||||
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=0;function t(t){return`${t}_callback_${Date.now()}_${e++}`}function n(e,n){return n===void 0&&(n={}),new Promise((r,i)=>{let a=t(`exec`);window[a]=(e,t,n)=>{r({errno:e,stdout:t,stderr:n}),o(a)};function o(e){delete window[e]}try{ksu.exec(e,JSON.stringify(n),a)}catch(e){i(e),o(a)}})}function r(){this.listeners={}}r.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},r.prototype.emit=function(e,...t){this.listeners[e]&&this.listeners[e].forEach(e=>e(...t))};function i(){this.listeners={},this.stdin=new r,this.stdout=new r,this.stderr=new r}i.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},i.prototype.emit=function(e,...t){this.listeners[e]&&this.listeners[e].forEach(e=>e(...t))};var a={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},o=([e,t,n])=>{let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);return Object.keys(t).forEach(e=>{r.setAttribute(e,String(t[e]))}),n?.length&&n.forEach(e=>{let t=o(e);r.appendChild(t)}),r},s=(e,t={})=>o([`svg`,{...a,...t},e]),c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},l=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),u=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),d=e=>{let t=u(e);return t.charAt(0).toUpperCase()+t.slice(1)},f=e=>Array.from(e.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{}),p=e=>typeof e==`string`?e:!e||!e.class?``:e.class&&typeof e.class==`string`?e.class.split(` `):e.class&&Array.isArray(e.class)?e.class:``,m=(e,{nameAttr:t,icons:n,attrs:r})=>{let i=e.getAttribute(t);if(i==null)return;let o=n[d(i)];if(!o)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);let u=f(e),m=c(u)?{}:{"aria-hidden":`true`},h={...a,"data-lucide":i,...m,...r,...u},g=p(u),_=p(r),v=l(`lucide`,`lucide-${i}`,...g,..._);v&&Object.assign(h,{class:v});let y=s(o,h);return e.parentNode?.replaceChild(y,e)},h=[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`}]],g=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 9H8`}],[`path`,{d:`M16 13H8`}],[`path`,{d:`M16 17H8`}]],_=[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}],[`path`,{d:`M21 3v5h-5`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}],[`path`,{d:`M8 16H3v5`}]],v=[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`}]],y=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]],b=[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]],x=({icons:e={},nameAttr:t=`data-lucide`,attrs:n={},root:r=document,inTemplates:i}={})=>{if(!Object.values(e).length)throw Error(`Please provide an icons object.
|
||||
If you want to use all the icons you can import it like:
|
||||
\`import { createIcons, icons } from 'lucide';
|
||||
lucide.createIcons({icons});\``);if(r===void 0)throw Error("`createIcons()` only works in a browser environment.");if(Array.from(r.querySelectorAll(`[${t}]`)).forEach(r=>m(r,{nameAttr:t,icons:e,attrs:n})),i&&Array.from(r.querySelectorAll(`template`)).forEach(r=>x({icons:e,nameAttr:t,attrs:n,root:r.content,inTemplates:i})),t===`data-lucide`){let t=r.querySelectorAll(`[icon-name]`);t.length>0&&(console.warn(`[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide`),Array.from(t).forEach(t=>m(t,{nameAttr:`icon-name`,icons:e,attrs:n})))}},S=`/data/adb/modules/LuminPro/config`,C=`/data/adb/modules/LuminPro/config/.backup`,w=`/data/adb/modules/LuminPro/pid/inotifyd.pid`,T=`/data/adb/modules/LuminPro/pid/up.flag`,E=`/data/adb/modules/LuminPro/pid/stop.flag`,D=`/data/adb/modules/LuminPro/service.log`,O=`/sys/class/backlight/panel0-backlight/brightness`,k=`/sys/class/backlight/panel0-backlight/max_brightness`;function A(e){let t=document.getElementById(`toast`);t.textContent=e,t.classList.add(`show`),setTimeout(()=>t.classList.remove(`show`),3e3)}async function j(e){try{return await n(e)}catch(e){return console.error(e),{errno:-1,stdout:``,stderr:String(e)}}}async function M(e,t){return j(`echo -n '${String(t).replace(/'/g,`'\\''`)}' > "${e}"`)}async function N(){let[e,t,n,r,i,a]=await Promise.all([j(`cat "${S}/ui_max_bri.txt"`),j(`cat "${S}/max_bri.txt"`),j(`cat "${S}/sleep_time.txt"`),j(`cat "${S}/auto_bri_sleep.txt"`),j(`cat "${S}/steps_num.txt"`),j(`cat "${S}/log_max_size.txt"`)]);if(e.errno===0&&(document.getElementById(`input-ui-max-bri`).value=e.stdout.trim()),t.errno===0&&(document.getElementById(`input-max-bri`).value=t.stdout.trim()),n.errno===0){let e=n.stdout.trim(),t=document.getElementById(`input-sleep-mode`),r=document.getElementById(`sleep-time-expand`);if(e&&e.includes(`-`)){t.checked=!0,r.classList.add(`show`);let[n,i]=e.split(`-`);n.length===4&&(document.getElementById(`input-sleep-start-h`).value=n.slice(0,2),document.getElementById(`input-sleep-start-m`).value=n.slice(2)),i.length===4&&(document.getElementById(`input-sleep-end-h`).value=i.slice(0,2),document.getElementById(`input-sleep-end-m`).value=i.slice(2))}else t.checked=!1,r.classList.remove(`show`),document.getElementById(`input-sleep-start-h`).value=`19`,document.getElementById(`input-sleep-start-m`).value=`00`,document.getElementById(`input-sleep-end-h`).value=`06`,document.getElementById(`input-sleep-end-m`).value=`00`}if(r.errno===0&&(document.getElementById(`input-auto-bri-sleep`).checked=r.stdout.trim()===`1`),i.errno===0){let e=i.stdout.trim();document.getElementById(`input-steps-num`).value=e||`50`}else document.getElementById(`input-steps-num`).value=`50`;if(a.errno===0){let e=a.stdout.trim();document.getElementById(`input-log-max-size`).value=e||`500`}else document.getElementById(`input-log-max-size`).value=`500`}async function P(){let e=document.getElementById(`input-ui-max-bri`).value,t=document.getElementById(`input-max-bri`).value,n=e=>String(e).padStart(2,`0`),r=document.getElementById(`input-sleep-mode`).checked,i=``;r&&(i=`${n(document.getElementById(`input-sleep-start-h`).value)}${n(document.getElementById(`input-sleep-start-m`).value)}-${n(document.getElementById(`input-sleep-end-h`).value)}${n(document.getElementById(`input-sleep-end-m`).value)}`);let a=document.getElementById(`input-auto-bri-sleep`).checked?`1`:`0`,o=document.getElementById(`input-steps-num`).value||`50`,s=document.getElementById(`input-log-max-size`).value||`500`;if(!e||!t){A(`亮度值不能为空`);return}A(`保存中...`),await M(`${S}/ui_max_bri.txt`,e),await M(`${S}/max_bri.txt`,t),await M(`${S}/sleep_time.txt`,i),await M(`${S}/auto_bri_sleep.txt`,a),await M(`${S}/steps_num.txt`,o),await M(`${S}/log_max_size.txt`,s),await j(`rm -f "${T}"`);let c=await j(`cat "${w}"`);c.errno===0&&c.stdout.trim()?A(`配置已保存 (可能需要在下次调整时生效)`):A(`配置已保存 (服务未运行)`)}var F=!1,I=null;function L(){let e=document.getElementById(`btn-reset`);e.textContent=`恢复默认`,e.classList.remove(`btn-danger`),F=!1,I&&clearTimeout(I)}async function R(){let e=document.getElementById(`btn-reset`);if(!F){F=!0,e.textContent=`确认`,e.classList.add(`btn-danger`),I=setTimeout(L,5e3);return}A(`正在恢复默认配置...`),L();let[t,n,r,i,a,o]=await Promise.all([j(`cat "${C}/ui_max_bri.txt"`),j(`cat "${C}/max_bri.txt"`),j(`cat "${C}/sleep_time.txt"`),j(`cat "${C}/auto_bri_sleep.txt"`),j(`cat "${C}/steps_num.txt"`),j(`cat "${C}/log_max_size.txt"`)]);if(t.errno===0&&(document.getElementById(`input-ui-max-bri`).value=t.stdout.trim()),n.errno===0&&(document.getElementById(`input-max-bri`).value=n.stdout.trim()),r.errno===0){let e=r.stdout.trim(),t=document.getElementById(`input-sleep-mode`),n=document.getElementById(`sleep-time-expand`);if(e.includes(`-`)){t.checked=!0,n.classList.add(`sh
Line truncated
|
||||
+3
-4
@@ -6,8 +6,8 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
||||
<title>LuminPro</title>
|
||||
<link rel="stylesheet" type="text/css" href="/internal/insets.css" />
|
||||
<script type="module" crossorigin src="/assets/index-DfP8X78P.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DAJ7hj2r.css">
|
||||
<script type="module" crossorigin src="/assets/index-GvCaVVmw.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DpSbbGTK.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -140,8 +140,8 @@
|
||||
<span class="card-icon"><i data-lucide="activity"></i></span>
|
||||
<h2>实时状态</h2>
|
||||
<div class="header-actions">
|
||||
<button class="btn-text-s" id="btn-toggle-service">暂停</button>
|
||||
<button class="btn-text-s" id="btn-restart-service">重启</button>
|
||||
<button class="btn-text-s" id="btn-refresh-status">刷新</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -170,7 +170,6 @@
|
||||
<div class="card-header">
|
||||
<span class="card-icon"><i data-lucide="file-text"></i></span>
|
||||
<h2>运行日志</h2>
|
||||
<button class="btn-text-s" id="btn-refresh-log">刷新</button>
|
||||
</div>
|
||||
<pre class="log-output" id="log-output">加载中...</pre>
|
||||
</section>
|
||||
|
||||
Reference in new issue
Block a user