From 106110d5464e5373aed9c07ad86c7dda7c4c508d Mon Sep 17 00:00:00 2001 From: Yule Date: Sun, 5 Apr 2026 00:14:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E4=BA=AE=E5=BA=A6=E4=BC=91=E7=9C=A0=EF=BC=9B=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E8=B0=83=E6=95=B4=E6=AD=A5=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- customize.sh | 42 ++++++ index.html | 109 +++++++++++---- module.prop | 4 +- script/restart.sh | 34 +++++ script/up.sh | 39 +++++- src/main.js | 211 +++++++++++++++++++++++++++--- src/style.css | 172 +++++++++++++++++++++++- webroot/assets/index-CRYvfSfT.css | 1 - webroot/assets/index-DAJ7hj2r.css | 1 + webroot/assets/index-DfP8X78P.js | 4 + webroot/assets/index-_esaoEhK.js | 4 - webroot/index.html | 113 ++++++++++++---- 12 files changed, 662 insertions(+), 72 deletions(-) create mode 100644 script/restart.sh delete mode 100644 webroot/assets/index-CRYvfSfT.css create mode 100644 webroot/assets/index-DAJ7hj2r.css create mode 100644 webroot/assets/index-DfP8X78P.js delete mode 100644 webroot/assets/index-_esaoEhK.js diff --git a/customize.sh b/customize.sh index 85b885a..5f7402b 100755 --- a/customize.sh +++ b/customize.sh @@ -134,6 +134,15 @@ IMPORT_OLD_CONFIG() { if [ -s "$old_config/sleep_time.txt" ]; then echo " - 休眠时间: $(cat "$old_config/sleep_time.txt")" fi + if [ -s "$old_config/auto_bri_sleep.txt" ]; then + echo " - 自动亮度时休眠: $(cat "$old_config/auto_bri_sleep.txt" | sed 's/1/开启/;s/0/关闭/')" + fi + if [ -s "$old_config/steps_num.txt" ]; then + echo " - 亮度提升步数: $(cat "$old_config/steps_num.txt")" + fi + if [ -s "$old_config/log_max_size.txt" ]; then + echo " - 日志大小限制: $(cat "$old_config/log_max_size.txt") KB" + fi echo "" echo "* 按音量 + 沿用旧配置, 按音量 - 重新测试" @@ -142,6 +151,22 @@ IMPORT_OLD_CONFIG() { cp -f "$old_config/ui_max_bri.txt" "$mod_config/" cp -f "$old_config/max_bri.txt" "$mod_config/" [ -s "$old_config/sleep_time.txt" ] && cp -f "$old_config/sleep_time.txt" "$mod_config/" + [ -s "$old_config/auto_bri_sleep.txt" ] && cp -f "$old_config/auto_bri_sleep.txt" "$mod_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 + echo "- 检测到从 2101 版本升级, 正在补全备份目录..." + mkdir -p "$mod_config/.backup" + cp -f "$mod_config/"*.txt "$mod_config/.backup/" 2>/dev/null + else + # 正常备份同步 + mkdir -p "$mod_config/.backup" + [ -d "$old_config/.backup" ] && cp -rf "$old_config/.backup/." "$mod_config/.backup/" + fi return 0 else echo "- 将重新测试" @@ -156,7 +181,23 @@ INIT_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" +} + +# 创建备份 (用于 WebUI 恢复默认) +CREATE_BACKUP() { + mkdir -p "$mod_config/.backup" + cp -f "$mod_config/ui_max_bri.txt" "$mod_config/.backup/" + cp -f "$mod_config/max_bri.txt" "$mod_config/.backup/" + cp -f "$mod_config/sleep_time.txt" "$mod_config/.backup/" + cp -f "$mod_config/auto_bri_sleep.txt" "$mod_config/.backup/" + cp -f "$mod_config/steps_num.txt" "$mod_config/.backup/" + cp -f "$mod_config/log_max_size.txt" "$mod_config/.backup/" } # 主函数 @@ -166,6 +207,7 @@ MAIN() { INIT_CONFIG CHECK_FILES TEST_UI_MAX_BRI + CREATE_BACKUP fi END } diff --git a/index.html b/index.html index 83f1dd5..4c95ed8 100644 --- a/index.html +++ b/index.html @@ -33,38 +33,100 @@

亮度配置

-
-
- 前台最大亮度 - 触发亮度提升的阈值 + +
+

亮度调节

+
+
+ 前台最大亮度 + 触发亮度提升的阈值 +
+
+ +
-
- +
+
+ 峰值最大亮度 + 亮度提升的目标值 +
+
+ +
+
+
+
+ 亮度提升步数 + 约 0.02 秒 / 步 +
+
+ +
-
-
- 峰值最大亮度 - 亮度提升的目标值 + +
+

执行策略

+
+
+ 自动亮度时休眠 + 开启自动亮度时不提升 +
+
+ +
-
- +
+
+ 定时休眠 + 设定时段内不提升亮度 +
+
+ +
+
+
+
+
+ + : + +
+ 至 +
+ + : + +
+
-
-
- 休眠时间 - 该时段内不提升亮度 -
-
- + +
+

系统管理

+
+
+ 日志大小限制 + 单位: KB +
+
+ +
+ @@ -76,7 +138,10 @@

实时状态

- +
+ + +
@@ -104,7 +169,7 @@

运行日志

- +
加载中...
diff --git a/module.prop b/module.prop index abe0af8..3e3ab49 100755 --- a/module.prop +++ b/module.prop @@ -1,6 +1,6 @@ id=LuminPro name=LuminPro丨日用屏幕亮度强化 -version=V2.1 -versionCode=2101 +version=V2.2 +versionCode=2201 author=酷安@Yule description=本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果 \ No newline at end of file diff --git a/script/restart.sh b/script/restart.sh new file mode 100644 index 0000000..e695ee9 --- /dev/null +++ b/script/restart.sh @@ -0,0 +1,34 @@ +#!/system/bin/sh +# LuminPro 服务重启脚本 + +MODDIR="${0%/*/*}" +PID_DIR="$MODDIR/pid" +pid_file="$PID_DIR/inotifyd.pid" +flag_file="$PID_DIR/up.flag" +now_bri_file="/sys/class/backlight/panel0-backlight/brightness" +log_file="$MODDIR/service.log" + +_log() { + printf '[%s] [service.restart] %s\n' "$(date '+%d %H:%M:%S.%3N')" "$1" >>"$log_file" +} + +_log "正在手动重启服务..." + +# 1. 杀死正在进行的 inotifyd +if [ -f "$pid_file" ]; then + kill -9 "$(cat "$pid_file")" 2>/dev/null + _log "已杀死现有 inotifyd ($(cat "$pid_file"))" +fi + +# 2. 清理遗留文件 +rm -f "$pid_file" +rm -f "$flag_file" +_log "已清理 pid 和 flag 文件" + +# 3. 重新启动 inotifyd +inotifyd "$MODDIR/script/up.sh" "$now_bri_file:c" & +inotifyd_pid="$!" +echo "$inotifyd_pid" >"$pid_file" +_log "inotifyd ($inotifyd_pid) 重新启动成功" + +exit 0 diff --git a/script/up.sh b/script/up.sh index c3e5f66..77ab486 100644 --- a/script/up.sh +++ b/script/up.sh @@ -11,6 +11,19 @@ log_file="$MODDIR/service.log" # 日志函数 _log() { + local max_size + max_size="$(cat "$CONFIG_DIR/log_max_size.txt" 2>/dev/null)" + [ -z "$max_size" ] && max_size="500" # 默认 500 KB + + # 获取当前日志大小 (KB) + if [ -f "$log_file" ]; then + local cur_size + cur_size=$(du -k "$log_file" | cut -f1) + if [ "$cur_size" -ge "$max_size" ]; then + echo "[$(date '+%d %H:%M:%S.%3N')] [service.up] 日志过大 ($cur_size KB), 自动重置" >"$log_file" + fi + fi + printf '[%s] [service.up] %s\n' "$(date '+%d %H:%M:%S.%3N')" "$1" >>"$log_file" } @@ -30,6 +43,7 @@ now_bri_file="/sys/class/backlight/panel0-backlight/brightness" ui_max_bri="$(cat "$CONFIG_DIR/ui_max_bri.txt")" max_bri="$(cat "$CONFIG_DIR/max_bri.txt")" sleep_time="$(cat "$CONFIG_DIR/sleep_time.txt" 2>/dev/null)" +auto_bri_sleep="$(cat "$CONFIG_DIR/auto_bri_sleep.txt" 2>/dev/null)" # 解析休眠时间 (格式: HHMM-HHMM, 例如 1900-0600) sleep_start="${sleep_time%-*}" # 1900 @@ -56,7 +70,8 @@ IS_SLEEP_TIME() { # 目标亮度 target_bri="$max_bri" -steps_num="50" # 步数 +steps_num="$(cat "$CONFIG_DIR/steps_num.txt" 2>/dev/null)" +[ -z "$steps_num" ] && steps_num="50" # 步数 (默认 50) # 循环调整 update_all() { @@ -111,6 +126,18 @@ CHECK_BRI() { return 2 } +# 判断是否开启了自动亮度且需要休眠 +IS_AUTO_BRI_SLEEP() { + if [ "$auto_bri_sleep" = "1" ]; then + local mode + mode="$(settings get system screen_brightness_mode 2>/dev/null)" + if [ "$mode" = "1" ]; then + return 0 # 需要休眠 + fi + fi + return 1 # 不需要休眠 +} + MAIN() { # 休眠时段内不调整亮度 if IS_SLEEP_TIME; then @@ -121,10 +148,18 @@ MAIN() { return fi + if IS_AUTO_BRI_SLEEP; then + _log "($$) 当前为自动亮度模式, 根据设置跳过本次调整" + _log "--------------------" + sleep 1 + rm -f "$flag_file" + return + fi + _log "($$) 亮度被调整, 将在 0.5s 后检测是否符合条件" sleep 0.5 CHECK_BRI - sleep 0.5 # 稍微延迟一会避免 inotifyd 刚启动就检测到亮度变化 + sleep 0.5 # 稍微延迟一会避免 inotifyd 刚启动就检测到亮度变化 rm -f "$flag_file" # 删除 flag, 允许下一次调整 } diff --git a/src/main.js b/src/main.js index 227958a..19becf2 100644 --- a/src/main.js +++ b/src/main.js @@ -2,6 +2,7 @@ import { exec } from 'kernelsu'; import { createIcons, Sun, Settings, Save, Activity, RefreshCw, FileText } from 'lucide'; 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 LOG_FILE = '/data/adb/modules/LuminPro/service.log'; @@ -41,22 +42,81 @@ async function writeFile(path, content) { // 1. 加载配置 async function loadConfig() { - const [uiRes, maxRes, sleepRes] = await Promise.all([ + const [uiRes, maxRes, sleepRes, autoRes, stepsRes, logSizeRes] = await Promise.all([ runCmd(`cat "${CONFIG_DIR}/ui_max_bri.txt"`), runCmd(`cat "${CONFIG_DIR}/max_bri.txt"`), - runCmd(`cat "${CONFIG_DIR}/sleep_time.txt"`) + runCmd(`cat "${CONFIG_DIR}/sleep_time.txt"`), + runCmd(`cat "${CONFIG_DIR}/auto_bri_sleep.txt"`), + runCmd(`cat "${CONFIG_DIR}/steps_num.txt"`), + runCmd(`cat "${CONFIG_DIR}/log_max_size.txt"`) ]); if (uiRes.errno === 0) document.getElementById('input-ui-max-bri').value = uiRes.stdout.trim(); if (maxRes.errno === 0) document.getElementById('input-max-bri').value = maxRes.stdout.trim(); - if (sleepRes.errno === 0) document.getElementById('input-sleep-time').value = sleepRes.stdout.trim(); + + if (sleepRes.errno === 0) { + const timeVal = sleepRes.stdout.trim(); + const modeSwitch = document.getElementById('input-sleep-mode'); + const expandArea = document.getElementById('sleep-time-expand'); + + if(timeVal && timeVal.includes('-')) { + modeSwitch.checked = true; + expandArea.classList.add('show'); + const [start, end] = timeVal.split('-'); + if(start.length === 4) { + document.getElementById('input-sleep-start-h').value = start.slice(0, 2); + document.getElementById('input-sleep-start-m').value = start.slice(2); + } + if(end.length === 4) { + document.getElementById('input-sleep-end-h').value = end.slice(0, 2); + document.getElementById('input-sleep-end-m').value = end.slice(2); + } + } else { + modeSwitch.checked = false; + expandArea.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 (autoRes.errno === 0) document.getElementById('input-auto-bri-sleep').checked = autoRes.stdout.trim() === '1'; + if (stepsRes.errno === 0) { + const v = stepsRes.stdout.trim(); + document.getElementById('input-steps-num').value = v ? v : '50'; + } else { + document.getElementById('input-steps-num').value = '50'; + } + if (logSizeRes.errno === 0) { + const v = logSizeRes.stdout.trim(); + document.getElementById('input-log-max-size').value = v ? v : '500'; + } else { + document.getElementById('input-log-max-size').value = '500'; + } } // 2. 保存配置并重启服务 async function saveConfig() { const uiMax = document.getElementById('input-ui-max-bri').value; const maxBri = document.getElementById('input-max-bri').value; - const sleepTime = document.getElementById('input-sleep-time').value; + + const pad = (v) => String(v).padStart(2, '0'); + const sleepMode = document.getElementById('input-sleep-mode').checked; + let sleepTime = ""; + + if (sleepMode) { + const sH = pad(document.getElementById('input-sleep-start-h').value); + const sM = pad(document.getElementById('input-sleep-start-m').value); + const eH = pad(document.getElementById('input-sleep-end-h').value); + const eM = pad(document.getElementById('input-sleep-end-m').value); + sleepTime = `${sH}${sM}-${eH}${eM}`; + } + + const autoBriSleep = document.getElementById('input-auto-bri-sleep').checked ? '1' : '0'; + const stepsNum = document.getElementById('input-steps-num').value || '50'; + const logMaxSize = document.getElementById('input-log-max-size').value || '500'; if (!uiMax || !maxBri) { showToast('亮度值不能为空'); @@ -69,6 +129,9 @@ async function saveConfig() { await writeFile(`${CONFIG_DIR}/ui_max_bri.txt`, uiMax); await writeFile(`${CONFIG_DIR}/max_bri.txt`, maxBri); await writeFile(`${CONFIG_DIR}/sleep_time.txt`, sleepTime); + await writeFile(`${CONFIG_DIR}/auto_bri_sleep.txt`, autoBriSleep); + await writeFile(`${CONFIG_DIR}/steps_num.txt`, stepsNum); + await writeFile(`${CONFIG_DIR}/log_max_size.txt`, logMaxSize); // 通过写亮度节点一个无变化的值,强制触发 inotifyd 执行 up.sh 以重新读取配置 // 注意:需要先清除 flag 以防 up.sh 挂起 @@ -85,6 +148,85 @@ async function saveConfig() { } } +// 2.5 恢复默认 +let isResetConfirming = false; +let resetTimer = null; + +function resetRestoreButton() { + const btn = document.getElementById('btn-reset'); + btn.textContent = '恢复默认'; + btn.classList.remove('btn-danger'); + isResetConfirming = false; + if(resetTimer) clearTimeout(resetTimer); +} + +async function handleReset() { + const btn = document.getElementById('btn-reset'); + + if (!isResetConfirming) { + // 进入确认状态 + isResetConfirming = true; + btn.textContent = '确认'; + btn.classList.add('btn-danger'); + + // 5秒后自动重置回原来状态 + resetTimer = setTimeout(resetRestoreButton, 5000); + return; + } + + // 执行恢复动作 + showToast('正在恢复默认配置...'); + resetRestoreButton(); + + // 读取备份 (或者回退到默认逻辑) + const [uiRes, maxRes, sleepRes, autoRes, stepsRes, logSizeRes] = await Promise.all([ + runCmd(`cat "${BACKUP_DIR}/ui_max_bri.txt"`), + runCmd(`cat "${BACKUP_DIR}/max_bri.txt"`), + runCmd(`cat "${BACKUP_DIR}/sleep_time.txt"`), + runCmd(`cat "${BACKUP_DIR}/auto_bri_sleep.txt"`), + runCmd(`cat "${BACKUP_DIR}/steps_num.txt"`), + runCmd(`cat "${BACKUP_DIR}/log_max_size.txt"`) + ]); + + // 填入值 + if (uiRes.errno === 0) document.getElementById('input-ui-max-bri').value = uiRes.stdout.trim(); + if (maxRes.errno === 0) document.getElementById('input-max-bri').value = maxRes.stdout.trim(); + + if (sleepRes.errno === 0) { + const tV = sleepRes.stdout.trim(); + const modeSwitch = document.getElementById('input-sleep-mode'); + const expandArea = document.getElementById('sleep-time-expand'); + + if(tV.includes('-')) { + modeSwitch.checked = true; + expandArea.classList.add('show'); + const [s, e] = tV.split('-'); + if(s.length === 4) { + document.getElementById('input-sleep-start-h').value = s.slice(0, 2); + document.getElementById('input-sleep-start-m').value = s.slice(2); + } + if(e.length === 4) { + document.getElementById('input-sleep-end-h').value = e.slice(0, 2); + document.getElementById('input-sleep-end-m').value = e.slice(2); + } + } + } else { + document.getElementById('input-sleep-mode').checked = true; + document.getElementById('sleep-time-expand').classList.add('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'; + } + + document.getElementById('input-auto-bri-sleep').checked = (autoRes.errno === 0) ? (autoRes.stdout.trim() === '1') : true; + document.getElementById('input-steps-num').value = (stepsRes.errno === 0) ? stepsRes.stdout.trim() : '50'; + document.getElementById('input-log-max-size').value = (logSizeRes.errno === 0) ? logSizeRes.stdout.trim() : '500'; + + // 直接触发保存 + await saveConfig(); +} + // 3. 刷新实时状态 async function loadStatus() { const [curRes, sysRes, pidRes] = await Promise.all([ @@ -112,24 +254,49 @@ async function loadStatus() { } // 简易判断当前休眠状态 (只为了前端展示,不影响后端核心) - const sleepInput = document.getElementById('input-sleep-time').value; + const isEnabled = document.getElementById('input-sleep-mode').checked; + const sH = document.getElementById('input-sleep-start-h').value; + const sM = document.getElementById('input-sleep-start-m').value; + const eH = document.getElementById('input-sleep-end-h').value; + const eM = document.getElementById('input-sleep-end-m').value; let isSleep = false; - if(sleepInput && sleepInput.includes('-')) { - const [start, end] = sleepInput.split('-'); - const d = new Date(); - const now = d.getHours() * 100 + d.getMinutes(); - const s = parseInt(start, 10); - const e = parseInt(end, 10); - if (s > e) { - if(now >= s || now < e) isSleep = true; - } else if (s < e) { - if(now >= s && now < e) isSleep = true; + + if(isEnabled && sH && sM && eH && eM) { + const now = new Date(); + const nV = now.getHours() * 100 + now.getMinutes(); + const sNum = parseInt(sH, 10) * 100 + parseInt(sM, 10); + const eNum = parseInt(eH, 10) * 100 + parseInt(eM, 10); + if (sNum > eNum) { + if(nV >= sNum || nV < eNum) isSleep = true; + } else if (sNum < eNum) { + if(nV >= sNum && nV < eNum) isSleep = true; } } document.getElementById('status-sleep').textContent = isSleep ? '休眠中' : '非休眠'; } -// 4. 加载日志 +// 5. 重启服务 +async function restartService() { + const btn = document.getElementById('btn-restart-service'); + + showToast('正在重启服务...'); + btn.disabled = true; + + // 执行重启脚本 + const res = await runCmd(`sh /data/adb/modules/LuminPro/script/restart.sh`); + + if (res.errno === 0) { + showToast('服务已成功重启'); + } else { + showToast('重启失败: ' + res.stderr); + } + + // 延迟刷新状态以确保 PID 文件已写入 + setTimeout(async () => { + await loadStatus(); + btn.disabled = false; + }, 1000); +} async function loadLogs() { const logEl = document.getElementById('log-output'); // 读取最后 50 行日志 @@ -162,9 +329,21 @@ async function init() { // 绑定事件 document.getElementById('btn-save').addEventListener('click', saveConfig); + document.getElementById('btn-reset').addEventListener('click', handleReset); + 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) => { + const expandArea = document.getElementById('sleep-time-expand'); + if (e.target.checked) { + expandArea.classList.add('show'); + } else { + expandArea.classList.remove('show'); + } + }); + // 初次加载数据 await loadConfig(); await loadStatus(); diff --git a/src/style.css b/src/style.css index 4c1a1b3..814a7e5 100644 --- a/src/style.css +++ b/src/style.css @@ -141,6 +141,22 @@ body { } /* Config Items */ +.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; + font-size: 0.875rem; + font-weight: 600; + color: var(--md-sys-color-primary); + text-transform: uppercase; + letter-spacing: 0.5px; +} + .config-item { display: flex; justify-content: space-between; @@ -149,7 +165,6 @@ body { .config-item + .config-item { margin-top: var(--spacing-m); - padding-top: var(--spacing-m); } .config-label { @@ -190,6 +205,111 @@ body { width: 140px; } +.config-item-expand { + display: flex; + justify-content: flex-end; + margin-top: var(--spacing-s); + max-height: 0; + overflow: hidden; + opacity: 0; + transition: all 0.3s ease; +} + +.config-item-expand.show { + max-height: 100px; /* 调整为适合内容的高度 */ + opacity: 1; + margin-bottom: var(--spacing-m); +} + +/* Custom Time Picker Styles */ +.custom-time-picker { + display: flex; + align-items: center; + gap: 12px; +} + +.time-unit { + display: flex; + align-items: center; + gap: 4px; + background-color: var(--md-sys-color-surface-container-high); + padding: 4px 8px; + border-radius: var(--border-radius-s); + border: 1px solid var(--md-sys-color-outline); +} + +.time-input { + width: 42px; + background-color: transparent; + color: var(--md-sys-color-on-surface); + border: none; + font-size: 1rem; + text-align: center; + font-family: 'Google Sans Code', monospace; + outline: none; + -moz-appearance: textfield; +} + +.time-input::-webkit-outer-spin-button, +.time-input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} + +.time-sep { + color: var(--md-sys-color-on-surface-variant); + font-size: 0.875rem; +} + +/* Switch Styles */ +.switch { + position: relative; + display: inline-block; + width: 52px; + height: 32px; +} + +.switch input { + opacity: 0; + width: 0; + height: 0; +} + +.slider { + position: absolute; + cursor: pointer; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: var(--md-sys-color-surface-container-high); + transition: .4s; + border-radius: 34px; + border: 2px solid var(--md-sys-color-outline); +} + +.slider:before { + position: absolute; + content: ""; + height: 24px; + width: 24px; + left: 2px; + bottom: 2px; + background-color: var(--md-sys-color-outline); + transition: .4s; + border-radius: 50%; +} + +input:checked + .slider { + background-color: var(--md-sys-color-primary-container); + border-color: var(--md-sys-color-primary); +} + +input:checked + .slider:before { + transform: translateX(20px); + background-color: var(--md-sys-color-primary); +} + /* Status Grid */ .status-grid { display: grid; @@ -222,6 +342,7 @@ body { .card-actions { display: flex; justify-content: flex-end; + gap: 12px; margin-top: var(--spacing-l); padding-top: var(--spacing-m); border-top: 1px solid var(--md-sys-color-outline-variant); @@ -252,6 +373,46 @@ body { color: var(--md-sys-color-on-primary); } +.btn-outline { + background-color: transparent; + border: 1px solid var(--md-sys-color-outline); + color: var(--md-sys-color-primary); +} + +.btn-outline-s, .btn-text-s { + background-color: transparent; + border: 1px solid var(--md-sys-color-outline-variant); + color: var(--md-sys-color-primary); + padding: 4px 10px; + min-width: 50px; + height: 28px; + font-size: 0.75rem; + border-radius: var(--border-radius-s); + cursor: pointer; + display: inline-flex; + align-items: center; + justify-content: center; + transition: all 0.2s; + white-space: nowrap; +} + +.btn-text-s:active { + background-color: var(--md-sys-color-surface-container-high); +} + +.btn-danger { + background-color: var(--md-sys-color-error) !important; + color: var(--md-sys-color-on-error) !important; + border: none !important; +} + +/* Header Actions container */ +.header-actions { + display: flex; + align-items: center; + gap: 8px; +} + .btn-icon-only { background: transparent; border: none; @@ -269,6 +430,15 @@ body { background-color: var(--md-sys-color-surface-container-high); } +.animate-spin { + animation: spin 1s linear infinite; +} + +@keyframes spin { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } +} + /* Logs */ .log-output { font-family: 'Google Sans Code', 'Consolas', 'Courier New', monospace; diff --git a/webroot/assets/index-CRYvfSfT.css b/webroot/assets/index-CRYvfSfT.css deleted file mode 100644 index 7e65354..0000000 --- a/webroot/assets/index-CRYvfSfT.css +++ /dev/null @@ -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-item{justify-content:space-between;align-items:center;display:flex}.config-item+.config-item{margin-top:var(--spacing-m);padding-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}.status-grid{gap:var(--spacing-m);grid-template-columns:1fr 1fr;display:grid}.status-item{background-color:var(--md-sys-color-surface-container);padding:var(--spacing-m);border-radius:var(--border-radius-s);flex-direction:column;display:flex}.status-label{color:var(--md-sys-color-on-surface-variant);margin-bottom:4px;font-size:.75rem}.status-value{color:var(--md-sys-color-primary);word-break:break-all;font-size:1.125rem;font-weight:500}.card-actions{margin-top:var(--spacing-l);padding-top:var(--spacing-m);border-top:1px solid var(--md-sys-color-outline-variant);justify-content:flex-end;display:flex}.btn{cursor:pointer;border:none;border-radius:100px;justify-content:center;align-items:center;gap:8px;padding:10px 24px;font-family:inherit;font-size:.875rem;font-weight:500;transition:background-color .2s,opacity .2s;display:inline-flex}.btn:active{opacity:.8}.btn-primary{background-color:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary)}.btn-icon-only{color:var(--md-sys-color-on-surface-variant);cursor:pointer;background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;padding:4px;font-size:1.25rem;display:flex}.btn-icon-only:active{background-color:var(--md-sys-color-surface-container-high)}.log-output{padding:var(--spacing-s);border-radius:var(--border-radius-s);white-space:pre-wrap;word-wrap:break-word;height:200px;margin:0;font-family:Google Sans Code,Consolas,Courier New,monospace;font-size:.75rem;overflow-y:auto}.toast{background-color:var(--md-sys-color-on-surface);color:var(--md-sys-color-surface);border-radius:var(--border-radius-s);z-index:1000;text-align:center;width:max-content;max-width:90vw;padding:12px 24px;font-size:.875rem;transition:transform .3s cubic-bezier(.18,.89,.32,1.28);position:fixed;bottom:24px;left:50%;transform:translate(-50%)translateY(100px);box-shadow:0 2px 5px #0006}.toast.show{transform:translate(-50%)translateY(0)} diff --git a/webroot/assets/index-DAJ7hj2r.css b/webroot/assets/index-DAJ7hj2r.css new file mode 100644 index 0000000..5e206db --- /dev/null +++ b/webroot/assets/index-DAJ7hj2r.css @@ -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: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;left:2px}input:checked+.slider{background-color:var(--md-sys-color-primary-container);border-color:var(--md-sys-color-primary)}input:checked+.slider:before{background-color:var(--md-sys-color-primary);transform:translate(20px)}.status-grid{gap:var(--spacing-m);grid-template-columns:1fr 1fr;display:grid}.status-item{background-color:var(--md-sys-color-surface-container);padding:var(--spacing-m);border-radius:var(--border-radius-s);flex-direction:column;display:flex}.status-label{color:var(--md-sys-color-on-surface-variant);margin-bottom:4px;font-size:.75rem}.status-value{color:var(--md-sys-color-primary);word-break:break-all;font-size:1.125rem;font-weight:500}.card-actions{margin-top:var(--spacing-l);padding-top:var(--spacing-m);border-top:1px solid var(--md-sys-color-outline-variant);justify-content:flex-end;gap:12px;display:flex}.btn{cursor:pointer;border:none;border-radius:100px;justify-content:center;align-items:center;gap:8px;padding:10px 24px;font-family:inherit;font-size:.875rem;font-weight:500;transition:background-color .2s,opacity .2s;display:inline-flex}.btn:active{opacity:.8}.btn-primary{background-color:var(--md-sys-color-primary);color:var(--md-sys-color-on-primary)}.btn-outline{border:1px solid var(--md-sys-color-outline);color:var(--md-sys-color-primary);background-color:#0000}.btn-outline-s,.btn-text-s{border:1px solid var(--md-sys-color-outline-variant);color:var(--md-sys-color-primary);border-radius:var(--border-radius-s);cursor:pointer;white-space:nowrap;background-color:#0000;justify-content:center;align-items:center;min-width:50px;height:28px;padding:4px 10px;font-size:.75rem;transition:all .2s;display:inline-flex}.btn-text-s:active{background-color:var(--md-sys-color-surface-container-high)}.btn-danger{background-color:var(--md-sys-color-error)!important;color:var(--md-sys-color-on-error)!important;border:none!important}.header-actions{align-items:center;gap:8px;display:flex}.btn-icon-only{color:var(--md-sys-color-on-surface-variant);cursor:pointer;background:0 0;border:none;border-radius:50%;justify-content:center;align-items:center;padding:4px;font-size:1.25rem;display:flex}.btn-icon-only:active{background-color:var(--md-sys-color-surface-container-high)}.animate-spin{animation:1s linear infinite spin}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.log-output{padding:var(--spacing-s);border-radius:var(--border-radius-s);white-space:pre-wrap;word-wrap:break-word;height:200px;margin:0;font-family:Google Sans Code,Consolas,Courier New,monospace;font-size:.75rem;overflow-y:auto}.toast{background-color:var(--md-sys-color-on-surface);color:var(--md-sys-color-surface);border-radius:var(--border-radius-s);z-index:1000;text-align:center;width:max-content;max-width:90vw;padding:12px 24px;font-size:.875rem;transition:transform .3s cubic-bezier(.18,.89,.32,1.28);position:fixed;bottom:24px;left:50%;transform:translate(-50%)translateY(100px);box-shadow:0 2px 5px #0006}.toast.show{transform:translate(-50%)translateY(0)} diff --git a/webroot/assets/index-DfP8X78P.js b/webroot/assets/index-DfP8X78P.js new file mode 100644 index 0000000..cac5d9d --- /dev/null +++ b/webroot/assets/index-DfP8X78P.js @@ -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/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&&(document.getElementById(`input-sleep-start-h`).value=r.slice(0,2),document.getElementById(`input-sleep-start-m`).value=r.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 document.getElementById(`input-sleep-mode`).checked=!0,document.getElementById(`sleep-time-expand`).classList.add(`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`;document.getElementById(`input-auto-bri-sleep`).checked=i.errno===0?i.stdout.trim()===`1`:!0,document.getElementById(`input-steps-num`).value=a.errno===0?a.stdout.trim():`50`,document.getElementById(`input-log-max-size`).value=o.errno===0?o.stdout.trim():`500`,await N()}async function R(){let[e,t,n]=await Promise.all([A(`cat "${D}"`),A(`cat "${O}"`),A(`cat "${w}"`)]);document.getElementById(`status-current-bri`).textContent=e.errno===0?e.stdout.trim():`N/A`,document.getElementById(`status-sys-max-bri`).textContent=t.errno===0?t.stdout.trim():`N/A`;let r=n.errno===0?n.stdout.trim():``,i=document.getElementById(`status-inotifyd-pid`),a=document.querySelector(`.status-dot`),o=document.querySelector(`.status-text`);r?(i.textContent=r,a.style.backgroundColor=`#4caf50`,o.textContent=`运行中`):(i.textContent=`未运行`,a.style.backgroundColor=`var(--md-sys-color-error)`,o.textContent=`已停止`);let s=document.getElementById(`input-sleep-mode`).checked,c=document.getElementById(`input-sleep-start-h`).value,l=document.getElementById(`input-sleep-start-m`).value,u=document.getElementById(`input-sleep-end-h`).value,d=document.getElementById(`input-sleep-end-m`).value,f=!1;if(s&&c&&l&&u&&d){let e=new Date,t=e.getHours()*100+e.getMinutes(),n=parseInt(c,10)*100+parseInt(l,10),r=parseInt(u,10)*100+parseInt(d,10);n>r?(t>=n||t=n&&t{await R(),e.disabled=!1},1e3)}async function B(){let e=document.getElementById(`log-output`),t=await A(`tail -n 50 "${E}"`);t.errno===0&&t.stdout?e.textContent=t.stdout:e.textContent=`暂无日志或读取失败`,e.scrollTop=e.scrollHeight}async function V(){x({icons:{Sun:b,Settings:y,Save:v,Activity:h,RefreshCw:_,FileText:g}}),document.getElementById(`btn-save`).addEventListener(`click`,N),document.getElementById(`btn-reset`).addEventListener(`click`,L),document.getElementById(`btn-restart-service`).addEventListener(`click`,z),document.getElementById(`btn-refresh-status`).addEventListener(`click`,R),document.getElementById(`btn-refresh-log`).addEventListener(`click`,B),document.getElementById(`input-sleep-mode`).addEventListener(`change`,e=>{let t=document.getElementById(`sleep-time-expand`);e.target.checked?t.classList.add(`show`):t.classList.remove(`show`)}),await M(),await R(),await B()}document.addEventListener(`DOMContentLoaded`,V); \ No newline at end of file diff --git a/webroot/assets/index-_esaoEhK.js b/webroot/assets/index-_esaoEhK.js deleted file mode 100644 index baebf7b..0000000 --- a/webroot/assets/index-_esaoEhK.js +++ /dev/null @@ -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/pid/inotifyd.pid`,w=`/data/adb/modules/LuminPro/pid/up.flag`,T=`/data/adb/modules/LuminPro/service.log`,E=`/sys/class/backlight/panel0-backlight/brightness`,D=`/sys/class/backlight/panel0-backlight/max_brightness`;function O(e){let t=document.getElementById(`toast`);t.textContent=e,t.classList.add(`show`),setTimeout(()=>t.classList.remove(`show`),3e3)}async function k(e){try{return await n(e)}catch(e){return console.error(e),{errno:-1,stdout:``,stderr:String(e)}}}async function A(e,t){return k(`echo -n '${String(t).replace(/'/g,`'\\''`)}' > "${e}"`)}async function j(){let[e,t,n]=await Promise.all([k(`cat "${S}/ui_max_bri.txt"`),k(`cat "${S}/max_bri.txt"`),k(`cat "${S}/sleep_time.txt"`)]);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&&(document.getElementById(`input-sleep-time`).value=n.stdout.trim())}async function M(){let e=document.getElementById(`input-ui-max-bri`).value,t=document.getElementById(`input-max-bri`).value,n=document.getElementById(`input-sleep-time`).value;if(!e||!t){O(`亮度值不能为空`);return}O(`保存中...`),await A(`${S}/ui_max_bri.txt`,e),await A(`${S}/max_bri.txt`,t),await A(`${S}/sleep_time.txt`,n),await k(`rm -f "${w}"`);let r=await k(`cat "${C}"`);r.errno===0&&r.stdout.trim()?O(`配置已保存 (可能需要在下次调整时生效)`):O(`配置已保存 (服务未运行)`)}async function N(){let[e,t,n]=await Promise.all([k(`cat "${E}"`),k(`cat "${D}"`),k(`cat "${C}"`)]);document.getElementById(`status-current-bri`).textContent=e.errno===0?e.stdout.trim():`N/A`,document.getElementById(`status-sys-max-bri`).textContent=t.errno===0?t.stdout.trim():`N/A`;let r=n.errno===0?n.stdout.trim():``,i=document.getElementById(`status-inotifyd-pid`),a=document.querySelector(`.status-dot`),o=document.querySelector(`.status-text`);r?(i.textContent=r,a.style.backgroundColor=`#4caf50`,o.textContent=`运行中`):(i.textContent=`未运行`,a.style.backgroundColor=`var(--md-sys-color-error)`,o.textContent=`已停止`);let s=document.getElementById(`input-sleep-time`).value,c=!1;if(s&&s.includes(`-`)){let[e,t]=s.split(`-`),n=new Date,r=n.getHours()*100+n.getMinutes(),i=parseInt(e,10),a=parseInt(t,10);i>a?(r>=i||r=i&&r LuminPro - - + + @@ -34,38 +34,100 @@

亮度配置

-
-
- 前台最大亮度 - 触发亮度提升的阈值 + +
+

亮度调节

+
+
+ 前台最大亮度 + 触发亮度提升的阈值 +
+
+ +
-
- +
+
+ 峰值最大亮度 + 亮度提升的目标值 +
+
+ +
+
+
+
+ 亮度提升步数 + 约 0.02 秒 / 步 +
+
+ +
-
-
- 峰值最大亮度 - 亮度提升的目标值 + +
+

执行策略

+
+
+ 自动亮度时休眠 + 开启自动亮度时不提升 +
+
+ +
-
- +
+
+ 定时休眠 + 设定时段内不提升亮度 +
+
+ +
+
+
+
+
+ + : + +
+ 至 +
+ + : + +
+
-
-
- 休眠时间 - 该时段内不提升亮度 -
-
- + +
+

系统管理

+
+
+ 日志大小限制 + 单位: KB +
+
+ +
+ @@ -77,7 +139,10 @@

实时状态

- +
+ + +
@@ -105,7 +170,7 @@

运行日志

- +
加载中...