mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
Compare commits
No files matched your search
+5
-1
@@ -2,4 +2,8 @@ node_modules/
|
||||
dist/
|
||||
.vite/
|
||||
*.log
|
||||
*.zip
|
||||
*.zip
|
||||
|
||||
# 屏蔽 webroot 下的所有文件,但保留目录本身
|
||||
webroot/*
|
||||
!webroot/.gitkeep
|
||||
@@ -0,0 +1,49 @@
|
||||
#!/system/bin/sh
|
||||
#shellcheck shell=ash
|
||||
|
||||
# LuminPro 手动提升/恢复亮度触发脚本
|
||||
|
||||
# 解析模块工作目录
|
||||
MODDIR="$(dirname "$(readlink -f "$0")")"
|
||||
CONFIG_DIR="$MODDIR/config"
|
||||
PATH_CONFIG_DIR="$CONFIG_DIR/path"
|
||||
PID_DIR="$MODDIR/pid"
|
||||
BOOST_FLAG="$PID_DIR/boost.flag"
|
||||
|
||||
# 默认设备路径
|
||||
DEFAULT_NOW_BRI_FILE="/sys/class/backlight/panel0-backlight/brightness"
|
||||
|
||||
# 读取配置的路径,如果不存在则回退至默认值
|
||||
if [ -f "$PATH_CONFIG_DIR/now_bri_file.txt" ]; then
|
||||
now_bri_file="$(cat "$PATH_CONFIG_DIR/now_bri_file.txt" 2>/dev/null | tr -d ' \n')"
|
||||
fi
|
||||
[ -z "$now_bri_file" ] && now_bri_file="$DEFAULT_NOW_BRI_FILE"
|
||||
|
||||
# 确保节点存在
|
||||
if [ ! -f "$now_bri_file" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "$BOOST_FLAG" ]; then
|
||||
restore_bri="$(cat "$BOOST_FLAG" 2>/dev/null | tr -d ' \n')"
|
||||
if [ -n "$restore_bri" ]; then
|
||||
echo -n "$restore_bri" >"$now_bri_file" 2>/dev/null
|
||||
fi
|
||||
rm -f "$BOOST_FLAG"
|
||||
else
|
||||
max_bri="$(cat "$CONFIG_DIR/max_bri.txt" 2>/dev/null | tr -d ' \n')"
|
||||
if [ -z "$max_bri" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 读取当前亮度并存档
|
||||
now_bri="$(cat "$now_bri_file" 2>/dev/null | tr -d ' \n')"
|
||||
|
||||
mkdir -p "$PID_DIR"
|
||||
echo -n "$now_bri" >"$BOOST_FLAG"
|
||||
|
||||
# 执行写入将亮度设定为峰值极限
|
||||
echo -n "$max_bri" >"$now_bri_file" 2>/dev/null
|
||||
fi
|
||||
|
||||
exit 0
|
||||
+1
-4
@@ -37,15 +37,12 @@ const excludes = [
|
||||
'package-lock.json',
|
||||
'package.json',
|
||||
'pnpm-lock.yaml',
|
||||
'vite.config.js',
|
||||
'src',
|
||||
'public',
|
||||
'.vscode',
|
||||
'.git',
|
||||
'.gitignore',
|
||||
'build.ps1',
|
||||
'build-module.js',
|
||||
'index.html', // 根目录的 html 已构建至 webroot
|
||||
'webui', // webui 目录已经构建到 webroot
|
||||
zipName
|
||||
];
|
||||
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
## V2.2-2204
|
||||
- 新增: `boost.sh` 脚本,支持一键将亮度提升至峰值极限
|
||||
- 新增: 对于部分设备,支持在刷入时建议更改配置文件以适配
|
||||
- 新增: inotifyd 的进程守护脚本,确保 inotifyd 进程的稳定性
|
||||
- 新增: 支持自定义亮度文件设备路径
|
||||
- 新增: 支持自定义 inotifyd 监测的事件
|
||||
- 优化: Web UI 页面外观优化
|
||||
- 优化: Web UI 的亮度刷新机制,优化性能
|
||||
- 优化: 进程抢占机制,避免同时运行多个提升亮度的进程
|
||||
- 修复: 刷入脚本中的配置继承问题
|
||||
|
||||
## V2.2-2202
|
||||
|
||||
### 核心逻辑
|
||||
- 新增: `action.sh` 支持模块管理器“操作”按钮点击快速切换开关状态
|
||||
- 新增: `stop.flag` 机制,支持在不重启服务的情况下拦截亮度提升逻辑
|
||||
- 重构: `up.sh` 逻辑,支持日志内容比对刷新及文件大小自动截断
|
||||
- 新增: 支持自动亮度休眠;支持自定义调整步数
|
||||
- 新增: `restart.sh` 脚本,实现 PID 清理、Flag 重置及服务重启的原子化操作。
|
||||
- 修复: 2.1 版本中,反复重启 inotifyd 造成的卡死问题
|
||||
- 完善 `customize.sh` 的迁移逻辑,支持从 2101 版本自动补全缺失配置及备份目录
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1 @@
|
||||
512
|
||||
Whitespace-only changes.
@@ -0,0 +1 @@
|
||||
/sys/class/backlight/panel0-backlight/max_brightness
|
||||
@@ -0,0 +1 @@
|
||||
/sys/class/backlight/panel0-backlight/brightness
|
||||
Whitespace-only changes.
@@ -0,0 +1 @@
|
||||
50
|
||||
Whitespace-only changes.
+230
-63
@@ -1,13 +1,106 @@
|
||||
#!/system/bin/sh
|
||||
#shellcheck shell=ash
|
||||
|
||||
now_bri_file="/sys/class/backlight/panel0-backlight/brightness"
|
||||
max_bri_file="/sys/class/backlight/panel0-backlight/max_brightness"
|
||||
# 默认设备路径(如果路径配置不存在)
|
||||
DEFAULT_NOW_BRI_FILE="/sys/class/backlight/panel0-backlight/brightness"
|
||||
DEFAULT_MAX_BRI_FILE="/sys/class/backlight/panel0-backlight/max_brightness"
|
||||
|
||||
mod_config="$MODPATH/config"
|
||||
mod_path_config="$mod_config/path"
|
||||
old_config="/data/adb/modules/LuminPro/config"
|
||||
old_path_config="/data/adb/modules/LuminPro/config/path"
|
||||
|
||||
# 创建配置目录
|
||||
[ -d "$mod_config" ] || mkdir -p "$mod_config"
|
||||
[ -d "$mod_path_config" ] || mkdir -p "$mod_path_config"
|
||||
|
||||
# ==========================
|
||||
# 配置读取函数
|
||||
# ==========================
|
||||
# 优先读取旧配置,其次读取默认配置
|
||||
get_config_value() {
|
||||
local config_name="$1"
|
||||
local old_file="$old_config/$config_name"
|
||||
local new_file="$mod_config/$config_name"
|
||||
local default_value="$2"
|
||||
|
||||
# 1. 检查旧配置是否存在且非空
|
||||
if [ -f "$old_file" ]; then
|
||||
local old_val
|
||||
old_val="$(cat "$old_file" 2>/dev/null | tr -d ' \n')"
|
||||
if [ -n "$old_val" ]; then
|
||||
echo "$old_val"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# 2. 检查默认配置是否存在且非空
|
||||
if [ -f "$new_file" ]; then
|
||||
local new_val
|
||||
new_val="$(cat "$new_file" 2>/dev/null | tr -d ' \n')"
|
||||
if [ -n "$new_val" ]; then
|
||||
echo "$new_val"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# 3. 返回默认值
|
||||
echo "$default_value"
|
||||
}
|
||||
|
||||
# 获取设备路径函数(与 get_config_value 相同逻辑)
|
||||
get_device_path() {
|
||||
local config_name="$1"
|
||||
local default_path="$2"
|
||||
get_config_value "$config_name" "$default_path"
|
||||
}
|
||||
|
||||
# 初始化全局变量(优先读取旧配置,其次读取默认值)
|
||||
now_bri_file="$(get_device_path "path/now_bri_file.txt" "$DEFAULT_NOW_BRI_FILE")"
|
||||
max_bri_file="$(get_device_path "path/max_bri_file.txt" "$DEFAULT_MAX_BRI_FILE")"
|
||||
|
||||
# 检查亮度节点文件
|
||||
CHECK_FILES() {
|
||||
sleep 1
|
||||
|
||||
echo ""
|
||||
echo "[*] 正在验证设备亮度节点..."
|
||||
echo ""
|
||||
|
||||
# 验证路径是否存在
|
||||
echo "- 当前亮度节点: $now_bri_file"
|
||||
echo "- 最大亮度节点: $max_bri_file"
|
||||
echo ""
|
||||
|
||||
if [ -f "$now_bri_file" ] && [ -f "$max_bri_file" ]; then
|
||||
echo "[OK] 找到亮度节点文件"
|
||||
else
|
||||
echo "[X] 未找到亮度节点文件"
|
||||
if [ ! -f "$now_bri_file" ]; then
|
||||
echo " - 当前亮度节点不存在: $now_bri_file"
|
||||
fi
|
||||
if [ ! -f "$max_bri_file" ]; then
|
||||
echo " - 最大亮度节点不存在: $max_bri_file"
|
||||
fi
|
||||
echo ""
|
||||
echo "设备不支持默认路径,需要修改配置"
|
||||
echo "修改方法:"
|
||||
echo " 1. 编辑压缩包内的 config/path/now_bri_file.txt"
|
||||
echo " 2. 编辑压缩包内的 config/path/max_bri_file.txt"
|
||||
echo " 3. 添加你设备的正确亮度节点路径"
|
||||
echo " 4. 重新打包并刷入模块"
|
||||
echo ""
|
||||
echo "查找路径的方法:"
|
||||
echo " find /sys -name '*brightness*' 2>/dev/null | grep -E '(brightness|lcd)'"
|
||||
abort "[X] 安装中止:无法找到设备亮度节点"
|
||||
fi
|
||||
|
||||
now_bri="$(cat "$now_bri_file")"
|
||||
max_bri_sys="$(cat "$max_bri_file")"
|
||||
|
||||
echo "[OK] 当前亮度: $now_bri"
|
||||
echo "[OK] 系统最大亮度: $max_bri_sys"
|
||||
}
|
||||
|
||||
# 监听音量键函数
|
||||
button_listener() {
|
||||
@@ -29,59 +122,42 @@ button_listener() {
|
||||
SHOW_CHANGELOG() {
|
||||
local changelog_file="$MODPATH/changelog.md"
|
||||
if [ -f "$changelog_file" ]; then
|
||||
echo "--------------------------------------"
|
||||
echo "- 本次更新日志:"
|
||||
echo "========================================"
|
||||
echo "[*] 本次更新日志:"
|
||||
# 提取第一个二级标题及其内容,直到遇到下一个二级标题或文件结束
|
||||
# 使用更具兼容性的 awk 逻辑
|
||||
awk '/^## / { if (p) exit; p=1; print; next } p { print }' "$changelog_file"
|
||||
echo "--------------------------------------"
|
||||
echo "========================================"
|
||||
fi
|
||||
}
|
||||
|
||||
NOTE() {
|
||||
cat "$MODPATH/NOTE.txt"
|
||||
echo ""
|
||||
echo "* 按音量 + 进入下一步, 按音量 - 退出"
|
||||
echo "* 继续则表明你已理解并接受所有风险"
|
||||
echo "[i] 按音量 + 进入下一步, 按音量 - 退出"
|
||||
echo "[i] 继续则表明你已理解并接受所有风险"
|
||||
|
||||
if [ "$(button_listener)" = "0" ]; then
|
||||
echo "- 已确认进入下一步"
|
||||
echo "[OK] 已确认进入下一步"
|
||||
else
|
||||
abort "- 已退出"
|
||||
abort "[X] 已退出"
|
||||
fi
|
||||
}
|
||||
|
||||
# 检查亮度节点文件
|
||||
CHECK_FILES() {
|
||||
sleep 1
|
||||
if [ -f "$now_bri_file" ] && [ -f "$max_bri_file" ]; then
|
||||
echo "- 找到亮度节点文件"
|
||||
else
|
||||
echo "x 未找到亮度节点文件"
|
||||
abort "x 暂不支持您的设备"
|
||||
fi
|
||||
|
||||
now_bri="$(cat "$now_bri_file")"
|
||||
max_bri="$(cat "$max_bri_file")"
|
||||
|
||||
echo "- 当前亮度: $now_bri"
|
||||
echo "- 最大亮度: $max_bri"
|
||||
}
|
||||
|
||||
# 测试前台最大亮度
|
||||
TEST_UI_MAX_BRI() {
|
||||
echo ""
|
||||
echo "- 开始测试前台最大亮度"
|
||||
echo "[*] 开始测试前台最大亮度"
|
||||
echo ""
|
||||
|
||||
sleep 1
|
||||
echo "******** 请关闭自动亮度 ********"
|
||||
echo "* 按音量 + 进入下一步, 按音量 - 退出"
|
||||
echo "======== 请关闭自动亮度 ========"
|
||||
echo "[i] 按音量 + 进入下一步, 按音量 - 退出"
|
||||
|
||||
if [ "$(button_listener)" = "0" ]; then
|
||||
echo "- 已确认进入下一步"
|
||||
echo "[OK] 已确认进入下一步"
|
||||
else
|
||||
abort "- 已退出"
|
||||
abort "[X] 已退出"
|
||||
fi
|
||||
|
||||
# 调整亮度前, 记录当前亮度用于之后恢复
|
||||
@@ -89,27 +165,33 @@ TEST_UI_MAX_BRI() {
|
||||
echo ""
|
||||
|
||||
sleep 1
|
||||
echo "******** 请将屏幕亮度调至最大 ********"
|
||||
echo "* 按音量 + 进入下一步, 按音量 - 退出"
|
||||
echo "======== 请将屏幕亮度调至最大 ========"
|
||||
echo "[i] 按音量 + 进入下一步, 按音量 - 退出"
|
||||
|
||||
if [ "$(button_listener)" = "0" ]; then
|
||||
echo "- 已确认进入下一步"
|
||||
echo "[OK] 已确认进入下一步"
|
||||
else
|
||||
abort "- 已退出"
|
||||
abort "[X] 已退出"
|
||||
fi
|
||||
|
||||
ui_max_bri="$(cat "$now_bri_file")"
|
||||
echo "- 前台最大亮度: [ $ui_max_bri ]"
|
||||
echo "[OK] 前台最大亮度: [ $ui_max_bri ]"
|
||||
|
||||
# 保存到旧配置和新配置
|
||||
echo -n "$ui_max_bri" >"$old_config/ui_max_bri.txt"
|
||||
echo -n "$ui_max_bri" >"$mod_config/ui_max_bri.txt"
|
||||
|
||||
echo ""
|
||||
echo "- 峰值最大亮度由节点文件获得: [ $max_bri ]"
|
||||
echo "- 若不符合预期, 请稍后到配置文件或 Web UI 更改"
|
||||
echo -n "$max_bri" >"$mod_config/max_bri.txt"
|
||||
echo "[i] 峰值最大亮度由节点文件获得: [ $max_bri_sys ]"
|
||||
echo "[i] 若不符合预期, 请稍后到配置文件或 Web UI 更改"
|
||||
|
||||
# 保存到旧配置和新配置
|
||||
echo -n "$max_bri_sys" >"$old_config/max_bri.txt"
|
||||
echo -n "$max_bri_sys" >"$mod_config/max_bri.txt"
|
||||
|
||||
echo ""
|
||||
echo "- 测试完成"
|
||||
echo "- 正在为你恢复亮度..."
|
||||
echo "[OK] 测试完成"
|
||||
echo "[*] 正在为你恢复亮度..."
|
||||
echo -n "$restore_bri" >"$now_bri_file"
|
||||
}
|
||||
|
||||
@@ -117,15 +199,53 @@ TEST_UI_MAX_BRI() {
|
||||
END() {
|
||||
echo ""
|
||||
sleep 1
|
||||
echo "******** 模块策略:"
|
||||
echo "- 当亮度达到 [ $(cat "$mod_config/ui_max_bri.txt") ] 时, 自动提升至 [ $(cat "$mod_config/max_bri.txt") ]"
|
||||
echo "- 配置目录: /data/adb/modules/LuminPro/config"
|
||||
echo "- 也可以使用 Web UI 进行配置"
|
||||
|
||||
# 读取最终配置
|
||||
local final_max_bri
|
||||
local final_ui_max_bri
|
||||
final_max_bri="$(get_config_value "max_bri.txt" "")"
|
||||
final_ui_max_bri="$(get_config_value "ui_max_bri.txt" "")"
|
||||
|
||||
# 检查是否需要重新测试
|
||||
if [ -z "$final_max_bri" ] || [ -z "$final_ui_max_bri" ]; then
|
||||
echo ""
|
||||
echo "[!] ======== 配置不完整 ========"
|
||||
if [ -z "$final_max_bri" ]; then
|
||||
echo "[X] 峰值最大亮度: 未配置"
|
||||
else
|
||||
echo "[OK] 峰值最大亮度: $final_max_bri"
|
||||
fi
|
||||
if [ -z "$final_ui_max_bri" ]; then
|
||||
echo "[X] 前台最大亮度: 未配置"
|
||||
else
|
||||
echo "[OK] 前台最大亮度: $final_ui_max_bri"
|
||||
fi
|
||||
echo ""
|
||||
echo "[!] 检测到配置缺失,需要重新进行亮度测试。"
|
||||
echo "[i] 请在模块安装后的重启后,通过以下方式补全配置:"
|
||||
echo " 1. 使用 Web UI 手工输入"
|
||||
echo " 2. 编辑配置文件: /data/adb/modules/LuminPro/config/"
|
||||
echo " 3. 重新刷入新的压缩包(会重新运行此脚本)"
|
||||
echo ""
|
||||
echo "[i] 或按音量 + 现在进行测试, 按音量 - 跳过"
|
||||
if [ "$(button_listener)" = "0" ]; then
|
||||
echo "[*] 正在进行测试..."
|
||||
TEST_UI_MAX_BRI
|
||||
final_max_bri="$(get_config_value "max_bri.txt" "")"
|
||||
final_ui_max_bri="$(get_config_value "ui_max_bri.txt" "")"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "* 模块已刷入, 请重启手机"
|
||||
echo "- 感谢您的使用"
|
||||
echo "- 作者: 酷安 @于乐yule"
|
||||
echo "======== 模块策略 ========"
|
||||
echo "[*] 当亮度达到 [ $final_ui_max_bri ] 时,自动提升至 [ $final_max_bri ]"
|
||||
echo "[i] 配置目录: /data/adb/modules/LuminPro/config"
|
||||
echo "[i] 也可以使用 Web UI 进行配置"
|
||||
|
||||
echo ""
|
||||
echo "[OK] 模块已刷入,请重启手机"
|
||||
echo "[i] 感谢您的使用"
|
||||
echo "[i] 作者: 酷安 @于乐yule"
|
||||
echo ""
|
||||
|
||||
sleep 1
|
||||
@@ -140,38 +260,53 @@ IMPORT_OLD_CONFIG() {
|
||||
|
||||
echo ""
|
||||
sleep 1
|
||||
echo "- 检测到已有配置:"
|
||||
echo " - 前台最大亮度: $(cat "$old_config/ui_max_bri.txt")"
|
||||
echo " - 峰值最大亮度: $(cat "$old_config/max_bri.txt")"
|
||||
echo "[i] 检测到已有配置:"
|
||||
echo " - 前台最大亮度: $(cat "$old_config/ui_max_bri.txt")"
|
||||
echo " - 峰值最大亮度: $(cat "$old_config/max_bri.txt")"
|
||||
if [ -s "$old_config/sleep_time.txt" ]; then
|
||||
echo " - 休眠时间: $(cat "$old_config/sleep_time.txt")"
|
||||
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/关闭/')"
|
||||
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")"
|
||||
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"
|
||||
echo " - 日志大小限制: $(cat "$old_config/log_max_size.txt") KB"
|
||||
fi
|
||||
echo ""
|
||||
echo "* 按音量 + 沿用旧配置, 按音量 - 重新测试"
|
||||
echo "[?] 按音量 + 沿用旧配置, 按音量 - 重新测试"
|
||||
|
||||
if [ "$(button_listener)" = "0" ]; then
|
||||
echo "- 已沿用旧配置"
|
||||
echo "[OK] 已沿用旧配置"
|
||||
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/"
|
||||
if [ -e "$old_config/sleep_time.txt" ]; then
|
||||
cp -f "$old_config/sleep_time.txt" "$mod_config/"
|
||||
else
|
||||
touch "$mod_config/sleep_time.txt"
|
||||
fi
|
||||
[ -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/"
|
||||
|
||||
# 迁移旧的路径配置(如果存在)
|
||||
mkdir -p "$mod_path_config"
|
||||
if [ -d "$old_path_config" ]; then
|
||||
[ -s "$old_path_config/now_bri_file.txt" ] && cp -f "$old_path_config/now_bri_file.txt" "$mod_path_config/"
|
||||
[ -s "$old_path_config/max_bri_file.txt" ] && cp -f "$old_path_config/max_bri_file.txt" "$mod_path_config/"
|
||||
else
|
||||
# 创建默认路径配置
|
||||
echo -n "$DEFAULT_NOW_BRI_FILE" >"$mod_path_config/now_bri_file.txt"
|
||||
echo -n "$DEFAULT_MAX_BRI_FILE" >"$mod_path_config/max_bri_file.txt"
|
||||
fi
|
||||
|
||||
# 版本迁移逻辑
|
||||
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 版本升级, 正在补全备份目录..."
|
||||
echo "[i] 检测到从 2101 版本升级,正在补全备份目录..."
|
||||
mkdir -p "$mod_config/.backup"
|
||||
cp -f "$mod_config/"*.txt "$mod_config/.backup/" 2>/dev/null
|
||||
else
|
||||
@@ -181,7 +316,7 @@ IMPORT_OLD_CONFIG() {
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
echo "- 将重新测试"
|
||||
echo "[*] 将重新测试"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
@@ -191,18 +326,49 @@ IMPORT_OLD_CONFIG() {
|
||||
# 初始化默认配置文件
|
||||
INIT_CONFIG() {
|
||||
mkdir -p "$mod_config"
|
||||
touch "$mod_config/ui_max_bri.txt"
|
||||
touch "$mod_config/max_bri.txt"
|
||||
mkdir -p "$mod_path_config"
|
||||
|
||||
# 仅在文件不存在时才创建,保留任何已存在的配置
|
||||
[ ! -f "$mod_config/ui_max_bri.txt" ] && touch "$mod_config/ui_max_bri.txt"
|
||||
[ ! -f "$mod_config/max_bri.txt" ] && touch "$mod_config/max_bri.txt"
|
||||
[ ! -f "$mod_config/sleep_time.txt" ] && touch "$mod_config/sleep_time.txt"
|
||||
[ ! -f "$mod_config/auto_bri_sleep.txt" ] && touch "$mod_config/auto_bri_sleep.txt"
|
||||
[ ! -f "$mod_config/steps_num.txt" ] && touch "$mod_config/steps_num.txt"
|
||||
[ ! -f "$mod_config/log_max_size.txt" ] && touch "$mod_config/log_max_size.txt"
|
||||
|
||||
# 初始化设备路径配置 (仅在文件不存在时使用默认值,保留用户自定义配置)
|
||||
[ ! -f "$mod_path_config/now_bri_file.txt" ] && echo -n "$DEFAULT_NOW_BRI_FILE" >"$mod_path_config/now_bri_file.txt"
|
||||
[ ! -f "$mod_path_config/max_bri_file.txt" ] && echo -n "$DEFAULT_MAX_BRI_FILE" >"$mod_path_config/max_bri_file.txt"
|
||||
}
|
||||
|
||||
# 补全缺失设置并设定默认值
|
||||
ENSURE_DEFAULTS() {
|
||||
[ ! -s "$mod_config/sleep_time.txt" ] && echo "1900-0600" >"$mod_config/sleep_time.txt"
|
||||
[ ! -f "$mod_config/sleep_time.txt" ] && touch "$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"
|
||||
}
|
||||
|
||||
# 机型兼容性校验
|
||||
CHECK_DEVICE_COMPATIBILITY() {
|
||||
local model prefix
|
||||
model="$(getprop ro.product.model)"
|
||||
prefix="$(echo "$model" | cut -c 1-9)"
|
||||
|
||||
if [ "$prefix" = "25128PNA1" ] || [ "$prefix" = "2512BPNDA" ]; then
|
||||
echo ""
|
||||
echo "[!] 您可能是 Xiaomi 17 Ultra 用户,建议您使用 '0' 事件作为监测对象,否则模块可能不生效"
|
||||
echo "[?] 是否将 inotifyd 监测事件修改为 '0'? (按音量 + 确认,按音量 - 跳过)"
|
||||
if [ "$(button_listener)" = "0" ]; then
|
||||
echo -n "0" >"$mod_config/inotify_events.txt"
|
||||
echo "[OK] 已设置为 0 事件监测"
|
||||
else
|
||||
echo "[*] 已跳过配置更改"
|
||||
fi
|
||||
sleep 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 创建备份 (用于 WebUI 恢复默认)
|
||||
CREATE_BACKUP() {
|
||||
mkdir -p "$mod_config/.backup"
|
||||
@@ -224,6 +390,7 @@ MAIN() {
|
||||
TEST_UI_MAX_BRI
|
||||
fi
|
||||
ENSURE_DEFAULTS
|
||||
CHECK_DEVICE_COMPATIBILITY
|
||||
CREATE_BACKUP
|
||||
END
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
id=LuminPro
|
||||
name=LuminPro丨日用屏幕亮度强化
|
||||
version=V2.2
|
||||
versionCode=2202
|
||||
versionCode=2204
|
||||
author=酷安@Yule
|
||||
description=本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果
|
||||
updateJson=https://share.yule.ink/magisk/mod/luminpro/update.json
|
||||
Generated
-881
@@ -1,881 +0,0 @@
|
||||
{
|
||||
"name": "luminpro-webui",
|
||||
"version": "2.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "luminpro-webui",
|
||||
"version": "2.1.0",
|
||||
"devDependencies": {
|
||||
"kernelsu": "^3.0.2",
|
||||
"vite": "^8.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/core": {
|
||||
"version": "1.9.2",
|
||||
"resolved": "https://registry.npmmirror.com/@emnapi/core/-/core-1.9.2.tgz",
|
||||
"integrity": "sha512-UC+ZhH3XtczQYfOlu3lNEkdW/p4dsJ1r/bP7H8+rhao3TTTMO1ATq/4DdIi23XuGoFY+Cz0JmCbdVl0hz9jZcA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@emnapi/wasi-threads": "1.2.1",
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/runtime": {
|
||||
"version": "1.9.2",
|
||||
"resolved": "https://registry.npmmirror.com/@emnapi/runtime/-/runtime-1.9.2.tgz",
|
||||
"integrity": "sha512-3U4+MIWHImeyu1wnmVygh5WlgfYDtyf0k8AbLhMFxOipihf6nrWC4syIm/SwEeec0mNSafiiNnMJwbza/Is6Lw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@emnapi/wasi-threads": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
|
||||
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@napi-rs/wasm-runtime": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.2.tgz",
|
||||
"integrity": "sha512-sNXv5oLJ7ob93xkZ1XnxisYhGYXfaG9f65/ZgYuAu3qt7b3NadcOEhLvx28hv31PgX8SZJRYrAIPQilQmFpLVw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@tybys/wasm-util": "^0.10.1"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/Brooooooklyn"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@emnapi/core": "^1.7.1",
|
||||
"@emnapi/runtime": "^1.7.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@oxc-project/types": {
|
||||
"version": "0.122.0",
|
||||
"resolved": "https://registry.npmmirror.com/@oxc-project/types/-/types-0.122.0.tgz",
|
||||
"integrity": "sha512-oLAl5kBpV4w69UtFZ9xqcmTi+GENWOcPF7FCrczTiBbmC0ibXxCwyvZGbO39rCVEuLGAZM84DH0pUIyyv/YJzA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/Boshen"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-android-arm64": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-pv1y2Fv0JybcykuiiD3qBOBdz6RteYojRFY1d+b95WVuzx211CRh+ytI/+9iVyWQ6koTh5dawe4S/yRfOFjgaA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-darwin-arm64": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-cFYr6zTG/3PXXF3pUO+umXxt1wkRK/0AYT8lDwuqvRC+LuKYWSAQAQZjCWDQpAH172ZV6ieYrNnFzVVcnSflAg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-darwin-x64": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-ZCsYknnHzeXYps0lGBz8JrF37GpE9bFVefrlmDrAQhOEi4IOIlcoU1+FwHEtyXGx2VkYAvhu7dyBf75EJQffBw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-freebsd-x64": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-dMLeprcVsyJsKolRXyoTH3NL6qtsT0Y2xeuEA8WQJquWFXkEC4bcu1rLZZSnZRMtAqwtrF/Ib9Ddtpa/Gkge9Q==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm-gnueabihf": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-YqWjAgGC/9M1lz3GR1r1rP79nMgo3mQiiA+Hfo+pvKFK1fAJ1bCi0ZQVh8noOqNacuY1qIcfyVfP6HoyBRZ85Q==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm64-gnu": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-/I5AS4cIroLpslsmzXfwbe5OmWvSsrFuEw3mwvbQ1kDxJ822hFHIx+vsN/TAzNVyepI/j/GSzrtCIwQPeKCLIg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm64-musl": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-V6/wZztnBqlx5hJQqNWwFdxIKN0m38p8Jas+VoSfgH54HSj9tKTt1dZvG6JRHcjh6D7TvrJPWFGaY9UBVOaWPw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-ppc64-gnu": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-AP3E9BpcUYliZCxa3w5Kwj9OtEVDYK6sVoUzy4vTOJsjPOgdaJZKFmN4oOlX0Wp0RPV2ETfmIra9x1xuayFB7g==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-s390x-gnu": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-nWwpvUSPkoFmZo0kQazZYOrT7J5DGOJ/+QHHzjvNlooDZED8oH82Yg67HvehPPLAg5fUff7TfWFHQS8IV1n3og==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-x64-gnu": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-RNrafz5bcwRy+O9e6P8Z/OCAJW/A+qtBczIqVYwTs14pf4iV1/+eKEjdOUta93q2TsT/FI0XYDP3TCky38LMAg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-x64-musl": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-Jpw/0iwoKWx3LJ2rc1yjFrj+T7iHZn2JDg1Yny1ma0luviFS4mhAIcd1LFNxK3EYu3DHWCps0ydXQ5i/rrJ2ig==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-openharmony-arm64": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-vRugONE4yMfVn0+7lUKdKvN4D5YusEiPilaoO2sgUWpCvrncvWgPMzK00ZFFJuiPgLwgFNP5eSiUlv2tfc+lpA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openharmony"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-wasm32-wasi": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-ykGiLr/6kkiHc0XnBfmFJuCjr5ZYKKofkx+chJWDjitX+KsJuAmrzWhwyOMSHzPhzOHOy7u9HlFoa5MoAOJ/Zg==",
|
||||
"cpu": [
|
||||
"wasm32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@napi-rs/wasm-runtime": "^1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-win32-arm64-msvc": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-5eOND4duWkwx1AzCxadcOrNeighiLwMInEADT0YM7xeEOOFcovWZCq8dadXgcRHSf3Ulh1kFo/qvzoFiCLOL1Q==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-win32-x64-msvc": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-PyqoipaswDLAZtot351MLhrlrh6lcZPo2LSYE+VDxbVk24LVKAGOuE4hb8xZQmrPAuEtTZW8E6D2zc5EUZX4Lw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/pluginutils": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-HHMwmarRKvoFsJorqYlFeFRzXZqCt2ETQlEDOb9aqssrnVBB1/+xgTGtuTrIk5vzLNX1MjMtTf7W9z3tsSbrxw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@tybys/wasm-util": {
|
||||
"version": "0.10.1",
|
||||
"resolved": "https://registry.npmmirror.com/@tybys/wasm-util/-/wasm-util-0.10.1.tgz",
|
||||
"integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"tslib": "^2.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/detect-libc": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.1.2.tgz",
|
||||
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/fdir": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmmirror.com/fdir/-/fdir-6.5.0.tgz",
|
||||
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"picomatch": "^3 || ^4"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"picomatch": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/kernelsu": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmmirror.com/kernelsu/-/kernelsu-3.0.2.tgz",
|
||||
"integrity": "sha512-3MTGgIbl3TWCzqnJP6Fun9tHv6VULR3O188U3raeGRSMzK+G3pldL9ySwaZWhsHCtI2BTvlQuu/3p10s4a5c3w==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/lightningcss": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss/-/lightningcss-1.32.0.tgz",
|
||||
"integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==",
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
"detect-libc": "^2.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"lightningcss-android-arm64": "1.32.0",
|
||||
"lightningcss-darwin-arm64": "1.32.0",
|
||||
"lightningcss-darwin-x64": "1.32.0",
|
||||
"lightningcss-freebsd-x64": "1.32.0",
|
||||
"lightningcss-linux-arm-gnueabihf": "1.32.0",
|
||||
"lightningcss-linux-arm64-gnu": "1.32.0",
|
||||
"lightningcss-linux-arm64-musl": "1.32.0",
|
||||
"lightningcss-linux-x64-gnu": "1.32.0",
|
||||
"lightningcss-linux-x64-musl": "1.32.0",
|
||||
"lightningcss-win32-arm64-msvc": "1.32.0",
|
||||
"lightningcss-win32-x64-msvc": "1.32.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-android-arm64": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz",
|
||||
"integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-darwin-arm64": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz",
|
||||
"integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-darwin-x64": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz",
|
||||
"integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-freebsd-x64": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz",
|
||||
"integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm-gnueabihf": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz",
|
||||
"integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm64-gnu": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz",
|
||||
"integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm64-musl": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz",
|
||||
"integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-x64-gnu": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz",
|
||||
"integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-x64-musl": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz",
|
||||
"integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-win32-arm64-msvc": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz",
|
||||
"integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-win32-x64-msvc": {
|
||||
"version": "1.32.0",
|
||||
"resolved": "https://registry.npmmirror.com/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz",
|
||||
"integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.11",
|
||||
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.11.tgz",
|
||||
"integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz",
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/picomatch": {
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-4.0.4.tgz",
|
||||
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.8",
|
||||
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.8.tgz",
|
||||
"integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.11",
|
||||
"picocolors": "^1.1.1",
|
||||
"source-map-js": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/rolldown": {
|
||||
"version": "1.0.0-rc.12",
|
||||
"resolved": "https://registry.npmmirror.com/rolldown/-/rolldown-1.0.0-rc.12.tgz",
|
||||
"integrity": "sha512-yP4USLIMYrwpPHEFB5JGH1uxhcslv6/hL0OyvTuY+3qlOSJvZ7ntYnoWpehBxufkgN0cvXxppuTu5hHa/zPh+A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@oxc-project/types": "=0.122.0",
|
||||
"@rolldown/pluginutils": "1.0.0-rc.12"
|
||||
},
|
||||
"bin": {
|
||||
"rolldown": "bin/cli.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rolldown/binding-android-arm64": "1.0.0-rc.12",
|
||||
"@rolldown/binding-darwin-arm64": "1.0.0-rc.12",
|
||||
"@rolldown/binding-darwin-x64": "1.0.0-rc.12",
|
||||
"@rolldown/binding-freebsd-x64": "1.0.0-rc.12",
|
||||
"@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.12",
|
||||
"@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.12",
|
||||
"@rolldown/binding-linux-arm64-musl": "1.0.0-rc.12",
|
||||
"@rolldown/binding-linux-ppc64-gnu": "1.0.0-rc.12",
|
||||
"@rolldown/binding-linux-s390x-gnu": "1.0.0-rc.12",
|
||||
"@rolldown/binding-linux-x64-gnu": "1.0.0-rc.12",
|
||||
"@rolldown/binding-linux-x64-musl": "1.0.0-rc.12",
|
||||
"@rolldown/binding-openharmony-arm64": "1.0.0-rc.12",
|
||||
"@rolldown/binding-wasm32-wasi": "1.0.0-rc.12",
|
||||
"@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.12",
|
||||
"@rolldown/binding-win32-x64-msvc": "1.0.0-rc.12"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tinyglobby": {
|
||||
"version": "0.2.15",
|
||||
"resolved": "https://registry.npmmirror.com/tinyglobby/-/tinyglobby-0.2.15.tgz",
|
||||
"integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fdir": "^6.5.0",
|
||||
"picomatch": "^4.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/SuperchupuDev"
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"dev": true,
|
||||
"license": "0BSD",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "8.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/vite/-/vite-8.0.3.tgz",
|
||||
"integrity": "sha512-B9ifbFudT1TFhfltfaIPgjo9Z3mDynBTJSUYxTjOQruf/zHH+ezCQKcoqO+h7a9Pw9Nm/OtlXAiGT1axBgwqrQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lightningcss": "^1.32.0",
|
||||
"picomatch": "^4.0.4",
|
||||
"postcss": "^8.5.8",
|
||||
"rolldown": "1.0.0-rc.12",
|
||||
"tinyglobby": "^0.2.15"
|
||||
},
|
||||
"bin": {
|
||||
"vite": "bin/vite.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/vitejs/vite?sponsor=1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "^20.19.0 || >=22.12.0",
|
||||
"@vitejs/devtools": "^0.1.0",
|
||||
"esbuild": "^0.27.0",
|
||||
"jiti": ">=1.21.0",
|
||||
"less": "^4.0.0",
|
||||
"sass": "^1.70.0",
|
||||
"sass-embedded": "^1.70.0",
|
||||
"stylus": ">=0.54.8",
|
||||
"sugarss": "^5.0.0",
|
||||
"terser": "^5.16.0",
|
||||
"tsx": "^4.8.1",
|
||||
"yaml": "^2.4.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/node": {
|
||||
"optional": true
|
||||
},
|
||||
"@vitejs/devtools": {
|
||||
"optional": true
|
||||
},
|
||||
"esbuild": {
|
||||
"optional": true
|
||||
},
|
||||
"jiti": {
|
||||
"optional": true
|
||||
},
|
||||
"less": {
|
||||
"optional": true
|
||||
},
|
||||
"sass": {
|
||||
"optional": true
|
||||
},
|
||||
"sass-embedded": {
|
||||
"optional": true
|
||||
},
|
||||
"stylus": {
|
||||
"optional": true
|
||||
},
|
||||
"sugarss": {
|
||||
"optional": true
|
||||
},
|
||||
"terser": {
|
||||
"optional": true
|
||||
},
|
||||
"tsx": {
|
||||
"optional": true
|
||||
},
|
||||
"yaml": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -4,9 +4,9 @@
|
||||
"version": "2.1.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build && node build-module.js",
|
||||
"preview": "vite preview"
|
||||
"dev": "cd webui && vite",
|
||||
"build": "cd webui && vite build && cd .. && node build-module.js",
|
||||
"preview": "cd webui && vite preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"archiver": "^7.0.1",
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
#!/system/bin/sh
|
||||
#shellcheck shell=ash
|
||||
# LuminPro 守护进程
|
||||
|
||||
# 使用 readlink 获取脚本真实绝对路径
|
||||
REAL_PATH="$(readlink -f "$0")"
|
||||
SCRIPT_DIR="$(dirname "$REAL_PATH")"
|
||||
MODDIR="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
PID_DIR="$MODDIR/pid"
|
||||
CONFIG_DIR="$MODDIR/config"
|
||||
PATH_CONFIG_DIR="$CONFIG_DIR/path"
|
||||
pid_file="$PID_DIR/inotifyd.pid"
|
||||
stop_file="$PID_DIR/stop.flag"
|
||||
pause_file="$PID_DIR/daemon.pause"
|
||||
log_file="$MODDIR/service.log"
|
||||
config_cache_file="$PID_DIR/.config_cache"
|
||||
|
||||
# 默认设备路径
|
||||
DEFAULT_NOW_BRI_FILE="/sys/class/backlight/panel0-backlight/brightness"
|
||||
|
||||
# 读取配置函数
|
||||
get_config() {
|
||||
local config_file="$1"
|
||||
local default_value="$2"
|
||||
if [ -f "$config_file" ]; then
|
||||
cat "$config_file"
|
||||
else
|
||||
echo "$default_value"
|
||||
fi
|
||||
}
|
||||
|
||||
# 获取当前配置的哈希值(用于检测配置变化)
|
||||
get_config_hash() {
|
||||
local now_file events
|
||||
now_file="$(get_config "$PATH_CONFIG_DIR/now_bri_file.txt" "$DEFAULT_NOW_BRI_FILE")"
|
||||
events="$(get_config "$CONFIG_DIR/inotify_events.txt" "c")"
|
||||
echo "${now_file}|${events}"
|
||||
}
|
||||
|
||||
# 日志函数
|
||||
_log() {
|
||||
local level="${2:-INFO}"
|
||||
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "daemon" "$level" "$1" >>"$log_file"
|
||||
}
|
||||
|
||||
# 确保环境就绪
|
||||
mkdir -p "$PID_DIR"
|
||||
|
||||
_log "守护进程启动,开始监控配置文件..." "INFO"
|
||||
|
||||
while true; do
|
||||
# 检查是否需要手动停止或暂时挂起
|
||||
if [ -f "$stop_file" ]; then
|
||||
# 全局停止,杀掉现有并等待
|
||||
[ -f "$pid_file" ] && kill -9 "$(cat "$pid_file")" 2>/dev/null
|
||||
rm -f "$pid_file"
|
||||
_log "检测到停止信号,已暂停" "WARN"
|
||||
sleep 5
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -f "$pause_file" ]; then
|
||||
# 暂时挂起(由 up.sh 处理中),杀掉现有并等待
|
||||
[ -f "$pid_file" ] && kill -9 "$(cat "$pid_file")" 2>/dev/null
|
||||
rm -f "$pid_file"
|
||||
sleep 1
|
||||
continue
|
||||
fi
|
||||
|
||||
# 获取当前配置
|
||||
current_config="$(get_config_hash)"
|
||||
|
||||
# 检查配置是否改变
|
||||
if [ -f "$config_cache_file" ]; then
|
||||
cached_config="$(cat "$config_cache_file")"
|
||||
if [ "$current_config" != "$cached_config" ]; then
|
||||
_log "✓ 配置文件已更新,重启监听进程..." "WARN"
|
||||
[ -f "$pid_file" ] && kill -9 "$(cat "$pid_file")" 2>/dev/null
|
||||
rm -f "$pid_file"
|
||||
echo "$current_config" >"$config_cache_file"
|
||||
sleep 1
|
||||
continue
|
||||
fi
|
||||
else
|
||||
# 第一次启动或缓存不存在,保存当前配置
|
||||
echo "$current_config" >"$config_cache_file"
|
||||
fi
|
||||
|
||||
# 正常启动并监听
|
||||
_log "→ 启动 inotifyd 监听..." "INFO"
|
||||
now_bri_file="${current_config%|*}"
|
||||
inotify_events="${current_config#*|}"
|
||||
|
||||
# 更新缓存,让 up.sh 知道当前监听的是哪个文件
|
||||
echo -n "$now_bri_file" >"$PATH_CONFIG_DIR/.cached_path"
|
||||
|
||||
# 启动并重定向 (不再使用子进程管道以保证 PID 抓取准确)
|
||||
inotifyd "$MODDIR/script/up.sh" "$now_bri_file:$inotify_events" >>"$log_file" 2>&1 &
|
||||
|
||||
inotify_pid=$!
|
||||
echo "$inotify_pid" >"$pid_file"
|
||||
_log "✓ inotifyd 已启动 (PID: $inotify_pid)" "SUCCESS"
|
||||
_log " 监听文件: $now_bri_file, 事件: $inotify_events" "INFO"
|
||||
|
||||
# 3. 通过 wait 阻塞,实时感知进程死亡 (兼容所有 BusyBox 环境)
|
||||
wait "$inotify_pid"
|
||||
_log "[-] 监听进程 ($inotify_pid) 已退出,将在 1 秒后重启..." "WARN"
|
||||
|
||||
sleep 0.5
|
||||
done
|
||||
+15
-14
@@ -5,30 +5,31 @@ 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"
|
||||
printf '[%s] [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
|
||||
pause_file="$PID_DIR/daemon.pause"
|
||||
|
||||
# 2. 清理遗留文件
|
||||
# 1. 强制通知守护进程并执行清理
|
||||
_log "通知守护进程执行全局重置..."
|
||||
touch "$pause_file"
|
||||
killall -9 inotifyd 2>/dev/null
|
||||
for p in $(pgrep -f "up.sh"); do
|
||||
[ "$p" != "$$" ] && kill -9 "$p" 2>/dev/null
|
||||
done
|
||||
|
||||
# 2. 清理遗留标记
|
||||
rm -f "$pid_file"
|
||||
rm -f "$flag_file"
|
||||
_log "已清理 pid 和 flag 文件"
|
||||
_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) 重新启动成功"
|
||||
# 3. 恢复守护进程 (它会自动拉起新 inotifyd)
|
||||
rm -f "$pause_file"
|
||||
_log "服务正在由守护进程重新拉起..."
|
||||
|
||||
exit 0
|
||||
+72
-51
@@ -4,17 +4,37 @@
|
||||
|
||||
MODDIR="${0%/*/*}"
|
||||
CONFIG_DIR="$MODDIR/config"
|
||||
PATH_CONFIG_DIR="$CONFIG_DIR/path"
|
||||
PID_DIR="$MODDIR/pid"
|
||||
flag_file="$PID_DIR/up.flag"
|
||||
stop_file="$PID_DIR/stop.flag"
|
||||
log_file="$MODDIR/service.log"
|
||||
pause_file="$PID_DIR/daemon.pause"
|
||||
|
||||
# 默认设备路径
|
||||
DEFAULT_NOW_BRI_FILE="/sys/class/backlight/panel0-backlight/brightness"
|
||||
|
||||
# 读取配置函数
|
||||
get_config() {
|
||||
local config_file="$1"
|
||||
local default_value="$2"
|
||||
if [ -f "$config_file" ]; then
|
||||
cat "$config_file"
|
||||
else
|
||||
echo "$default_value"
|
||||
fi
|
||||
}
|
||||
|
||||
# 获取亮度文件路径
|
||||
now_bri_file="$(get_config "$PATH_CONFIG_DIR/now_bri_file.txt" "$DEFAULT_NOW_BRI_FILE")"
|
||||
|
||||
# 日志函数
|
||||
_log() {
|
||||
# 如果 stop.flag 存在并且不是正在清理日志,我们仍允许记录停止状态,但此处先检查基础
|
||||
local level="${2:-INFO}"
|
||||
|
||||
case "$1" in
|
||||
"日志过大"*) ;;
|
||||
*) if [ -f "$stop_file" ]; then return; fi ;;
|
||||
"日志过大"*) ;;
|
||||
*) if [ -f "$stop_file" ]; then return; fi ;;
|
||||
esac
|
||||
|
||||
local max_size
|
||||
@@ -26,30 +46,32 @@ _log() {
|
||||
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"
|
||||
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "up" "WARN" "日志过大 ($cur_size KB), 自动重置" >"$log_file"
|
||||
fi
|
||||
fi
|
||||
|
||||
printf '[%s] [service.up] %s\n' "$(date '+%d %H:%M:%S.%3N')" "$1" >>"$log_file"
|
||||
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "up" "$level" "$1" >>"$log_file"
|
||||
}
|
||||
|
||||
_log "($$) 被 inotifyd 调用..."
|
||||
_log "[*] 收到 inotifyd 通知 (PID: $$)" "INFO"
|
||||
_log "[!] 正在抢占:清理其他 inotifyd 进程..." "WAIT"
|
||||
touch "$pause_file"
|
||||
killall -9 inotifyd 2>/dev/null
|
||||
for p in $(pgrep -f "up.sh"); do
|
||||
[ "$p" != "$$" ] && kill -9 "$p" 2>/dev/null
|
||||
done
|
||||
|
||||
if [ -f "$stop_file" ]; then
|
||||
_log "($$) 检测到 stop.flag, 停止本次调整 (服务已暂停)"
|
||||
_log "[X] 服务已处于手动暂停状态,本次操作被取消" "WARN"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 建立一个 flag, 避免重复执行; 如果已经有 flag, 则退出
|
||||
if [ -f "$flag_file" ]; then
|
||||
_log "($$) 重复执行, 这个进程退出, 将有其他进程接管"
|
||||
_log "[X] 另一个 up.sh 进程正在运行,本进程退出" "WARN"
|
||||
exit 1
|
||||
fi
|
||||
touch "$flag_file"
|
||||
|
||||
# 节点文件
|
||||
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")"
|
||||
@@ -95,11 +117,11 @@ update_all() {
|
||||
|
||||
# 如果步长为 0 (差值太小), 直接设置目标亮度
|
||||
if [ "$step_value" -eq 0 ]; then
|
||||
_log "($$) 步长为 0, 直接设置目标亮度: $target_bri"
|
||||
_log "[OK] 直接设定亮度为: $target_bri" "INFO"
|
||||
echo -n "$target_bri" >"$now_bri_file" && return 0 || return 1
|
||||
fi
|
||||
|
||||
_log "($$) 开始调整亮度: $start_bri -> $target_bri, 共 $steps_num 步, 每步 $step_value"
|
||||
_log "[*] 开始调整亮度: $start_bri -> $target_bri (共 $steps_num 步)" "INFO"
|
||||
for step in $(seq 1 "$steps_num"); do
|
||||
echo -n $((start_bri + step * step_value)) >"$now_bri_file"
|
||||
sleep 0.02
|
||||
@@ -114,64 +136,63 @@ CHECK_BRI() {
|
||||
local cycle_num
|
||||
local now_bri
|
||||
|
||||
# 循环 10 次 (检查 5s)
|
||||
# 循环 10 次 (检查 3s)
|
||||
# shellcheck disable=SC2034
|
||||
for cycle_num in $(seq 1 10); do
|
||||
now_bri="$(cat "$now_bri_file")"
|
||||
if [ "$now_bri" -ge "$ui_max_bri" ]; then
|
||||
if [ "$now_bri" -ge "$ui_max_bri" ] && [ "$now_bri" -lt "$target_bri" ]; then
|
||||
_log "[+] 满足提升条件: $now_bri >= $ui_max_bri,目标 ^ $target_bri" "SUCCESS"
|
||||
|
||||
if update_all; then
|
||||
_log "($$) 亮度调整完成!"
|
||||
_log "--------------------"
|
||||
_log "[OK] 亮度提升已完成 (当前: $target_bri)" "SUCCESS"
|
||||
_log "================================================" "INFO"
|
||||
return 0
|
||||
else
|
||||
_log "($$) 亮度调整失败!"
|
||||
_log "--------------------"
|
||||
_log "[X] 亮度提升失败:无法写入节点文件" "ERROR"
|
||||
_log "================================================" "ERROR"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
sleep 0.5 # 不符合条件, 等待后再次检测
|
||||
fi
|
||||
sleep 0.3
|
||||
done
|
||||
|
||||
_log "($$) 亮度 ($(cat "$now_bri_file")) 未达到条件, 本次调整取消"
|
||||
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 # 不需要休眠
|
||||
_log "[-] 检测超时:未持续触发有效提升阈值" "WARN"
|
||||
return 1
|
||||
}
|
||||
|
||||
MAIN() {
|
||||
# 休眠时段内不调整亮度
|
||||
# 解析并判断休眠
|
||||
if IS_SLEEP_TIME; then
|
||||
_log "($$) 当前处于休眠时段 ($sleep_start-$sleep_end), 跳过本次调整"
|
||||
_log "--------------------"
|
||||
sleep 1
|
||||
_log "[||] 休眠时段 ($sleep_start-$sleep_end),本次调整已跳过" "INFO"
|
||||
_log "================================================" "INFO"
|
||||
rm -f "$flag_file"
|
||||
return
|
||||
fi
|
||||
|
||||
if IS_AUTO_BRI_SLEEP; then
|
||||
_log "($$) 当前为自动亮度模式, 根据设置跳过本次调整"
|
||||
_log "--------------------"
|
||||
sleep 1
|
||||
rm -f "$flag_file"
|
||||
return
|
||||
if [ "$auto_bri_sleep" = "1" ]; then
|
||||
mode="$(settings get system screen_brightness_mode 2>/dev/null)"
|
||||
if [ "$mode" = "1" ]; then
|
||||
_log "[<>] 自动亮度模式已启用,本次调整已跳过" "INFO"
|
||||
_log "================================================" "INFO"
|
||||
rm -f "$flag_file"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
_log "($$) 亮度被调整, 将在 0.5s 后检测是否符合条件"
|
||||
sleep 0.5
|
||||
_log "[*] 检测亮度变化..." "INFO"
|
||||
# sleep 0.5
|
||||
CHECK_BRI
|
||||
sleep 0.5 # 稍微延迟一会避免 inotifyd 刚启动就检测到亮度变化
|
||||
rm -f "$flag_file" # 删除 flag, 允许下一次调整
|
||||
rm -f "$flag_file" # 删除成果锁
|
||||
rm -f "$pause_file" # 解锁守护进程,让它自动拉起 inotifyd
|
||||
|
||||
# 如果配置文件被修改了,杀掉 inotifyd 让 daemon 重启并重新读取配置
|
||||
local current_now_bri cached_now_bri
|
||||
current_now_bri="$(cat "$PATH_CONFIG_DIR/now_bri_file.txt" 2>/dev/null || echo "$DEFAULT_NOW_BRI_FILE")"
|
||||
cached_now_bri="$(cat "$PATH_CONFIG_DIR/.cached_path" 2>/dev/null || echo "$DEFAULT_NOW_BRI_FILE")"
|
||||
|
||||
if [ "$current_now_bri" != "$cached_now_bri" ]; then
|
||||
_log "[*] 配置已更新,重启 inotifyd..." "WARN"
|
||||
killall -9 inotifyd 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
MAIN
|
||||
|
||||
+33
-49
@@ -3,67 +3,51 @@
|
||||
|
||||
MODDIR="${0%/*}"
|
||||
CONFIG_DIR="$MODDIR/config"
|
||||
PID_DIR="$MODDIR/pid"
|
||||
|
||||
now_bri_file="/sys/class/backlight/panel0-backlight/brightness"
|
||||
|
||||
# 配置文件路径
|
||||
ui_max_bri_file="$CONFIG_DIR/ui_max_bri.txt"
|
||||
max_bri_file="$CONFIG_DIR/max_bri.txt"
|
||||
sleep_time_file="$CONFIG_DIR/sleep_time.txt"
|
||||
|
||||
pid_file="$PID_DIR/inotifyd.pid"
|
||||
PATH_CONFIG_DIR="$CONFIG_DIR/path"
|
||||
log_file="$MODDIR/service.log"
|
||||
|
||||
# inotifyd 用法:
|
||||
# inotifyd 程序 文件[:掩码] ...
|
||||
#
|
||||
# 当文件发生与 掩码(MASK) 匹配的文件系统事件时,运行 程序(PROG):
|
||||
# 程序 事件 文件 [目录文件]
|
||||
# 如果 程序(PROG) 为 "-",则事件将发送到标准输出 (stdout)。
|
||||
#
|
||||
# 以下是针对“此文件”的事件:
|
||||
# a 已访问 (accessed) c 已修改 (modified) e 元数据更改 (metadata change) w 已关闭 (可写)
|
||||
# r 已打开 (opened) D 已删除 (deleted) M 已移动 (moved) 0 已关闭 (不可写)
|
||||
# u 已卸载 (unmounted) o 溢出 (overflow) x 不可监控 (unwatchable)
|
||||
#
|
||||
# 以下是针对“此目录中”的文件事件:
|
||||
# m 移入 (moved in) y 移出 (moved out) n 已创建 (created) d 已删除 (deleted)
|
||||
# 当所有文件都发生 x 事件时,inotifyd 将退出(在等待程序运行结束后)。
|
||||
# 默认设备路径
|
||||
DEFAULT_NOW_BRI_FILE="/sys/class/backlight/panel0-backlight/brightness"
|
||||
DEFAULT_MAX_BRI_FILE="/sys/class/backlight/panel0-backlight/max_brightness"
|
||||
|
||||
# 监控当前亮度文件的日志
|
||||
# # inotifyd - /sys/class/backlight/panel0-backlight/brightness
|
||||
# c /sys/class/backlight/panel0-backlight/brightness # 已修改
|
||||
# r /sys/class/backlight/panel0-backlight/brightness # 已打开
|
||||
# a /sys/class/backlight/panel0-backlight/brightness # 已访问
|
||||
# 0 /sys/class/backlight/panel0-backlight/brightness # 已关闭(不可写)
|
||||
# -- 经过了 1 亮度值的调整 --
|
||||
# c /sys/class/backlight/panel0-backlight/brightness
|
||||
# r /sys/class/backlight/panel0-backlight/brightness
|
||||
# a /sys/class/backlight/panel0-backlight/brightness
|
||||
# 0 /sys/class/backlight/panel0-backlight/brightness
|
||||
# ...
|
||||
# 读取配置函数
|
||||
get_config() {
|
||||
local config_file="$1"
|
||||
local default_value="$2"
|
||||
if [ -f "$config_file" ]; then
|
||||
cat "$config_file"
|
||||
else
|
||||
echo "$default_value"
|
||||
fi
|
||||
}
|
||||
|
||||
_log() {
|
||||
printf '[%s] [service] %s\n' "$(date '+%d %H:%M:%S.%3N')" "$1" >>"$log_file"
|
||||
local level="${2:-INFO}"
|
||||
printf '[%s] [%s] [%-8s] %s\n' "$(date '+%m-%d %H:%M:%S')" "service" "$level" "$1" >>"$log_file"
|
||||
}
|
||||
|
||||
# 等待系统就绪
|
||||
sleep 30
|
||||
|
||||
_log "LuminPro 已启动"
|
||||
_log "- 前台最大亮度: $(cat "$ui_max_bri_file")"
|
||||
_log "- 峰值最大亮度: $(cat "$max_bri_file")"
|
||||
_log "- 休眠时间: $(cat "$sleep_time_file")"
|
||||
_log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" "START"
|
||||
_log "LuminPro 模块已启动" "SUCCESS"
|
||||
_log "前台最大亮度: $(cat "$CONFIG_DIR/ui_max_bri.txt")" "INFO"
|
||||
_log "峰值最大亮度: $(cat "$CONFIG_DIR/max_bri.txt")" "INFO"
|
||||
_log "休眠时间: $(cat "$CONFIG_DIR/sleep_time.txt")" "INFO"
|
||||
|
||||
mkdir -p "$PID_DIR"
|
||||
[ -f "$pid_file" ] && rm -f "$pid_file"
|
||||
[ -f "$PID_DIR/up.flag" ] && rm -f "$PID_DIR/up.flag"
|
||||
# 读取设备路径配置
|
||||
now_bri_file="$(get_config "$PATH_CONFIG_DIR/now_bri_file.txt" "$DEFAULT_NOW_BRI_FILE")"
|
||||
max_bri_file="$(get_config "$PATH_CONFIG_DIR/max_bri_file.txt" "$DEFAULT_MAX_BRI_FILE")"
|
||||
_log "当前亮度节点: $now_bri_file" "INFO"
|
||||
_log "最大亮度节点: $max_bri_file" "INFO"
|
||||
|
||||
_log "启动守护监控进程..." "WAIT"
|
||||
chmod 755 "$MODDIR/script/up.sh"
|
||||
chmod 755 "$MODDIR/script/daemon.sh"
|
||||
|
||||
# 启动 inotifyd 监控
|
||||
inotifyd "$MODDIR/script/up.sh" "$now_bri_file:c" &
|
||||
inotifyd_pid="$!"
|
||||
echo "$inotifyd_pid" >"$pid_file"
|
||||
# 启动守护进程
|
||||
sh "$MODDIR/script/daemon.sh" &
|
||||
_log "守护进程已启动 (PID: $!)" "SUCCESS"
|
||||
_log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" "DONE"
|
||||
|
||||
exit 0
|
||||
-379
@@ -1,379 +0,0 @@
|
||||
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';
|
||||
|
||||
// ==========================
|
||||
// 工具函数
|
||||
// ==========================
|
||||
function showToast(msg) {
|
||||
const toast = document.getElementById('toast');
|
||||
toast.textContent = msg;
|
||||
toast.classList.add('show');
|
||||
setTimeout(() => toast.classList.remove('show'), 3000);
|
||||
}
|
||||
|
||||
// 封装的 exec,按需返回真实执行结果
|
||||
async function runCmd(cmd) {
|
||||
try {
|
||||
const res = await exec(cmd);
|
||||
return res;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return { errno: -1, stdout: '', stderr: String(e) };
|
||||
}
|
||||
}
|
||||
|
||||
// 写入文件
|
||||
async function writeFile(path, content) {
|
||||
const safeContent = String(content).replace(/'/g, "'\\''");
|
||||
return runCmd(`echo -n '${safeContent}' > "${path}"`);
|
||||
}
|
||||
|
||||
// ==========================
|
||||
// 业务逻辑
|
||||
// ==========================
|
||||
|
||||
// 1. 加载配置
|
||||
async function loadConfig() {
|
||||
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}/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) {
|
||||
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 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('亮度值不能为空');
|
||||
return;
|
||||
}
|
||||
|
||||
showToast('保存中...');
|
||||
|
||||
// 保存到文件 (若不存在则可能失败,前提是模块已经建立 config 目录)
|
||||
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 挂起
|
||||
await runCmd(`rm -f "${FLAG_FILE}"`);
|
||||
|
||||
// 或者最干脆的办法,直接杀掉 inotifyd,然后用模块本来的启动逻辑。
|
||||
// 但是 up.sh 本来就没有后台重启机制,它是通过 inotifyd 重启自己的。
|
||||
// 稳妥起见:
|
||||
const pidRes = await runCmd(`cat "${PID_FILE}"`);
|
||||
if (pidRes.errno === 0 && pidRes.stdout.trim()) {
|
||||
showToast('配置已保存 (可能需要在下次调整时生效)');
|
||||
} else {
|
||||
showToast('配置已保存 (服务未运行)');
|
||||
}
|
||||
}
|
||||
|
||||
// 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, 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 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(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 ? '休眠中' : '非休眠';
|
||||
}
|
||||
|
||||
// 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) {
|
||||
const freshLog = res.stdout.trim() || '暂无日志';
|
||||
// 只有当日志内容变化时才更新 DOM, 减少闪烁
|
||||
if(logEl.textContent !== freshLog) {
|
||||
logEl.textContent = freshLog;
|
||||
logEl.scrollTop = logEl.scrollHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 自动刷新循环
|
||||
async function startAutoRefresh() {
|
||||
await Promise.all([loadStatus(), loadLogs()]);
|
||||
setTimeout(startAutoRefresh, 500); // 0.5s 周期
|
||||
}
|
||||
|
||||
// ==========================
|
||||
// 初始化
|
||||
// ==========================
|
||||
async function init() {
|
||||
|
||||
// 初始化 Lucide 图标
|
||||
createIcons({
|
||||
icons: {
|
||||
Sun,
|
||||
Settings,
|
||||
Save,
|
||||
Activity,
|
||||
RefreshCw,
|
||||
FileText
|
||||
}
|
||||
});
|
||||
|
||||
// 绑定事件
|
||||
document.getElementById('btn-save').addEventListener('click', saveConfig);
|
||||
document.getElementById('btn-reset').addEventListener('click', handleReset);
|
||||
document.getElementById('btn-toggle-service').addEventListener('click', toggleService);
|
||||
document.getElementById('btn-restart-service').addEventListener('click', restartService);
|
||||
|
||||
// 定时休眠折叠逻辑
|
||||
document.getElementById('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();
|
||||
// 开启自动刷新状态和日志 (内置了已包含 loadStatus 和 loadLogs)
|
||||
startAutoRefresh();
|
||||
}
|
||||
|
||||
// DOM 加载完成后运行
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"versionCode": 2202,
|
||||
"versionCode": 2204,
|
||||
"version": "V2.2",
|
||||
"zipUrl": "https://share.yule.ink/magisk/mod/luminpro/module/LuminPro_V2.2-2202.zip",
|
||||
"zipUrl": "https://share.yule.ink/magisk/mod/luminpro/module/LuminPro_V2.2-2204.zip",
|
||||
"changelog": "https://share.yule.ink/magisk/mod/luminpro/changelog.md"
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
:root{--md-sys-color-background:#111318;--md-sys-color-on-background:#e2e2e9;--md-sys-color-surface:#1e1f25;--md-sys-color-surface-container:#212429;--md-sys-color-surface-container-high:#2b2930;--md-sys-color-on-surface:#e2e2e9;--md-sys-color-on-surface-variant:#c4c6d0;--md-sys-color-primary:#a8c7fa;--md-sys-color-on-primary:#062e6f;--md-sys-color-primary-container:#1b4b9b;--md-sys-color-on-primary-container:#d3e3fd;--md-sys-color-outline:#8e9099;--md-sys-color-outline-variant:#44474f;--md-sys-color-error:#ffb4ab;--md-sys-color-on-error:#690005;--border-radius-m:16px;--border-radius-s:8px;--spacing-s:8px;--spacing-m:16px;--spacing-l:24px}@font-face{font-family:Geist;src:url(/Geist-VariableFont_wght.ttf)format("truetype");font-weight:100 900;font-style:normal}@font-face{font-family:Google Sans Code;src:url(/GoogleSansCode-VariableFont_wght.ttf)format("truetype");font-weight:100 900;font-style:normal}*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}body{padding:0;padding-top:var(--safe-area-inset-top,0);padding-bottom:var(--safe-area-inset-bottom,0);background-color:var(--md-sys-color-background);color:var(--md-sys-color-on-background);margin:0;font-family:Geist,system-ui,-apple-system,sans-serif;line-height:1.5}#app{padding:var(--spacing-m);gap:var(--spacing-m);flex-direction:column;max-width:600px;margin:0 auto;display:flex}.app-header{padding:var(--spacing-m) 0;justify-content:space-between;align-items:center;display:flex}.header-content{align-items:center;gap:var(--spacing-m);display:flex}.header-icon{background:var(--md-sys-color-surface-container-high);border-radius:50%;justify-content:center;align-items:center;width:48px;height:48px;font-size:2rem;display:flex}.header-text h1{color:var(--md-sys-color-on-background);margin:0;font-size:1.25rem;font-weight:500}.header-subtitle{color:var(--md-sys-color-on-surface-variant);margin:0;font-size:.875rem}.header-status{background:var(--md-sys-color-surface-container);border-radius:100px;align-items:center;gap:6px;padding:4px 12px;font-size:.875rem;display:flex}.status-dot{background-color:var(--md-sys-color-error);border-radius:50%;width:8px;height:8px}.card{background-color:var(--md-sys-color-surface);border-radius:var(--border-radius-m);padding:var(--spacing-l);box-shadow:0 1px 3px #0000004d,0 4px 8px 3px #00000026}.card-header{align-items:center;gap:var(--spacing-s);margin-bottom:var(--spacing-l);display:flex}.card-header h2{color:var(--md-sys-color-on-surface);flex-grow:1;margin:0;font-size:1.125rem;font-weight:500}.config-group{margin-bottom:var(--spacing-l);padding:var(--spacing-m);background-color:var(--md-sys-color-surface-container);border-radius:var(--border-radius-s)}.group-title{margin:0 0 var(--spacing-m) 0;color:var(--md-sys-color-primary);text-transform:uppercase;letter-spacing:.5px;font-size:.875rem;font-weight:600}.config-item{justify-content:space-between;align-items:center;display:flex}.config-item+.config-item{margin-top:var(--spacing-m)}.config-label{flex-direction:column;display:flex}.config-name{color:var(--md-sys-color-on-surface);font-size:1rem}.config-desc{color:var(--md-sys-color-on-surface-variant);font-size:.875rem}.config-input{background-color:var(--md-sys-color-surface-container-high);color:var(--md-sys-color-on-surface);border:1px solid var(--md-sys-color-outline);border-radius:var(--border-radius-s);text-align:right;outline:none;width:100px;padding:8px 12px;font-family:inherit;font-size:1rem;transition:border-color .2s,box-shadow .2s}.config-input:focus{border-color:var(--md-sys-color-primary);box-shadow:0 0 0 2px #a8c7fa4d}.config-input-wide{width:140px}.config-item-expand{margin-top:var(--spacing-s);opacity:0;justify-content:flex-end;max-height:0;transition:all .3s;display:flex;overflow:hidden}.config-item-expand.show{opacity:1;max-height:100px;margin-bottom:var(--spacing-m)}.custom-time-picker{align-items:center;gap: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
|
||||
@@ -1,4 +0,0 @@
|
||||
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=0;function t(t){return`${t}_callback_${Date.now()}_${e++}`}function n(e,n){return n===void 0&&(n={}),new Promise((r,i)=>{let a=t(`exec`);window[a]=(e,t,n)=>{r({errno:e,stdout:t,stderr:n}),o(a)};function o(e){delete window[e]}try{ksu.exec(e,JSON.stringify(n),a)}catch(e){i(e),o(a)}})}function r(){this.listeners={}}r.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},r.prototype.emit=function(e,...t){this.listeners[e]&&this.listeners[e].forEach(e=>e(...t))};function i(){this.listeners={},this.stdin=new r,this.stdout=new r,this.stderr=new r}i.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},i.prototype.emit=function(e,...t){this.listeners[e]&&this.listeners[e].forEach(e=>e(...t))};var a={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},o=([e,t,n])=>{let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);return Object.keys(t).forEach(e=>{r.setAttribute(e,String(t[e]))}),n?.length&&n.forEach(e=>{let t=o(e);r.appendChild(t)}),r},s=(e,t={})=>o([`svg`,{...a,...t},e]),c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},l=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),u=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),d=e=>{let t=u(e);return t.charAt(0).toUpperCase()+t.slice(1)},f=e=>Array.from(e.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{}),p=e=>typeof e==`string`?e:!e||!e.class?``:e.class&&typeof e.class==`string`?e.class.split(` `):e.class&&Array.isArray(e.class)?e.class:``,m=(e,{nameAttr:t,icons:n,attrs:r})=>{let i=e.getAttribute(t);if(i==null)return;let o=n[d(i)];if(!o)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);let u=f(e),m=c(u)?{}:{"aria-hidden":`true`},h={...a,"data-lucide":i,...m,...r,...u},g=p(u),_=p(r),v=l(`lucide`,`lucide-${i}`,...g,..._);v&&Object.assign(h,{class:v});let y=s(o,h);return e.parentNode?.replaceChild(y,e)},h=[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`}]],g=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 9H8`}],[`path`,{d:`M16 13H8`}],[`path`,{d:`M16 17H8`}]],_=[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}],[`path`,{d:`M21 3v5h-5`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}],[`path`,{d:`M8 16H3v5`}]],v=[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`}]],y=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]],b=[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]],x=({icons:e={},nameAttr:t=`data-lucide`,attrs:n={},root:r=document,inTemplates:i}={})=>{if(!Object.values(e).length)throw Error(`Please provide an icons object.
|
||||
If you want to use all the icons you can import it like:
|
||||
\`import { createIcons, icons } from 'lucide';
|
||||
lucide.createIcons({icons});\``);if(r===void 0)throw Error("`createIcons()` only works in a browser environment.");if(Array.from(r.querySelectorAll(`[${t}]`)).forEach(r=>m(r,{nameAttr:t,icons:e,attrs:n})),i&&Array.from(r.querySelectorAll(`template`)).forEach(r=>x({icons:e,nameAttr:t,attrs:n,root:r.content,inTemplates:i})),t===`data-lucide`){let t=r.querySelectorAll(`[icon-name]`);t.length>0&&(console.warn(`[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide`),Array.from(t).forEach(t=>m(t,{nameAttr:`icon-name`,icons:e,attrs:n})))}},S=`/data/adb/modules/LuminPro/config`,C=`/data/adb/modules/LuminPro/config/.backup`,w=`/data/adb/modules/LuminPro/pid/inotifyd.pid`,T=`/data/adb/modules/LuminPro/pid/up.flag`,E=`/data/adb/modules/LuminPro/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
|
||||
+153
-30
@@ -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-GvCaVVmw.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DpSbbGTK.css">
|
||||
<script type="module" crossorigin src="/assets/index-B_73ZWwP.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BsOofCBH.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -15,10 +15,10 @@
|
||||
<!-- 顶部头 -->
|
||||
<header class="app-header">
|
||||
<div class="header-content">
|
||||
<div class="header-icon"><i data-lucide="sun"></i></div>
|
||||
<div class="header-text">
|
||||
<h1>LuminPro</h1>
|
||||
<p class="header-subtitle" id="module-version">日用屏幕亮度强化</p>
|
||||
<p class="header-subtitle">日用屏幕亮度强化</p>
|
||||
<p class="header-version" id="module-version">V2.2-2203</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-status" id="module-status">
|
||||
@@ -27,10 +27,60 @@
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 实时状态 -->
|
||||
<section class="card" id="status-section" data-nav-group="status">
|
||||
<div class="card-header">
|
||||
<h2>实时状态</h2>
|
||||
<div class="header-actions">
|
||||
<button class="btn-text-s" id="btn-refresh-status">刷新</button>
|
||||
<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">
|
||||
<div class="status-item">
|
||||
<span class="status-label">当前亮度</span>
|
||||
<span class="status-value" id="status-current-bri">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">系统最大亮度</span>
|
||||
<span class="status-value" id="status-sys-max-bri">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">inotifyd PID</span>
|
||||
<span class="status-value" id="status-inotifyd-pid">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">休眠状态</span>
|
||||
<span class="status-value" id="status-sleep">—</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 亮度控制区 -->
|
||||
<div class="brightness-section">
|
||||
<div class="brightness-header">
|
||||
<span class="brightness-title">亮度</span>
|
||||
<span class="brightness-percent" id="brightness-display">—%</span>
|
||||
</div>
|
||||
<div class="brightness-container">
|
||||
<span class="brightness-label">0%</span>
|
||||
<input type="range" id="brightness-slider" class="brightness-slider" min="0" max="255" />
|
||||
<span class="brightness-label">100%</span>
|
||||
</div>
|
||||
<div class="auto-brightness-row">
|
||||
<span class="auto-brightness-label">自动亮度调节</span>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="auto-brightness-toggle">
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 配置卡片 -->
|
||||
<section class="card" id="config-section">
|
||||
<section class="card" id="config-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<span class="card-icon"><i data-lucide="settings"></i></span>
|
||||
<h2>亮度配置</h2>
|
||||
</div>
|
||||
|
||||
@@ -134,48 +184,121 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 实时状态 -->
|
||||
<section class="card" id="status-section">
|
||||
<!-- 高级设置卡片 -->
|
||||
<section class="card" id="advanced-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<span class="card-icon"><i data-lucide="activity"></i></span>
|
||||
<h2>实时状态</h2>
|
||||
<div class="header-actions">
|
||||
<button class="btn-text-s" id="btn-toggle-service">暂停</button>
|
||||
<button class="btn-text-s" id="btn-restart-service">重启</button>
|
||||
<h2>高级设置</h2>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">inotifyd 监听事件</span>
|
||||
<span class="config-desc">默认 c。修改需重启服务</span>
|
||||
<button class="btn-text-s" id="btn-view-inotifyd-help" style="margin-top: 6px; padding: 2px 6px;">查看支持事件</button>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="text" id="input-inotify-events" class="config-input" placeholder="c" />
|
||||
</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">
|
||||
<textarea id="input-now-bri-file" class="config-textarea"></textarea>
|
||||
</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">
|
||||
<textarea id="input-sys-max-bri-file" class="config-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="status-grid">
|
||||
<div class="status-item">
|
||||
<span class="status-label">当前亮度</span>
|
||||
<span class="status-value" id="status-current-bri">—</span>
|
||||
<div class="card-actions">
|
||||
<button class="btn btn-primary" id="btn-save-advanced">
|
||||
<span class="btn-icon"><i data-lucide="save"></i></span> 保存设置
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Web UI 配置卡片 -->
|
||||
<section class="card" id="webui-config-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<h2>Web UI 配置</h2>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">状态/日志刷新间隔</span>
|
||||
<span class="config-desc">单位: 毫秒 (最小100ms)</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-status-refresh-interval" class="config-input" min="100" value="1000" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">系统最大亮度</span>
|
||||
<span class="status-value" id="status-sys-max-bri">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">inotifyd PID</span>
|
||||
<span class="status-value" id="status-inotifyd-pid">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">休眠状态</span>
|
||||
<span class="status-value" id="status-sleep">—</span>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">配置卡片刷新间隔</span>
|
||||
<span class="config-desc">单位: 毫秒 (最小1000ms)</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-config-refresh-interval" class="config-input" min="1000" value="5000" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<button class="btn btn-primary" id="btn-save-webui-config">
|
||||
<span class="btn-icon"><i data-lucide="save"></i></span> 保存配置
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 日志 -->
|
||||
<section class="card" id="log-section">
|
||||
<section class="card" id="log-section" data-nav-group="log">
|
||||
<div class="card-header">
|
||||
<span class="card-icon"><i data-lucide="file-text"></i></span>
|
||||
<h2>运行日志</h2>
|
||||
<div class="header-actions">
|
||||
<select id="log-level-filter" class="log-filter-select">
|
||||
<option value="">全部等级</option>
|
||||
<option value="INFO">INFO</option>
|
||||
<option value="WARN">WARN</option>
|
||||
<option value="ERROR">ERROR</option>
|
||||
<option value="SUCCESS">SUCCESS</option>
|
||||
</select>
|
||||
<button class="btn-text-s" id="btn-clear-logs">清空日志</button>
|
||||
</div>
|
||||
</div>
|
||||
<pre class="log-output" id="log-output">加载中...</pre>
|
||||
</section>
|
||||
|
||||
<!-- Toast -->
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<!-- 浮动底栏 -->
|
||||
<div class="floating-navbar">
|
||||
<div class="navbar-slider"></div>
|
||||
<button class="navbar-btn active" data-section="status">
|
||||
<i data-lucide="activity"></i>
|
||||
<span>状态</span>
|
||||
</button>
|
||||
<button class="navbar-btn" data-section="config">
|
||||
<i data-lucide="settings"></i>
|
||||
<span>配置</span>
|
||||
</button>
|
||||
<button class="navbar-btn" data-section="log">
|
||||
<i data-lucide="file-text"></i>
|
||||
<span>日志</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
+151
-28
@@ -14,10 +14,10 @@
|
||||
<!-- 顶部头 -->
|
||||
<header class="app-header">
|
||||
<div class="header-content">
|
||||
<div class="header-icon"><i data-lucide="sun"></i></div>
|
||||
<div class="header-text">
|
||||
<h1>LuminPro</h1>
|
||||
<p class="header-subtitle" id="module-version">日用屏幕亮度强化</p>
|
||||
<p class="header-subtitle">日用屏幕亮度强化</p>
|
||||
<p class="header-version" id="module-version">V2.2-2203</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-status" id="module-status">
|
||||
@@ -26,10 +26,60 @@
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 实时状态 -->
|
||||
<section class="card" id="status-section" data-nav-group="status">
|
||||
<div class="card-header">
|
||||
<h2>实时状态</h2>
|
||||
<div class="header-actions">
|
||||
<button class="btn-text-s" id="btn-refresh-status">刷新</button>
|
||||
<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">
|
||||
<div class="status-item">
|
||||
<span class="status-label">当前亮度</span>
|
||||
<span class="status-value" id="status-current-bri">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">系统最大亮度</span>
|
||||
<span class="status-value" id="status-sys-max-bri">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">inotifyd PID</span>
|
||||
<span class="status-value" id="status-inotifyd-pid">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">休眠状态</span>
|
||||
<span class="status-value" id="status-sleep">—</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 亮度控制区 -->
|
||||
<div class="brightness-section">
|
||||
<div class="brightness-header">
|
||||
<span class="brightness-title">亮度</span>
|
||||
<span class="brightness-percent" id="brightness-display">—%</span>
|
||||
</div>
|
||||
<div class="brightness-container">
|
||||
<span class="brightness-label">0%</span>
|
||||
<input type="range" id="brightness-slider" class="brightness-slider" min="0" max="255" />
|
||||
<span class="brightness-label">100%</span>
|
||||
</div>
|
||||
<div class="auto-brightness-row">
|
||||
<span class="auto-brightness-label">自动亮度调节</span>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="auto-brightness-toggle">
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 配置卡片 -->
|
||||
<section class="card" id="config-section">
|
||||
<section class="card" id="config-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<span class="card-icon"><i data-lucide="settings"></i></span>
|
||||
<h2>亮度配置</h2>
|
||||
</div>
|
||||
|
||||
@@ -133,48 +183,121 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 实时状态 -->
|
||||
<section class="card" id="status-section">
|
||||
<!-- 高级设置卡片 -->
|
||||
<section class="card" id="advanced-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<span class="card-icon"><i data-lucide="activity"></i></span>
|
||||
<h2>实时状态</h2>
|
||||
<div class="header-actions">
|
||||
<button class="btn-text-s" id="btn-toggle-service">暂停</button>
|
||||
<button class="btn-text-s" id="btn-restart-service">重启</button>
|
||||
<h2>高级设置</h2>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">inotifyd 监听事件</span>
|
||||
<span class="config-desc">默认 c。修改需重启服务</span>
|
||||
<button class="btn-text-s" id="btn-view-inotifyd-help" style="margin-top: 6px; padding: 2px 6px;">查看支持事件</button>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="text" id="input-inotify-events" class="config-input" placeholder="c" />
|
||||
</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">
|
||||
<textarea id="input-now-bri-file" class="config-textarea"></textarea>
|
||||
</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">
|
||||
<textarea id="input-sys-max-bri-file" class="config-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="status-grid">
|
||||
<div class="status-item">
|
||||
<span class="status-label">当前亮度</span>
|
||||
<span class="status-value" id="status-current-bri">—</span>
|
||||
<div class="card-actions">
|
||||
<button class="btn btn-primary" id="btn-save-advanced">
|
||||
<span class="btn-icon"><i data-lucide="save"></i></span> 保存设置
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Web UI 配置卡片 -->
|
||||
<section class="card" id="webui-config-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<h2>Web UI 配置</h2>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">状态/日志刷新间隔</span>
|
||||
<span class="config-desc">单位: 毫秒 (最小100ms)</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-status-refresh-interval" class="config-input" min="100" value="1000" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">系统最大亮度</span>
|
||||
<span class="status-value" id="status-sys-max-bri">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">inotifyd PID</span>
|
||||
<span class="status-value" id="status-inotifyd-pid">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<span class="status-label">休眠状态</span>
|
||||
<span class="status-value" id="status-sleep">—</span>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">配置卡片刷新间隔</span>
|
||||
<span class="config-desc">单位: 毫秒 (最小1000ms)</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-config-refresh-interval" class="config-input" min="1000" value="5000" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<button class="btn btn-primary" id="btn-save-webui-config">
|
||||
<span class="btn-icon"><i data-lucide="save"></i></span> 保存配置
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 日志 -->
|
||||
<section class="card" id="log-section">
|
||||
<section class="card" id="log-section" data-nav-group="log">
|
||||
<div class="card-header">
|
||||
<span class="card-icon"><i data-lucide="file-text"></i></span>
|
||||
<h2>运行日志</h2>
|
||||
<div class="header-actions">
|
||||
<select id="log-level-filter" class="log-filter-select">
|
||||
<option value="">全部等级</option>
|
||||
<option value="INFO">INFO</option>
|
||||
<option value="WARN">WARN</option>
|
||||
<option value="ERROR">ERROR</option>
|
||||
<option value="SUCCESS">SUCCESS</option>
|
||||
</select>
|
||||
<button class="btn-text-s" id="btn-clear-logs">清空日志</button>
|
||||
</div>
|
||||
</div>
|
||||
<pre class="log-output" id="log-output">加载中...</pre>
|
||||
</section>
|
||||
|
||||
<!-- Toast -->
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<!-- 浮动底栏 -->
|
||||
<div class="floating-navbar">
|
||||
<div class="navbar-slider"></div>
|
||||
<button class="navbar-btn active" data-section="status">
|
||||
<i data-lucide="activity"></i>
|
||||
<span>状态</span>
|
||||
</button>
|
||||
<button class="navbar-btn" data-section="config">
|
||||
<i data-lucide="settings"></i>
|
||||
<span>配置</span>
|
||||
</button>
|
||||
<button class="navbar-btn" data-section="log">
|
||||
<i data-lucide="file-text"></i>
|
||||
<span>日志</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,785 @@
|
||||
import { exec } from 'kernelsu';
|
||||
import { createIcons, Sun, Settings, Save, Activity, RefreshCw, FileText } from 'lucide';
|
||||
|
||||
const CONFIG_DIR = '/data/adb/modules/LuminPro/config';
|
||||
const PATH_CONFIG_DIR = '/data/adb/modules/LuminPro/config/path';
|
||||
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 DEFAULT_NOW_BRI_FILE = '/sys/class/backlight/panel0-backlight/brightness';
|
||||
const DEFAULT_SYS_MAX_BRI_FILE = '/sys/class/backlight/panel0-backlight/max_brightness';
|
||||
|
||||
let NOW_BRI_FILE = DEFAULT_NOW_BRI_FILE;
|
||||
let SYS_MAX_BRI_FILE = DEFAULT_SYS_MAX_BRI_FILE;
|
||||
let INOTIFY_EVENTS = 'c';
|
||||
|
||||
let cachedCurrentBri = null;
|
||||
let cachedSysMaxBri = null;
|
||||
|
||||
// Web UI 配置
|
||||
let statusLogRefreshInterval = 1000; // 状态/日志刷新间隔(默认1秒)
|
||||
let configRefreshInterval = 5000; // 配置卡片刷新间隔(默认5秒)
|
||||
let autoRefreshStatusLogTimer = null; // 状态/日志刷新定时器
|
||||
let autoRefreshConfigTimer = null; // 配置刷新定时器
|
||||
|
||||
// ==========================
|
||||
// 工具函数
|
||||
// ==========================
|
||||
function showToast(msg) {
|
||||
const toast = document.getElementById('toast');
|
||||
toast.textContent = msg;
|
||||
toast.classList.add('show');
|
||||
setTimeout(() => toast.classList.remove('show'), 3000);
|
||||
}
|
||||
|
||||
// 封装的 exec,按需返回真实执行结果
|
||||
async function runCmd(cmd) {
|
||||
try {
|
||||
const res = await exec(cmd);
|
||||
return res;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return { errno: -1, stdout: '', stderr: String(e) };
|
||||
}
|
||||
}
|
||||
|
||||
// 写入文件
|
||||
async function writeFile(path, content) {
|
||||
const safeContent = String(content).replace(/'/g, "'\\''");
|
||||
return runCmd(`echo -n '${safeContent}' > "${path}"`);
|
||||
}
|
||||
|
||||
// ==========================
|
||||
// 业务逻辑
|
||||
// ==========================
|
||||
|
||||
// 1. 加载配置
|
||||
async function loadConfig() {
|
||||
// 首先加载设备路径配置
|
||||
const [pathNowRes, pathMaxRes, eventsRes] = await Promise.all([
|
||||
runCmd(`cat "${PATH_CONFIG_DIR}/now_bri_file.txt"`),
|
||||
runCmd(`cat "${PATH_CONFIG_DIR}/max_bri_file.txt"`),
|
||||
runCmd(`cat "${CONFIG_DIR}/inotify_events.txt"`)
|
||||
]);
|
||||
|
||||
if (pathNowRes.errno === 0) NOW_BRI_FILE = pathNowRes.stdout.trim();
|
||||
if (pathMaxRes.errno === 0) SYS_MAX_BRI_FILE = pathMaxRes.stdout.trim();
|
||||
if (eventsRes.errno === 0 && eventsRes.stdout.trim()) INOTIFY_EVENTS = eventsRes.stdout.trim();
|
||||
else INOTIFY_EVENTS = 'c';
|
||||
|
||||
document.getElementById('input-inotify-events').value = INOTIFY_EVENTS;
|
||||
|
||||
|
||||
// 然后加载其他配置
|
||||
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}/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();
|
||||
|
||||
// 加载高级设置中的设备路径
|
||||
document.getElementById('input-now-bri-file').value = NOW_BRI_FILE;
|
||||
document.getElementById('input-sys-max-bri-file').value = SYS_MAX_BRI_FILE;
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
// 加载 Web UI 配置(从 localStorage)
|
||||
const savedStatusRefresh = localStorage.getItem('statusLogRefreshInterval');
|
||||
const savedConfigRefresh = localStorage.getItem('configRefreshInterval');
|
||||
|
||||
if (savedStatusRefresh && !isNaN(parseInt(savedStatusRefresh, 10))) {
|
||||
statusLogRefreshInterval = Math.max(100, parseInt(savedStatusRefresh, 10));
|
||||
}
|
||||
if (savedConfigRefresh && !isNaN(parseInt(savedConfigRefresh, 10))) {
|
||||
configRefreshInterval = Math.max(1000, parseInt(savedConfigRefresh, 10));
|
||||
}
|
||||
|
||||
document.getElementById('input-status-refresh-interval').value = statusLogRefreshInterval;
|
||||
document.getElementById('input-config-refresh-interval').value = configRefreshInterval;
|
||||
}
|
||||
|
||||
// 2. 保存配置并重启服务
|
||||
async function saveConfig() {
|
||||
const uiMax = document.getElementById('input-ui-max-bri').value;
|
||||
const maxBri = document.getElementById('input-max-bri').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('亮度值不能为空');
|
||||
return;
|
||||
}
|
||||
|
||||
showToast('保存中...');
|
||||
|
||||
// 保存到文件 (若不存在则可能失败,前提是模块已经建立 config 目录)
|
||||
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 挂起
|
||||
await runCmd(`rm -f "${FLAG_FILE}"`);
|
||||
|
||||
// 或者最干脆的办法,直接杀掉 inotifyd,然后用模块本来的启动逻辑。
|
||||
// 但是 up.sh 本来就没有后台重启机制,它是通过 inotifyd 重启自己的。
|
||||
// 稳妥起见:
|
||||
const pidRes = await runCmd(`cat "${PID_FILE}"`);
|
||||
if (pidRes.errno === 0 && pidRes.stdout.trim()) {
|
||||
showToast('配置已保存 (可能需要在下次调整时生效)');
|
||||
} else {
|
||||
showToast('配置已保存 (服务未运行)');
|
||||
}
|
||||
}
|
||||
|
||||
// 2.2 保存高级设置(设备路径及事件监听)
|
||||
async function saveAdvancedConfig() {
|
||||
const nowBriFile = document.getElementById('input-now-bri-file').value || DEFAULT_NOW_BRI_FILE;
|
||||
const sysMaxBriFile = document.getElementById('input-sys-max-bri-file').value || DEFAULT_SYS_MAX_BRI_FILE;
|
||||
const eventsVal = document.getElementById('input-inotify-events').value || 'c';
|
||||
|
||||
showToast('保存中...');
|
||||
|
||||
// 保存设备路径配置
|
||||
const configChanged = (NOW_BRI_FILE !== nowBriFile) || (SYS_MAX_BRI_FILE !== sysMaxBriFile) || (INOTIFY_EVENTS !== eventsVal);
|
||||
await writeFile(`${PATH_CONFIG_DIR}/now_bri_file.txt`, nowBriFile);
|
||||
await writeFile(`${PATH_CONFIG_DIR}/max_bri_file.txt`, sysMaxBriFile);
|
||||
await writeFile(`${CONFIG_DIR}/inotify_events.txt`, eventsVal);
|
||||
|
||||
if (configChanged) {
|
||||
INOTIFY_EVENTS = eventsVal;
|
||||
showToast('高级设置已修改,需要重启服务生效');
|
||||
} else {
|
||||
showToast('设置已保存');
|
||||
}
|
||||
}
|
||||
|
||||
// 2.3 保存 Web UI 配置
|
||||
function saveWebUIConfig() {
|
||||
const statusRefresh = parseInt(document.getElementById('input-status-refresh-interval').value, 10) || 1000;
|
||||
const configRefresh = parseInt(document.getElementById('input-config-refresh-interval').value, 10) || 5000;
|
||||
|
||||
// 验证最小值
|
||||
if (statusRefresh < 100) {
|
||||
showToast('状态/日志刷新间隔最小为100ms');
|
||||
document.getElementById('input-status-refresh-interval').value = 100;
|
||||
return;
|
||||
}
|
||||
if (configRefresh < 1000) {
|
||||
showToast('配置刷新间隔最小为1000ms');
|
||||
document.getElementById('input-config-refresh-interval').value = 1000;
|
||||
return;
|
||||
}
|
||||
|
||||
// 保存到 localStorage
|
||||
localStorage.setItem('statusLogRefreshInterval', statusRefresh);
|
||||
localStorage.setItem('configRefreshInterval', configRefresh);
|
||||
|
||||
// 更新全局变量
|
||||
statusLogRefreshInterval = statusRefresh;
|
||||
configRefreshInterval = configRefresh;
|
||||
|
||||
// 重启刷新循环
|
||||
stopAutoRefresh();
|
||||
startAutoRefresh();
|
||||
|
||||
showToast('Web UI 配置已保存,刷新间隔已更新');
|
||||
}
|
||||
|
||||
// 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(forceFull = false) {
|
||||
if (forceFull || cachedCurrentBri === null || cachedSysMaxBri === null) {
|
||||
const [cRes, sRes] = await Promise.all([
|
||||
runCmd(`cat "${NOW_BRI_FILE}"`),
|
||||
runCmd(`cat "${SYS_MAX_BRI_FILE}"`)
|
||||
]);
|
||||
if (cRes.errno === 0) cachedCurrentBri = cRes.stdout.trim();
|
||||
if (sRes.errno === 0) cachedSysMaxBri = sRes.stdout.trim();
|
||||
}
|
||||
|
||||
const [pidRes, stopRes, autoBriRes] = await Promise.all([
|
||||
runCmd(`cat "${PID_FILE}"`),
|
||||
runCmd(`[ -f "${STOP_FLAG_FILE}" ] && echo "1" || echo "0"`),
|
||||
runCmd(`settings get system screen_brightness_mode`)
|
||||
]);
|
||||
|
||||
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 statusContainer = document.getElementById('module-status');
|
||||
const toggleBtn = document.getElementById('btn-toggle-service');
|
||||
|
||||
if (isPaused) {
|
||||
statusDot.style.backgroundColor = 'var(--md-sys-color-error)';
|
||||
statusDot.style.boxShadow = '0 0 8px rgba(244, 67, 54, 0.5)';
|
||||
statusText.textContent = '已暂停';
|
||||
toggleBtn.textContent = '启用';
|
||||
statusContainer.classList.remove('status-running', 'status-loading');
|
||||
statusContainer.classList.add('status-paused');
|
||||
} else if (running) {
|
||||
statusDot.style.backgroundColor = '#4caf50';
|
||||
statusDot.style.boxShadow = '0 0 8px rgba(76, 175, 80, 0.6)';
|
||||
statusText.textContent = '运行中';
|
||||
toggleBtn.textContent = '暂停';
|
||||
statusContainer.classList.remove('status-paused', 'status-loading');
|
||||
statusContainer.classList.add('status-running');
|
||||
} else {
|
||||
statusDot.style.backgroundColor = 'var(--md-sys-color-error)';
|
||||
statusDot.style.boxShadow = '0 0 8px rgba(244, 67, 54, 0.5)';
|
||||
statusText.textContent = '未运行';
|
||||
toggleBtn.textContent = '暂停';
|
||||
statusContainer.classList.remove('status-running', 'status-paused');
|
||||
statusContainer.classList.add('status-loading');
|
||||
}
|
||||
|
||||
// 填入数值
|
||||
const currentBri = cachedCurrentBri || '0';
|
||||
document.getElementById('status-current-bri').textContent = currentBri;
|
||||
document.getElementById('status-sys-max-bri').textContent = cachedSysMaxBri || '—';
|
||||
document.getElementById('status-inotifyd-pid').textContent = running ? pidRes.stdout.trim() : '离线';
|
||||
|
||||
// 更新亮度滑条
|
||||
const brightnessSlider = document.getElementById('brightness-slider');
|
||||
const sysMaxBri = cachedSysMaxBri ? parseInt(cachedSysMaxBri, 10) : 255;
|
||||
brightnessSlider.max = sysMaxBri;
|
||||
const currentBriValue = parseInt(currentBri, 10) || 0;
|
||||
brightnessSlider.value = currentBriValue;
|
||||
|
||||
// 显示为百分比
|
||||
const percentage = Math.round((currentBriValue / sysMaxBri) * 100);
|
||||
document.getElementById('brightness-display').textContent = percentage + '%';
|
||||
|
||||
// 更新自动亮度开关
|
||||
const autoBriMode = autoBriRes.errno === 0 ? parseInt(autoBriRes.stdout.trim(), 10) : 0;
|
||||
const autoBriToggle = document.getElementById('auto-brightness-toggle');
|
||||
autoBriToggle.checked = autoBriMode === 1;
|
||||
|
||||
// 简易判断当前休眠状态 (只为了前端展示,不影响后端核心)
|
||||
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(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 ? '休眠中' : '非休眠';
|
||||
}
|
||||
|
||||
// 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(true);
|
||||
}
|
||||
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(true);
|
||||
btn.disabled = false;
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
async function handleBrightnessChange(e) {
|
||||
try {
|
||||
const newBri = parseInt(e.target.value, 10);
|
||||
const brightnessSlider = document.getElementById('brightness-slider');
|
||||
const sysMaxBri = parseInt(brightnessSlider.max, 10);
|
||||
const percentage = Math.round((newBri / sysMaxBri) * 100);
|
||||
|
||||
// 立即更新 UI(不等待文件 IO)
|
||||
document.getElementById('brightness-display').textContent = percentage + '%';
|
||||
cachedCurrentBri = String(newBri);
|
||||
|
||||
// 直接写入文件,无防抖
|
||||
const cmd = `echo -n '${newBri}' > '${NOW_BRI_FILE}' 2>/dev/null && echo 'OK'`;
|
||||
const res = await runCmd(cmd);
|
||||
|
||||
if (!(res.errno === 0 && res.stdout.includes('OK'))) {
|
||||
showToast('亮度设置失败,已恢复');
|
||||
await loadStatus(true); // 恢复旧值
|
||||
}
|
||||
} catch (error) {
|
||||
showToast('设置亮度出错: ' + error.message);
|
||||
await loadStatus(true);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleAutoBrightnessToggle(e) {
|
||||
try {
|
||||
const mode = e.target.checked ? 1 : 0;
|
||||
const cmd = `settings put system screen_brightness_mode ${mode}`;
|
||||
const res = await runCmd(cmd);
|
||||
|
||||
if (res.errno === 0) {
|
||||
const msg = mode === 1 ? '自动亮度已启用' : '手动亮度已启用';
|
||||
showToast(msg);
|
||||
} else {
|
||||
showToast('设置失败: ' + (res.stderr || '未知错误'));
|
||||
e.target.checked = !e.target.checked; // 恢复旧值
|
||||
}
|
||||
} catch (error) {
|
||||
showToast('设置自动亮度出错: ' + error.message);
|
||||
e.target.checked = !e.target.checked;
|
||||
}
|
||||
}
|
||||
|
||||
// 保存所有原始日志内容
|
||||
let fullLogContent = '';
|
||||
|
||||
async function applyLogFilter() {
|
||||
// 快速应用日志筛选,不重新读取文件
|
||||
const logEl = document.getElementById('log-output');
|
||||
const filterLevel = document.getElementById('log-level-filter').value;
|
||||
|
||||
if (!fullLogContent) {
|
||||
logEl.textContent = '暂无日志';
|
||||
return;
|
||||
}
|
||||
|
||||
let displayLog = fullLogContent;
|
||||
if (filterLevel) {
|
||||
const lines = fullLogContent.split('\n');
|
||||
const filteredLines = lines.filter(line => line.includes(`[${filterLevel}]`));
|
||||
displayLog = filteredLines.length > 0 ? filteredLines.join('\n') : `暂无 [${filterLevel}] 等级的日志`;
|
||||
}
|
||||
|
||||
if (logEl.textContent !== displayLog) {
|
||||
logEl.textContent = displayLog;
|
||||
logEl.scrollTop = logEl.scrollHeight;
|
||||
}
|
||||
}
|
||||
|
||||
async function loadLogs() {
|
||||
|
||||
// 读取最后 50 行日志
|
||||
const res = await runCmd(`tail -n 50 "${LOG_FILE}"`);
|
||||
if (res.errno === 0) {
|
||||
const rawLog = res.stdout.trim() || '暂无日志';
|
||||
fullLogContent = rawLog;
|
||||
|
||||
// 应用筛选
|
||||
await applyLogFilter();
|
||||
}
|
||||
}
|
||||
|
||||
let clearLogsConfirming = false;
|
||||
let clearLogsTimer = null;
|
||||
|
||||
async function handleClearLogs() {
|
||||
const btn = document.getElementById('btn-clear-logs');
|
||||
|
||||
if (!clearLogsConfirming) {
|
||||
// 进入确认状态
|
||||
clearLogsConfirming = true;
|
||||
btn.textContent = '确认清空';
|
||||
btn.classList.add('btn-danger');
|
||||
|
||||
// 5秒后自动重置回原来状态
|
||||
clearLogsTimer = setTimeout(() => {
|
||||
clearLogsConfirming = false;
|
||||
btn.textContent = '清空日志';
|
||||
btn.classList.remove('btn-danger');
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
// 执行清空动作
|
||||
clearLogsConfirming = false;
|
||||
btn.textContent = '清空日志';
|
||||
btn.classList.remove('btn-danger');
|
||||
clearTimeout(clearLogsTimer);
|
||||
|
||||
showToast('正在清空日志...');
|
||||
const res = await runCmd(`> "${LOG_FILE}"`);
|
||||
|
||||
if (res.errno === 0) {
|
||||
fullLogContent = '';
|
||||
showToast('日志已清空');
|
||||
await loadLogs(); // 刷新显示
|
||||
} else {
|
||||
showToast('清空失败: ' + (res.stderr || '未知错误'));
|
||||
}
|
||||
}
|
||||
|
||||
// 自动刷新循环
|
||||
function stopAutoRefresh() {
|
||||
if (autoRefreshStatusLogTimer) {
|
||||
clearTimeout(autoRefreshStatusLogTimer);
|
||||
autoRefreshStatusLogTimer = null;
|
||||
}
|
||||
if (autoRefreshConfigTimer) {
|
||||
clearTimeout(autoRefreshConfigTimer);
|
||||
autoRefreshConfigTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
async function startAutoRefreshStatusLog() {
|
||||
try {
|
||||
await Promise.all([loadStatus(), loadLogs()]);
|
||||
} catch (error) {
|
||||
console.error('Error refreshing status/logs:', error);
|
||||
}
|
||||
autoRefreshStatusLogTimer = setTimeout(startAutoRefreshStatusLog, statusLogRefreshInterval);
|
||||
}
|
||||
|
||||
async function startAutoRefreshConfig() {
|
||||
try {
|
||||
// 刷新配置相关卡片 (这里可以添加配置相关的刷新逻辑)
|
||||
// 目前配置不需要定时读取,但保留这个函数以便后续扩展
|
||||
} catch (error) {
|
||||
console.error('Error refreshing config:', error);
|
||||
}
|
||||
autoRefreshConfigTimer = setTimeout(startAutoRefreshConfig, configRefreshInterval);
|
||||
}
|
||||
|
||||
async function startAutoRefresh() {
|
||||
// 立即执行一次状态/日志刷新
|
||||
await Promise.all([loadStatus(true), loadLogs()]);
|
||||
|
||||
// 启动定时刷新
|
||||
autoRefreshStatusLogTimer = setTimeout(startAutoRefreshStatusLog, statusLogRefreshInterval);
|
||||
autoRefreshConfigTimer = setTimeout(startAutoRefreshConfig, configRefreshInterval);
|
||||
}
|
||||
|
||||
// ==========================
|
||||
// 初始化
|
||||
// ==========================
|
||||
|
||||
// 底栏导航逻辑
|
||||
function setupNavbar() {
|
||||
const navbarBtns = document.querySelectorAll('.navbar-btn');
|
||||
const sections = document.querySelectorAll('.card');
|
||||
const navbarSlider = document.querySelector('.navbar-slider');
|
||||
let sliderFixedWidth = 0; // 固定滑块宽度
|
||||
|
||||
// 更新滑块位置
|
||||
function updateSliderPosition(activeBtn) {
|
||||
if (!navbarSlider || !activeBtn) return;
|
||||
|
||||
const navbarRect = activeBtn.closest('.floating-navbar').getBoundingClientRect();
|
||||
const btnRect = activeBtn.getBoundingClientRect();
|
||||
|
||||
const sliderLeft = btnRect.left - navbarRect.left;
|
||||
|
||||
// 首次设置固定宽度
|
||||
if (sliderFixedWidth === 0) {
|
||||
sliderFixedWidth = btnRect.width;
|
||||
navbarSlider.style.width = sliderFixedWidth + 'px';
|
||||
}
|
||||
|
||||
navbarSlider.style.left = sliderLeft + 'px';
|
||||
}
|
||||
|
||||
// 根据分组显示卡片
|
||||
function showGroup(groupName) {
|
||||
sections.forEach(section => {
|
||||
const sectionGroup = section.getAttribute('data-nav-group');
|
||||
section.style.display = sectionGroup === groupName ? 'block' : 'none';
|
||||
});
|
||||
}
|
||||
|
||||
// 设置按钮状态
|
||||
function setActiveBtn(btn) {
|
||||
navbarBtns.forEach(b => b.classList.remove('active'));
|
||||
btn.classList.add('active');
|
||||
updateSliderPosition(btn);
|
||||
}
|
||||
|
||||
// 为每个按钮添加点击监听
|
||||
navbarBtns.forEach(btn => {
|
||||
btn.addEventListener('click', () => {
|
||||
const groupName = btn.getAttribute('data-section');
|
||||
showGroup(groupName);
|
||||
setActiveBtn(btn);
|
||||
});
|
||||
});
|
||||
|
||||
// 初始化:显示第一个分组
|
||||
if (navbarBtns.length > 0) {
|
||||
const firstGroup = navbarBtns[0].getAttribute('data-section');
|
||||
showGroup(firstGroup);
|
||||
updateSliderPosition(navbarBtns[0]);
|
||||
}
|
||||
|
||||
// 监听窗口大小变化以更新滑块位置
|
||||
window.addEventListener('resize', () => {
|
||||
const activeBtn = document.querySelector('.navbar-btn.active');
|
||||
if (activeBtn) updateSliderPosition(activeBtn);
|
||||
});
|
||||
}
|
||||
|
||||
async function init() {
|
||||
|
||||
// 初始化 Lucide 图标
|
||||
createIcons({
|
||||
icons: {
|
||||
Sun,
|
||||
Settings,
|
||||
Save,
|
||||
Activity,
|
||||
RefreshCw,
|
||||
FileText
|
||||
}
|
||||
});
|
||||
|
||||
// 初始化底栏导航
|
||||
setupNavbar();
|
||||
|
||||
// 绑定事件
|
||||
document.getElementById('btn-refresh-status').addEventListener('click', async () => {
|
||||
showToast('刷新状态...');
|
||||
await loadStatus(true);
|
||||
});
|
||||
document.getElementById('btn-save').addEventListener('click', saveConfig);
|
||||
document.getElementById('btn-save-advanced').addEventListener('click', saveAdvancedConfig);
|
||||
document.getElementById('btn-save-webui-config').addEventListener('click', saveWebUIConfig);
|
||||
document.getElementById('btn-reset').addEventListener('click', handleReset);
|
||||
document.getElementById('btn-toggle-service').addEventListener('click', toggleService);
|
||||
document.getElementById('btn-restart-service').addEventListener('click', restartService);
|
||||
|
||||
// 绑定亮度和自动亮度控件事件
|
||||
const brightnessSlider = document.getElementById('brightness-slider');
|
||||
const autoBrightnessToggle = document.getElementById('auto-brightness-toggle');
|
||||
|
||||
if (brightnessSlider) {
|
||||
brightnessSlider.addEventListener('input', handleBrightnessChange);
|
||||
}
|
||||
|
||||
if (autoBrightnessToggle) {
|
||||
autoBrightnessToggle.addEventListener('change', handleAutoBrightnessToggle);
|
||||
}
|
||||
|
||||
// 绑定日志控件事件
|
||||
const logLevelFilter = document.getElementById('log-level-filter');
|
||||
const btnClearLogs = document.getElementById('btn-clear-logs');
|
||||
|
||||
if (logLevelFilter) {
|
||||
logLevelFilter.addEventListener('change', async () => {
|
||||
await applyLogFilter(); // 改变筛选等级时应用筛选
|
||||
});
|
||||
}
|
||||
|
||||
if (btnClearLogs) {
|
||||
btnClearLogs.addEventListener('click', handleClearLogs);
|
||||
}
|
||||
|
||||
// 绑定查看支持事件按钮
|
||||
const btnInotifyHelp = document.getElementById('btn-view-inotifyd-help');
|
||||
if (btnInotifyHelp) {
|
||||
btnInotifyHelp.addEventListener('click', async () => {
|
||||
showToast('获取中...');
|
||||
const res = await runCmd('inotifyd --help');
|
||||
const output = (res.stderr || '') + (res.stdout || '');
|
||||
if (output) {
|
||||
alert(output.trim());
|
||||
} else {
|
||||
alert('无法获取该命令的帮助信息。');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 定时休眠折叠逻辑
|
||||
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');
|
||||
}
|
||||
});
|
||||
|
||||
// Textarea 自适应高度
|
||||
document.querySelectorAll('.config-textarea').forEach(textarea => {
|
||||
const autoResize = () => {
|
||||
textarea.style.height = 'auto';
|
||||
textarea.style.height = Math.min(textarea.scrollHeight, 300) + 'px';
|
||||
};
|
||||
textarea.addEventListener('input', autoResize);
|
||||
textarea.addEventListener('change', autoResize);
|
||||
// 初始加载时调整高度
|
||||
setTimeout(autoResize, 0);
|
||||
});
|
||||
|
||||
// 初次加载配置
|
||||
await loadConfig();
|
||||
// 开启自动刷新状态和日志 (内置了已包含 loadStatus 和 loadLogs)
|
||||
startAutoRefresh();
|
||||
}
|
||||
|
||||
// DOM 加载完成后运行
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
@@ -41,6 +41,16 @@
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
/* 隐藏所有滚动条 */
|
||||
html {
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE/Edge */
|
||||
}
|
||||
|
||||
html::-webkit-scrollbar {
|
||||
display: none; /* Chrome, Safari */
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
@@ -51,10 +61,17 @@ body {
|
||||
color: var(--md-sys-color-on-background);
|
||||
font-family: 'Geist', system-ui, -apple-system, sans-serif;
|
||||
line-height: 1.5;
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE/Edge */
|
||||
}
|
||||
|
||||
body::-webkit-scrollbar {
|
||||
display: none; /* Chrome, Safari */
|
||||
}
|
||||
|
||||
#app {
|
||||
padding: var(--spacing-m);
|
||||
padding: 20px;
|
||||
padding-bottom: calc(20px + 80px);
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
@@ -67,54 +84,107 @@ body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: var(--spacing-m) 0;
|
||||
padding: 20px 20px;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-m);
|
||||
gap: 16px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.header-icon {
|
||||
font-size: 2rem;
|
||||
background: var(--md-sys-color-surface-container-high);
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
font-size: 2.5rem;
|
||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.header-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.header-text h1 {
|
||||
margin: 0;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 500;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--md-sys-color-on-background);
|
||||
letter-spacing: -0.3px;
|
||||
}
|
||||
|
||||
.header-subtitle {
|
||||
margin: 0;
|
||||
font-size: 0.875rem;
|
||||
font-size: 0.9rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.header-version {
|
||||
margin: 0;
|
||||
font-size: 0.75rem;
|
||||
color: var(--md-sys-color-primary);
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.header-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: var(--md-sys-color-surface-container);
|
||||
padding: 4px 12px;
|
||||
border-radius: 100px;
|
||||
gap: 8px;
|
||||
background: var(--md-sys-color-surface-container-high);
|
||||
padding: 8px 16px;
|
||||
border-radius: 12px;
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-weight: 500;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.08);
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--md-sys-color-error); /* 默认离线红色,在线动态改为绿色 #4caf50 */
|
||||
background-color: var(--md-sys-color-error);
|
||||
box-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
|
||||
animation: status-pulse 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes status-pulse {
|
||||
0%, 100% {
|
||||
box-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 12px rgba(244, 67, 54, 0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes status-pulse-green {
|
||||
0%, 100% {
|
||||
box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 12px rgba(76, 175, 80, 0.8);
|
||||
}
|
||||
}
|
||||
|
||||
.header-status.status-running .status-dot {
|
||||
animation: status-pulse-green 2s infinite;
|
||||
}
|
||||
|
||||
.header-status.status-paused .status-dot,
|
||||
.header-status.status-loading .status-dot {
|
||||
animation: status-pulse 2s infinite;
|
||||
}
|
||||
|
||||
/* Cards */
|
||||
@@ -123,6 +193,13 @@ body {
|
||||
border-radius: var(--border-radius-m);
|
||||
padding: var(--spacing-l);
|
||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#log-section {
|
||||
flex: 1;
|
||||
min-height: calc(100vh - 220px);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
@@ -163,6 +240,17 @@ body {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#advanced-section .config-item {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#advanced-section .config-value {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.config-item + .config-item {
|
||||
margin-top: var(--spacing-m);
|
||||
}
|
||||
@@ -196,6 +284,33 @@ body {
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
#advanced-section .config-input {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.config-textarea {
|
||||
width: 100%;
|
||||
min-height: 60px;
|
||||
max-height: 300px;
|
||||
padding: 8px 12px;
|
||||
font-family: 'Geist', system-ui, monospace;
|
||||
font-size: 0.875rem;
|
||||
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);
|
||||
resize: vertical;
|
||||
line-height: 1.4;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.config-textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.3);
|
||||
}
|
||||
|
||||
.config-input:focus {
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.3);
|
||||
@@ -338,6 +453,138 @@ input:checked + .slider:before {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* Brightness Section */
|
||||
.brightness-section {
|
||||
margin-top: var(--spacing-l);
|
||||
padding: var(--spacing-m);
|
||||
background: linear-gradient(135deg, var(--md-sys-color-surface-container-high) 0%, var(--md-sys-color-surface-container) 100%);
|
||||
border-radius: var(--border-radius-m);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
}
|
||||
|
||||
.brightness-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: var(--spacing-m);
|
||||
}
|
||||
|
||||
.brightness-title {
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.brightness-percent {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
color: var(--md-sys-color-primary);
|
||||
min-width: 50px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Brightness Slider Container */
|
||||
.brightness-container {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: var(--spacing-m);
|
||||
padding: var(--spacing-s) 0;
|
||||
}
|
||||
|
||||
.brightness-label {
|
||||
font-size: 0.75rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
min-width: 24px;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Brightness Slider */
|
||||
.brightness-slider {
|
||||
flex: 1;
|
||||
height: 8px;
|
||||
border-radius: 4px;
|
||||
background: var(--md-sys-color-surface-container);
|
||||
outline: none;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
cursor: grab;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.brightness-slider:hover {
|
||||
height: 10px;
|
||||
box-shadow: 0 0 8px rgba(168, 199, 250, 0.3);
|
||||
}
|
||||
|
||||
.brightness-slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
background: var(--md-sys-color-primary);
|
||||
cursor: grab;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
||||
transition: all 0.2s;
|
||||
border: 2px solid var(--md-sys-color-surface);
|
||||
}
|
||||
|
||||
.brightness-slider::-webkit-slider-thumb:hover {
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.brightness-slider::-webkit-slider-thumb:active {
|
||||
cursor: grabbing;
|
||||
box-shadow: 0 0 0 10px rgba(168, 199, 250, 0.2);
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-thumb {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
background: var(--md-sys-color-primary);
|
||||
cursor: grab;
|
||||
border: 2px solid var(--md-sys-color-surface);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-thumb:hover {
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-thumb:active {
|
||||
cursor: grabbing;
|
||||
box-shadow: 0 0 0 10px rgba(168, 199, 250, 0.2);
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-track {
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Auto Brightness Row */
|
||||
.auto-brightness-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: var(--spacing-s) var(--spacing-m);
|
||||
background-color: rgba(168, 199, 250, 0.08);
|
||||
border-radius: var(--border-radius-s);
|
||||
}
|
||||
|
||||
.auto-brightness-label {
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
.card-actions {
|
||||
display: flex;
|
||||
@@ -445,11 +692,41 @@ input:checked + .slider:before {
|
||||
font-size: 0.75rem;
|
||||
padding: var(--spacing-s);
|
||||
border-radius: var(--border-radius-s);
|
||||
height: 200px;
|
||||
flex: 1;
|
||||
min-height: 300px;
|
||||
overflow-y: auto;
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE/Edge */
|
||||
}
|
||||
|
||||
.log-filter-select {
|
||||
padding: 4px 10px;
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: var(--border-radius-s);
|
||||
background-color: var(--md-sys-color-surface);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-family: inherit;
|
||||
font-size: 0.75rem;
|
||||
height: 28px;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.log-filter-select:hover {
|
||||
border-color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.log-filter-select:focus {
|
||||
outline: none;
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
|
||||
}
|
||||
|
||||
.log-output::-webkit-scrollbar {
|
||||
display: none; /* Chrome, Safari */
|
||||
}
|
||||
|
||||
/* Simple Toast */
|
||||
@@ -474,3 +751,70 @@ input:checked + .slider:before {
|
||||
.toast.show {
|
||||
transform: translateX(-50%) translateY(0);
|
||||
}
|
||||
|
||||
/* Floating Navigation Bar */
|
||||
.floating-navbar {
|
||||
position: fixed;
|
||||
bottom: 16px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
backdrop-filter: blur(10px);
|
||||
padding: 12px 20px;
|
||||
border-radius: 28px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.2);
|
||||
z-index: 999;
|
||||
width: fit-content;
|
||||
max-width: calc(100% - 32px);
|
||||
}
|
||||
|
||||
.navbar-slider {
|
||||
position: absolute;
|
||||
height: 32px;
|
||||
border-radius: 12px;
|
||||
background-color: rgba(var(--md-sys-color-primary-rgb, 103, 58, 183), 0.2);
|
||||
border: 1px solid rgba(var(--md-sys-color-primary-rgb, 103, 58, 183), 0.3);
|
||||
transition: left 0.35s ease-out, width 0.35s ease-out, background-color 0.35s ease-out, box-shadow 0.35s ease-out;
|
||||
pointer-events: none;
|
||||
z-index: -1;
|
||||
box-shadow: inset 0 2px 4px rgba(var(--md-sys-color-primary-rgb, 103, 58, 183), 0.15), 0 1px 3px rgba(var(--md-sys-color-primary-rgb, 103, 58, 183), 0.1);
|
||||
}
|
||||
|
||||
.navbar-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
padding: 10px 20px;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 0.75rem;
|
||||
cursor: pointer;
|
||||
border-radius: 8px;
|
||||
transition: all 0.2s ease;
|
||||
flex: 1;
|
||||
max-width: 90px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.navbar-btn i {
|
||||
font-size: 1.25rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.navbar-btn:active {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
}
|
||||
|
||||
.navbar-btn.active {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: 'webroot',
|
||||
outDir: '../webroot',
|
||||
emptyOutDir: true,
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user