4 Commits
16 changed files with 804 additions and 124 deletions

No files matched your search

+19
View File
@@ -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
+18 -1
View File
@@ -7,10 +7,27 @@ const versionMatch = propContent.match(/^version=(.*)$/m);
const versionCodeMatch = propContent.match(/^versionCode=(.*)$/m);
const version = versionMatch ? versionMatch[1].trim() : 'Unknown';
const versionCode = versionCodeMatch ? versionCodeMatch[1].trim() : '0000';
const versionCodeStr = versionCodeMatch ? versionCodeMatch[1].trim() : '0000';
const versionCode = parseInt(versionCodeStr, 10);
const zipName = `LuminPro_${version}-${versionCode}.zip`;
// --- 新增: 自动同步 update.json ---
const updateJsonPath = 'update.json';
if (fs.existsSync(updateJsonPath)) {
try {
const updateJson = JSON.parse(fs.readFileSync(updateJsonPath, 'utf-8'));
updateJson.versionCode = versionCode;
updateJson.version = version;
updateJson.zipUrl = `https://share.yule.ink/magisk/mod/luminpro/module/${zipName}`;
fs.writeFileSync(updateJsonPath, JSON.stringify(updateJson, null, 4), 'utf-8');
console.log(`>>> [1/2] 已同步 update.json (版本: ${version}, Code: ${versionCode})`);
} catch (e) {
console.error(`[错误] 无法更新 update.json: ${e.message}`);
}
}
// ---------------------------------
console.log(`\n>>> [2/2] 创建模块 ZIP 压缩包...`);
// 明确需要忽略的文件清单
+15
View File
@@ -0,0 +1,15 @@
## V2.2-2202
### 核心逻辑
- 新增: `action.sh` 支持模块管理器“操作”按钮点击快速切换开关状态
- 新增: `stop.flag` 机制,支持在不重启服务的情况下拦截亮度提升逻辑
- 重构: `up.sh` 逻辑,支持日志内容比对刷新及文件大小自动截断
- 新增: `restart.sh` 脚本,实现 PID 清理、Flag 重置及服务重启的原子化操作。
- 修复: 2.1 版本中,反复重启 inotifyd 造成的卡死问题
- 完善 `customize.sh` 的迁移逻辑,支持从 2101 版本自动补全缺失配置及备份目录
### WebUI
- 重构: 将配置划分为“亮度调节”、“执行策略”及“系统管理”三大板块
- 优化: 移除手动刷新按钮,实现 0.5s 频率的实时动态状态与日志监控
- 优化: “定时休眠”采用开关折叠设计,优化窄屏移动端布局
- 优化: “恢复默认”引入二次确认机制及安装时备份目录读取
+60 -2
View File
@@ -26,6 +26,18 @@ button_listener() {
}
# 注意事项
SHOW_CHANGELOG() {
local changelog_file="$MODPATH/changelog.md"
if [ -f "$changelog_file" ]; then
echo "--------------------------------------"
echo "- 本次更新日志:"
# 提取第一个二级标题及其内容,直到遇到下一个二级标题或文件结束
# 使用更具兼容性的 awk 逻辑
awk '/^## / { if (p) exit; p=1; print; next } p { print }' "$changelog_file"
echo "--------------------------------------"
fi
}
NOTE() {
cat "$MODPATH/NOTE.txt"
echo ""
@@ -134,6 +146,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 +163,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/"
# 版本迁移逻辑
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 "- 将重新测试"
@@ -153,20 +190,41 @@ 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"
echo "1900-0600" >"$mod_config/sleep_time.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 恢复默认)
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/"
}
# 主函数
MAIN() {
NOTE
SHOW_CHANGELOG
if ! IMPORT_OLD_CONFIG; then
INIT_CONFIG
CHECK_FILES
TEST_UI_MAX_BRI
fi
ENSURE_DEFAULTS
CREATE_BACKUP
END
}
+86 -22
View File
@@ -33,38 +33,100 @@
<h2>亮度配置</h2>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">前台最大亮度</span>
<span class="config-desc">触发亮度提升的阈值</span>
<!-- 分类: 亮度调节 -->
<div class="config-group">
<h3 class="group-title">亮度调节</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">前台最大亮度</span>
<span class="config-desc">触发亮度提升的阈值</span>
</div>
<div class="config-value">
<input type="number" id="input-ui-max-bri" class="config-input" min="0" />
</div>
</div>
<div class="config-value">
<input type="number" id="input-ui-max-bri" class="config-input" min="0" />
<div class="config-item">
<div class="config-label">
<span class="config-name">峰值最大亮度</span>
<span class="config-desc">亮度提升的目标值</span>
</div>
<div class="config-value">
<input type="number" id="input-max-bri" class="config-input" min="0" />
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">亮度提升步数</span>
<span class="config-desc">约 0.02 秒 / 步</span>
</div>
<div class="config-value">
<input type="number" id="input-steps-num" class="config-input" min="1" max="500" />
</div>
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">峰值最大亮度</span>
<span class="config-desc">亮度提升的目标值</span>
<!-- 分类: 执行策略 -->
<div class="config-group">
<h3 class="group-title">执行策略</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">自动亮度时休眠</span>
<span class="config-desc">开启自动亮度时不提升</span>
</div>
<div class="config-value">
<label class="switch">
<input type="checkbox" id="input-auto-bri-sleep">
<span class="slider"></span>
</label>
</div>
</div>
<div class="config-value">
<input type="number" id="input-max-bri" class="config-input" min="0" />
<div class="config-item">
<div class="config-label">
<span class="config-name">定时休眠</span>
<span class="config-desc">设定时段内不提升亮度</span>
</div>
<div class="config-value">
<label class="switch">
<input type="checkbox" id="input-sleep-mode">
<span class="slider"></span>
</label>
</div>
</div>
<div class="config-item-expand" id="sleep-time-expand">
<div class="custom-time-picker">
<div class="time-unit">
<input type="number" id="input-sleep-start-h" class="time-input" min="0" max="23" placeholder="00" />
<span>:</span>
<input type="number" id="input-sleep-start-m" class="time-input" min="0" max="59" placeholder="00" />
</div>
<span class="time-sep">至</span>
<div class="time-unit">
<input type="number" id="input-sleep-end-h" class="time-input" min="0" max="23" placeholder="00" />
<span>:</span>
<input type="number" id="input-sleep-end-m" class="time-input" min="0" max="59" placeholder="00" />
</div>
</div>
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">休眠时间</span>
<span class="config-desc">该时段内不提升亮度</span>
</div>
<div class="config-value">
<input type="text" id="input-sleep-time" class="config-input config-input-wide"
placeholder="如 1900-0600" />
<!-- 分类: 系统管理 -->
<div class="config-group">
<h3 class="group-title">系统管理</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">日志大小限制</span>
<span class="config-desc">单位: KB</span>
</div>
<div class="config-value">
<input type="number" id="input-log-max-size" class="config-input" min="1" max="10240" />
</div>
</div>
</div>
<div class="card-actions">
<button class="btn btn-outline" id="btn-reset">
恢复默认
</button>
<button class="btn btn-primary" id="btn-save">
<span class="btn-icon"><i data-lucide="save"></i></span> 保存配置
</button>
@@ -76,7 +138,10 @@
<div class="card-header">
<span class="card-icon"><i data-lucide="activity"></i></span>
<h2>实时状态</h2>
<button class="btn-icon-only" id="btn-refresh-status" title="刷新"><i data-lucide="refresh-cw"></i></button>
<div class="header-actions">
<button class="btn-text-s" id="btn-toggle-service">暂停</button>
<button class="btn-text-s" id="btn-restart-service">重启</button>
</div>
</div>
<div class="status-grid">
@@ -104,7 +169,6 @@
<div class="card-header">
<span class="card-icon"><i data-lucide="file-text"></i></span>
<h2>运行日志</h2>
<button class="btn-icon-only" id="btn-refresh-log" title="刷新"><i data-lucide="refresh-cw"></i></button>
</div>
<pre class="log-output" id="log-output">加载中...</pre>
</section>
+4 -3
View File
@@ -1,6 +1,7 @@
id=LuminPro
name=LuminPro丨日用屏幕亮度强化
version=V2.1
versionCode=2101
version=V2.2
versionCode=2202
author=酷安@Yule
description=本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果
description=本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果
updateJson=https://share.yule.ink/magisk/mod/luminpro/update.json
+34
View File
@@ -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
+45 -17
View File
@@ -5,23 +5,39 @@
MODDIR="${0%/*/*}"
CONFIG_DIR="$MODDIR/config"
PID_DIR="$MODDIR/pid"
pid_file="$PID_DIR/inotifyd.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
# 获取当前日志大小 (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"
}
_log "($$) 被 inotifyd 调用..."
# 被执行后杀死 inotifyd, 避免重复执行
if [ -f "$pid_file" ]; then
kill -9 "$(cat "$pid_file")" 2>/dev/null
_log "($$) inotifyd ($(cat "$pid_file")) 已杀死"
rm -f "$pid_file"
if [ -f "$stop_file" ]; then
_log "($$) 检测到 stop.flag, 停止本次调整 (服务已暂停)"
exit 0
fi
# 建立一个 flag, 避免重复执行; 如果已经有 flag, 则退出
@@ -38,6 +54,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
@@ -64,7 +81,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() {
@@ -119,12 +137,16 @@ CHECK_BRI() {
return 2
}
# 重启 inotifyd
REBOOT_INOTIFYD() {
inotifyd "$MODDIR/script/up.sh" "$now_bri_file:c" &
inotifyd_pid="$!"
echo "$inotifyd_pid" >"$pid_file"
_log "($$) inotifyd ($inotifyd_pid) 已重启"
# 判断是否开启了自动亮度且需要休眠
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() {
@@ -133,7 +155,14 @@ MAIN() {
_log "($$) 当前处于休眠时段 ($sleep_start-$sleep_end), 跳过本次调整"
_log "--------------------"
sleep 1
REBOOT_INOTIFYD
rm -f "$flag_file"
return
fi
if IS_AUTO_BRI_SLEEP; then
_log "($$) 当前为自动亮度模式, 根据设置跳过本次调整"
_log "--------------------"
sleep 1
rm -f "$flag_file"
return
fi
@@ -141,8 +170,7 @@ MAIN() {
_log "($$) 亮度被调整, 将在 0.5s 后检测是否符合条件"
sleep 0.5
CHECK_BRI
sleep 0.5 # 稍微延迟一会避免 inotifyd 刚启动就检测到亮度变化
REBOOT_INOTIFYD
sleep 0.5 # 稍微延迟一会避免 inotifyd 刚启动就检测到亮度变化
rm -f "$flag_file" # 删除 flag, 允许下一次调整
}
+253 -49
View File
@@ -2,8 +2,10 @@ 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 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';
@@ -41,22 +43,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 +130,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,62 +149,191 @@ async function saveConfig() {
}
}
// 3. 刷新实时状态
async function loadStatus() {
const [curRes, sysRes, pidRes] = await Promise.all([
runCmd(`cat "${NOW_BRI_FILE}"`),
runCmd(`cat "${SYS_MAX_BRI_FILE}"`),
runCmd(`cat "${PID_FILE}"`)
]);
// 2.5 恢复默认
let isResetConfirming = false;
let resetTimer = null;
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';
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');
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');
if (pid) {
pidEl.textContent = pid;
dotEl.style.backgroundColor = '#4caf50'; // 绿色
statusText.textContent = '运行中';
} else {
pidEl.textContent = '未运行';
dotEl.style.backgroundColor = 'var(--md-sys-color-error)';
statusText.textContent = '已停止';
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, stopRes] = await Promise.all([
runCmd(`cat "${NOW_BRI_FILE}"`),
runCmd(`cat "${SYS_MAX_BRI_FILE}"`),
runCmd(`cat "${PID_FILE}"`),
runCmd(`[ -f "${STOP_FLAG_FILE}" ] && echo "1" || echo "0"`)
]);
const isPaused = stopRes.stdout.trim() === '1';
const running = pidRes.errno === 0 && pidRes.stdout.trim();
const statusDot = document.querySelector('.header-status .status-dot');
const statusText = document.querySelector('.header-status .status-text');
const toggleBtn = document.getElementById('btn-toggle-service');
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 {
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 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. 加载日志
// 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');
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 行日志
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 周期
}
// ==========================
@@ -162,13 +355,24 @@ async function init() {
// 绑定事件
document.getElementById('btn-save').addEventListener('click', saveConfig);
document.getElementById('btn-refresh-status').addEventListener('click', loadStatus);
document.getElementById('btn-refresh-log').addEventListener('click', loadLogs);
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('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();
await loadLogs();
// 开启自动刷新状态和日志 (内置了已包含 loadStatus 和 loadLogs)
startAutoRefresh();
}
// DOM 加载完成后运行
+171 -1
View File
@@ -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: 8px;
}
.time-unit {
display: flex;
align-items: center;
gap: 2px;
background-color: var(--md-sys-color-surface-container-high);
padding: 2px 6px;
border-radius: var(--border-radius-s);
border: 1px solid var(--md-sys-color-outline);
}
.time-input {
width: 32px;
background-color: transparent;
color: var(--md-sys-color-on-surface);
border: none;
font-size: 0.875rem;
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;
+6
View File
@@ -0,0 +1,6 @@
{
"versionCode": 2202,
"version": "V2.2",
"zipUrl": "https://share.yule.ink/magisk/mod/luminpro/module/LuminPro_V2.2-2202.zip",
"changelog": "https://share.yule.ink/magisk/mod/luminpro/changelog.md"
}
-1
View File
@@ -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;padLine truncated
+1
View File
@@ -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
+4
View File
@@ -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
-4
View File
@@ -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<a)&&(c=!0):i<a&&r>=i&&r<a&&(c=!0)}document.getElementById(`status-sleep`).textContent=c?`休眠中`:`非休眠`}async function P(){let e=document.getElementById(`log-output`),t=await k(`tail -n 50 "${T}"`);t.errno===0&&t.stdout?e.textContent=t.stdout:e.textContent=`暂无日志或读取失败`,e.scrollTop=e.scrollHeight}async function F(){x({icons:{Sun:b,Settings:y,Save:v,Activity:h,RefreshCw:_,FileText:g}}),document.getElementById(`btn-save`).addEventListener(`click`,M),document.getElementById(`btn-refresh-status`).addEventListener(`click`,N),document.getElementById(`btn-refresh-log`).addEventListener(`click`,P),await j(),await N(),await P()}document.addEventListener(`DOMContentLoaded`,F);
+88 -24
View File
@@ -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-_esaoEhK.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CRYvfSfT.css">
<script type="module" crossorigin src="/assets/index-GvCaVVmw.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DpSbbGTK.css">
</head>
<body>
@@ -34,38 +34,100 @@
<h2>亮度配置</h2>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">前台最大亮度</span>
<span class="config-desc">触发亮度提升的阈值</span>
<!-- 分类: 亮度调节 -->
<div class="config-group">
<h3 class="group-title">亮度调节</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">前台最大亮度</span>
<span class="config-desc">触发亮度提升的阈值</span>
</div>
<div class="config-value">
<input type="number" id="input-ui-max-bri" class="config-input" min="0" />
</div>
</div>
<div class="config-value">
<input type="number" id="input-ui-max-bri" class="config-input" min="0" />
<div class="config-item">
<div class="config-label">
<span class="config-name">峰值最大亮度</span>
<span class="config-desc">亮度提升的目标值</span>
</div>
<div class="config-value">
<input type="number" id="input-max-bri" class="config-input" min="0" />
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">亮度提升步数</span>
<span class="config-desc">约 0.02 秒 / 步</span>
</div>
<div class="config-value">
<input type="number" id="input-steps-num" class="config-input" min="1" max="500" />
</div>
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">峰值最大亮度</span>
<span class="config-desc">亮度提升的目标值</span>
<!-- 分类: 执行策略 -->
<div class="config-group">
<h3 class="group-title">执行策略</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">自动亮度时休眠</span>
<span class="config-desc">开启自动亮度时不提升</span>
</div>
<div class="config-value">
<label class="switch">
<input type="checkbox" id="input-auto-bri-sleep">
<span class="slider"></span>
</label>
</div>
</div>
<div class="config-value">
<input type="number" id="input-max-bri" class="config-input" min="0" />
<div class="config-item">
<div class="config-label">
<span class="config-name">定时休眠</span>
<span class="config-desc">设定时段内不提升亮度</span>
</div>
<div class="config-value">
<label class="switch">
<input type="checkbox" id="input-sleep-mode">
<span class="slider"></span>
</label>
</div>
</div>
<div class="config-item-expand" id="sleep-time-expand">
<div class="custom-time-picker">
<div class="time-unit">
<input type="number" id="input-sleep-start-h" class="time-input" min="0" max="23" placeholder="00" />
<span>:</span>
<input type="number" id="input-sleep-start-m" class="time-input" min="0" max="59" placeholder="00" />
</div>
<span class="time-sep">至</span>
<div class="time-unit">
<input type="number" id="input-sleep-end-h" class="time-input" min="0" max="23" placeholder="00" />
<span>:</span>
<input type="number" id="input-sleep-end-m" class="time-input" min="0" max="59" placeholder="00" />
</div>
</div>
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">休眠时间</span>
<span class="config-desc">该时段内不提升亮度</span>
</div>
<div class="config-value">
<input type="text" id="input-sleep-time" class="config-input config-input-wide"
placeholder="如 1900-0600" />
<!-- 分类: 系统管理 -->
<div class="config-group">
<h3 class="group-title">系统管理</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">日志大小限制</span>
<span class="config-desc">单位: KB</span>
</div>
<div class="config-value">
<input type="number" id="input-log-max-size" class="config-input" min="1" max="10240" />
</div>
</div>
</div>
<div class="card-actions">
<button class="btn btn-outline" id="btn-reset">
恢复默认
</button>
<button class="btn btn-primary" id="btn-save">
<span class="btn-icon"><i data-lucide="save"></i></span> 保存配置
</button>
@@ -77,7 +139,10 @@
<div class="card-header">
<span class="card-icon"><i data-lucide="activity"></i></span>
<h2>实时状态</h2>
<button class="btn-icon-only" id="btn-refresh-status" title="刷新"><i data-lucide="refresh-cw"></i></button>
<div class="header-actions">
<button class="btn-text-s" id="btn-toggle-service">暂停</button>
<button class="btn-text-s" id="btn-restart-service">重启</button>
</div>
</div>
<div class="status-grid">
@@ -105,7 +170,6 @@
<div class="card-header">
<span class="card-icon"><i data-lucide="file-text"></i></span>
<h2>运行日志</h2>
<button class="btn-icon-only" id="btn-refresh-log" title="刷新"><i data-lucide="refresh-cw"></i></button>
</div>
<pre class="log-output" id="log-output">加载中...</pre>
</section>