mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
Compare commits
No files matched your search
@@ -0,0 +1,8 @@
|
||||
b1ac7dab449904d761b64b59192b217387ca5ab8b9a36a581c257078c36d8032 action.sh
|
||||
6bc62f25981328edd3cfcfe6fe51b073f2d7e7710d7ef7fcdac28d4e384fc3d4 bin/jq
|
||||
0c2d380d5171449802d1dc62ffa312c0ff9a41c73216c1159324a85705d02f0e boost.sh
|
||||
8b3080197fa7ac3511717d901f509327e9a3e7db1de61d660f83f9ebf55913fd customize.sh
|
||||
397ae139ce6f759828a3ebf1e9469d804ce5dabb06039271c65942990c06cbb0 script/daemon.sh
|
||||
dba55a38466598334b47d19b720aec5402988333e1565668066c6a585be0d4ce script/restart.sh
|
||||
077d25cae2d464ae4b131faa41a298a1eecbd695f13218d91679a74523bf9fee script/up.sh
|
||||
d84d1fe9c69feaf94055eda18cdc12695b3191071ae0931e82ebf36bcd3e3400 service.sh
|
||||
@@ -3,46 +3,42 @@
|
||||
|
||||
# LuminPro 手动提升/恢复亮度触发脚本
|
||||
|
||||
# 解析模块工作目录
|
||||
MODDIR="$(dirname "$(readlink -f "$0")")"
|
||||
CONFIG_DIR="$MODDIR/config"
|
||||
PATH_CONFIG_DIR="$CONFIG_DIR/path"
|
||||
CONFIG_FILE="$MODDIR/config/config.json"
|
||||
JQ="$MODDIR/bin/jq"
|
||||
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"
|
||||
get_cfg() {
|
||||
local key="$1" default="$2"
|
||||
local val
|
||||
if val=$("$JQ" -re ".${key}" "$CONFIG_FILE" 2>/dev/null); then
|
||||
echo "$val"
|
||||
else
|
||||
echo "$default"
|
||||
fi
|
||||
}
|
||||
|
||||
now_bri_file="$(get_cfg 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
|
||||
[ -n "$restore_bri" ] && echo -n "$restore_bri" >"$now_bri_file" 2>/dev/null
|
||||
rm -f "$BOOST_FLAG"
|
||||
else
|
||||
max_bri="$(cat "$CONFIG_DIR/max_bri.txt" 2>/dev/null | tr -d ' \n')"
|
||||
if [ -z "$max_bri" ]; then
|
||||
max_bri="$(get_cfg max_bri '')"
|
||||
if [ -z "$max_bri" ] || [ "$max_bri" = "0" ]; 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
|
||||
|
||||
|
||||
+49
-4
@@ -1,4 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import crypto from 'crypto';
|
||||
import archiver from 'archiver';
|
||||
|
||||
// 读取版本信息用以命名
|
||||
@@ -10,7 +12,7 @@ const version = versionMatch ? versionMatch[1].trim() : 'Unknown';
|
||||
const versionCodeStr = versionCodeMatch ? versionCodeMatch[1].trim() : '0000';
|
||||
const versionCode = parseInt(versionCodeStr, 10);
|
||||
|
||||
const zipName = `LuminPro_${version}-${versionCode}.zip`;
|
||||
const zipName = `LuminPro_${version}.zip`;
|
||||
|
||||
// --- 新增: 自动同步 update.json ---
|
||||
const updateJsonPath = 'update.json';
|
||||
@@ -21,15 +23,13 @@ if (fs.existsSync(updateJsonPath)) {
|
||||
updateJson.version = version;
|
||||
updateJson.zipUrl = `https://share.yule.ink/magisk/mod/luminpro/module/${zipName}`;
|
||||
fs.writeFileSync(updateJsonPath, JSON.stringify(updateJson, null, 4), 'utf-8');
|
||||
console.log(`>>> [1/2] 已同步 update.json (版本: ${version}, Code: ${versionCode})`);
|
||||
console.log(`>>> [1/3] 已同步 update.json (版本: ${version}, Code: ${versionCode})`);
|
||||
} catch (e) {
|
||||
console.error(`[错误] 无法更新 update.json: ${e.message}`);
|
||||
}
|
||||
}
|
||||
// ---------------------------------
|
||||
|
||||
console.log(`\n>>> [2/2] 创建模块 ZIP 压缩包...`);
|
||||
|
||||
// 明确需要忽略的文件清单
|
||||
const excludes = [
|
||||
'docs',
|
||||
@@ -46,6 +46,35 @@ const excludes = [
|
||||
zipName
|
||||
];
|
||||
|
||||
console.log(`\n>>> [2/3] 生成 SHA256SUMS...`);
|
||||
|
||||
// 计算可执行文件(所有 .sh 脚本 + bin/ 二进制)的 SHA256
|
||||
function sha256File(filePath) {
|
||||
return crypto.createHash('sha256').update(fs.readFileSync(filePath)).digest('hex');
|
||||
}
|
||||
|
||||
function collectExecutables(dir, baseDir = dir) {
|
||||
const results = [];
|
||||
for (const dirent of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
const full = path.join(dir, dirent.name);
|
||||
const rel = path.relative(baseDir, full).replace(/\\/g, '/');
|
||||
if (dirent.isDirectory()) {
|
||||
results.push(...collectExecutables(full, baseDir));
|
||||
} else if (dirent.name.endsWith('.sh') || dir.endsWith('bin')) {
|
||||
results.push(rel);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
const execFiles = collectExecutables('.').filter(f => !excludes.some(e => f.startsWith(e)));
|
||||
const sha256Lines = execFiles.sort().map(f => `${sha256File(f)} ${f}`);
|
||||
const sha256SumsPath = 'SHA256SUMS';
|
||||
fs.writeFileSync(sha256SumsPath, sha256Lines.join('\n') + '\n', 'utf-8');
|
||||
console.log(`已生成 ${sha256Lines.length} 条记录:\n${sha256Lines.join('\n')}`);
|
||||
|
||||
console.log(`\n>>> [3/3] 创建模块 ZIP 压缩包...`);
|
||||
|
||||
// 初始化归档器
|
||||
const output = fs.createWriteStream(zipName);
|
||||
const archive = archiver('zip', {
|
||||
@@ -73,6 +102,22 @@ archive.on('error', function (err) {
|
||||
|
||||
archive.pipe(output);
|
||||
|
||||
// 将所有 .sh 文件统一转换为 LF 换行符,防止 Windows 环境写入 CRLF 导致 ash 报错
|
||||
function fixLineEndings(dir) {
|
||||
for (const dirent of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
const full = path.join(dir, dirent.name);
|
||||
if (dirent.isDirectory() && !excludes.includes(dirent.name)) {
|
||||
fixLineEndings(full);
|
||||
} else if (dirent.name.endsWith('.sh')) {
|
||||
const content = fs.readFileSync(full, 'utf8');
|
||||
if (content.includes('\r\n')) {
|
||||
fs.writeFileSync(full, content.replace(/\r\n/g, '\n'), 'utf8');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fixLineEndings('.');
|
||||
|
||||
// 将没在排除列表里的文件打进去
|
||||
const dirContents = fs.readdirSync('.', { withFileTypes: true });
|
||||
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
## v2.2-2208
|
||||
|
||||
- 新增: 黑名单功能,可在指定应用内禁止模块工作
|
||||
- 新增: Web UI 日志导出、复制功能
|
||||
- 优化: Web UI 外观
|
||||
- 优化: 日志信息
|
||||
|
||||
## V2.2-2204
|
||||
|
||||
- 新增: `boost.sh` 脚本,支持一键将亮度提升至峰值极限
|
||||
- 新增: 对于部分设备,支持在刷入时建议更改配置文件以适配
|
||||
- 新增: inotifyd 的进程守护脚本,确保 inotifyd 进程的稳定性
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
1
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ui_max_bri": 0,
|
||||
"max_bri": 0,
|
||||
"steps_num": 50,
|
||||
"log_max_size": 512,
|
||||
"auto_bri_sleep": 1,
|
||||
"display_hdr_sleep": 0,
|
||||
"sleep_time": "",
|
||||
"inotify_events": "c",
|
||||
"now_bri_file": "/sys/class/backlight/panel0-backlight/brightness",
|
||||
"max_bri_file": "/sys/class/backlight/panel0-backlight/max_brightness",
|
||||
"blacklist_apps": []
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
512
|
||||
Whitespace-only changes.
@@ -1 +0,0 @@
|
||||
/sys/class/backlight/panel0-backlight/max_brightness
|
||||
@@ -1 +0,0 @@
|
||||
/sys/class/backlight/panel0-backlight/brightness
|
||||
Whitespace-only changes.
@@ -1 +0,0 @@
|
||||
50
|
||||
Whitespace-only changes.
+308
-279
@@ -1,134 +1,117 @@
|
||||
#!/system/bin/sh
|
||||
#shellcheck shell=ash
|
||||
|
||||
# 默认设备路径(如果路径配置不存在)
|
||||
# ==========================
|
||||
# ARM64 架构检查
|
||||
# ==========================
|
||||
ARCH=$(getprop ro.product.cpu.abi)
|
||||
if [ "$ARCH" != "arm64-v8a" ]; then
|
||||
ui_print "********************************"
|
||||
ui_print " 本模块仅支持 ARM64 设备!"
|
||||
ui_print " 当前架构: $ARCH"
|
||||
ui_print "********************************"
|
||||
abort "不支持的架构: $ARCH"
|
||||
fi
|
||||
|
||||
# 默认设备路径
|
||||
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"
|
||||
# jq 二进制(已随模块提取)
|
||||
JQ="$MODPATH/bin/jq"
|
||||
CONFIG_FILE="$mod_config/config.json"
|
||||
|
||||
mkdir -p "$mod_config"
|
||||
chmod 755 "$JQ" 2>/dev/null
|
||||
|
||||
# ==========================
|
||||
# 配置读取函数
|
||||
# 工具函数
|
||||
# ==========================
|
||||
# 优先读取旧配置,其次读取默认配置
|
||||
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] 找到亮度节点文件"
|
||||
# 从当前 config.json 读取字段值
|
||||
cfg_get() {
|
||||
local key="$1" default="$2"
|
||||
local val
|
||||
if val=$("$JQ" -re ".${key}" "$CONFIG_FILE" 2>/dev/null); then
|
||||
echo "$val"
|
||||
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] 安装中止:无法找到设备亮度节点"
|
||||
echo "$default"
|
||||
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() {
|
||||
local choose
|
||||
local branch
|
||||
# 从旧 txt 文件读取值(迁移用)
|
||||
read_old_txt() {
|
||||
local file="$old_config/$1"
|
||||
local default="$2"
|
||||
if [ -f "$file" ]; then
|
||||
local val
|
||||
val="$(cat "$file" 2>/dev/null | tr -d ' \n')"
|
||||
[ -n "$val" ] && echo "$val" || echo "$default"
|
||||
else
|
||||
echo "$default"
|
||||
fi
|
||||
}
|
||||
|
||||
# 用 cfg_* 变量写入 config.json
|
||||
write_config_json() {
|
||||
"$JQ" -n \
|
||||
--arg ui_max_bri "${cfg_ui_max_bri:-0}" \
|
||||
--arg max_bri "${cfg_max_bri:-0}" \
|
||||
--arg steps_num "${cfg_steps_num:-50}" \
|
||||
--arg log_max_size "${cfg_log_max_size:-512}" \
|
||||
--arg auto_bri_sleep "${cfg_auto_bri_sleep:-1}" \
|
||||
--arg display_hdr_sleep "${cfg_display_hdr_sleep:-0}" \
|
||||
--arg sleep_time "${cfg_sleep_time:-}" \
|
||||
--arg inotify_events "${cfg_inotify_events:-c}" \
|
||||
--arg now_bri_file "${cfg_now_bri_file:-$DEFAULT_NOW_BRI_FILE}" \
|
||||
--arg max_bri_file "${cfg_max_bri_file:-$DEFAULT_MAX_BRI_FILE}" \
|
||||
--argjson blacklist_apps "${cfg_blacklist_apps:-[]}" \
|
||||
'{
|
||||
ui_max_bri: ($ui_max_bri | tonumber),
|
||||
max_bri: ($max_bri | tonumber),
|
||||
steps_num: ($steps_num | tonumber),
|
||||
log_max_size: ($log_max_size | tonumber),
|
||||
auto_bri_sleep: ($auto_bri_sleep | tonumber),
|
||||
display_hdr_sleep: ($display_hdr_sleep | tonumber),
|
||||
sleep_time: $sleep_time,
|
||||
inotify_events: $inotify_events,
|
||||
now_bri_file: $now_bri_file,
|
||||
max_bri_file: $max_bri_file,
|
||||
blacklist_apps: $blacklist_apps
|
||||
}' >"$CONFIG_FILE"
|
||||
}
|
||||
|
||||
# ==========================
|
||||
# 安装流程函数
|
||||
# ==========================
|
||||
|
||||
btn() {
|
||||
while :; do
|
||||
choose="$(getevent -qlc 1 | awk '{ print $3 }')"
|
||||
case "$choose" in
|
||||
KEY_VOLUMEUP) branch="0" ;;
|
||||
KEY_VOLUMEDOWN) branch="1" ;;
|
||||
*) continue ;;
|
||||
local c
|
||||
c="$(getevent -qlc 1 | awk '{ print $3 }')"
|
||||
case "$c" in
|
||||
KEY_VOLUMEUP)
|
||||
echo "0"
|
||||
return
|
||||
;;
|
||||
KEY_VOLUMEDOWN)
|
||||
echo "1"
|
||||
return
|
||||
;;
|
||||
esac
|
||||
echo "$branch"
|
||||
break
|
||||
done
|
||||
}
|
||||
|
||||
# 注意事项
|
||||
SHOW_CHANGELOG() {
|
||||
local changelog_file="$MODPATH/changelog.md"
|
||||
if [ -f "$changelog_file" ]; then
|
||||
echo "========================================"
|
||||
echo "[*] 本次更新日志:"
|
||||
# 提取第一个二级标题及其内容,直到遇到下一个二级标题或文件结束
|
||||
# 使用更具兼容性的 awk 逻辑
|
||||
awk '/^## / { if (p) exit; p=1; print; next } p { print }' "$changelog_file"
|
||||
echo "========================================"
|
||||
fi
|
||||
local f="$MODPATH/changelog.md"
|
||||
[ -f "$f" ] || return
|
||||
echo "========================================"
|
||||
echo "[*] 本次更新日志:"
|
||||
awk '/^## / { if (p) exit; p=1; print; next } p { print }' "$f"
|
||||
echo "========================================"
|
||||
}
|
||||
|
||||
NOTE() {
|
||||
@@ -136,217 +119,193 @@ NOTE() {
|
||||
echo ""
|
||||
echo "[i] 按音量 + 进入下一步, 按音量 - 退出"
|
||||
echo "[i] 继续则表明你已理解并接受所有风险"
|
||||
[ "$(btn)" = "0" ] && echo "[OK] 已确认" || abort "[X] 已退出"
|
||||
}
|
||||
|
||||
if [ "$(button_listener)" = "0" ]; then
|
||||
echo "[OK] 已确认进入下一步"
|
||||
CHECK_FILES() {
|
||||
sleep 1
|
||||
now_bri_file="$(cfg_get now_bri_file "$DEFAULT_NOW_BRI_FILE")"
|
||||
max_bri_file="$(cfg_get max_bri_file "$DEFAULT_MAX_BRI_FILE")"
|
||||
|
||||
echo ""
|
||||
echo "[*] 正在验证设备亮度节点..."
|
||||
echo "- 当前亮度节点: $now_bri_file"
|
||||
echo "- 最大亮度节点: $max_bri_file"
|
||||
echo ""
|
||||
|
||||
if [ -f "$now_bri_file" ] && [ -f "$max_bri_file" ]; then
|
||||
echo "[OK] 找到亮度节点文件"
|
||||
else
|
||||
abort "[X] 已退出"
|
||||
[ ! -f "$now_bri_file" ] && echo "[X] 当前亮度节点不存在: $now_bri_file"
|
||||
[ ! -f "$max_bri_file" ] && echo "[X] 最大亮度节点不存在: $max_bri_file"
|
||||
echo ""
|
||||
echo "设备不支持默认路径,刷入后请通过 Web UI 手动配置亮度节点"
|
||||
echo "查找路径: find /sys -name '*brightness*' 2>/dev/null"
|
||||
abort "[X] 安装中止:无法找到设备亮度节点"
|
||||
fi
|
||||
|
||||
echo "[OK] 当前亮度: $(cat "$now_bri_file")"
|
||||
echo "[OK] 系统最大亮度: $(cat "$max_bri_file")"
|
||||
}
|
||||
|
||||
# 测试前台最大亮度
|
||||
TEST_UI_MAX_BRI() {
|
||||
echo ""
|
||||
echo "[*] 开始测试前台最大亮度"
|
||||
echo ""
|
||||
|
||||
sleep 1
|
||||
|
||||
echo "======== 请关闭自动亮度 ========"
|
||||
echo "[i] 按音量 + 进入下一步, 按音量 - 退出"
|
||||
[ "$(btn)" = "0" ] && echo "[OK] 已确认" || abort "[X] 已退出"
|
||||
|
||||
if [ "$(button_listener)" = "0" ]; then
|
||||
echo "[OK] 已确认进入下一步"
|
||||
else
|
||||
abort "[X] 已退出"
|
||||
fi
|
||||
|
||||
# 调整亮度前, 记录当前亮度用于之后恢复
|
||||
local restore_bri
|
||||
restore_bri="$(cat "$now_bri_file")"
|
||||
echo ""
|
||||
|
||||
sleep 1
|
||||
|
||||
echo "======== 请将屏幕亮度调至最大 ========"
|
||||
echo "[i] 按音量 + 进入下一步, 按音量 - 退出"
|
||||
[ "$(btn)" = "0" ] && echo "[OK] 已确认" || abort "[X] 已退出"
|
||||
|
||||
if [ "$(button_listener)" = "0" ]; then
|
||||
echo "[OK] 已确认进入下一步"
|
||||
else
|
||||
abort "[X] 已退出"
|
||||
fi
|
||||
local measured_ui measured_max
|
||||
measured_ui="$(cat "$now_bri_file")"
|
||||
measured_max="$(cat "$max_bri_file")"
|
||||
echo "[OK] 前台最大亮度: [ $measured_ui ]"
|
||||
echo "[i] 峰值最大亮度由节点文件获得: [ $measured_max ]"
|
||||
echo "[i] 若不符合预期,请稍后到 Web UI 更改"
|
||||
|
||||
ui_max_bri="$(cat "$now_bri_file")"
|
||||
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 "[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"
|
||||
# 写入 JSON
|
||||
"$JQ" ".ui_max_bri = ($measured_ui | tonumber) | .max_bri = ($measured_max | tonumber)" \
|
||||
"$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
|
||||
|
||||
echo ""
|
||||
echo "[OK] 测试完成"
|
||||
echo "[*] 正在为你恢复亮度..."
|
||||
echo "[*] 正在恢复亮度..."
|
||||
echo -n "$restore_bri" >"$now_bri_file"
|
||||
}
|
||||
|
||||
# 结束
|
||||
END() {
|
||||
echo ""
|
||||
sleep 1
|
||||
|
||||
# 读取最终配置
|
||||
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" "")"
|
||||
# 导入旧配置(支持 JSON 格式和旧 txt 格式)
|
||||
IMPORT_OLD_CONFIG() {
|
||||
# 1. 已有 JSON 格式
|
||||
if [ -f "$old_config/config.json" ]; then
|
||||
local old_ui
|
||||
old_ui=$("$JQ" -re '.ui_max_bri' "$old_config/config.json" 2>/dev/null || echo "0")
|
||||
if [ "${old_ui:-0}" -gt 0 ] 2>/dev/null; then
|
||||
echo ""
|
||||
sleep 1
|
||||
echo "[i] 检测到已有 JSON 配置:"
|
||||
echo " - 前台最大亮度: $old_ui"
|
||||
echo " - 峰值最大亮度: $("$JQ" -re '.max_bri' "$old_config/config.json" 2>/dev/null)"
|
||||
local old_st
|
||||
old_st=$("$JQ" -re '.sleep_time // empty' "$old_config/config.json" 2>/dev/null)
|
||||
[ -n "$old_st" ] && echo " - 休眠时间: $old_st"
|
||||
echo ""
|
||||
echo "[?] 按音量 + 沿用旧配置, 按音量 - 重新测试"
|
||||
if [ "$(btn)" = "0" ]; then
|
||||
cp -f "$old_config/config.json" "$CONFIG_FILE"
|
||||
# 若旧 JSON 缺少 blacklist_apps 字段,尝试从 blacklist_apps.txt 补入
|
||||
if ! "$JQ" -e '.blacklist_apps' "$CONFIG_FILE" >/dev/null 2>&1; then
|
||||
local bl_arr
|
||||
if [ -s "$old_config/blacklist_apps.txt" ]; then
|
||||
bl_arr=$("$JQ" -Rs 'split("\n") | map(select(length > 0))' \
|
||||
"$old_config/blacklist_apps.txt" 2>/dev/null || echo '[]')
|
||||
else
|
||||
bl_arr='[]'
|
||||
fi
|
||||
local tmp_cfg="$CONFIG_FILE.tmp"
|
||||
"$JQ" --argjson bl "$bl_arr" '. + {blacklist_apps: $bl}' \
|
||||
"$CONFIG_FILE" >"$tmp_cfg" && mv -f "$tmp_cfg" "$CONFIG_FILE"
|
||||
fi
|
||||
echo "[OK] 已导入 JSON 配置"
|
||||
return 0
|
||||
else
|
||||
echo "[*] 将重新测试"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
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
|
||||
exit 0
|
||||
}
|
||||
|
||||
# 导入旧配置
|
||||
IMPORT_OLD_CONFIG() {
|
||||
if [ -d "$old_config" ] &&
|
||||
[ -s "$old_config/ui_max_bri.txt" ] &&
|
||||
[ -s "$old_config/max_bri.txt" ]; then
|
||||
|
||||
# 2. 旧 txt 格式迁移
|
||||
if [ -d "$old_config" ] && [ -s "$old_config/ui_max_bri.txt" ] && [ -s "$old_config/max_bri.txt" ]; then
|
||||
echo ""
|
||||
sleep 1
|
||||
echo "[i] 检测到已有配置:"
|
||||
echo "[i] 检测到旧格式配置,将迁移至 JSON:"
|
||||
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")"
|
||||
fi
|
||||
if [ -s "$old_config/auto_bri_sleep.txt" ]; then
|
||||
echo " - 自动亮度时休眠: $(cat "$old_config/auto_bri_sleep.txt" | sed 's/1/开启/;s/0/关闭/')"
|
||||
fi
|
||||
if [ -s "$old_config/steps_num.txt" ]; then
|
||||
echo " - 亮度提升步数: $(cat "$old_config/steps_num.txt")"
|
||||
fi
|
||||
if [ -s "$old_config/log_max_size.txt" ]; then
|
||||
echo " - 日志大小限制: $(cat "$old_config/log_max_size.txt") KB"
|
||||
fi
|
||||
[ -s "$old_config/sleep_time.txt" ] && echo " - 休眠时间: $(cat "$old_config/sleep_time.txt")"
|
||||
[ -s "$old_config/auto_bri_sleep.txt" ] && echo " - 自动亮度时休眠: $(cat "$old_config/auto_bri_sleep.txt" | sed 's/1/开启/;s/0/关闭/')"
|
||||
[ -s "$old_config/steps_num.txt" ] && echo " - 亮度步数: $(cat "$old_config/steps_num.txt")"
|
||||
[ -s "$old_config/log_max_size.txt" ] && echo " - 日志限制: $(cat "$old_config/log_max_size.txt") KB"
|
||||
[ -s "$old_config/blacklist_apps.txt" ] && echo " - 黑名单: $(wc -l <"$old_config/blacklist_apps.txt" | tr -d ' ') 个"
|
||||
echo ""
|
||||
echo "[?] 按音量 + 沿用旧配置, 按音量 - 重新测试"
|
||||
if [ "$(btn)" = "0" ]; then
|
||||
cfg_ui_max_bri="$(read_old_txt ui_max_bri.txt '0')"
|
||||
cfg_max_bri="$(read_old_txt max_bri.txt '0')"
|
||||
cfg_steps_num="$(read_old_txt steps_num.txt '50')"
|
||||
cfg_log_max_size="$(read_old_txt log_max_size.txt '512')"
|
||||
cfg_auto_bri_sleep="$(read_old_txt auto_bri_sleep.txt '1')"
|
||||
cfg_display_hdr_sleep="$(read_old_txt display_hdr_sleep.txt '0')"
|
||||
cfg_sleep_time="$(read_old_txt sleep_time.txt '')"
|
||||
cfg_inotify_events="$(read_old_txt inotify_events.txt 'c')"
|
||||
cfg_now_bri_file="$(read_old_txt path/now_bri_file.txt "$DEFAULT_NOW_BRI_FILE")"
|
||||
cfg_max_bri_file="$(read_old_txt path/max_bri_file.txt "$DEFAULT_MAX_BRI_FILE")"
|
||||
|
||||
if [ "$(button_listener)" = "0" ]; then
|
||||
echo "[OK] 已沿用旧配置"
|
||||
cp -f "$old_config/ui_max_bri.txt" "$mod_config/"
|
||||
cp -f "$old_config/max_bri.txt" "$mod_config/"
|
||||
if [ -e "$old_config/sleep_time.txt" ]; then
|
||||
cp -f "$old_config/sleep_time.txt" "$mod_config/"
|
||||
# 黑名单转 JSON 数组
|
||||
if [ -s "$old_config/blacklist_apps.txt" ]; then
|
||||
cfg_blacklist_apps=$("$JQ" -Rs 'split("\n") | map(select(length > 0))' \
|
||||
"$old_config/blacklist_apps.txt" 2>/dev/null || echo '[]')
|
||||
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"
|
||||
cfg_blacklist_apps='[]'
|
||||
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 "[i] 检测到从 2101 版本升级,正在补全备份目录..."
|
||||
mkdir -p "$mod_config/.backup"
|
||||
cp -f "$mod_config/"*.txt "$mod_config/.backup/" 2>/dev/null
|
||||
else
|
||||
# 正常备份同步
|
||||
mkdir -p "$mod_config/.backup"
|
||||
[ -d "$old_config/.backup" ] && cp -rf "$old_config/.backup/." "$mod_config/.backup/"
|
||||
fi
|
||||
write_config_json
|
||||
|
||||
# 删除旧 txt 配置文件
|
||||
rm -f "$old_config/"*.txt 2>/dev/null
|
||||
rm -rf "$old_config/path" 2>/dev/null
|
||||
echo "[OK] 配置已迁移至 JSON,旧文件已清理"
|
||||
return 0
|
||||
else
|
||||
echo "[*] 将重新测试"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# 初始化默认配置文件
|
||||
# 初始化默认配置
|
||||
INIT_CONFIG() {
|
||||
mkdir -p "$mod_config"
|
||||
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"
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
cfg_ui_max_bri=0
|
||||
cfg_max_bri=0
|
||||
cfg_steps_num=50
|
||||
cfg_log_max_size=512
|
||||
cfg_auto_bri_sleep=1
|
||||
cfg_display_hdr_sleep=0
|
||||
cfg_sleep_time=""
|
||||
cfg_inotify_events="c"
|
||||
cfg_now_bri_file="$DEFAULT_NOW_BRI_FILE"
|
||||
cfg_max_bri_file="$DEFAULT_MAX_BRI_FILE"
|
||||
cfg_blacklist_apps="[]"
|
||||
write_config_json
|
||||
fi
|
||||
}
|
||||
|
||||
# 补全缺失设置并设定默认值
|
||||
# 补全缺失字段
|
||||
ENSURE_DEFAULTS() {
|
||||
[ ! -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"
|
||||
"$JQ" '
|
||||
.steps_num = (.steps_num // 50) |
|
||||
.log_max_size = (.log_max_size // 512) |
|
||||
.auto_bri_sleep = (.auto_bri_sleep // 1) |
|
||||
.display_hdr_sleep = (.display_hdr_sleep // 0) |
|
||||
.sleep_time = (.sleep_time // "") |
|
||||
.inotify_events = (.inotify_events // "c") |
|
||||
.blacklist_apps = (.blacklist_apps // [])
|
||||
' "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
|
||||
}
|
||||
|
||||
# 机型兼容性校验
|
||||
@@ -357,30 +316,100 @@ CHECK_DEVICE_COMPATIBILITY() {
|
||||
|
||||
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 "[!] 您可能是 Xiaomi 17 Ultra 用户,建议使用 '0' 事件作为监测对象"
|
||||
echo "[?] 是否将 inotifyd 监测事件修改为 '0'? (音量 + 确认,音量 - 跳过)"
|
||||
if [ "$(btn)" = "0" ]; then
|
||||
"$JQ" '.inotify_events = "0"' "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
|
||||
echo "[OK] 已设置为 0 事件监测"
|
||||
else
|
||||
echo "[*] 已跳过配置更改"
|
||||
echo "[*] 已跳过"
|
||||
fi
|
||||
sleep 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 创建备份 (用于 WebUI 恢复默认)
|
||||
# 创建备份(供 WebUI 恢复默认用)
|
||||
CREATE_BACKUP() {
|
||||
mkdir -p "$mod_config/.backup"
|
||||
cp -f "$mod_config/ui_max_bri.txt" "$mod_config/.backup/"
|
||||
cp -f "$mod_config/max_bri.txt" "$mod_config/.backup/"
|
||||
cp -f "$mod_config/sleep_time.txt" "$mod_config/.backup/"
|
||||
cp -f "$mod_config/auto_bri_sleep.txt" "$mod_config/.backup/"
|
||||
cp -f "$mod_config/steps_num.txt" "$mod_config/.backup/"
|
||||
cp -f "$mod_config/log_max_size.txt" "$mod_config/.backup/"
|
||||
cp -f "$CONFIG_FILE" "$mod_config/.backup/config.json"
|
||||
}
|
||||
|
||||
END() {
|
||||
echo ""
|
||||
sleep 1
|
||||
|
||||
# 确保 now_bri_file / max_bri_file 已设置(import 路径可能未调用 CHECK_FILES)
|
||||
: "${now_bri_file:=$(cfg_get now_bri_file "$DEFAULT_NOW_BRI_FILE")}"
|
||||
: "${max_bri_file:=$(cfg_get max_bri_file "$DEFAULT_MAX_BRI_FILE")}"
|
||||
|
||||
local final_ui final_max
|
||||
final_ui=$("$JQ" -re 'if .ui_max_bri > 0 then .ui_max_bri else empty end' "$CONFIG_FILE" 2>/dev/null)
|
||||
final_max=$("$JQ" -re 'if .max_bri > 0 then .max_bri else empty end' "$CONFIG_FILE" 2>/dev/null)
|
||||
|
||||
if [ -z "$final_max" ] || [ -z "$final_ui" ]; then
|
||||
echo ""
|
||||
echo "[!] ======== 配置不完整 ========"
|
||||
[ -z "$final_max" ] && echo "[X] 峰值最大亮度: 未配置" || echo "[OK] 峰值最大亮度: $final_max"
|
||||
[ -z "$final_ui" ] && echo "[X] 前台最大亮度: 未配置" || echo "[OK] 前台最大亮度: $final_ui"
|
||||
echo ""
|
||||
echo "[i] 配置缺失,请重启后通过 Web UI 手动配置"
|
||||
echo "[i] 或按音量 + 现在进行测试, 按音量 - 跳过"
|
||||
if [ "$(btn)" = "0" ]; then
|
||||
TEST_UI_MAX_BRI
|
||||
final_ui=$("$JQ" -re 'if .ui_max_bri > 0 then .ui_max_bri else empty end' "$CONFIG_FILE" 2>/dev/null)
|
||||
final_max=$("$JQ" -re 'if .max_bri > 0 then .max_bri else empty end' "$CONFIG_FILE" 2>/dev/null)
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "======== 将要应用的配置 ========"
|
||||
echo "[*] 前台最大亮度: $final_ui"
|
||||
echo "[*] 峰值最大亮度: $final_max"
|
||||
|
||||
local steps log_size auto_bri disp_hdr st inotify bl_count now_path max_path
|
||||
steps=$("$JQ" -re '.steps_num' "$CONFIG_FILE" 2>/dev/null || echo "50")
|
||||
log_size=$("$JQ" -re '.log_max_size' "$CONFIG_FILE" 2>/dev/null || echo "512")
|
||||
auto_bri=$("$JQ" -re '.auto_bri_sleep' "$CONFIG_FILE" 2>/dev/null || echo "1")
|
||||
disp_hdr=$("$JQ" -re '.display_hdr_sleep' "$CONFIG_FILE" 2>/dev/null || echo "0")
|
||||
st=$("$JQ" -re '.sleep_time // empty' "$CONFIG_FILE" 2>/dev/null)
|
||||
inotify=$("$JQ" -re '.inotify_events' "$CONFIG_FILE" 2>/dev/null || echo "c")
|
||||
now_path=$("$JQ" -re '.now_bri_file' "$CONFIG_FILE" 2>/dev/null || echo "$DEFAULT_NOW_BRI_FILE")
|
||||
max_path=$("$JQ" -re '.max_bri_file' "$CONFIG_FILE" 2>/dev/null || echo "$DEFAULT_MAX_BRI_FILE")
|
||||
bl_count=$("$JQ" -re '.blacklist_apps | length' "$CONFIG_FILE" 2>/dev/null || echo "0")
|
||||
|
||||
echo "[*] 亮度渐变步数: $steps"
|
||||
echo "[*] 日志大小上限: ${log_size} KB"
|
||||
if [ "$auto_bri" = "1" ]; then
|
||||
echo "[*] 自动亮度时跳过: 开启"
|
||||
else
|
||||
echo "[*] 自动亮度时跳过: 关闭"
|
||||
fi
|
||||
if [ "$disp_hdr" = "1" ]; then
|
||||
echo "[*] HDR 内容时跳过: 开启"
|
||||
else
|
||||
echo "[*] HDR 内容时跳过: 关闭"
|
||||
fi
|
||||
if [ -n "$st" ]; then
|
||||
echo "[*] 休眠时段: $st"
|
||||
else
|
||||
echo "[*] 休眠时段: 未配置"
|
||||
fi
|
||||
echo "[*] inotifyd 事件: $inotify"
|
||||
echo "[*] 当前亮度节点: $now_path"
|
||||
echo "[*] 最大亮度节点: $max_path"
|
||||
echo "[*] 黑名单应用: ${bl_count} 个"
|
||||
echo "==============================="
|
||||
echo "[i] 配置文件: /data/adb/modules/LuminPro/config/config.json"
|
||||
echo "[i] 也可以使用 Web UI 进行配置"
|
||||
echo ""
|
||||
echo "[OK] 模块已刷入,请重启手机"
|
||||
echo "[i] 感谢您的使用"
|
||||
echo "[i] 作者: 酷安 @于乐yule"
|
||||
echo ""
|
||||
sleep 1
|
||||
exit 0
|
||||
}
|
||||
|
||||
# 主函数
|
||||
MAIN() {
|
||||
NOTE
|
||||
SHOW_CHANGELOG
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
id=LuminPro
|
||||
name=LuminPro丨日用屏幕亮度强化
|
||||
version=V2.2
|
||||
versionCode=2204
|
||||
version=V2.2-2208
|
||||
versionCode=2208
|
||||
author=酷安@Yule
|
||||
description=本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果
|
||||
updateJson=https://share.yule.ink/magisk/mod/luminpro/update.json
|
||||
+12
-1
@@ -9,11 +9,22 @@
|
||||
"preview": "cd webui && vite preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/vite": "^4.2.2",
|
||||
"archiver": "^7.0.1",
|
||||
"kernelsu": "^3.0.2",
|
||||
"tailwindcss": "^4.2.2",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"vite": "^8.0.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"lucide": "^1.7.0"
|
||||
"@vitejs/plugin-vue": "^6.0.5",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide": "^1.7.0",
|
||||
"lucide-vue-next": "^1.0.0",
|
||||
"markdown-it": "^14.1.1",
|
||||
"pinyin-match": "^1.2.10",
|
||||
"tailwind-merge": "^3.5.0",
|
||||
"vue": "^3.5.32"
|
||||
}
|
||||
}
|
||||
Generated
+513
-2
@@ -8,22 +8,72 @@ importers:
|
||||
|
||||
.:
|
||||
dependencies:
|
||||
'@vitejs/plugin-vue':
|
||||
specifier: ^6.0.5
|
||||
version: 6.0.5(vite@8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1))(vue@3.5.32)
|
||||
class-variance-authority:
|
||||
specifier: ^0.7.1
|
||||
version: 0.7.1
|
||||
clsx:
|
||||
specifier: ^2.1.1
|
||||
version: 2.1.1
|
||||
lucide:
|
||||
specifier: ^1.7.0
|
||||
version: 1.7.0
|
||||
lucide-vue-next:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0(vue@3.5.32)
|
||||
markdown-it:
|
||||
specifier: ^14.1.1
|
||||
version: 14.1.1
|
||||
pinyin-match:
|
||||
specifier: ^1.2.10
|
||||
version: 1.2.10
|
||||
tailwind-merge:
|
||||
specifier: ^3.5.0
|
||||
version: 3.5.0
|
||||
vue:
|
||||
specifier: ^3.5.32
|
||||
version: 3.5.32
|
||||
devDependencies:
|
||||
'@tailwindcss/vite':
|
||||
specifier: ^4.2.2
|
||||
version: 4.2.2(vite@8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1))
|
||||
archiver:
|
||||
specifier: ^7.0.1
|
||||
version: 7.0.1
|
||||
kernelsu:
|
||||
specifier: ^3.0.2
|
||||
version: 3.0.2
|
||||
tailwindcss:
|
||||
specifier: ^4.2.2
|
||||
version: 4.2.2
|
||||
tw-animate-css:
|
||||
specifier: ^1.4.0
|
||||
version: 1.4.0
|
||||
vite:
|
||||
specifier: ^8.0.3
|
||||
version: 8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)
|
||||
version: 8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1)
|
||||
|
||||
packages:
|
||||
|
||||
'@babel/helper-string-parser@7.27.1':
|
||||
resolution: {integrity: sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@babel/helper-validator-identifier@7.28.5':
|
||||
resolution: {integrity: sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@babel/parser@7.29.2':
|
||||
resolution: {integrity: sha512-4GgRzy/+fsBa72/RZVJmGKPmZu9Byn8o4MoLpmNe1m8ZfYnz5emHLQz3U4gLud6Zwl0RZIcgiLD7Uq7ySFuDLA==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
hasBin: true
|
||||
|
||||
'@babel/types@7.29.0':
|
||||
resolution: {integrity: sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
|
||||
'@emnapi/core@1.9.2':
|
||||
resolution: {integrity: sha512-UC+ZhH3XtczQYfOlu3lNEkdW/p4dsJ1r/bP7H8+rhao3TTTMO1ATq/4DdIi23XuGoFY+Cz0JmCbdVl0hz9jZcA==}
|
||||
|
||||
@@ -37,6 +87,22 @@ packages:
|
||||
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.13':
|
||||
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
|
||||
|
||||
'@jridgewell/remapping@2.3.5':
|
||||
resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==}
|
||||
|
||||
'@jridgewell/resolve-uri@3.1.2':
|
||||
resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==}
|
||||
engines: {node: '>=6.0.0'}
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.5':
|
||||
resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==}
|
||||
|
||||
'@jridgewell/trace-mapping@0.3.31':
|
||||
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
|
||||
|
||||
'@napi-rs/wasm-runtime@1.1.2':
|
||||
resolution: {integrity: sha512-sNXv5oLJ7ob93xkZ1XnxisYhGYXfaG9f65/ZgYuAu3qt7b3NadcOEhLvx28hv31PgX8SZJRYrAIPQilQmFpLVw==}
|
||||
peerDependencies:
|
||||
@@ -148,9 +214,142 @@ packages:
|
||||
'@rolldown/pluginutils@1.0.0-rc.12':
|
||||
resolution: {integrity: sha512-HHMwmarRKvoFsJorqYlFeFRzXZqCt2ETQlEDOb9aqssrnVBB1/+xgTGtuTrIk5vzLNX1MjMtTf7W9z3tsSbrxw==}
|
||||
|
||||
'@rolldown/pluginutils@1.0.0-rc.2':
|
||||
resolution: {integrity: sha512-izyXV/v+cHiRfozX62W9htOAvwMo4/bXKDrQ+vom1L1qRuexPock/7VZDAhnpHCLNejd3NJ6hiab+tO0D44Rgw==}
|
||||
|
||||
'@tailwindcss/node@4.2.2':
|
||||
resolution: {integrity: sha512-pXS+wJ2gZpVXqFaUEjojq7jzMpTGf8rU6ipJz5ovJV6PUGmlJ+jvIwGrzdHdQ80Sg+wmQxUFuoW1UAAwHNEdFA==}
|
||||
|
||||
'@tailwindcss/oxide-android-arm64@4.2.2':
|
||||
resolution: {integrity: sha512-dXGR1n+P3B6748jZO/SvHZq7qBOqqzQ+yFrXpoOWWALWndF9MoSKAT3Q0fYgAzYzGhxNYOoysRvYlpixRBBoDg==}
|
||||
engines: {node: '>= 20'}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
'@tailwindcss/oxide-darwin-arm64@4.2.2':
|
||||
resolution: {integrity: sha512-iq9Qjr6knfMpZHj55/37ouZeykwbDqF21gPFtfnhCCKGDcPI/21FKC9XdMO/XyBM7qKORx6UIhGgg6jLl7BZlg==}
|
||||
engines: {node: '>= 20'}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@tailwindcss/oxide-darwin-x64@4.2.2':
|
||||
resolution: {integrity: sha512-BlR+2c3nzc8f2G639LpL89YY4bdcIdUmiOOkv2GQv4/4M0vJlpXEa0JXNHhCHU7VWOKWT/CjqHdTP8aUuDJkuw==}
|
||||
engines: {node: '>= 20'}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@tailwindcss/oxide-freebsd-x64@4.2.2':
|
||||
resolution: {integrity: sha512-YUqUgrGMSu2CDO82hzlQ5qSb5xmx3RUrke/QgnoEx7KvmRJHQuZHZmZTLSuuHwFf0DJPybFMXMYf+WJdxHy/nQ==}
|
||||
engines: {node: '>= 20'}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@tailwindcss/oxide-linux-arm-gnueabihf@4.2.2':
|
||||
resolution: {integrity: sha512-FPdhvsW6g06T9BWT0qTwiVZYE2WIFo2dY5aCSpjG/S/u1tby+wXoslXS0kl3/KXnULlLr1E3NPRRw0g7t2kgaQ==}
|
||||
engines: {node: '>= 20'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@tailwindcss/oxide-linux-arm64-gnu@4.2.2':
|
||||
resolution: {integrity: sha512-4og1V+ftEPXGttOO7eCmW7VICmzzJWgMx+QXAJRAhjrSjumCwWqMfkDrNu1LXEQzNAwz28NCUpucgQPrR4S2yw==}
|
||||
engines: {node: '>= 20'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@tailwindcss/oxide-linux-arm64-musl@4.2.2':
|
||||
resolution: {integrity: sha512-oCfG/mS+/+XRlwNjnsNLVwnMWYH7tn/kYPsNPh+JSOMlnt93mYNCKHYzylRhI51X+TbR+ufNhhKKzm6QkqX8ag==}
|
||||
engines: {node: '>= 20'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@tailwindcss/oxide-linux-x64-gnu@4.2.2':
|
||||
resolution: {integrity: sha512-rTAGAkDgqbXHNp/xW0iugLVmX62wOp2PoE39BTCGKjv3Iocf6AFbRP/wZT/kuCxC9QBh9Pu8XPkv/zCZB2mcMg==}
|
||||
engines: {node: '>= 20'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@tailwindcss/oxide-linux-x64-musl@4.2.2':
|
||||
resolution: {integrity: sha512-XW3t3qwbIwiSyRCggeO2zxe3KWaEbM0/kW9e8+0XpBgyKU4ATYzcVSMKteZJ1iukJ3HgHBjbg9P5YPRCVUxlnQ==}
|
||||
engines: {node: '>= 20'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@tailwindcss/oxide-wasm32-wasi@4.2.2':
|
||||
resolution: {integrity: sha512-eKSztKsmEsn1O5lJ4ZAfyn41NfG7vzCg496YiGtMDV86jz1q/irhms5O0VrY6ZwTUkFy/EKG3RfWgxSI3VbZ8Q==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
cpu: [wasm32]
|
||||
bundledDependencies:
|
||||
- '@napi-rs/wasm-runtime'
|
||||
- '@emnapi/core'
|
||||
- '@emnapi/runtime'
|
||||
- '@tybys/wasm-util'
|
||||
- '@emnapi/wasi-threads'
|
||||
- tslib
|
||||
|
||||
'@tailwindcss/oxide-win32-arm64-msvc@4.2.2':
|
||||
resolution: {integrity: sha512-qPmaQM4iKu5mxpsrWZMOZRgZv1tOZpUm+zdhhQP0VhJfyGGO3aUKdbh3gDZc/dPLQwW4eSqWGrrcWNBZWUWaXQ==}
|
||||
engines: {node: '>= 20'}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@tailwindcss/oxide-win32-x64-msvc@4.2.2':
|
||||
resolution: {integrity: sha512-1T/37VvI7WyH66b+vqHj/cLwnCxt7Qt3WFu5Q8hk65aOvlwAhs7rAp1VkulBJw/N4tMirXjVnylTR72uI0HGcA==}
|
||||
engines: {node: '>= 20'}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@tailwindcss/oxide@4.2.2':
|
||||
resolution: {integrity: sha512-qEUA07+E5kehxYp9BVMpq9E8vnJuBHfJEC0vPC5e7iL/hw7HR61aDKoVoKzrG+QKp56vhNZe4qwkRmMC0zDLvg==}
|
||||
engines: {node: '>= 20'}
|
||||
|
||||
'@tailwindcss/vite@4.2.2':
|
||||
resolution: {integrity: sha512-mEiF5HO1QqCLXoNEfXVA1Tzo+cYsrqV7w9Juj2wdUFyW07JRenqMG225MvPwr3ZD9N1bFQj46X7r33iHxLUW0w==}
|
||||
peerDependencies:
|
||||
vite: ^5.2.0 || ^6 || ^7 || ^8
|
||||
|
||||
'@tybys/wasm-util@0.10.1':
|
||||
resolution: {integrity: sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==}
|
||||
|
||||
'@vitejs/plugin-vue@6.0.5':
|
||||
resolution: {integrity: sha512-bL3AxKuQySfk1iGcBsQnoRVexTPJq0Z/ixFVM8OhVJAP6ZXXXLtM7NFKWhLl30Kg7uTBqIaPXbh+nuQCuBDedg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
peerDependencies:
|
||||
vite: ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0
|
||||
vue: ^3.2.25
|
||||
|
||||
'@vue/compiler-core@3.5.32':
|
||||
resolution: {integrity: sha512-4x74Tbtqnda8s/NSD6e1Dr5p1c8HdMU5RWSjMSUzb8RTcUQqevDCxVAitcLBKT+ie3o0Dl9crc/S/opJM7qBGQ==}
|
||||
|
||||
'@vue/compiler-dom@3.5.32':
|
||||
resolution: {integrity: sha512-ybHAu70NtiEI1fvAUz3oXZqkUYEe5J98GjMDpTGl5iHb0T15wQYLR4wE3h9xfuTNA+Cm2f4czfe8B4s+CCH57Q==}
|
||||
|
||||
'@vue/compiler-sfc@3.5.32':
|
||||
resolution: {integrity: sha512-8UYUYo71cP/0YHMO814TRZlPuUUw3oifHuMR7Wp9SNoRSrxRQnhMLNlCeaODNn6kNTJsjFoQ/kqIj4qGvya4Xg==}
|
||||
|
||||
'@vue/compiler-ssr@3.5.32':
|
||||
resolution: {integrity: sha512-Gp4gTs22T3DgRotZ8aA/6m2jMR+GMztvBXUBEUOYOcST+giyGWJ4WvFd7QLHBkzTxkfOt8IELKNdpzITLbA2rw==}
|
||||
|
||||
'@vue/reactivity@3.5.32':
|
||||
resolution: {integrity: sha512-/ORasxSGvZ6MN5gc+uE364SxFdJ0+WqVG0CENXaGW58TOCdrAW76WWaplDtECeS1qphvtBZtR+3/o1g1zL4xPQ==}
|
||||
|
||||
'@vue/runtime-core@3.5.32':
|
||||
resolution: {integrity: sha512-pDrXCejn4UpFDFmMd27AcJEbHaLemaE5o4pbb7sLk79SRIhc6/t34BQA7SGNgYtbMnvbF/HHOftYBgFJtUoJUQ==}
|
||||
|
||||
'@vue/runtime-dom@3.5.32':
|
||||
resolution: {integrity: sha512-1CDVv7tv/IV13V8Nip1k/aaObVbWqRlVCVezTwx3K07p7Vxossp5JU1dcPNhJk3w347gonIUT9jQOGutyJrSVQ==}
|
||||
|
||||
'@vue/server-renderer@3.5.32':
|
||||
resolution: {integrity: sha512-IOjm2+JQwRFS7W28HNuJeXQle9KdZbODFY7hFGVtnnghF51ta20EWAZJHX+zLGtsHhaU6uC9BGPV52KVpYryMQ==}
|
||||
peerDependencies:
|
||||
vue: 3.5.32
|
||||
|
||||
'@vue/shared@3.5.32':
|
||||
resolution: {integrity: sha512-ksNyrmRQzWJJ8n3cRDuSF7zNNontuJg1YHnmWRJd2AMu8Ij2bqwiiri2lH5rHtYPZjj4STkNcgcmiQqlOjiYGg==}
|
||||
|
||||
abort-controller@3.0.0:
|
||||
resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==}
|
||||
engines: {node: '>=6.5'}
|
||||
@@ -179,6 +378,9 @@ packages:
|
||||
resolution: {integrity: sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ==}
|
||||
engines: {node: '>= 14'}
|
||||
|
||||
argparse@2.0.1:
|
||||
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
|
||||
|
||||
async@3.2.6:
|
||||
resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==}
|
||||
|
||||
@@ -247,6 +449,13 @@ packages:
|
||||
buffer@6.0.3:
|
||||
resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==}
|
||||
|
||||
class-variance-authority@0.7.1:
|
||||
resolution: {integrity: sha512-Ka+9Trutv7G8M6WT6SeiRWz792K5qEqIGEGzXKhAE6xOWAY6pPH8U+9IY3oCMv6kqTmLsv7Xh/2w2RigkePMsg==}
|
||||
|
||||
clsx@2.1.1:
|
||||
resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
color-convert@2.0.1:
|
||||
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
|
||||
engines: {node: '>=7.0.0'}
|
||||
@@ -274,6 +483,9 @@ packages:
|
||||
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
csstype@3.2.3:
|
||||
resolution: {integrity: sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==}
|
||||
|
||||
detect-libc@2.1.2:
|
||||
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
|
||||
engines: {node: '>=8'}
|
||||
@@ -287,6 +499,21 @@ packages:
|
||||
emoji-regex@9.2.2:
|
||||
resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==}
|
||||
|
||||
enhanced-resolve@5.20.1:
|
||||
resolution: {integrity: sha512-Qohcme7V1inbAfvjItgw0EaxVX5q2rdVEZHRBrEQdRZTssLDGsL8Lwrznl8oQ/6kuTJONLaDcGjkNP247XEhcA==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
entities@4.5.0:
|
||||
resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==}
|
||||
engines: {node: '>=0.12'}
|
||||
|
||||
entities@7.0.1:
|
||||
resolution: {integrity: sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==}
|
||||
engines: {node: '>=0.12'}
|
||||
|
||||
estree-walker@2.0.2:
|
||||
resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==}
|
||||
|
||||
event-target-shim@5.0.1:
|
||||
resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==}
|
||||
engines: {node: '>=6'}
|
||||
@@ -349,6 +576,10 @@ packages:
|
||||
jackspeak@3.4.3:
|
||||
resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==}
|
||||
|
||||
jiti@2.6.1:
|
||||
resolution: {integrity: sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==}
|
||||
hasBin: true
|
||||
|
||||
kernelsu@3.0.2:
|
||||
resolution: {integrity: sha512-3MTGgIbl3TWCzqnJP6Fun9tHv6VULR3O188U3raeGRSMzK+G3pldL9ySwaZWhsHCtI2BTvlQuu/3p10s4a5c3w==}
|
||||
|
||||
@@ -430,15 +661,33 @@ packages:
|
||||
resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
|
||||
linkify-it@5.0.0:
|
||||
resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==}
|
||||
|
||||
lodash@4.18.1:
|
||||
resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==}
|
||||
|
||||
lru-cache@10.4.3:
|
||||
resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}
|
||||
|
||||
lucide-vue-next@1.0.0:
|
||||
resolution: {integrity: sha512-V6SPvx1IHTj/UY+FrIYWV5faISsPSb8BnWSFDxAtezWKvWc9ZZ40PDrdu1/Qb5vg4lHWr1hs1BAMGVGm6V1Xdg==}
|
||||
peerDependencies:
|
||||
vue: '>=3.0.1'
|
||||
|
||||
lucide@1.7.0:
|
||||
resolution: {integrity: sha512-aYNogbuIxea3a8offpKjdMGf2FsUk9GECFh0B4iJgXlJOX41+7/ncvLVluKki8477SoybEdyGGf+qGYLBDiEsA==}
|
||||
|
||||
magic-string@0.30.21:
|
||||
resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==}
|
||||
|
||||
markdown-it@14.1.1:
|
||||
resolution: {integrity: sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA==}
|
||||
hasBin: true
|
||||
|
||||
mdurl@2.0.0:
|
||||
resolution: {integrity: sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==}
|
||||
|
||||
minimatch@5.1.9:
|
||||
resolution: {integrity: sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==}
|
||||
engines: {node: '>=10'}
|
||||
@@ -478,6 +727,9 @@ packages:
|
||||
resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
pinyin-match@1.2.10:
|
||||
resolution: {integrity: sha512-Xo1uMd9n56/xP2EAn7yfApnTmAGCLGqxFIm1fuOnSMty0xhqRF3+ZwVjp2yWFD/alv60RUWa/cZoQSeTSp1HxA==}
|
||||
|
||||
postcss@8.5.8:
|
||||
resolution: {integrity: sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
@@ -489,6 +741,10 @@ packages:
|
||||
resolution: {integrity: sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==}
|
||||
engines: {node: '>= 0.6.0'}
|
||||
|
||||
punycode.js@2.3.1:
|
||||
resolution: {integrity: sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
readable-stream@2.3.8:
|
||||
resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==}
|
||||
|
||||
@@ -551,6 +807,16 @@ packages:
|
||||
resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
tailwind-merge@3.5.0:
|
||||
resolution: {integrity: sha512-I8K9wewnVDkL1NTGoqWmVEIlUcB9gFriAEkXkfCjX5ib8ezGxtR3xD7iZIxrfArjEsH7F1CHD4RFUtxefdqV/A==}
|
||||
|
||||
tailwindcss@4.2.2:
|
||||
resolution: {integrity: sha512-KWBIxs1Xb6NoLdMVqhbhgwZf2PGBpPEiwOqgI4pFIYbNTfBXiKYyWoTsXgBQ9WFg/OlhnvHaY+AEpW7wSmFo2Q==}
|
||||
|
||||
tapable@2.3.2:
|
||||
resolution: {integrity: sha512-1MOpMXuhGzGL5TTCZFItxCc0AARf1EZFQkGqMm7ERKj8+Hgr5oLvJOVFcC+lRmR8hCe2S3jC4T5D7Vg/d7/fhA==}
|
||||
engines: {node: '>=6'}
|
||||
|
||||
tar-stream@3.1.8:
|
||||
resolution: {integrity: sha512-U6QpVRyCGHva435KoNWy9PRoi2IFYCgtEhq9nmrPPpbRacPs9IH4aJ3gbrFC8dPcXvdSZ4XXfXT5Fshbp2MtlQ==}
|
||||
|
||||
@@ -567,6 +833,12 @@ packages:
|
||||
tslib@2.8.1:
|
||||
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
||||
|
||||
tw-animate-css@1.4.0:
|
||||
resolution: {integrity: sha512-7bziOlRqH0hJx80h/3mbicLW7o8qLsH5+RaLR2t+OHM3D0JlWGODQKQ4cxbK7WlvmUxpcj6Kgu6EKqjrGFe3QQ==}
|
||||
|
||||
uc.micro@2.1.0:
|
||||
resolution: {integrity: sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==}
|
||||
|
||||
util-deprecate@1.0.2:
|
||||
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
|
||||
|
||||
@@ -613,6 +885,14 @@ packages:
|
||||
yaml:
|
||||
optional: true
|
||||
|
||||
vue@3.5.32:
|
||||
resolution: {integrity: sha512-vM4z4Q9tTafVfMAK7IVzmxg34rSzTFMyIe0UUEijUCkn9+23lj0WRfA83dg7eQZIUlgOSGrkViIaCfqSAUXsMw==}
|
||||
peerDependencies:
|
||||
typescript: '*'
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
|
||||
which@2.0.2:
|
||||
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
|
||||
engines: {node: '>= 8'}
|
||||
@@ -632,6 +912,19 @@ packages:
|
||||
|
||||
snapshots:
|
||||
|
||||
'@babel/helper-string-parser@7.27.1': {}
|
||||
|
||||
'@babel/helper-validator-identifier@7.28.5': {}
|
||||
|
||||
'@babel/parser@7.29.2':
|
||||
dependencies:
|
||||
'@babel/types': 7.29.0
|
||||
|
||||
'@babel/types@7.29.0':
|
||||
dependencies:
|
||||
'@babel/helper-string-parser': 7.27.1
|
||||
'@babel/helper-validator-identifier': 7.28.5
|
||||
|
||||
'@emnapi/core@1.9.2':
|
||||
dependencies:
|
||||
'@emnapi/wasi-threads': 1.2.1
|
||||
@@ -657,6 +950,25 @@ snapshots:
|
||||
wrap-ansi: 8.1.0
|
||||
wrap-ansi-cjs: wrap-ansi@7.0.0
|
||||
|
||||
'@jridgewell/gen-mapping@0.3.13':
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
'@jridgewell/trace-mapping': 0.3.31
|
||||
|
||||
'@jridgewell/remapping@2.3.5':
|
||||
dependencies:
|
||||
'@jridgewell/gen-mapping': 0.3.13
|
||||
'@jridgewell/trace-mapping': 0.3.31
|
||||
|
||||
'@jridgewell/resolve-uri@3.1.2': {}
|
||||
|
||||
'@jridgewell/sourcemap-codec@1.5.5': {}
|
||||
|
||||
'@jridgewell/trace-mapping@0.3.31':
|
||||
dependencies:
|
||||
'@jridgewell/resolve-uri': 3.1.2
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
|
||||
'@napi-rs/wasm-runtime@1.1.2(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)':
|
||||
dependencies:
|
||||
'@emnapi/core': 1.9.2
|
||||
@@ -721,11 +1033,141 @@ snapshots:
|
||||
|
||||
'@rolldown/pluginutils@1.0.0-rc.12': {}
|
||||
|
||||
'@rolldown/pluginutils@1.0.0-rc.2': {}
|
||||
|
||||
'@tailwindcss/node@4.2.2':
|
||||
dependencies:
|
||||
'@jridgewell/remapping': 2.3.5
|
||||
enhanced-resolve: 5.20.1
|
||||
jiti: 2.6.1
|
||||
lightningcss: 1.32.0
|
||||
magic-string: 0.30.21
|
||||
source-map-js: 1.2.1
|
||||
tailwindcss: 4.2.2
|
||||
|
||||
'@tailwindcss/oxide-android-arm64@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide-darwin-arm64@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide-darwin-x64@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide-freebsd-x64@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide-linux-arm-gnueabihf@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide-linux-arm64-gnu@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide-linux-arm64-musl@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide-linux-x64-gnu@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide-linux-x64-musl@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide-wasm32-wasi@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide-win32-arm64-msvc@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide-win32-x64-msvc@4.2.2':
|
||||
optional: true
|
||||
|
||||
'@tailwindcss/oxide@4.2.2':
|
||||
optionalDependencies:
|
||||
'@tailwindcss/oxide-android-arm64': 4.2.2
|
||||
'@tailwindcss/oxide-darwin-arm64': 4.2.2
|
||||
'@tailwindcss/oxide-darwin-x64': 4.2.2
|
||||
'@tailwindcss/oxide-freebsd-x64': 4.2.2
|
||||
'@tailwindcss/oxide-linux-arm-gnueabihf': 4.2.2
|
||||
'@tailwindcss/oxide-linux-arm64-gnu': 4.2.2
|
||||
'@tailwindcss/oxide-linux-arm64-musl': 4.2.2
|
||||
'@tailwindcss/oxide-linux-x64-gnu': 4.2.2
|
||||
'@tailwindcss/oxide-linux-x64-musl': 4.2.2
|
||||
'@tailwindcss/oxide-wasm32-wasi': 4.2.2
|
||||
'@tailwindcss/oxide-win32-arm64-msvc': 4.2.2
|
||||
'@tailwindcss/oxide-win32-x64-msvc': 4.2.2
|
||||
|
||||
'@tailwindcss/vite@4.2.2(vite@8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1))':
|
||||
dependencies:
|
||||
'@tailwindcss/node': 4.2.2
|
||||
'@tailwindcss/oxide': 4.2.2
|
||||
tailwindcss: 4.2.2
|
||||
vite: 8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1)
|
||||
|
||||
'@tybys/wasm-util@0.10.1':
|
||||
dependencies:
|
||||
tslib: 2.8.1
|
||||
optional: true
|
||||
|
||||
'@vitejs/plugin-vue@6.0.5(vite@8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1))(vue@3.5.32)':
|
||||
dependencies:
|
||||
'@rolldown/pluginutils': 1.0.0-rc.2
|
||||
vite: 8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1)
|
||||
vue: 3.5.32
|
||||
|
||||
'@vue/compiler-core@3.5.32':
|
||||
dependencies:
|
||||
'@babel/parser': 7.29.2
|
||||
'@vue/shared': 3.5.32
|
||||
entities: 7.0.1
|
||||
estree-walker: 2.0.2
|
||||
source-map-js: 1.2.1
|
||||
|
||||
'@vue/compiler-dom@3.5.32':
|
||||
dependencies:
|
||||
'@vue/compiler-core': 3.5.32
|
||||
'@vue/shared': 3.5.32
|
||||
|
||||
'@vue/compiler-sfc@3.5.32':
|
||||
dependencies:
|
||||
'@babel/parser': 7.29.2
|
||||
'@vue/compiler-core': 3.5.32
|
||||
'@vue/compiler-dom': 3.5.32
|
||||
'@vue/compiler-ssr': 3.5.32
|
||||
'@vue/shared': 3.5.32
|
||||
estree-walker: 2.0.2
|
||||
magic-string: 0.30.21
|
||||
postcss: 8.5.8
|
||||
source-map-js: 1.2.1
|
||||
|
||||
'@vue/compiler-ssr@3.5.32':
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.32
|
||||
'@vue/shared': 3.5.32
|
||||
|
||||
'@vue/reactivity@3.5.32':
|
||||
dependencies:
|
||||
'@vue/shared': 3.5.32
|
||||
|
||||
'@vue/runtime-core@3.5.32':
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.5.32
|
||||
'@vue/shared': 3.5.32
|
||||
|
||||
'@vue/runtime-dom@3.5.32':
|
||||
dependencies:
|
||||
'@vue/reactivity': 3.5.32
|
||||
'@vue/runtime-core': 3.5.32
|
||||
'@vue/shared': 3.5.32
|
||||
csstype: 3.2.3
|
||||
|
||||
'@vue/server-renderer@3.5.32(vue@3.5.32)':
|
||||
dependencies:
|
||||
'@vue/compiler-ssr': 3.5.32
|
||||
'@vue/shared': 3.5.32
|
||||
vue: 3.5.32
|
||||
|
||||
'@vue/shared@3.5.32': {}
|
||||
|
||||
abort-controller@3.0.0:
|
||||
dependencies:
|
||||
event-target-shim: 5.0.1
|
||||
@@ -764,6 +1206,8 @@ snapshots:
|
||||
- bare-buffer
|
||||
- react-native-b4a
|
||||
|
||||
argparse@2.0.1: {}
|
||||
|
||||
async@3.2.6: {}
|
||||
|
||||
b4a@1.8.0: {}
|
||||
@@ -815,6 +1259,12 @@ snapshots:
|
||||
base64-js: 1.5.1
|
||||
ieee754: 1.2.1
|
||||
|
||||
class-variance-authority@0.7.1:
|
||||
dependencies:
|
||||
clsx: 2.1.1
|
||||
|
||||
clsx@2.1.1: {}
|
||||
|
||||
color-convert@2.0.1:
|
||||
dependencies:
|
||||
color-name: 1.1.4
|
||||
@@ -844,6 +1294,8 @@ snapshots:
|
||||
shebang-command: 2.0.0
|
||||
which: 2.0.2
|
||||
|
||||
csstype@3.2.3: {}
|
||||
|
||||
detect-libc@2.1.2: {}
|
||||
|
||||
eastasianwidth@0.2.0: {}
|
||||
@@ -852,6 +1304,17 @@ snapshots:
|
||||
|
||||
emoji-regex@9.2.2: {}
|
||||
|
||||
enhanced-resolve@5.20.1:
|
||||
dependencies:
|
||||
graceful-fs: 4.2.11
|
||||
tapable: 2.3.2
|
||||
|
||||
entities@4.5.0: {}
|
||||
|
||||
entities@7.0.1: {}
|
||||
|
||||
estree-walker@2.0.2: {}
|
||||
|
||||
event-target-shim@5.0.1: {}
|
||||
|
||||
events-universal@1.0.1:
|
||||
@@ -905,6 +1368,8 @@ snapshots:
|
||||
optionalDependencies:
|
||||
'@pkgjs/parseargs': 0.11.0
|
||||
|
||||
jiti@2.6.1: {}
|
||||
|
||||
kernelsu@3.0.2: {}
|
||||
|
||||
lazystream@1.0.1:
|
||||
@@ -960,12 +1425,35 @@ snapshots:
|
||||
lightningcss-win32-arm64-msvc: 1.32.0
|
||||
lightningcss-win32-x64-msvc: 1.32.0
|
||||
|
||||
linkify-it@5.0.0:
|
||||
dependencies:
|
||||
uc.micro: 2.1.0
|
||||
|
||||
lodash@4.18.1: {}
|
||||
|
||||
lru-cache@10.4.3: {}
|
||||
|
||||
lucide-vue-next@1.0.0(vue@3.5.32):
|
||||
dependencies:
|
||||
vue: 3.5.32
|
||||
|
||||
lucide@1.7.0: {}
|
||||
|
||||
magic-string@0.30.21:
|
||||
dependencies:
|
||||
'@jridgewell/sourcemap-codec': 1.5.5
|
||||
|
||||
markdown-it@14.1.1:
|
||||
dependencies:
|
||||
argparse: 2.0.1
|
||||
entities: 4.5.0
|
||||
linkify-it: 5.0.0
|
||||
mdurl: 2.0.0
|
||||
punycode.js: 2.3.1
|
||||
uc.micro: 2.1.0
|
||||
|
||||
mdurl@2.0.0: {}
|
||||
|
||||
minimatch@5.1.9:
|
||||
dependencies:
|
||||
brace-expansion: 2.0.3
|
||||
@@ -993,6 +1481,8 @@ snapshots:
|
||||
|
||||
picomatch@4.0.4: {}
|
||||
|
||||
pinyin-match@1.2.10: {}
|
||||
|
||||
postcss@8.5.8:
|
||||
dependencies:
|
||||
nanoid: 3.3.11
|
||||
@@ -1003,6 +1493,8 @@ snapshots:
|
||||
|
||||
process@0.11.10: {}
|
||||
|
||||
punycode.js@2.3.1: {}
|
||||
|
||||
readable-stream@2.3.8:
|
||||
dependencies:
|
||||
core-util-is: 1.0.3
|
||||
@@ -1100,6 +1592,12 @@ snapshots:
|
||||
dependencies:
|
||||
ansi-regex: 6.2.2
|
||||
|
||||
tailwind-merge@3.5.0: {}
|
||||
|
||||
tailwindcss@4.2.2: {}
|
||||
|
||||
tapable@2.3.2: {}
|
||||
|
||||
tar-stream@3.1.8:
|
||||
dependencies:
|
||||
b4a: 1.8.0
|
||||
@@ -1132,9 +1630,13 @@ snapshots:
|
||||
tslib@2.8.1:
|
||||
optional: true
|
||||
|
||||
tw-animate-css@1.4.0: {}
|
||||
|
||||
uc.micro@2.1.0: {}
|
||||
|
||||
util-deprecate@1.0.2: {}
|
||||
|
||||
vite@8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2):
|
||||
vite@8.0.3(@emnapi/core@1.9.2)(@emnapi/runtime@1.9.2)(jiti@2.6.1):
|
||||
dependencies:
|
||||
lightningcss: 1.32.0
|
||||
picomatch: 4.0.4
|
||||
@@ -1143,10 +1645,19 @@ snapshots:
|
||||
tinyglobby: 0.2.15
|
||||
optionalDependencies:
|
||||
fsevents: 2.3.3
|
||||
jiti: 2.6.1
|
||||
transitivePeerDependencies:
|
||||
- '@emnapi/core'
|
||||
- '@emnapi/runtime'
|
||||
|
||||
vue@3.5.32:
|
||||
dependencies:
|
||||
'@vue/compiler-dom': 3.5.32
|
||||
'@vue/compiler-sfc': 3.5.32
|
||||
'@vue/runtime-dom': 3.5.32
|
||||
'@vue/server-renderer': 3.5.32(vue@3.5.32)
|
||||
'@vue/shared': 3.5.32
|
||||
|
||||
which@2.0.2:
|
||||
dependencies:
|
||||
isexe: 2.0.0
|
||||
|
||||
+18
-36
@@ -2,80 +2,68 @@
|
||||
#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"
|
||||
CONFIG_FILE="$MODDIR/config/config.json"
|
||||
JQ="$MODDIR/bin/jq"
|
||||
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"
|
||||
get_cfg() {
|
||||
local key="$1" default="$2"
|
||||
local val
|
||||
if val=$("$JQ" -re ".${key}" "$CONFIG_FILE" 2>/dev/null); then
|
||||
echo "$val"
|
||||
else
|
||||
echo "$default_value"
|
||||
echo "$default"
|
||||
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")"
|
||||
now_file="$(get_cfg now_bri_file "$DEFAULT_NOW_BRI_FILE")"
|
||||
events="$(get_cfg inotify_events "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"
|
||||
_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"
|
||||
_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"
|
||||
_log "检测到配置变更,重启监听进程" "INFO"
|
||||
[ -f "$pid_file" ] && kill -9 "$(cat "$pid_file")" 2>/dev/null
|
||||
rm -f "$pid_file"
|
||||
echo "$current_config" >"$config_cache_file"
|
||||
@@ -83,29 +71,23 @@ while true; do
|
||||
continue
|
||||
fi
|
||||
else
|
||||
# 第一次启动或缓存不存在,保存当前配置
|
||||
echo "$current_config" >"$config_cache_file"
|
||||
fi
|
||||
|
||||
# 正常启动并监听
|
||||
_log "→ 启动 inotifyd 监听..." "INFO"
|
||||
_log "正在启动 inotifyd 监听" "INFO"
|
||||
now_bri_file="${current_config%|*}"
|
||||
inotify_events="${current_config#*|}"
|
||||
|
||||
# 更新缓存,让 up.sh 知道当前监听的是哪个文件
|
||||
echo -n "$now_bri_file" >"$PATH_CONFIG_DIR/.cached_path"
|
||||
# 缓存当前监听路径(供 up.sh 参考)
|
||||
echo -n "$now_bri_file" >"$MODDIR/config/.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"
|
||||
_log "inotifyd 已启动 (PID: $inotify_pid), 监听: $now_bri_file, 事件: $inotify_events" "SUCCESS"
|
||||
|
||||
# 3. 通过 wait 阻塞,实时感知进程死亡 (兼容所有 BusyBox 环境)
|
||||
wait "$inotify_pid"
|
||||
_log "[-] 监听进程 ($inotify_pid) 已退出,将在 1 秒后重启..." "WARN"
|
||||
_log "监听进程 (PID: $inotify_pid) 已退出,即将重启" "WARN"
|
||||
|
||||
sleep 0.5
|
||||
done
|
||||
+4
-4
@@ -11,12 +11,12 @@ _log() {
|
||||
printf '[%s] [restart] %s\n' "$(date '+%d %H:%M:%S.%3N')" "$1" >>"$log_file"
|
||||
}
|
||||
|
||||
_log "正在手动重启服务..."
|
||||
_log "收到手动重启请求"
|
||||
|
||||
pause_file="$PID_DIR/daemon.pause"
|
||||
|
||||
# 1. 强制通知守护进程并执行清理
|
||||
_log "通知守护进程执行全局重置..."
|
||||
_log "通知守护进程挂起,清理残余进程"
|
||||
touch "$pause_file"
|
||||
killall -9 inotifyd 2>/dev/null
|
||||
for p in $(pgrep -f "up.sh"); do
|
||||
@@ -26,10 +26,10 @@ done
|
||||
# 2. 清理遗留标记
|
||||
rm -f "$pid_file"
|
||||
rm -f "$flag_file"
|
||||
_log "已清理 pid 和 flag 锁文件"
|
||||
_log "已清理锁文件"
|
||||
|
||||
# 3. 恢复守护进程 (它会自动拉起新 inotifyd)
|
||||
rm -f "$pause_file"
|
||||
_log "服务正在由守护进程重新拉起..."
|
||||
_log "守护进程已恢复,等待自动拉起监听"
|
||||
|
||||
exit 0
|
||||
+99
-79
@@ -3,58 +3,50 @@
|
||||
# 亮度提升脚本
|
||||
|
||||
MODDIR="${0%/*/*}"
|
||||
CONFIG_DIR="$MODDIR/config"
|
||||
PATH_CONFIG_DIR="$CONFIG_DIR/path"
|
||||
CONFIG_FILE="$MODDIR/config/config.json"
|
||||
JQ="$MODDIR/bin/jq"
|
||||
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"
|
||||
get_cfg() {
|
||||
local key="$1" default="$2"
|
||||
local val
|
||||
if val=$("$JQ" -re ".${key}" "$CONFIG_FILE" 2>/dev/null); then
|
||||
echo "$val"
|
||||
else
|
||||
echo "$default_value"
|
||||
echo "$default"
|
||||
fi
|
||||
}
|
||||
|
||||
# 获取亮度文件路径
|
||||
now_bri_file="$(get_config "$PATH_CONFIG_DIR/now_bri_file.txt" "$DEFAULT_NOW_BRI_FILE")"
|
||||
now_bri_file="$(get_cfg now_bri_file "$DEFAULT_NOW_BRI_FILE")"
|
||||
|
||||
# 日志函数
|
||||
_log() {
|
||||
local level="${2:-INFO}"
|
||||
|
||||
case "$1" in
|
||||
"日志过大"*) ;;
|
||||
"日志超限"*) ;;
|
||||
*) if [ -f "$stop_file" ]; then return; fi ;;
|
||||
esac
|
||||
|
||||
local max_size
|
||||
max_size="$(cat "$CONFIG_DIR/log_max_size.txt" 2>/dev/null)"
|
||||
[ -z "$max_size" ] && max_size="500" # 默认 500 KB
|
||||
|
||||
# 获取当前日志大小 (KB)
|
||||
max_size="$(get_cfg log_max_size 500)"
|
||||
if [ -f "$log_file" ]; then
|
||||
local cur_size
|
||||
cur_size=$(du -k "$log_file" | cut -f1)
|
||||
if [ "$cur_size" -ge "$max_size" ]; then
|
||||
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "up" "WARN" "日志过大 ($cur_size KB), 自动重置" >"$log_file"
|
||||
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "up" "WARN" "日志超限 (${cur_size}KB / ${max_size}KB),已自动重置" >"$log_file"
|
||||
fi
|
||||
fi
|
||||
|
||||
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "up" "$level" "$1" >>"$log_file"
|
||||
}
|
||||
|
||||
_log "[*] 收到 inotifyd 通知 (PID: $$)" "INFO"
|
||||
_log "[!] 正在抢占:清理其他 inotifyd 进程..." "WAIT"
|
||||
_log "收到 inotifyd 事件通知 (PID: $$)" "INFO"
|
||||
_log "正在接管控制权,清理残余进程..." "INFO"
|
||||
touch "$pause_file"
|
||||
killall -9 inotifyd 2>/dev/null
|
||||
for p in $(pgrep -f "up.sh"); do
|
||||
@@ -62,135 +54,163 @@ for p in $(pgrep -f "up.sh"); do
|
||||
done
|
||||
|
||||
if [ -f "$stop_file" ]; then
|
||||
_log "[X] 服务已处于手动暂停状态,本次操作被取消" "WARN"
|
||||
_log "服务已暂停,跳过本次处理" "WARN"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f "$flag_file" ]; then
|
||||
_log "[X] 另一个 up.sh 进程正在运行,本进程退出" "WARN"
|
||||
_log "检测到并发执行,当前进程退出" "WARN"
|
||||
exit 1
|
||||
fi
|
||||
touch "$flag_file"
|
||||
|
||||
# 读取配置 (均为数值)
|
||||
ui_max_bri="$(cat "$CONFIG_DIR/ui_max_bri.txt")"
|
||||
max_bri="$(cat "$CONFIG_DIR/max_bri.txt")"
|
||||
sleep_time="$(cat "$CONFIG_DIR/sleep_time.txt" 2>/dev/null)"
|
||||
auto_bri_sleep="$(cat "$CONFIG_DIR/auto_bri_sleep.txt" 2>/dev/null)"
|
||||
# 读取配置
|
||||
ui_max_bri="$(get_cfg ui_max_bri 0)"
|
||||
max_bri="$(get_cfg max_bri 0)"
|
||||
sleep_time="$(get_cfg sleep_time '')"
|
||||
auto_bri_sleep="$(get_cfg auto_bri_sleep 1)"
|
||||
display_hdr_sleep="$(get_cfg display_hdr_sleep 0)"
|
||||
steps_num="$(get_cfg steps_num 50)"
|
||||
|
||||
# 解析休眠时间 (格式: HHMM-HHMM, 例如 1900-0600)
|
||||
sleep_start="${sleep_time%-*}" # 1900
|
||||
sleep_end="${sleep_time#*-}" # 0600
|
||||
# 解析休眠时间
|
||||
sleep_start="${sleep_time%-*}"
|
||||
sleep_end="${sleep_time#*-}"
|
||||
|
||||
# 判断当前是否处于休眠时段
|
||||
IS_SLEEP_TIME() {
|
||||
local now
|
||||
now="$(date '+%H%M')" # 当前时间, 例如 "2130"
|
||||
|
||||
# 未配置或格式无效则不休眠
|
||||
now="$(date '+%H%M')"
|
||||
[ -z "$sleep_start" ] || [ -z "$sleep_end" ] && return 1
|
||||
# 起止相同表示不启用休眠
|
||||
[ "$sleep_start" = "$sleep_end" ] && return 1
|
||||
|
||||
if [ "$sleep_start" -gt "$sleep_end" ]; then
|
||||
# 跨午夜: 1900-0600 → 当前 >= 19:00 或 当前 < 06:00
|
||||
[ "$now" -ge "$sleep_start" ] || [ "$now" -lt "$sleep_end" ]
|
||||
else
|
||||
# 不跨午夜: 0100-0600 → 当前 >= 01:00 且 当前 < 06:00
|
||||
[ "$now" -ge "$sleep_start" ] && [ "$now" -lt "$sleep_end" ]
|
||||
fi
|
||||
}
|
||||
|
||||
# 目标亮度
|
||||
target_bri="$max_bri"
|
||||
steps_num="$(cat "$CONFIG_DIR/steps_num.txt" 2>/dev/null)"
|
||||
[ -z "$steps_num" ] && steps_num="50" # 步数 (默认 50)
|
||||
|
||||
# 循环调整
|
||||
update_all() {
|
||||
local step
|
||||
|
||||
# 在调整前的这一刻读取当前亮度作为起始值
|
||||
start_bri="$(cat "$now_bri_file")"
|
||||
bri_diff="$((target_bri - start_bri))"
|
||||
step_value="$((bri_diff / steps_num))"
|
||||
|
||||
# 如果步长为 0 (差值太小), 直接设置目标亮度
|
||||
if [ "$step_value" -eq 0 ]; then
|
||||
_log "[OK] 直接设定亮度为: $target_bri" "INFO"
|
||||
_log "差値过小,直接设定亮度: $target_bri" "INFO"
|
||||
echo -n "$target_bri" >"$now_bri_file" && return 0 || return 1
|
||||
fi
|
||||
|
||||
_log "[*] 开始调整亮度: $start_bri -> $target_bri (共 $steps_num 步)" "INFO"
|
||||
_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
|
||||
done
|
||||
|
||||
# 最后一步写入目标亮度, 确保精确到位
|
||||
echo -n "$target_bri" >"$now_bri_file" && return 0 || return 1
|
||||
}
|
||||
|
||||
# 检测亮度是否符合条件
|
||||
CHECK_BRI() {
|
||||
local cycle_num
|
||||
local now_bri
|
||||
|
||||
# 循环 10 次 (检查 3s)
|
||||
local cycle_num now_bri
|
||||
# shellcheck disable=SC2034
|
||||
for cycle_num in $(seq 1 10); do
|
||||
now_bri="$(cat "$now_bri_file")"
|
||||
if [ "$now_bri" -ge "$ui_max_bri" ] && [ "$now_bri" -lt "$target_bri" ]; then
|
||||
_log "[+] 满足提升条件: $now_bri >= $ui_max_bri,目标 ^ $target_bri" "SUCCESS"
|
||||
|
||||
_log "触发提升: 当前亮度 $now_bri ≥ 阈値 $ui_max_bri,目标 $target_bri" "INFO"
|
||||
if update_all; then
|
||||
_log "[OK] 亮度提升已完成 (当前: $target_bri)" "SUCCESS"
|
||||
_log "================================================" "INFO"
|
||||
_log "亮度提升完成 ($target_bri)" "SUCCESS"
|
||||
return 0
|
||||
else
|
||||
_log "[X] 亮度提升失败:无法写入节点文件" "ERROR"
|
||||
_log "================================================" "ERROR"
|
||||
_log "亮度提升失败: 无法写入亮度节点" "ERROR"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
sleep 0.3
|
||||
done
|
||||
_log "[-] 检测超时:未持续触发有效提升阈值" "WARN"
|
||||
_log "检测超时: 亮度未持续达到提升阈値" "INFO"
|
||||
return 1
|
||||
}
|
||||
|
||||
MAIN() {
|
||||
# 解析并判断休眠
|
||||
if IS_SLEEP_TIME; then
|
||||
_log "[||] 休眠时段 ($sleep_start-$sleep_end),本次调整已跳过" "INFO"
|
||||
_log "================================================" "INFO"
|
||||
rm -f "$flag_file"
|
||||
_log "处于休眠时段 ($sleep_start-$sleep_end),跳过提升" "INFO"
|
||||
rm -f "$flag_file" "$pause_file"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ "$auto_bri_sleep" = "1" ]; then
|
||||
local mode
|
||||
mode="$(settings get system screen_brightness_mode 2>/dev/null)"
|
||||
if [ "$mode" = "1" ]; then
|
||||
_log "[<>] 自动亮度模式已启用,本次调整已跳过" "INFO"
|
||||
_log "================================================" "INFO"
|
||||
rm -f "$flag_file"
|
||||
_log "自动亮度已启用,跳过提升" "INFO"
|
||||
rm -f "$flag_file" "$pause_file"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
_log "[*] 检测亮度变化..." "INFO"
|
||||
# sleep 0.5
|
||||
# 黑名单检测(从 JSON 数组读取)
|
||||
local blacklist_len
|
||||
blacklist_len=$("$JQ" -r '.blacklist_apps | length' "$CONFIG_FILE" 2>/dev/null || echo "0")
|
||||
if [ "${blacklist_len:-0}" -gt 0 ]; then
|
||||
local current_focus current_app
|
||||
current_focus="$(dumpsys window | grep mCurrentFocus | sed 's/.*u[0-9][0-9]* //' | sed 's/}.*//')"
|
||||
current_app="${current_focus%%/*}"
|
||||
if [ -n "$current_focus" ] &&
|
||||
"$JQ" -re --arg f "$current_focus" --arg a "$current_app" \
|
||||
'.blacklist_apps | map(. == $f or . == $a) | any' \
|
||||
"$CONFIG_FILE" >/dev/null 2>&1; then
|
||||
_log "当前前台 ($current_focus) 在黑名单中,跳过提升" "INFO"
|
||||
rm -f "$flag_file" "$pause_file"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# 显示 HDR 内容时休眠
|
||||
if [ "$display_hdr_sleep" = "1" ]; then
|
||||
local hdr_flag_file="$PID_DIR/hdr.flag"
|
||||
if [ -f "$hdr_flag_file" ]; then
|
||||
local flag_time now
|
||||
flag_time="$(cat "$hdr_flag_file")"
|
||||
now="$(date +%s)"
|
||||
if awk "BEGIN{exit !(($now - $flag_time) < 2)}" 2>/dev/null; then
|
||||
_log "HDR 冷却期内,跳过提升" "INFO"
|
||||
rm -f "$flag_file" "$pause_file"
|
||||
return
|
||||
else
|
||||
rm -f "$hdr_flag_file"
|
||||
fi
|
||||
fi
|
||||
local hdr_ratio
|
||||
local hdr_cache_file="$PID_DIR/.hdr_ratio_cache"
|
||||
hdr_ratio="$(dumpsys display 2>/dev/null | sed -n 's/.*hdrSdrRatio \([0-9.]*\).*/\1/p' | head -n 1)"
|
||||
if echo "$hdr_ratio" | grep -qE '^[0-9]+\.[0-9]+$'; then
|
||||
echo -n "$hdr_ratio" >"$hdr_cache_file"
|
||||
elif [ -f "$hdr_cache_file" ]; then
|
||||
hdr_ratio="$(cat "$hdr_cache_file")"
|
||||
_log "HDR 比率读取为空,使用缓存值: $hdr_ratio" "INFO"
|
||||
fi
|
||||
if echo "$hdr_ratio" | grep -qE '^[0-9]+\.[0-9]+$'; then
|
||||
local hdr_ratio_rounded
|
||||
hdr_ratio_rounded="$(awk "BEGIN{printf \"%.2f\", $hdr_ratio}")"
|
||||
if awk "BEGIN{exit !($hdr_ratio_rounded > 1.00)}" 2>/dev/null; then
|
||||
_log "检测到 HDR 内容 (比率: $hdr_ratio_rounded),跳过提升" "INFO"
|
||||
date +%s >"$hdr_flag_file"
|
||||
rm -f "$flag_file" "$pause_file"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
_log "正在检测亮度变化..." "INFO"
|
||||
CHECK_BRI
|
||||
rm -f "$flag_file" # 删除成果锁
|
||||
rm -f "$pause_file" # 解锁守护进程,让它自动拉起 inotifyd
|
||||
rm -f "$flag_file"
|
||||
rm -f "$pause_file"
|
||||
|
||||
# 如果配置文件被修改了,杀掉 inotifyd 让 daemon 重启并重新读取配置
|
||||
# 如果监听路径变更,重启 inotifyd
|
||||
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")"
|
||||
|
||||
current_now_bri="$(get_cfg now_bri_file "$DEFAULT_NOW_BRI_FILE")"
|
||||
cached_now_bri="$(cat "$MODDIR/config/.cached_path" 2>/dev/null || echo "$DEFAULT_NOW_BRI_FILE")"
|
||||
if [ "$current_now_bri" != "$cached_now_bri" ]; then
|
||||
_log "[*] 配置已更新,重启 inotifyd..." "WARN"
|
||||
_log "检测到监听路径变更,重启 inotifyd" "INFO"
|
||||
killall -9 inotifyd 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
+19
-22
@@ -2,52 +2,49 @@
|
||||
#shellcheck shell=ash
|
||||
|
||||
MODDIR="${0%/*}"
|
||||
CONFIG_DIR="$MODDIR/config"
|
||||
PATH_CONFIG_DIR="$CONFIG_DIR/path"
|
||||
CONFIG_FILE="$MODDIR/config/config.json"
|
||||
JQ="$MODDIR/bin/jq"
|
||||
log_file="$MODDIR/service.log"
|
||||
|
||||
# 默认设备路径
|
||||
DEFAULT_NOW_BRI_FILE="/sys/class/backlight/panel0-backlight/brightness"
|
||||
DEFAULT_MAX_BRI_FILE="/sys/class/backlight/panel0-backlight/max_brightness"
|
||||
|
||||
# 读取配置函数
|
||||
get_config() {
|
||||
local config_file="$1"
|
||||
local default_value="$2"
|
||||
if [ -f "$config_file" ]; then
|
||||
cat "$config_file"
|
||||
get_cfg() {
|
||||
local key="$1" default="$2"
|
||||
local val
|
||||
if val=$("$JQ" -re ".${key}" "$CONFIG_FILE" 2>/dev/null); then
|
||||
echo "$val"
|
||||
else
|
||||
echo "$default_value"
|
||||
echo "$default"
|
||||
fi
|
||||
}
|
||||
|
||||
_log() {
|
||||
local level="${2:-INFO}"
|
||||
printf '[%s] [%s] [%-8s] %s\n' "$(date '+%m-%d %H:%M:%S')" "service" "$level" "$1" >>"$log_file"
|
||||
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "service" "$level" "$1" >>"$log_file"
|
||||
}
|
||||
|
||||
# 等待系统就绪
|
||||
sleep 30
|
||||
|
||||
_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"
|
||||
# 清理上次遗留的标记文件
|
||||
rm -f "$MODDIR/pid/"*.flag "$MODDIR/pid/"*.pause "$MODDIR/pid/.hdr_ratio_cache"
|
||||
|
||||
# 读取设备路径配置
|
||||
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 "LuminPro 服务启动" "INFO"
|
||||
_log "前台最大亮度: $(get_cfg ui_max_bri 0)" "INFO"
|
||||
_log "峰值最大亮度: $(get_cfg max_bri 0)" "INFO"
|
||||
_log "休眠时段: $(get_cfg sleep_time '')" "INFO"
|
||||
|
||||
now_bri_file="$(get_cfg now_bri_file "$DEFAULT_NOW_BRI_FILE")"
|
||||
max_bri_file="$(get_cfg max_bri_file "$DEFAULT_MAX_BRI_FILE")"
|
||||
_log "当前亮度节点: $now_bri_file" "INFO"
|
||||
_log "最大亮度节点: $max_bri_file" "INFO"
|
||||
|
||||
_log "启动守护监控进程..." "WAIT"
|
||||
_log "正在启动守护进程" "INFO"
|
||||
chmod 755 "$MODDIR/script/up.sh"
|
||||
chmod 755 "$MODDIR/script/daemon.sh"
|
||||
|
||||
# 启动守护进程
|
||||
sh "$MODDIR/script/daemon.sh" &
|
||||
_log "守护进程已启动 (PID: $!)" "SUCCESS"
|
||||
_log "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" "DONE"
|
||||
|
||||
exit 0
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"versionCode": 2204,
|
||||
"version": "V2.2",
|
||||
"zipUrl": "https://share.yule.ink/magisk/mod/luminpro/module/LuminPro_V2.2-2204.zip",
|
||||
"versionCode": 2208,
|
||||
"version": "V2.2-2208",
|
||||
"zipUrl": "https://share.yule.ink/magisk/mod/luminpro/module/LuminPro_V2.2-2208.zip",
|
||||
"changelog": "https://share.yule.ink/magisk/mod/luminpro/changelog.md"
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
+3
-292
@@ -6,301 +6,12 @@
|
||||
<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-B_73ZWwP.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BsOofCBH.css">
|
||||
<script type="module" crossorigin src="/assets/index-DR4CWo6g.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-N1q1T35U.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
<!-- 顶部头 -->
|
||||
<header class="app-header">
|
||||
<div class="header-content">
|
||||
<div class="header-text">
|
||||
<h1>LuminPro</h1>
|
||||
<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">
|
||||
<span class="status-dot"></span>
|
||||
<span class="status-text">运行中</span>
|
||||
</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" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<h2>亮度配置</h2>
|
||||
</div>
|
||||
|
||||
<!-- 分类: 亮度调节 -->
|
||||
<div class="config-group">
|
||||
<h3 class="group-title">亮度调节</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">前台最大亮度</span>
|
||||
<span class="config-desc">触发亮度提升的阈值</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-ui-max-bri" class="config-input" min="0" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">峰值最大亮度</span>
|
||||
<span class="config-desc">亮度提升的目标值</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-max-bri" class="config-input" min="0" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">亮度提升步数</span>
|
||||
<span class="config-desc">约 0.02 秒 / 步</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-steps-num" class="config-input" min="1" max="500" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 分类: 执行策略 -->
|
||||
<div class="config-group">
|
||||
<h3 class="group-title">执行策略</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">自动亮度时休眠</span>
|
||||
<span class="config-desc">开启自动亮度时不提升</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="input-auto-bri-sleep">
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">定时休眠</span>
|
||||
<span class="config-desc">设定时段内不提升亮度</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="input-sleep-mode">
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item-expand" id="sleep-time-expand">
|
||||
<div class="custom-time-picker">
|
||||
<div class="time-unit">
|
||||
<input type="number" id="input-sleep-start-h" class="time-input" min="0" max="23" placeholder="00" />
|
||||
<span>:</span>
|
||||
<input type="number" id="input-sleep-start-m" class="time-input" min="0" max="59" placeholder="00" />
|
||||
</div>
|
||||
<span class="time-sep">至</span>
|
||||
<div class="time-unit">
|
||||
<input type="number" id="input-sleep-end-h" class="time-input" min="0" max="23" placeholder="00" />
|
||||
<span>:</span>
|
||||
<input type="number" id="input-sleep-end-m" class="time-input" min="0" max="59" placeholder="00" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 分类: 系统管理 -->
|
||||
<div class="config-group">
|
||||
<h3 class="group-title">系统管理</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">日志大小限制</span>
|
||||
<span class="config-desc">单位: KB</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-log-max-size" class="config-input" min="1" max="10240" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<button class="btn btn-outline" id="btn-reset">
|
||||
恢复默认
|
||||
</button>
|
||||
<button class="btn btn-primary" id="btn-save">
|
||||
<span class="btn-icon"><i data-lucide="save"></i></span> 保存配置
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 高级设置卡片 -->
|
||||
<section class="card" id="advanced-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<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="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="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" data-nav-group="log">
|
||||
<div class="card-header">
|
||||
<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>
|
||||
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://shadcn-vue.com/schema.json",
|
||||
"style": "default",
|
||||
"typescript": false,
|
||||
"tailwind": {
|
||||
"config": "",
|
||||
"css": "src/index.css",
|
||||
"baseColor": "slate",
|
||||
"cssVariables": true,
|
||||
"prefix": ""
|
||||
},
|
||||
"aliases": {
|
||||
"components": "@/components",
|
||||
"utils": "@/lib/utils",
|
||||
"ui": "@/components/ui",
|
||||
"lib": "@/lib",
|
||||
"composables": "@/composables"
|
||||
},
|
||||
"registries": []
|
||||
}
|
||||
+1
-291
@@ -6,300 +6,10 @@
|
||||
<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" />
|
||||
<link rel="stylesheet" href="/src/style.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
<!-- 顶部头 -->
|
||||
<header class="app-header">
|
||||
<div class="header-content">
|
||||
<div class="header-text">
|
||||
<h1>LuminPro</h1>
|
||||
<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">
|
||||
<span class="status-dot"></span>
|
||||
<span class="status-text">运行中</span>
|
||||
</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" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<h2>亮度配置</h2>
|
||||
</div>
|
||||
|
||||
<!-- 分类: 亮度调节 -->
|
||||
<div class="config-group">
|
||||
<h3 class="group-title">亮度调节</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">前台最大亮度</span>
|
||||
<span class="config-desc">触发亮度提升的阈值</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-ui-max-bri" class="config-input" min="0" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">峰值最大亮度</span>
|
||||
<span class="config-desc">亮度提升的目标值</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-max-bri" class="config-input" min="0" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">亮度提升步数</span>
|
||||
<span class="config-desc">约 0.02 秒 / 步</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-steps-num" class="config-input" min="1" max="500" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 分类: 执行策略 -->
|
||||
<div class="config-group">
|
||||
<h3 class="group-title">执行策略</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">自动亮度时休眠</span>
|
||||
<span class="config-desc">开启自动亮度时不提升</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="input-auto-bri-sleep">
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">定时休眠</span>
|
||||
<span class="config-desc">设定时段内不提升亮度</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="input-sleep-mode">
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item-expand" id="sleep-time-expand">
|
||||
<div class="custom-time-picker">
|
||||
<div class="time-unit">
|
||||
<input type="number" id="input-sleep-start-h" class="time-input" min="0" max="23" placeholder="00" />
|
||||
<span>:</span>
|
||||
<input type="number" id="input-sleep-start-m" class="time-input" min="0" max="59" placeholder="00" />
|
||||
</div>
|
||||
<span class="time-sep">至</span>
|
||||
<div class="time-unit">
|
||||
<input type="number" id="input-sleep-end-h" class="time-input" min="0" max="23" placeholder="00" />
|
||||
<span>:</span>
|
||||
<input type="number" id="input-sleep-end-m" class="time-input" min="0" max="59" placeholder="00" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 分类: 系统管理 -->
|
||||
<div class="config-group">
|
||||
<h3 class="group-title">系统管理</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">日志大小限制</span>
|
||||
<span class="config-desc">单位: KB</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-log-max-size" class="config-input" min="1" max="10240" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<button class="btn btn-outline" id="btn-reset">
|
||||
恢复默认
|
||||
</button>
|
||||
<button class="btn btn-primary" id="btn-save">
|
||||
<span class="btn-icon"><i data-lucide="save"></i></span> 保存配置
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 高级设置卡片 -->
|
||||
<section class="card" id="advanced-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<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="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="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" data-nav-group="log">
|
||||
<div class="card-header">
|
||||
<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>
|
||||
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,148 @@
|
||||
<script setup>
|
||||
import { ref, provide, onMounted, onUnmounted, watch } from 'vue';
|
||||
import { moduleInfo } from 'kernelsu';
|
||||
import { runCmd, showToast } from './utils.js';
|
||||
import { useStatus } from './composables/useStatus.js';
|
||||
import { useConfig } from './composables/useConfig.js';
|
||||
import { useLog } from './composables/useLog.js';
|
||||
import BottomNav from './components/BottomNav.vue';
|
||||
import StatusView from './views/StatusView.vue';
|
||||
import ConfigView from './views/ConfigView.vue';
|
||||
import AppsView from './views/AppsView.vue';
|
||||
import LogView from './views/LogView.vue';
|
||||
import AboutView from './views/AboutView.vue';
|
||||
|
||||
const currentView = ref('status');
|
||||
const moduleVersion = ref('');
|
||||
const status = useStatus();
|
||||
const config = useConfig();
|
||||
const log = useLog();
|
||||
|
||||
// 供子组件使用
|
||||
provide('showToast', showToast);
|
||||
provide('status', status);
|
||||
provide('config', config);
|
||||
provide('log', log);
|
||||
|
||||
let refreshTimer = null;
|
||||
|
||||
function startRefresh() {
|
||||
stopRefresh();
|
||||
if (!config.autoRefresh.value) return;
|
||||
const interval = config.statusRefreshInterval.value;
|
||||
refreshTimer = setInterval(async () => {
|
||||
try {
|
||||
await Promise.all([status.load(), log.load()]);
|
||||
} catch {}
|
||||
}, interval);
|
||||
}
|
||||
|
||||
function stopRefresh() {
|
||||
if (refreshTimer) { clearInterval(refreshTimer); refreshTimer = null; }
|
||||
}
|
||||
|
||||
function restartRefresh(enabled, interval) {
|
||||
config.autoRefresh.value = enabled;
|
||||
config.statusRefreshInterval.value = interval;
|
||||
startRefresh();
|
||||
}
|
||||
provide('restartRefresh', restartRefresh);
|
||||
|
||||
// 跟随系统色彩偏好变化
|
||||
let _mq = null;
|
||||
function _onSystemTheme() {
|
||||
if (config.themeMode.value === 'system') config.applyTheme('system');
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
// 应用 UI 缩放 + 主题
|
||||
config.applyZoom();
|
||||
config.applyTheme(config.themeMode.value);
|
||||
_mq = window.matchMedia('(prefers-color-scheme: light)');
|
||||
_mq.addEventListener('change', _onSystemTheme);
|
||||
|
||||
// 读取模块版本
|
||||
try {
|
||||
const info = JSON.parse(moduleInfo());
|
||||
moduleVersion.value = info.version || '';
|
||||
} catch {
|
||||
moduleVersion.value = '[debug]';
|
||||
}
|
||||
|
||||
// 页面滚动监听
|
||||
window.addEventListener('scroll', onScroll, { passive: true });
|
||||
|
||||
// 初始加载
|
||||
try {
|
||||
await Promise.all([status.load(true), config.load(), log.load()]);
|
||||
} catch {}
|
||||
|
||||
startRefresh();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
stopRefresh();
|
||||
window.removeEventListener('scroll', onScroll);
|
||||
_mq?.removeEventListener('change', _onSystemTheme);
|
||||
});
|
||||
|
||||
function onScroll() {
|
||||
const topBlur = document.querySelector('.top-blur');
|
||||
if (topBlur) topBlur.classList.toggle('scrolled', window.scrollY > 10);
|
||||
}
|
||||
|
||||
function handleViewChange(view) {
|
||||
currentView.value = view;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="min-h-screen bg-background text-foreground">
|
||||
<!-- 顶部状态栏渐变模糊 -->
|
||||
<div class="top-blur"></div>
|
||||
|
||||
<div id="app">
|
||||
<!-- 顶部头 -->
|
||||
<header class="app-header">
|
||||
<div class="header-content">
|
||||
<div class="header-text">
|
||||
<h1>LuminPro</h1>
|
||||
<p class="header-subtitle">日用屏幕亮度强化</p>
|
||||
<p class="header-version">{{ moduleVersion || 'V2.2' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-status-container">
|
||||
<div
|
||||
class="header-status"
|
||||
id="module-status"
|
||||
:class="status.statusClass.value"
|
||||
>
|
||||
<span class="status-dot"></span>
|
||||
<span class="status-text">{{ status.statusText.value }}</span>
|
||||
</div>
|
||||
<div class="header-status-actions">
|
||||
<button class="btn-status-action" id="btn-toggle-service" @click="status.toggleService(showToast)">
|
||||
{{ status.isPaused.value ? '启用' : '暂停' }}
|
||||
</button>
|
||||
<button class="btn-status-action" id="btn-restart-service" @click="status.restartService(showToast)">
|
||||
重启
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 各视图(v-show 保持 DOM 以维持状态) -->
|
||||
<StatusView v-show="currentView === 'status'" />
|
||||
<ConfigView v-show="currentView === 'config'" />
|
||||
<AppsView v-show="currentView === 'apps'" />
|
||||
<LogView v-show="currentView === 'log'" />
|
||||
<AboutView v-show="currentView === 'about'" />
|
||||
</div>
|
||||
|
||||
<!-- 底栏导航 -->
|
||||
<BottomNav v-model="currentView" @update:model-value="handleViewChange" />
|
||||
|
||||
<!-- Toast (保持 id="toast" 供 utils.js showToast 使用) -->
|
||||
<div class="toast" id="toast"></div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,266 @@
|
||||
/* ==========================================
|
||||
About View Styles
|
||||
========================================== */
|
||||
.about-hero {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: var(--spacing-l) 0 var(--spacing-m);
|
||||
gap: 8px;
|
||||
}
|
||||
.about-logo {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
border-radius: 20px;
|
||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--md-sys-color-primary);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.about-name {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
.about-desc {
|
||||
margin: 0;
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
.about-version-badge {
|
||||
display: inline-block;
|
||||
padding: 2px 10px;
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
border-radius: 100px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
.about-section-title {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-primary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin: var(--spacing-l) 0 var(--spacing-s);
|
||||
}
|
||||
.about-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
border-radius: var(--border-radius-m);
|
||||
overflow: hidden;
|
||||
}
|
||||
.about-list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 14px 16px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-size: 0.9375rem;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
transition: background-color 0.15s;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
}
|
||||
.about-list-item + .about-list-item {
|
||||
border-top: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.06);
|
||||
}
|
||||
.about-list-item:active {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
}
|
||||
.about-list-icon {
|
||||
color: var(--md-sys-color-primary);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.about-list-chevron {
|
||||
margin-left: auto;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
opacity: 0.5;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.about-footer {
|
||||
text-align: center;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 0.8125rem;
|
||||
margin-top: var(--spacing-l);
|
||||
padding-top: var(--spacing-m);
|
||||
border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 142, 144, 153), 0.15);
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
Doc Sheet (Bottom drawer)
|
||||
========================================== */
|
||||
.doc-sheet-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.5);
|
||||
backdrop-filter: blur(4px);
|
||||
z-index: 1999;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
.doc-sheet-backdrop.show {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.doc-sheet {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
max-height: 90vh;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
border-radius: 28px 28px 0 0;
|
||||
z-index: 2000;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transform: translateY(100%);
|
||||
transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
|
||||
box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
|
||||
overflow: hidden;
|
||||
}
|
||||
.doc-sheet.show {
|
||||
transform: translateY(0);
|
||||
}
|
||||
.doc-sheet-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16px 16px 12px;
|
||||
border-bottom: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.07);
|
||||
gap: 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.doc-sheet-title {
|
||||
font-size: 1.0625rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
flex: 1;
|
||||
}
|
||||
.doc-sheet-close {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s;
|
||||
}
|
||||
.doc-sheet-close:active {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
}
|
||||
.doc-sheet-body {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 20px 20px 48px;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
.doc-sheet-body::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.doc-sheet-loading {
|
||||
text-align: center;
|
||||
padding: 48px 20px;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
.doc-sheet-content {
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.75;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
word-break: break-word;
|
||||
}
|
||||
.doc-sheet-content h1, .doc-sheet-content h2 {
|
||||
color: var(--md-sys-color-primary);
|
||||
margin-top: 1.4em;
|
||||
}
|
||||
.doc-sheet-content h3 {
|
||||
color: var(--md-sys-color-secondary);
|
||||
margin-top: 1.2em;
|
||||
}
|
||||
.doc-sheet-content code {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: 'Geist Mono', monospace;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
Log Filter Tabs
|
||||
========================================== */
|
||||
.log-filter-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-s);
|
||||
}
|
||||
.log-filter-tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: 4px;
|
||||
border-radius: var(--border-radius-s);
|
||||
}
|
||||
.log-filter-tab {
|
||||
padding: 4px 12px;
|
||||
border-radius: calc(var(--border-radius-s) - 2px);
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.log-filter-tab.active {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
color: var(--md-sys-color-primary);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
/* ==========================================
|
||||
Theme Segmented Button
|
||||
========================================== */
|
||||
.theme-seg {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: 3px;
|
||||
border-radius: var(--border-radius-s);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.theme-seg-btn {
|
||||
padding: 4px 12px;
|
||||
border-radius: calc(var(--border-radius-s) - 2px);
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.18s ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.theme-seg-btn.active {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,530 @@
|
||||
.app-list-hint {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
margin-top: 0;
|
||||
margin-bottom: var(--spacing-m);
|
||||
}
|
||||
|
||||
/* App Search */
|
||||
.app-search-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: var(--border-radius-m);
|
||||
padding: 8px 12px;
|
||||
margin-bottom: var(--spacing-m);
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.app-search-container:focus-within {
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.3);
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.app-search-input {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-size: 0.875rem;
|
||||
outline: none;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.app-search-input::placeholder {
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.count-badge {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
padding: 2px 8px;
|
||||
border-radius: 20px;
|
||||
margin-left: 8px;
|
||||
white-space: nowrap;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
/* App List */
|
||||
.app-list-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-s);
|
||||
max-height: 60vh;
|
||||
overflow-y: auto;
|
||||
border-radius: var(--border-radius-m);
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.app-list-container::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.app-list-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
border-radius: var(--border-radius-s);
|
||||
transition: background-color 0.2s;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.app-item-main-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-m);
|
||||
padding: var(--spacing-s) var(--spacing-m);
|
||||
}
|
||||
|
||||
.app-item-main-row:active {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
}
|
||||
|
||||
.app-checkbox-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.app-checkbox {
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.app-checkbox-custom {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border: 2px solid var(--md-sys-color-outline);
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.app-checkbox:checked + .app-checkbox-custom {
|
||||
background-color: var(--md-sys-color-primary);
|
||||
border-color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.app-checkbox.unsaved:checked + .app-checkbox-custom {
|
||||
background-color: #4caf50;
|
||||
border-color: #4caf50;
|
||||
}
|
||||
|
||||
.app-checkbox:checked + .app-checkbox-custom::after {
|
||||
content: '';
|
||||
width: 5px;
|
||||
height: 10px;
|
||||
border: solid var(--md-sys-color-on-primary);
|
||||
border-width: 0 2px 2px 0;
|
||||
transform: rotate(45deg);
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
|
||||
.app-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.app-name {
|
||||
font-size: 1rem;
|
||||
font-weight: 500;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.app-pkg {
|
||||
font-size: 0.8125rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-family: 'Geist Mono', monospace;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
word-break: break-all;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.app-badge {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
padding: 0 4px;
|
||||
border-radius: 4px;
|
||||
font-size: 0.65rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.app-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 8px;
|
||||
object-fit: cover;
|
||||
flex-shrink: 0;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.app-icon-fallback {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 8px;
|
||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), rgba(168, 199, 250, 0.5));
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.25rem;
|
||||
font-weight: bold;
|
||||
flex-shrink: 0;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.app-uid {
|
||||
font-size: 0.65rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
padding: 0 4px;
|
||||
border-radius: 4px;
|
||||
font-family: 'Geist Mono', monospace;
|
||||
margin-left: 6px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* 部分选中状态(有活动条目但包未完全选中)*/
|
||||
.app-checkbox-custom.partial {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
border-color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.app-checkbox-custom.partial::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
background-color: var(--md-sys-color-primary);
|
||||
border-radius: 1px;
|
||||
}
|
||||
|
||||
/* 活动列表展开箭头 */
|
||||
.app-activities-chevron {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: var(--border-radius-s);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s, background-color 0.2s;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.app-activities-chevron:hover {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
}
|
||||
|
||||
.app-activities-chevron.expanded {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
/* 活动列表容器 */
|
||||
.app-activities-list {
|
||||
display: none;
|
||||
flex-direction: column;
|
||||
padding: 0 var(--spacing-m) var(--spacing-s);
|
||||
border-top: 1px solid var(--md-sys-color-outline-variant);
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.app-activities-list.show {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* 单条活动条目 */
|
||||
.activity-entry-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 5px 4px;
|
||||
border-radius: var(--border-radius-s);
|
||||
}
|
||||
|
||||
.activity-entry-path {
|
||||
flex: 1;
|
||||
font-family: 'Geist Mono', 'Roboto Mono', monospace;
|
||||
font-size: 0.75rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
word-break: break-all;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.activity-entry-delete {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
color: var(--md-sys-color-error);
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.activity-entry-delete:hover {
|
||||
background-color: var(--md-sys-color-error-container);
|
||||
}
|
||||
|
||||
/* 按活动屏蔽输入卡片 */
|
||||
.activity-block-card {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
border-radius: var(--border-radius-m);
|
||||
padding: var(--spacing-s) var(--spacing-m);
|
||||
margin-bottom: var(--spacing-m);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.activity-block-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.activity-block-label {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.btn-picker-trigger {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
background: none;
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: var(--border-radius-s);
|
||||
color: var(--md-sys-color-primary);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
padding: 3px 8px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s, border-color 0.2s;
|
||||
white-space: nowrap;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.btn-picker-trigger:hover {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
border-color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.activity-block-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.activity-block-input {
|
||||
flex: 1;
|
||||
background: var(--md-sys-color-surface-container);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: var(--border-radius-s);
|
||||
padding: 7px 10px;
|
||||
font-family: 'Geist Mono', 'Roboto Mono', monospace;
|
||||
font-size: 0.8125rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
outline: none;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.activity-block-input:focus {
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.3);
|
||||
}
|
||||
|
||||
/* ========================
|
||||
获取活动名向导覆盖层
|
||||
======================== */
|
||||
.activity-picker-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: var(--md-sys-color-background);
|
||||
z-index: 950;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transform: translateX(100%);
|
||||
transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
}
|
||||
|
||||
.activity-picker-overlay.show {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
.activity-picker-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: calc(var(--safe-area-inset-top, 0px) + 16px) 16px 12px;
|
||||
border-bottom: 1px solid var(--md-sys-color-outline-variant);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.picker-back-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: 50%;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.picker-back-btn:hover {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
}
|
||||
|
||||
.picker-title {
|
||||
font-size: 1.0625rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.picker-steps-indicator {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 16px 0 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.picker-step-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--md-sys-color-outline-variant);
|
||||
transition: background-color 0.3s, transform 0.3s, width 0.3s;
|
||||
}
|
||||
|
||||
.picker-step-dot.active {
|
||||
background-color: var(--md-sys-color-primary);
|
||||
transform: scale(1.2);
|
||||
width: 18px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.activity-picker-body {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.picker-step {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 32px 32px calc(var(--safe-area-inset-bottom, 0px) + 48px);
|
||||
text-align: center;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.picker-step-icon {
|
||||
color: var(--md-sys-color-primary);
|
||||
opacity: 0.9;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.picker-step-title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-on-background);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.picker-step-desc {
|
||||
font-size: 0.9375rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
line-height: 1.65;
|
||||
max-width: 300px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.picker-action-btn {
|
||||
margin-top: 12px;
|
||||
padding: 12px 32px;
|
||||
border-radius: 24px;
|
||||
font-size: 0.9375rem;
|
||||
}
|
||||
|
||||
.picker-status-text {
|
||||
display: inline-block;
|
||||
font-weight: 500;
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.picker-status-text.polling {
|
||||
animation: picker-pulse 1.2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes picker-pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.35; }
|
||||
}
|
||||
|
||||
.picker-result-box {
|
||||
background: var(--md-sys-color-surface-container-high);
|
||||
border: 1.5px solid var(--md-sys-color-primary);
|
||||
border-radius: var(--border-radius-m);
|
||||
padding: 14px 18px;
|
||||
font-family: 'Geist Mono', 'Roboto Mono', monospace;
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
word-break: break-all;
|
||||
line-height: 1.55;
|
||||
max-width: 320px;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.picker-result-actions {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
@@ -0,0 +1,646 @@
|
||||
// oxlint-disable no-unused-expressions
|
||||
import { listPackages, getPackagesInfo } from 'kernelsu';
|
||||
import { createIcons, Eye, EyeOff } from 'lucide';
|
||||
import PinyinMatch from 'pinyin-match';
|
||||
import { CONFIG_DIR, showToast, runCmd, readConfig, updateConfig } from './utils.js';
|
||||
|
||||
let showingSystemApps = true;
|
||||
let savedBlacklist = new Set();
|
||||
let activityEntries = new Set(); // 活动级黑名单条目(格式:pkg/ActivityClass)
|
||||
|
||||
export function updateUnsavedStyling() {
|
||||
const items = document.querySelectorAll('.app-list-item');
|
||||
items.forEach(item => {
|
||||
const cb = item.querySelector('.app-checkbox');
|
||||
const custom = item.querySelector('.app-checkbox-custom');
|
||||
if (!cb || !custom) return;
|
||||
const pkg = cb.dataset.pkg;
|
||||
const hasActivities = pkg && [...activityEntries].some(e => e.startsWith(pkg + '/'));
|
||||
// 部分选中:有活动条目但包名未完全选中
|
||||
if (!cb.checked && hasActivities) {
|
||||
custom.classList.add('partial');
|
||||
} else {
|
||||
custom.classList.remove('partial');
|
||||
}
|
||||
// 未保存高亮
|
||||
if (cb.checked && !savedBlacklist.has(pkg)) {
|
||||
cb.classList.add('unsaved');
|
||||
} else {
|
||||
cb.classList.remove('unsaved');
|
||||
}
|
||||
// 箭头可见性
|
||||
const chevron = item.querySelector('.app-activities-chevron');
|
||||
if (chevron) {
|
||||
chevron.style.display = hasActivities ? '' : 'none';
|
||||
if (!hasActivities) {
|
||||
const actList = item.querySelector('.app-activities-list');
|
||||
if (actList) { actList.classList.remove('show'); chevron.classList.remove('expanded'); }
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
export function reorderDOMApps() {
|
||||
const container = document.getElementById('app-list-container');
|
||||
if (!container) return;
|
||||
const items = Array.from(container.children);
|
||||
const getState = (item) => {
|
||||
const cb = item.querySelector('.app-checkbox');
|
||||
if (cb?.checked) return 2; // 完全选中
|
||||
const pkg = cb?.dataset.pkg;
|
||||
if (pkg && [...activityEntries].some(e => e.startsWith(pkg + '/'))) return 1; // 部分选中
|
||||
return 0;
|
||||
};
|
||||
items.sort((a, b) => getState(b) - getState(a));
|
||||
items.forEach(item => container.appendChild(item));
|
||||
}
|
||||
|
||||
export function renderActivityList(pkg, container) {
|
||||
const entries = [...activityEntries].filter(e => e.startsWith(pkg + '/'));
|
||||
container.innerHTML = '';
|
||||
entries.forEach(entry => {
|
||||
const entryDiv = document.createElement('div');
|
||||
entryDiv.className = 'activity-entry-item';
|
||||
const actPath = document.createElement('span');
|
||||
actPath.className = 'activity-entry-path';
|
||||
actPath.textContent = entry.slice(pkg.length + 1);
|
||||
const delBtn = document.createElement('button');
|
||||
delBtn.className = 'activity-entry-delete';
|
||||
delBtn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>';
|
||||
delBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
activityEntries.delete(entry);
|
||||
renderActivityList(pkg, container);
|
||||
const actItem = container.closest('.app-list-item');
|
||||
if (actItem) {
|
||||
const chevron = actItem.querySelector('.app-activities-chevron');
|
||||
const remaining = [...activityEntries].filter(e => e.startsWith(pkg + '/'));
|
||||
if (chevron) chevron.style.display = remaining.length > 0 ? '' : 'none';
|
||||
if (remaining.length === 0) { container.classList.remove('show'); if (chevron) chevron.classList.remove('expanded'); }
|
||||
}
|
||||
updateUnsavedStyling();
|
||||
reorderDOMApps();
|
||||
});
|
||||
entryDiv.appendChild(actPath);
|
||||
entryDiv.appendChild(delBtn);
|
||||
container.appendChild(entryDiv);
|
||||
});
|
||||
}
|
||||
|
||||
export async function loadApps() {
|
||||
const container = document.getElementById('app-list-container');
|
||||
if (!container) return;
|
||||
container.innerHTML = '<div style="text-align:center;padding:20px;color:var(--md-sys-color-on-surface-variant);">加载中...</div>';
|
||||
|
||||
try {
|
||||
// 读取已保存的黑名单(从 JSON 配置读取)
|
||||
const cfg = await readConfig();
|
||||
const allSaved = Array.isArray(cfg.blacklist_apps) ? cfg.blacklist_apps : [];
|
||||
savedBlacklist = new Set(allSaved);
|
||||
const savedPkgEntries = new Set(allSaved.filter(e => !e.includes('/')));
|
||||
activityEntries = new Set(allSaved.filter(e => e.includes('/')));
|
||||
|
||||
let infoList = [];
|
||||
try {
|
||||
const pkgs = await listPackages();
|
||||
if (pkgs && pkgs.length > 0) {
|
||||
infoList = await getPackagesInfo(pkgs);
|
||||
} else {
|
||||
throw new Error('No packages found');
|
||||
}
|
||||
} catch {
|
||||
// 模拟 150 个应用包数据用于调试
|
||||
console.log("[DEBUG] 使用模拟应用列表数据");
|
||||
infoList = Array.from({ length: 150 }, (_, i) => ({
|
||||
packageName: `com.mock.app${i}`,
|
||||
appLabel: i % 10 === 0 ? `测试应用 ${i} (含抖音关键字)` : `模拟应用 ${i}`,
|
||||
isSystem: i % 5 === 0,
|
||||
uid: 10000 + i
|
||||
}));
|
||||
}
|
||||
|
||||
// 过滤系统应用
|
||||
if (!showingSystemApps) {
|
||||
infoList = infoList.filter(app => !app.isSystem);
|
||||
}
|
||||
|
||||
container.innerHTML = '';
|
||||
|
||||
// 排序:非系统优先,按名称
|
||||
infoList.sort((a, b) => {
|
||||
if (a.isSystem !== b.isSystem) return a.isSystem ? 1 : -1;
|
||||
return (a.appLabel || "").localeCompare(b.appLabel || "");
|
||||
});
|
||||
|
||||
if (infoList.length === 0) {
|
||||
infoList.push(
|
||||
{ packageName: "com.example.app1", appLabel: "示例 1", isSystem: false, uid: 10123 },
|
||||
{ packageName: "com.example.app2", appLabel: "示例 2", isSystem: false, uid: 10124 },
|
||||
{ packageName: "com.example.sys1", appLabel: "系统示例 1", isSystem: true, uid: 1000 },
|
||||
{ packageName: "com.example.sys2", appLabel: "系统示例 2", isSystem: true, uid: 1001 }
|
||||
);
|
||||
if (!showingSystemApps) {
|
||||
infoList = infoList.filter(app => !app.isSystem);
|
||||
}
|
||||
}
|
||||
|
||||
// uid 去重
|
||||
const seenUids = new Set();
|
||||
infoList = infoList.filter(app => {
|
||||
if (app.uid === undefined || app.uid === null) return true;
|
||||
if (seenUids.has(app.uid)) return false;
|
||||
seenUids.add(app.uid);
|
||||
return true;
|
||||
});
|
||||
|
||||
infoList.forEach(app => {
|
||||
const item = document.createElement('div');
|
||||
item.className = 'app-list-item';
|
||||
|
||||
const checkboxLabel = document.createElement('label');
|
||||
checkboxLabel.className = 'app-checkbox-label';
|
||||
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.className = 'app-checkbox';
|
||||
checkbox.dataset.pkg = app.packageName;
|
||||
|
||||
// 依据已保存包名条目勾选(不含活动条目)
|
||||
checkbox.checked = savedPkgEntries.has(app.packageName);
|
||||
checkbox.addEventListener('change', () => {
|
||||
updateUnsavedStyling();
|
||||
reorderDOMApps();
|
||||
});
|
||||
|
||||
const customCheckbox = document.createElement('span');
|
||||
customCheckbox.className = 'app-checkbox-custom';
|
||||
checkboxLabel.appendChild(checkbox);
|
||||
checkboxLabel.appendChild(customCheckbox);
|
||||
|
||||
const infoDiv = document.createElement('div');
|
||||
infoDiv.className = 'app-info';
|
||||
|
||||
const nameSpan = document.createElement('span');
|
||||
nameSpan.className = 'app-name';
|
||||
nameSpan.appendChild(document.createTextNode(app.appLabel || 'Unknown'));
|
||||
|
||||
if (app.uid !== undefined) {
|
||||
const uidBadge = document.createElement('span');
|
||||
uidBadge.className = 'app-uid';
|
||||
uidBadge.textContent = String(app.uid);
|
||||
nameSpan.appendChild(uidBadge);
|
||||
}
|
||||
|
||||
const pkgSpan = document.createElement('span');
|
||||
pkgSpan.className = 'app-pkg';
|
||||
pkgSpan.textContent = app.packageName || '';
|
||||
|
||||
if (app.isSystem) {
|
||||
const sysBadge = document.createElement('span');
|
||||
sysBadge.className = 'app-badge';
|
||||
sysBadge.textContent = '系统';
|
||||
pkgSpan.appendChild(sysBadge);
|
||||
}
|
||||
|
||||
infoDiv.appendChild(nameSpan);
|
||||
infoDiv.appendChild(pkgSpan);
|
||||
|
||||
// 活动展开箭头
|
||||
const chevronBtn = document.createElement('button');
|
||||
chevronBtn.className = 'app-activities-chevron';
|
||||
chevronBtn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>';
|
||||
const pkgActivities = [...activityEntries].filter(e => e.startsWith(app.packageName + '/'));
|
||||
chevronBtn.style.display = pkgActivities.length > 0 ? '' : 'none';
|
||||
|
||||
const mainRow = document.createElement('div');
|
||||
mainRow.className = 'app-item-main-row';
|
||||
mainRow.appendChild(checkboxLabel);
|
||||
mainRow.appendChild(infoDiv);
|
||||
mainRow.appendChild(chevronBtn);
|
||||
|
||||
// 活动列表(初始折叠)
|
||||
const actListDiv = document.createElement('div');
|
||||
actListDiv.className = 'app-activities-list';
|
||||
actListDiv.dataset.pkg = app.packageName;
|
||||
renderActivityList(app.packageName, actListDiv);
|
||||
|
||||
chevronBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
actListDiv.classList.toggle('show');
|
||||
chevronBtn.classList.toggle('expanded');
|
||||
});
|
||||
|
||||
item.appendChild(mainRow);
|
||||
item.appendChild(actListDiv);
|
||||
container.appendChild(item);
|
||||
});
|
||||
|
||||
updateUnsavedStyling();
|
||||
reorderDOMApps();
|
||||
|
||||
const badge = document.getElementById('app-count-badge');
|
||||
if (badge) badge.textContent = infoList.length;
|
||||
|
||||
if (infoList.length === 0) {
|
||||
container.innerHTML = '<div style="text-align:center;padding:20px;color:var(--md-sys-color-on-surface-variant);">无应用</div>';
|
||||
}
|
||||
} catch (e) {
|
||||
container.innerHTML = `<div style="text-align:center;padding:20px;color:var(--md-sys-color-error);">加载失败: ${e.message || String(e)}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
export function setupAppsEvents() {
|
||||
// 下拉菜单控制
|
||||
const btnAppsMenu = document.getElementById('btn-apps-menu');
|
||||
const appsDropdownMenu = document.getElementById('apps-dropdown-menu');
|
||||
|
||||
if (btnAppsMenu && appsDropdownMenu) {
|
||||
btnAppsMenu.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
appsDropdownMenu.classList.toggle('show');
|
||||
});
|
||||
document.addEventListener('click', (e) => {
|
||||
if (!btnAppsMenu.contains(e.target) && !appsDropdownMenu.contains(e.target)) {
|
||||
appsDropdownMenu.classList.remove('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 切换系统应用显示
|
||||
const btnToggleSysApps = document.getElementById('btn-toggle-sys-apps');
|
||||
if (btnToggleSysApps) {
|
||||
btnToggleSysApps.addEventListener('click', () => {
|
||||
showingSystemApps = !showingSystemApps;
|
||||
|
||||
const textSpan = document.getElementById('sys-apps-text');
|
||||
const iconWrap = document.getElementById('sys-apps-icon');
|
||||
|
||||
if (textSpan) textSpan.textContent = showingSystemApps ? '隐藏系统应用' : '显示系统应用';
|
||||
|
||||
if (iconWrap) {
|
||||
const p = iconWrap.parentNode;
|
||||
const newIcon = document.createElement('i');
|
||||
newIcon.setAttribute('data-lucide', showingSystemApps ? 'eye-off' : 'eye');
|
||||
newIcon.id = 'sys-apps-icon';
|
||||
p.replaceChild(newIcon, iconWrap);
|
||||
createIcons({ icons: { Eye, EyeOff }, nameAttr: 'data-lucide' });
|
||||
}
|
||||
|
||||
loadApps();
|
||||
appsDropdownMenu && appsDropdownMenu.classList.remove('show');
|
||||
});
|
||||
}
|
||||
|
||||
// 智能选择
|
||||
const btnSmartSelect = document.getElementById('btn-smart-select');
|
||||
if (btnSmartSelect) {
|
||||
const smartKeywords = ["相册", "抖音", "快手", "视频", "哔哩哔哩", "bili", "pili", "netflix", "youtube", "tiktok", "x"];
|
||||
btnSmartSelect.addEventListener('click', () => {
|
||||
const items = document.querySelectorAll('.app-list-item');
|
||||
items.forEach(item => {
|
||||
const name = item.querySelector('.app-name').textContent.toLowerCase();
|
||||
const checkbox = item.querySelector('.app-checkbox');
|
||||
let match = false;
|
||||
for (const kw of smartKeywords) {
|
||||
if (kw === 'x') {
|
||||
if (name === 'x' || name === 'x (twitter)') { match = true; break; }
|
||||
} else if (name.includes(kw)) {
|
||||
match = true; break;
|
||||
}
|
||||
}
|
||||
if (match) checkbox.checked = true;
|
||||
});
|
||||
updateUnsavedStyling();
|
||||
reorderDOMApps();
|
||||
appsDropdownMenu && appsDropdownMenu.classList.remove('show');
|
||||
});
|
||||
}
|
||||
|
||||
// 手动添加包名
|
||||
const btnManualAdd = document.getElementById('btn-manual-add');
|
||||
if (btnManualAdd) {
|
||||
btnManualAdd.addEventListener('click', async () => {
|
||||
appsDropdownMenu && appsDropdownMenu.classList.remove('show');
|
||||
const pkg = prompt('请输入你要彻底屏蔽的完整应用包名(例如: com.example.app):');
|
||||
if (!pkg || !pkg.trim()) return;
|
||||
|
||||
const realPkg = pkg.trim();
|
||||
const existing = document.querySelector(`.app-checkbox[data-pkg="${realPkg}"]`);
|
||||
if (existing) {
|
||||
existing.checked = true;
|
||||
updateUnsavedStyling();
|
||||
reorderDOMApps();
|
||||
showToast('该应用已在列表中,已为你自动勾选并置顶');
|
||||
return;
|
||||
}
|
||||
|
||||
showToast('正在尝试获取应用信息...');
|
||||
let appData = { packageName: realPkg, appLabel: '未知 (手动添加)', isSystem: false, uid: '自定义' };
|
||||
try {
|
||||
const info = await getPackagesInfo([realPkg]);
|
||||
if (info && info.length > 0) appData = info[0];
|
||||
} catch { /* ignore */ }
|
||||
|
||||
const container = document.getElementById('app-list-container');
|
||||
const item = document.createElement('div');
|
||||
item.className = 'app-list-item';
|
||||
|
||||
const checkboxLabel = document.createElement('label');
|
||||
checkboxLabel.className = 'app-checkbox-label';
|
||||
|
||||
const checkbox = document.createElement('input');
|
||||
checkbox.type = 'checkbox';
|
||||
checkbox.className = 'app-checkbox';
|
||||
checkbox.dataset.pkg = realPkg;
|
||||
checkbox.checked = true;
|
||||
checkbox.addEventListener('change', () => { updateUnsavedStyling(); reorderDOMApps(); });
|
||||
|
||||
const customCheckbox = document.createElement('span');
|
||||
customCheckbox.className = 'app-checkbox-custom';
|
||||
checkboxLabel.appendChild(checkbox);
|
||||
checkboxLabel.appendChild(customCheckbox);
|
||||
|
||||
const infoDiv = document.createElement('div');
|
||||
infoDiv.className = 'app-info';
|
||||
|
||||
const nameSpan = document.createElement('span');
|
||||
nameSpan.className = 'app-name';
|
||||
nameSpan.appendChild(document.createTextNode(appData.appLabel || 'Unknown'));
|
||||
|
||||
if (appData.uid !== undefined) {
|
||||
const uidBadge = document.createElement('span');
|
||||
uidBadge.className = 'app-uid';
|
||||
uidBadge.textContent = String(appData.uid);
|
||||
nameSpan.appendChild(uidBadge);
|
||||
}
|
||||
|
||||
const pkgSpan = document.createElement('span');
|
||||
pkgSpan.className = 'app-pkg';
|
||||
pkgSpan.textContent = realPkg;
|
||||
|
||||
if (appData.isSystem) {
|
||||
const sysBadge = document.createElement('span');
|
||||
sysBadge.className = 'app-badge';
|
||||
sysBadge.textContent = '系统';
|
||||
pkgSpan.appendChild(sysBadge);
|
||||
}
|
||||
|
||||
infoDiv.appendChild(nameSpan);
|
||||
infoDiv.appendChild(pkgSpan);
|
||||
|
||||
const chevronBtn = document.createElement('button');
|
||||
chevronBtn.className = 'app-activities-chevron';
|
||||
chevronBtn.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>';
|
||||
chevronBtn.style.display = 'none';
|
||||
|
||||
const mainRow = document.createElement('div');
|
||||
mainRow.className = 'app-item-main-row';
|
||||
mainRow.appendChild(checkboxLabel);
|
||||
mainRow.appendChild(infoDiv);
|
||||
mainRow.appendChild(chevronBtn);
|
||||
|
||||
const actListDiv = document.createElement('div');
|
||||
actListDiv.className = 'app-activities-list';
|
||||
actListDiv.dataset.pkg = realPkg;
|
||||
|
||||
chevronBtn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
actListDiv.classList.toggle('show');
|
||||
chevronBtn.classList.toggle('expanded');
|
||||
});
|
||||
|
||||
item.appendChild(mainRow);
|
||||
item.appendChild(actListDiv);
|
||||
container.appendChild(item);
|
||||
|
||||
updateUnsavedStyling();
|
||||
reorderDOMApps();
|
||||
showToast('已成功添加并勾选');
|
||||
});
|
||||
}
|
||||
|
||||
// 全选
|
||||
const btnSelectAll = document.getElementById('btn-select-all');
|
||||
if (btnSelectAll) {
|
||||
btnSelectAll.addEventListener('click', () => {
|
||||
document.querySelectorAll('.app-checkbox').forEach(cb => { cb.checked = true; });
|
||||
updateUnsavedStyling();
|
||||
appsDropdownMenu && appsDropdownMenu.classList.remove('show');
|
||||
});
|
||||
}
|
||||
|
||||
// 全不选
|
||||
const btnSelectNone = document.getElementById('btn-select-none');
|
||||
if (btnSelectNone) {
|
||||
btnSelectNone.addEventListener('click', () => {
|
||||
document.querySelectorAll('.app-checkbox').forEach(cb => { cb.checked = false; });
|
||||
updateUnsavedStyling();
|
||||
appsDropdownMenu && appsDropdownMenu.classList.remove('show');
|
||||
});
|
||||
}
|
||||
|
||||
// 反选
|
||||
const btnInvertSelection = document.getElementById('btn-invert-selection');
|
||||
if (btnInvertSelection) {
|
||||
btnInvertSelection.addEventListener('click', () => {
|
||||
document.querySelectorAll('.app-checkbox').forEach(cb => { cb.checked = !cb.checked; });
|
||||
updateUnsavedStyling();
|
||||
appsDropdownMenu && appsDropdownMenu.classList.remove('show');
|
||||
});
|
||||
}
|
||||
|
||||
// 刷新(重排)
|
||||
const btnAppsRefresh = document.getElementById('btn-apps-refresh');
|
||||
if (btnAppsRefresh) {
|
||||
btnAppsRefresh.addEventListener('click', () => { reorderDOMApps(); });
|
||||
}
|
||||
|
||||
// 保存黑名单
|
||||
const btnSaveBlacklist = document.getElementById('btn-save-blacklist');
|
||||
if (btnSaveBlacklist) {
|
||||
btnSaveBlacklist.addEventListener('click', async () => {
|
||||
showToast('保存中...');
|
||||
const selectedPkgs = [];
|
||||
document.querySelectorAll('.app-checkbox').forEach(cb => { if (cb.checked) selectedPkgs.push(cb.dataset.pkg); });
|
||||
const allEntries = [...selectedPkgs, ...activityEntries];
|
||||
const res = await updateConfig({ blacklist_apps: allEntries });
|
||||
if (res.errno === 0 || res.stdout?.includes('OK')) {
|
||||
showToast('黑名单保存成功');
|
||||
savedBlacklist = new Set(allEntries);
|
||||
updateUnsavedStyling();
|
||||
reorderDOMApps();
|
||||
} else {
|
||||
showToast('保存失败: ' + res.stderr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 按活动屏蔽
|
||||
const btnAddActivity = document.getElementById('btn-add-activity');
|
||||
const inputActivityEntry = document.getElementById('input-activity-entry');
|
||||
if (btnAddActivity && inputActivityEntry) {
|
||||
const doAddActivity = () => {
|
||||
const val = inputActivityEntry.value.trim();
|
||||
if (!val) return;
|
||||
const parts = val.split('/');
|
||||
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
||||
showToast('格式错误,请输入 包名/完整活动类名');
|
||||
return;
|
||||
}
|
||||
activityEntries.add(val);
|
||||
inputActivityEntry.value = '';
|
||||
const pkg = parts[0];
|
||||
document.querySelectorAll('.app-list-item').forEach(appItem => {
|
||||
const cb = appItem.querySelector('.app-checkbox');
|
||||
if (cb && cb.dataset.pkg === pkg) {
|
||||
const actList = appItem.querySelector('.app-activities-list');
|
||||
const chevron = appItem.querySelector('.app-activities-chevron');
|
||||
if (actList) { renderActivityList(pkg, actList); actList.classList.add('show'); }
|
||||
if (chevron) { chevron.style.display = ''; chevron.classList.add('expanded'); }
|
||||
}
|
||||
});
|
||||
updateUnsavedStyling();
|
||||
reorderDOMApps();
|
||||
showToast(`已添加: ${val}`);
|
||||
};
|
||||
btnAddActivity.addEventListener('click', doAddActivity);
|
||||
inputActivityEntry.addEventListener('keydown', (e) => { if (e.key === 'Enter') doAddActivity(); });
|
||||
}
|
||||
|
||||
// 搜索
|
||||
const inputAppSearch = document.getElementById('input-app-search');
|
||||
if (inputAppSearch) {
|
||||
inputAppSearch.addEventListener('input', (e) => {
|
||||
const keyword = e.target.value.trim().toLowerCase();
|
||||
const items = document.querySelectorAll('.app-list-item');
|
||||
let visibleCount = 0;
|
||||
items.forEach(item => {
|
||||
const name = item.querySelector('.app-name').textContent;
|
||||
const pkg = item.querySelector('.app-pkg').textContent.toLowerCase();
|
||||
if (!keyword || pkg.includes(keyword) || PinyinMatch.match(name, keyword)) {
|
||||
item.style.display = 'flex';
|
||||
visibleCount++;
|
||||
} else {
|
||||
item.style.display = 'none';
|
||||
}
|
||||
});
|
||||
const badge = document.getElementById('app-count-badge');
|
||||
if (badge) badge.textContent = visibleCount;
|
||||
});
|
||||
}
|
||||
|
||||
setupActivityPicker();
|
||||
}
|
||||
|
||||
function setupActivityPicker() {
|
||||
const overlay = document.getElementById('activity-picker-overlay');
|
||||
if (!overlay) return;
|
||||
|
||||
const btnPickActivity = document.getElementById('btn-pick-activity');
|
||||
const btnPickerBack = document.getElementById('btn-picker-back');
|
||||
const step1 = document.getElementById('picker-step-1');
|
||||
const step2 = document.getElementById('picker-step-2');
|
||||
const step3 = document.getElementById('picker-step-3');
|
||||
const dots = [
|
||||
document.getElementById('picker-dot-1'),
|
||||
document.getElementById('picker-dot-2'),
|
||||
document.getElementById('picker-dot-3'),
|
||||
];
|
||||
const btnStep1Next = document.getElementById('btn-picker-step1-next');
|
||||
const btnPickerStart = document.getElementById('btn-picker-start');
|
||||
const btnPickerRetry = document.getElementById('btn-picker-retry');
|
||||
const btnPickerConfirm = document.getElementById('btn-picker-confirm');
|
||||
const pickerStatusText = document.getElementById('picker-status-text');
|
||||
const pickerResultText = document.getElementById('picker-result-text');
|
||||
|
||||
let pollingTimer = null;
|
||||
let detectedActivity = null;
|
||||
|
||||
function showStep(n) {
|
||||
[step1, step2, step3].forEach((s, i) => {
|
||||
if (s) s.style.display = i + 1 === n ? 'flex' : 'none';
|
||||
});
|
||||
dots.forEach((d, i) => {
|
||||
d?.classList.toggle('active', i + 1 === n);
|
||||
});
|
||||
}
|
||||
|
||||
function stopPolling() {
|
||||
if (pollingTimer) { clearInterval(pollingTimer); pollingTimer = null; }
|
||||
}
|
||||
|
||||
function openPicker() {
|
||||
stopPolling();
|
||||
detectedActivity = null;
|
||||
if (btnPickerStart) btnPickerStart.disabled = false;
|
||||
if (pickerStatusText) {
|
||||
pickerStatusText.textContent = '等待中...';
|
||||
pickerStatusText.classList.remove('polling');
|
||||
}
|
||||
showStep(1);
|
||||
overlay.classList.add('show');
|
||||
}
|
||||
|
||||
function closePicker() {
|
||||
stopPolling();
|
||||
overlay.classList.remove('show');
|
||||
}
|
||||
|
||||
btnPickActivity?.addEventListener('click', openPicker);
|
||||
btnPickerBack?.addEventListener('click', closePicker);
|
||||
btnStep1Next?.addEventListener('click', () => showStep(2));
|
||||
|
||||
btnPickerStart?.addEventListener('click', () => {
|
||||
btnPickerStart.disabled = true;
|
||||
if (pickerStatusText) {
|
||||
pickerStatusText.textContent = '检测中,请切换到目标界面...';
|
||||
pickerStatusText.classList.add('polling');
|
||||
}
|
||||
stopPolling();
|
||||
pollingTimer = setInterval(async () => {
|
||||
try {
|
||||
const res = await runCmd(`dumpsys window 2>/dev/null | grep mCurrentFocus | sed 's/.*u[0-9][0-9]* //' | sed 's/}.*//'`);
|
||||
if (res.errno !== 0) return;
|
||||
const activity = res.stdout.trim();
|
||||
// 空值或仍在 WebUI 内则继续等待
|
||||
if (!activity || activity.toLowerCase().includes('webui')) return;
|
||||
stopPolling();
|
||||
detectedActivity = activity;
|
||||
if (pickerStatusText) pickerStatusText.classList.remove('polling');
|
||||
if (pickerResultText) pickerResultText.textContent = activity;
|
||||
if (btnPickerStart) btnPickerStart.disabled = false;
|
||||
showStep(3);
|
||||
} catch { /* 忽略,继续轮询 */ }
|
||||
}, 600);
|
||||
});
|
||||
|
||||
btnPickerRetry?.addEventListener('click', () => {
|
||||
stopPolling();
|
||||
detectedActivity = null;
|
||||
if (btnPickerStart) btnPickerStart.disabled = false;
|
||||
if (pickerStatusText) {
|
||||
pickerStatusText.textContent = '等待中...';
|
||||
pickerStatusText.classList.remove('polling');
|
||||
}
|
||||
showStep(2);
|
||||
});
|
||||
|
||||
btnPickerConfirm?.addEventListener('click', () => {
|
||||
if (!detectedActivity) return;
|
||||
activityEntries.add(detectedActivity);
|
||||
const pkg = detectedActivity.split('/')[0];
|
||||
document.querySelectorAll('.app-list-item').forEach(appItem => {
|
||||
const cb = appItem.querySelector('.app-checkbox');
|
||||
if (cb && cb.dataset.pkg === pkg) {
|
||||
const actList = appItem.querySelector('.app-activities-list');
|
||||
const chevron = appItem.querySelector('.app-activities-chevron');
|
||||
if (actList) { renderActivityList(pkg, actList); actList.classList.add('show'); }
|
||||
if (chevron) { chevron.style.display = ''; chevron.classList.add('expanded'); }
|
||||
}
|
||||
});
|
||||
updateUnsavedStyling();
|
||||
reorderDOMApps();
|
||||
showToast(`已添加: ${detectedActivity}`);
|
||||
closePicker();
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,564 @@
|
||||
/* Cards */
|
||||
.card {
|
||||
background-color: var(--md-sys-color-surface);
|
||||
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;
|
||||
}
|
||||
|
||||
/* Page Transitions */
|
||||
.card-animate-in {
|
||||
animation: cardFadeIn 0.4s cubic-bezier(0.2, 0, 0, 1) forwards;
|
||||
}
|
||||
|
||||
.navbar-slider {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
@keyframes cardFadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(12px) scale(0.985);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
#log-section {
|
||||
flex: 1;
|
||||
min-height: calc(100vh - 220px);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-s);
|
||||
margin-bottom: var(--spacing-l);
|
||||
}
|
||||
|
||||
.card-header h2 {
|
||||
margin: 0;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 500;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
/* Config Items */
|
||||
.config-group {
|
||||
margin-bottom: var(--spacing-l);
|
||||
padding: var(--spacing-m);
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
border-radius: var(--border-radius-m);
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.05);
|
||||
}
|
||||
|
||||
.group-title {
|
||||
margin: 0 0 var(--spacing-m) 0;
|
||||
color: var(--md-sys-color-primary);
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.group-title i, .group-title svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.config-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
#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);
|
||||
border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 142, 144, 153), 0.1);
|
||||
padding-top: var(--spacing-m);
|
||||
}
|
||||
|
||||
.config-label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.config-name {
|
||||
font-size: 1rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.config-desc {
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.config-input {
|
||||
width: 100px;
|
||||
padding: 8px 12px;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: var(--border-radius-s);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-size: 1rem;
|
||||
font-family: inherit;
|
||||
text-align: right;
|
||||
outline: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.config-input:focus {
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2);
|
||||
background-color: var(--md-sys-color-surface);
|
||||
}
|
||||
|
||||
#advanced-section .config-input {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.config-textarea {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
width: 100%;
|
||||
min-height: 60px;
|
||||
max-height: 300px;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: var(--border-radius-m);
|
||||
resize: vertical;
|
||||
padding: 10px 14px;
|
||||
font-family: 'Geist Mono', system-ui, monospace;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.4;
|
||||
transition: all 0.2s ease;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.config-textarea:focus {
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2);
|
||||
background-color: var(--md-sys-color-surface);
|
||||
}
|
||||
|
||||
.config-input-wide {
|
||||
width: 140px;
|
||||
}
|
||||
|
||||
.config-item-expand {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: var(--spacing-s);
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.config-item-expand.show {
|
||||
max-height: 100px; /* 调整为适合内容的高度 */
|
||||
opacity: 1;
|
||||
margin-bottom: var(--spacing-m);
|
||||
}
|
||||
|
||||
/* Custom Time Picker Styles */
|
||||
.custom-time-picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.time-unit {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
padding: 2px 6px;
|
||||
border-radius: var(--border-radius-s);
|
||||
border: 1px solid var(--md-sys-color-outline);
|
||||
}
|
||||
|
||||
.time-input {
|
||||
width: 32px;
|
||||
background-color: transparent;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
border: none;
|
||||
font-size: 0.875rem;
|
||||
text-align: center;
|
||||
font-family: 'Geist Mono', monospace;
|
||||
outline: none;
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
.time-input::-webkit-outer-spin-button,
|
||||
.time-input::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.time-sep {
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
/* Switch Styles */
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 52px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
transition: .4s;
|
||||
border-radius: 34px;
|
||||
border: 2px solid var(--md-sys-color-outline);
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
left: 2px;
|
||||
bottom: 2px;
|
||||
background-color: var(--md-sys-color-outline);
|
||||
transition: .4s;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
border-color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
transform: translateX(20px);
|
||||
background-color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
/* Status Grid */
|
||||
.status-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--spacing-m);
|
||||
}
|
||||
|
||||
.status-item {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: var(--spacing-m);
|
||||
border-radius: var(--border-radius-m);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.04);
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.status-item:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.status-item-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.status-item-header svg {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.status-label {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.status-value {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-primary);
|
||||
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 (Progress Bar Style) */
|
||||
.brightness-slider {
|
||||
flex: 1;
|
||||
height: 24px;
|
||||
border-radius: 12px;
|
||||
/* 背景将由 JS 通过 linear-gradient 动态更新实现进度条效果 */
|
||||
background: var(--md-sys-color-surface-container-high);
|
||||
outline: none;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
cursor: grab;
|
||||
transition: height 0.2s, box-shadow 0.2s;
|
||||
border: 1px solid rgba(255, 255, 255, 0.03);
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
|
||||
overflow: hidden; /* 确保进度条颜色不溢出圆角 */
|
||||
}
|
||||
|
||||
.brightness-slider:hover {
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.brightness-slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 0;
|
||||
height: 0;
|
||||
background: transparent;
|
||||
cursor: grab;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.brightness-slider::-webkit-slider-thumb:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.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(var(--md-sys-color-primary-rgb), 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;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: var(--spacing-l);
|
||||
padding-top: var(--spacing-m);
|
||||
border-top: 1px solid var(--md-sys-color-outline-variant);
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 10px 24px;
|
||||
border-radius: 100px;
|
||||
border: none;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s, opacity 0.2s;
|
||||
}
|
||||
|
||||
.btn:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: var(--md-sys-color-primary);
|
||||
color: var(--md-sys-color-on-primary);
|
||||
}
|
||||
|
||||
.btn-outline {
|
||||
background-color: transparent;
|
||||
border: 1px solid var(--md-sys-color-outline);
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.btn-outline-s, .btn-text-s {
|
||||
background-color: transparent;
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
color: var(--md-sys-color-primary);
|
||||
padding: 4px 10px;
|
||||
min-width: 50px;
|
||||
height: 28px;
|
||||
font-size: 0.75rem;
|
||||
border-radius: var(--border-radius-s);
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn-text-s:active {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: var(--md-sys-color-error) !important;
|
||||
color: var(--md-sys-color-on-error) !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
/* Header Actions container */
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.btn-icon-only {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 1.25rem;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.btn-icon-only-s {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
color: var(--md-sys-color-primary);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.btn-icon-only-s:active {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.btn-icon-only-s i, .btn-icon-only-s svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.animate-spin {
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted, watch } from 'vue';
|
||||
import {
|
||||
Activity as IconActivity,
|
||||
Settings as IconSettings,
|
||||
AppWindow as IconApps,
|
||||
ScrollText as IconLog,
|
||||
Info as IconInfo,
|
||||
} from 'lucide-vue-next';
|
||||
|
||||
const props = defineProps({ modelValue: { type: String, default: 'status' } });
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
const navItems = [
|
||||
{ key: 'status', label: '状态', icon: IconActivity },
|
||||
{ key: 'config', label: '配置', icon: IconSettings },
|
||||
{ key: 'apps', label: '黑名单', icon: IconApps },
|
||||
{ key: 'log', label: '日志', icon: IconLog },
|
||||
{ key: 'about', label: '关于', icon: IconInfo },
|
||||
];
|
||||
|
||||
const navbarEl = ref(null);
|
||||
const sliderEl = ref(null);
|
||||
const btnRefs = ref([]);
|
||||
|
||||
function updateSlider(key, animate = true) {
|
||||
const idx = navItems.findIndex(n => n.key === key);
|
||||
if (idx < 0) return;
|
||||
const btn = btnRefs.value[idx];
|
||||
if (!btn || !sliderEl.value) return;
|
||||
if (!animate) sliderEl.value.style.transition = 'none';
|
||||
sliderEl.value.style.width = btn.offsetWidth + 'px';
|
||||
sliderEl.value.style.transform = `translateX(${btn.offsetLeft}px)`;
|
||||
if (!animate) requestAnimationFrame(() => { if (sliderEl.value) sliderEl.value.style.transition = ''; });
|
||||
}
|
||||
|
||||
function select(key) {
|
||||
emit('update:modelValue', key);
|
||||
}
|
||||
|
||||
watch(() => props.modelValue, v => updateSlider(v));
|
||||
|
||||
// ---- 拖拽逻辑 ----
|
||||
let isDragging = false;
|
||||
let isActuallyDragging = false;
|
||||
let startX = 0;
|
||||
let startSliderX = 0;
|
||||
|
||||
function onPointerDown(e) {
|
||||
isDragging = true;
|
||||
isActuallyDragging = false;
|
||||
startX = e.clientX;
|
||||
const idx = navItems.findIndex(n => n.key === props.modelValue);
|
||||
startSliderX = idx >= 0 && btnRefs.value[idx] ? btnRefs.value[idx].offsetLeft : 0;
|
||||
}
|
||||
|
||||
function onPointerMove(e) {
|
||||
if (!isDragging) return;
|
||||
const dx = e.clientX - startX;
|
||||
if (!isActuallyDragging && Math.abs(dx) > 10) {
|
||||
isActuallyDragging = true;
|
||||
navbarEl.value?.setPointerCapture(e.pointerId);
|
||||
}
|
||||
if (!isActuallyDragging || !sliderEl.value) return;
|
||||
const first = btnRefs.value[0];
|
||||
const last = btnRefs.value[btnRefs.value.length - 1];
|
||||
const minX = first ? first.offsetLeft : 0;
|
||||
const maxX = last ? last.offsetLeft : 0;
|
||||
let tx = startSliderX + dx;
|
||||
if (tx < minX) tx = minX + (tx - minX) * 0.3;
|
||||
if (tx > maxX) tx = maxX + (tx - maxX) * 0.3;
|
||||
sliderEl.value.style.transition = 'none';
|
||||
sliderEl.value.style.transform = `translateX(${tx}px)`;
|
||||
}
|
||||
|
||||
function onPointerUp(e) {
|
||||
if (!isDragging) return;
|
||||
const wasDragging = isActuallyDragging;
|
||||
isDragging = false;
|
||||
isActuallyDragging = false;
|
||||
navbarEl.value?.releasePointerCapture(e.pointerId);
|
||||
|
||||
if (wasDragging && sliderEl.value) {
|
||||
const sliderRect = sliderEl.value.getBoundingClientRect();
|
||||
const navRect = navbarEl.value?.getBoundingClientRect();
|
||||
const currentX = navRect ? sliderRect.left - navRect.left : 0;
|
||||
let closest = navItems[0].key;
|
||||
let minDist = Infinity;
|
||||
btnRefs.value.forEach((btn, i) => {
|
||||
if (!btn) return;
|
||||
const dist = Math.abs(btn.offsetLeft - currentX);
|
||||
if (dist < minDist) { minDist = dist; closest = navItems[i].key; }
|
||||
});
|
||||
select(closest);
|
||||
} else {
|
||||
updateSlider(props.modelValue);
|
||||
}
|
||||
}
|
||||
|
||||
function onResize() { updateSlider(props.modelValue, false); }
|
||||
|
||||
onMounted(() => {
|
||||
updateSlider(props.modelValue, false);
|
||||
window.addEventListener('resize', onResize);
|
||||
});
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', onResize);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<nav
|
||||
class="floating-navbar"
|
||||
ref="navbarEl"
|
||||
@pointerdown="onPointerDown"
|
||||
@pointermove="onPointerMove"
|
||||
@pointerup="onPointerUp"
|
||||
>
|
||||
<div class="navbar-slider" ref="sliderEl"></div>
|
||||
|
||||
<button
|
||||
v-for="(item, i) in navItems"
|
||||
:key="item.key"
|
||||
:ref="el => btnRefs[i] = el"
|
||||
class="navbar-btn"
|
||||
:class="{ active: modelValue === item.key }"
|
||||
:data-section="item.key"
|
||||
@click="select(item.key)"
|
||||
>
|
||||
<component :is="item.icon" :size="20" :stroke-width="1.75" />
|
||||
<span>{{ item.label }}</span>
|
||||
</button>
|
||||
</nav>
|
||||
</template>
|
||||
@@ -0,0 +1,32 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cva } from 'class-variance-authority';
|
||||
|
||||
const badgeVariants = cva(
|
||||
'inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium transition-colors',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'bg-primary/20 text-primary border border-primary/30',
|
||||
secondary: 'bg-secondary text-secondary-foreground',
|
||||
destructive: 'bg-destructive/20 text-destructive border border-destructive/30',
|
||||
outline: 'border border-border text-foreground',
|
||||
success: 'bg-green-500/20 text-green-400 border border-green-500/30',
|
||||
warning: 'bg-amber-500/20 text-amber-400 border border-amber-500/30',
|
||||
},
|
||||
},
|
||||
defaultVariants: { variant: 'default' },
|
||||
}
|
||||
);
|
||||
|
||||
const props = defineProps({
|
||||
variant: { type: String, default: 'default' },
|
||||
class: { type: String, default: '' },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span :class="cn(badgeVariants({ variant }), props.class)">
|
||||
<slot />
|
||||
</span>
|
||||
</template>
|
||||
@@ -0,0 +1,51 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cva } from 'class-variance-authority';
|
||||
|
||||
const buttonVariants = cva(
|
||||
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80',
|
||||
destructive: 'bg-destructive/20 text-destructive border border-destructive/40 hover:bg-destructive/30',
|
||||
outline: 'border border-border bg-transparent hover:bg-secondary hover:text-secondary-foreground',
|
||||
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
||||
ghost: 'hover:bg-secondary hover:text-secondary-foreground',
|
||||
link: 'text-primary underline-offset-4 hover:underline',
|
||||
},
|
||||
size: {
|
||||
default: 'h-9 px-4 py-2',
|
||||
sm: 'h-8 rounded-md px-3 text-xs',
|
||||
lg: 'h-10 rounded-md px-8',
|
||||
icon: 'h-9 w-9',
|
||||
'icon-sm': 'h-8 w-8',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const props = defineProps({
|
||||
variant: { type: String, default: 'default' },
|
||||
size: { type: String, default: 'default' },
|
||||
class: { type: String, default: '' },
|
||||
disabled: { type: Boolean, default: false },
|
||||
type: { type: String, default: 'button' },
|
||||
as: { type: String, default: 'button' },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<component
|
||||
:is="as"
|
||||
:type="as === 'button' ? type : undefined"
|
||||
:disabled="disabled || undefined"
|
||||
:class="cn(buttonVariants({ variant, size }), props.class)"
|
||||
>
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
@@ -0,0 +1,13 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :class="cn('rounded-xl border border-border/40 bg-card text-card-foreground shadow-md', props.class)">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,36 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
modelValue: { type: [String, Number], default: '' },
|
||||
type: { type: String, default: 'text' },
|
||||
placeholder: { type: String, default: '' },
|
||||
disabled: { type: Boolean, default: false },
|
||||
min: { type: [String, Number], default: undefined },
|
||||
max: { type: [String, Number], default: undefined },
|
||||
autocomplete: { type: String, default: 'off' },
|
||||
spellcheck: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<input
|
||||
v-bind="$attrs"
|
||||
:type="type"
|
||||
:value="modelValue"
|
||||
:placeholder="placeholder"
|
||||
:disabled="disabled"
|
||||
:min="min"
|
||||
:max="max"
|
||||
:autocomplete="autocomplete"
|
||||
:spellcheck="spellcheck"
|
||||
:class="cn(
|
||||
'flex h-9 w-full rounded-md border border-input bg-muted px-3 py-1 text-sm text-foreground shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-primary disabled:cursor-not-allowed disabled:opacity-50',
|
||||
props.class
|
||||
)"
|
||||
@input="emit('update:modelValue', $event.target.value)"
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,14 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
for: { type: String, default: undefined },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<label :for="props.for" :class="cn('text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70', props.class)">
|
||||
<slot />
|
||||
</label>
|
||||
</template>
|
||||
@@ -0,0 +1,19 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
vertical: { type: Boolean, default: false },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
:role="'separator'"
|
||||
:class="cn(
|
||||
vertical ? 'inline-flex h-full w-px' : 'flex h-px w-full',
|
||||
'bg-border shrink-0',
|
||||
props.class
|
||||
)"
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,39 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
modelValue: { type: Boolean, default: false },
|
||||
disabled: { type: Boolean, default: false },
|
||||
id: { type: String, default: undefined },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
:aria-checked="modelValue"
|
||||
:disabled="disabled"
|
||||
:id="id"
|
||||
:class="cn(
|
||||
'relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
|
||||
modelValue
|
||||
? 'bg-primary border-2 border-transparent'
|
||||
: 'bg-transparent border-2 border-muted-foreground/40',
|
||||
props.class
|
||||
)"
|
||||
@click="emit('update:modelValue', !modelValue)"
|
||||
>
|
||||
<span
|
||||
:class="cn(
|
||||
'pointer-events-none block rounded-full shadow-sm ring-0 transition-all duration-200',
|
||||
modelValue
|
||||
? 'h-5 w-5 translate-x-5 bg-white'
|
||||
: 'h-4 w-4 translate-x-0.5 bg-muted-foreground/60'
|
||||
)"
|
||||
/>
|
||||
</button>
|
||||
</template>
|
||||
@@ -0,0 +1,28 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
modelValue: { type: String, default: '' },
|
||||
placeholder: { type: String, default: '' },
|
||||
disabled: { type: Boolean, default: false },
|
||||
rows: { type: Number, default: 2 },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<textarea
|
||||
v-bind="$attrs"
|
||||
:value="modelValue"
|
||||
:placeholder="placeholder"
|
||||
:disabled="disabled"
|
||||
:rows="rows"
|
||||
:class="cn(
|
||||
'flex min-h-15 w-full rounded-md border border-input bg-muted px-3 py-2 text-sm font-mono text-foreground shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-primary disabled:cursor-not-allowed disabled:opacity-50 resize-vertical',
|
||||
props.class
|
||||
)"
|
||||
@input="emit('update:modelValue', $event.target.value)"
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,159 @@
|
||||
import { ref, reactive } from 'vue';
|
||||
import { listPackages, getPackagesInfo } from 'kernelsu';
|
||||
import PinyinMatch from 'pinyin-match';
|
||||
import { runCmd, readConfig, updateConfig } from '../utils.js';
|
||||
|
||||
export function useApps() {
|
||||
const apps = ref([]);
|
||||
const isLoading = ref(false);
|
||||
const loadError = ref('');
|
||||
const searchKeyword = ref('');
|
||||
const showingSystemApps = ref(true);
|
||||
const savedBlacklist = ref(new Set());
|
||||
const activityEntries = ref(new Set());
|
||||
|
||||
/** 每个 app 条目结构: { packageName, appLabel, isSystem, uid, checked, hasActivities } */
|
||||
|
||||
async function load() {
|
||||
isLoading.value = true;
|
||||
loadError.value = '';
|
||||
try {
|
||||
const cfg = await readConfig();
|
||||
const allSaved = Array.isArray(cfg.blacklist_apps) ? cfg.blacklist_apps : [];
|
||||
savedBlacklist.value = new Set(allSaved);
|
||||
const savedPkgSet = new Set(allSaved.filter(e => !e.includes('/')));
|
||||
activityEntries.value = new Set(allSaved.filter(e => e.includes('/')));
|
||||
|
||||
let infoList = [];
|
||||
try {
|
||||
const pkgs = await listPackages();
|
||||
if (pkgs && pkgs.length > 0) infoList = await getPackagesInfo(pkgs);
|
||||
else throw new Error('no pkgs');
|
||||
} catch {
|
||||
console.log('[DEBUG] 使用模拟数据');
|
||||
infoList = Array.from({ length: 150 }, (_, i) => ({
|
||||
packageName: `com.mock.app${i}`,
|
||||
appLabel: i % 10 === 0 ? `测试应用 ${i} (含抖音关键字)` : `模拟应用 ${i}`,
|
||||
isSystem: i % 5 === 0,
|
||||
uid: 10000 + i,
|
||||
}));
|
||||
}
|
||||
|
||||
if (!showingSystemApps.value) infoList = infoList.filter(a => !a.isSystem);
|
||||
|
||||
infoList.sort((a, b) => {
|
||||
if (a.isSystem !== b.isSystem) return a.isSystem ? 1 : -1;
|
||||
return (a.appLabel || '').localeCompare(b.appLabel || '');
|
||||
});
|
||||
|
||||
const seenUids = new Set();
|
||||
infoList = infoList.filter(a => {
|
||||
if (a.uid == null) return true;
|
||||
if (seenUids.has(a.uid)) return false;
|
||||
seenUids.add(a.uid); return true;
|
||||
});
|
||||
|
||||
apps.value = infoList.map(a => reactive({
|
||||
packageName: a.packageName,
|
||||
appLabel: a.appLabel || 'Unknown',
|
||||
isSystem: a.isSystem,
|
||||
uid: a.uid,
|
||||
checked: savedPkgSet.has(a.packageName),
|
||||
expanded: false,
|
||||
}));
|
||||
|
||||
_reorder();
|
||||
} catch (e) {
|
||||
loadError.value = e.message || String(e);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function _reorder() {
|
||||
apps.value.sort((a, b) => {
|
||||
const stateA = a.checked ? 2 : (hasActivity(a.packageName) ? 1 : 0);
|
||||
const stateB = b.checked ? 2 : (hasActivity(b.packageName) ? 1 : 0);
|
||||
return stateB - stateA;
|
||||
});
|
||||
}
|
||||
|
||||
function hasActivity(pkg) {
|
||||
return [...activityEntries.value].some(e => e.startsWith(pkg + '/'));
|
||||
}
|
||||
|
||||
function getActivities(pkg) {
|
||||
return [...activityEntries.value].filter(e => e.startsWith(pkg + '/'));
|
||||
}
|
||||
|
||||
function addActivity(entry) {
|
||||
activityEntries.value.add(entry);
|
||||
_reorder();
|
||||
}
|
||||
|
||||
function removeActivity(entry) {
|
||||
activityEntries.value.delete(entry);
|
||||
_reorder();
|
||||
}
|
||||
|
||||
async function save(toast) {
|
||||
toast('保存中...');
|
||||
const selectedPkgs = apps.value.filter(a => a.checked).map(a => a.packageName);
|
||||
const allEntries = [...selectedPkgs, ...activityEntries.value];
|
||||
const res = await updateConfig({ blacklist_apps: allEntries });
|
||||
if (res.errno === 0) {
|
||||
savedBlacklist.value = new Set(allEntries);
|
||||
toast('黑名单保存成功');
|
||||
} else {
|
||||
toast('保存失败: ' + res.stderr);
|
||||
}
|
||||
}
|
||||
|
||||
function onCheckboxChange() { _reorder(); }
|
||||
|
||||
function toggleSystemApps() {
|
||||
showingSystemApps.value = !showingSystemApps.value;
|
||||
load();
|
||||
}
|
||||
|
||||
function selectAll() { apps.value.forEach(a => { a.checked = true; }); _reorder(); }
|
||||
function selectNone() { apps.value.forEach(a => { a.checked = false; }); _reorder(); }
|
||||
function invertSelection() { apps.value.forEach(a => { a.checked = !a.checked; }); _reorder(); }
|
||||
|
||||
const smartKeywords = ['抖音', 'tiktok', '爱奇艺', '优酷', '腾讯视频', '哔哩', 'bilibili',
|
||||
'youku', 'iqiyi', '芒果', '西瓜', '快手', 'kuaishou', '小红书',
|
||||
'netflix', 'youtube', 'hulu', 'disney', 'prime', '相册', 'gallery', 'photos', 'x'];
|
||||
|
||||
function smartSelect() {
|
||||
apps.value.forEach(a => {
|
||||
const name = (a.appLabel || '').toLowerCase();
|
||||
const pkg = (a.packageName || '').toLowerCase();
|
||||
for (const kw of smartKeywords) {
|
||||
if (kw === 'x') {
|
||||
if (name === 'x' || name === 'x (twitter)') { a.checked = true; break; }
|
||||
} else if (name.includes(kw) || pkg.includes(kw)) { a.checked = true; break; }
|
||||
}
|
||||
});
|
||||
_reorder();
|
||||
}
|
||||
|
||||
// 过滤后的列表
|
||||
function getFilteredApps() {
|
||||
const kw = searchKeyword.value.trim().toLowerCase();
|
||||
if (!kw) return apps.value;
|
||||
return apps.value.filter(a => {
|
||||
const pkg = a.packageName.toLowerCase();
|
||||
return pkg.includes(kw) || PinyinMatch.match(a.appLabel, kw);
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
apps, isLoading, loadError, searchKeyword, showingSystemApps,
|
||||
savedBlacklist, activityEntries,
|
||||
load, save,
|
||||
hasActivity, getActivities, addActivity, removeActivity,
|
||||
onCheckboxChange,
|
||||
toggleSystemApps, selectAll, selectNone, invertSelection, smartSelect,
|
||||
getFilteredApps,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
import { ref } from 'vue';
|
||||
import {
|
||||
runCmd, readConfig, writeConfig, updateConfig,
|
||||
CONFIG_FILE, BACKUP_CONFIG_FILE, PID_FILE, FLAG_FILE,
|
||||
DEFAULT_NOW_BRI_FILE, DEFAULT_SYS_MAX_BRI_FILE,
|
||||
} from '../utils.js';
|
||||
|
||||
export function useConfig() {
|
||||
// 亮度配置
|
||||
const uiMaxBri = ref('');
|
||||
const maxBri = ref('');
|
||||
const stepsNum = ref('50');
|
||||
const logMaxSize = ref('500');
|
||||
|
||||
// 执行策略
|
||||
const autoBriSleep = ref(false);
|
||||
const displayHdrSleep = ref(false);
|
||||
const sleepMode = ref(false);
|
||||
const sleepStartH = ref('19');
|
||||
const sleepStartM = ref('00');
|
||||
const sleepEndH = ref('06');
|
||||
const sleepEndM = ref('00');
|
||||
|
||||
// 高级设置
|
||||
const nowBriFile = ref(DEFAULT_NOW_BRI_FILE);
|
||||
const sysMaxBriFile = ref(DEFAULT_SYS_MAX_BRI_FILE);
|
||||
const inotifyEvents = ref('c');
|
||||
|
||||
// Web UI 配置 (localStorage 持久化)
|
||||
const autoRefresh = ref(localStorage.getItem('autoRefresh') !== 'false');
|
||||
const statusRefreshInterval = ref(
|
||||
Math.max(100, parseInt(localStorage.getItem('statusLogRefreshInterval') || '1000', 10))
|
||||
);
|
||||
const uiZoom = ref(
|
||||
Math.min(150, Math.max(50, parseInt(localStorage.getItem('uiZoom') || '100', 10)))
|
||||
);
|
||||
const themeMode = ref(localStorage.getItem('themeMode') || 'system');
|
||||
|
||||
async function load() {
|
||||
const cfg = await readConfig();
|
||||
if (!cfg || Object.keys(cfg).length === 0) return;
|
||||
|
||||
uiMaxBri.value = cfg.ui_max_bri != null ? String(cfg.ui_max_bri) : '';
|
||||
maxBri.value = cfg.max_bri != null ? String(cfg.max_bri) : '';
|
||||
stepsNum.value = cfg.steps_num != null ? String(cfg.steps_num) : '50';
|
||||
logMaxSize.value = cfg.log_max_size != null ? String(cfg.log_max_size) : '500';
|
||||
autoBriSleep.value = cfg.auto_bri_sleep === 1;
|
||||
displayHdrSleep.value = cfg.display_hdr_sleep === 1;
|
||||
nowBriFile.value = cfg.now_bri_file || DEFAULT_NOW_BRI_FILE;
|
||||
sysMaxBriFile.value = cfg.max_bri_file || DEFAULT_SYS_MAX_BRI_FILE;
|
||||
inotifyEvents.value = cfg.inotify_events || 'c';
|
||||
|
||||
const st = cfg.sleep_time || '';
|
||||
if (st && st.includes('-')) {
|
||||
sleepMode.value = true;
|
||||
const [s, e] = st.split('-');
|
||||
if (s.length === 4) { sleepStartH.value = s.slice(0, 2); sleepStartM.value = s.slice(2); }
|
||||
if (e.length === 4) { sleepEndH.value = e.slice(0, 2); sleepEndM.value = e.slice(2); }
|
||||
} else {
|
||||
sleepMode.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function getSleepTimeStr() {
|
||||
if (!sleepMode.value) return '';
|
||||
const pad = v => String(v).padStart(2, '0');
|
||||
return `${pad(sleepStartH.value)}${pad(sleepStartM.value)}-${pad(sleepEndH.value)}${pad(sleepEndM.value)}`;
|
||||
}
|
||||
|
||||
async function save(toast) {
|
||||
if (!uiMaxBri.value || !maxBri.value) { toast('亮度値不能为空'); return; }
|
||||
toast('保存中...');
|
||||
// 读取当前配置(保留 blacklist_apps 等其他字段)
|
||||
const current = await readConfig();
|
||||
await writeConfig({
|
||||
...current,
|
||||
ui_max_bri: parseInt(uiMaxBri.value) || 0,
|
||||
max_bri: parseInt(maxBri.value) || 0,
|
||||
steps_num: parseInt(stepsNum.value) || 50,
|
||||
log_max_size: parseInt(logMaxSize.value) || 500,
|
||||
auto_bri_sleep: autoBriSleep.value ? 1 : 0,
|
||||
display_hdr_sleep: displayHdrSleep.value ? 1 : 0,
|
||||
sleep_time: getSleepTimeStr(),
|
||||
});
|
||||
await runCmd(`rm -f "${FLAG_FILE}"`);
|
||||
const pidRes = await runCmd(`cat "${PID_FILE}"`);
|
||||
toast(pidRes.errno === 0 && pidRes.stdout.trim() ? '配置已保存 (下次调整时生效)' : '配置已保存 (服务未运行)');
|
||||
}
|
||||
|
||||
async function saveAdvanced(toast, onPathsChanged) {
|
||||
toast('保存中...');
|
||||
await updateConfig({
|
||||
now_bri_file: nowBriFile.value || DEFAULT_NOW_BRI_FILE,
|
||||
max_bri_file: sysMaxBriFile.value || DEFAULT_SYS_MAX_BRI_FILE,
|
||||
inotify_events: inotifyEvents.value || 'c',
|
||||
});
|
||||
onPathsChanged?.();
|
||||
toast('高级设置已保存,需重启服务生效');
|
||||
}
|
||||
|
||||
async function resetToDefaults(toast) {
|
||||
toast('正在恢复默认配置...');
|
||||
const backupRes = await runCmd(`cat "${BACKUP_CONFIG_FILE}"`);
|
||||
if (backupRes.errno !== 0 || !backupRes.stdout.trim()) {
|
||||
toast('备份文件不存在,无法恢复');
|
||||
return;
|
||||
}
|
||||
let backup;
|
||||
try { backup = JSON.parse(backupRes.stdout); } catch { toast('备份文件损坏'); return; }
|
||||
|
||||
uiMaxBri.value = backup.ui_max_bri != null ? String(backup.ui_max_bri) : '';
|
||||
maxBri.value = backup.max_bri != null ? String(backup.max_bri) : '';
|
||||
autoBriSleep.value = backup.auto_bri_sleep === 1;
|
||||
displayHdrSleep.value = backup.display_hdr_sleep === 1;
|
||||
stepsNum.value = backup.steps_num != null ? String(backup.steps_num) : '50';
|
||||
logMaxSize.value = backup.log_max_size != null ? String(backup.log_max_size) : '500';
|
||||
nowBriFile.value = backup.now_bri_file || DEFAULT_NOW_BRI_FILE;
|
||||
sysMaxBriFile.value = backup.max_bri_file || DEFAULT_SYS_MAX_BRI_FILE;
|
||||
inotifyEvents.value = backup.inotify_events || 'c';
|
||||
|
||||
const st = backup.sleep_time || '';
|
||||
if (st && st.includes('-')) {
|
||||
sleepMode.value = true;
|
||||
const [s, e] = st.split('-');
|
||||
if (s.length === 4) { sleepStartH.value = s.slice(0, 2); sleepStartM.value = s.slice(2); }
|
||||
if (e.length === 4) { sleepEndH.value = e.slice(0, 2); sleepEndM.value = e.slice(2); }
|
||||
} else {
|
||||
sleepMode.value = true;
|
||||
sleepStartH.value = '19'; sleepStartM.value = '00';
|
||||
sleepEndH.value = '06'; sleepEndM.value = '00';
|
||||
}
|
||||
await save(toast);
|
||||
}
|
||||
|
||||
function saveWebUIConfig(toast, newAutoRefresh, newInterval, newZoom, newTheme, onRestart) {
|
||||
const interval = Math.max(100, parseInt(newInterval, 10) || 1000);
|
||||
const zoom = Math.min(150, Math.max(50, parseInt(newZoom, 10) || 100));
|
||||
localStorage.setItem('autoRefresh', newAutoRefresh);
|
||||
localStorage.setItem('statusLogRefreshInterval', interval);
|
||||
localStorage.setItem('uiZoom', zoom);
|
||||
localStorage.setItem('themeMode', newTheme);
|
||||
autoRefresh.value = newAutoRefresh;
|
||||
statusRefreshInterval.value = interval;
|
||||
uiZoom.value = zoom;
|
||||
themeMode.value = newTheme;
|
||||
document.documentElement.style.zoom = zoom / 100;
|
||||
applyTheme(newTheme);
|
||||
onRestart?.(newAutoRefresh, interval);
|
||||
toast('Web UI 配置已保存');
|
||||
}
|
||||
|
||||
function applyZoom() {
|
||||
document.documentElement.style.zoom = uiZoom.value / 100;
|
||||
}
|
||||
|
||||
function applyTheme(mode) {
|
||||
const html = document.documentElement;
|
||||
html.classList.remove('light', 'dark');
|
||||
if (mode === 'light') html.classList.add('light');
|
||||
else if (mode === 'dark') html.classList.add('dark');
|
||||
}
|
||||
|
||||
return {
|
||||
uiMaxBri, maxBri, stepsNum, logMaxSize,
|
||||
autoBriSleep, displayHdrSleep,
|
||||
sleepMode, sleepStartH, sleepStartM, sleepEndH, sleepEndM,
|
||||
nowBriFile, sysMaxBriFile, inotifyEvents,
|
||||
autoRefresh, statusRefreshInterval, uiZoom, themeMode,
|
||||
load, save, saveAdvanced, resetToDefaults,
|
||||
saveWebUIConfig, applyZoom, applyTheme,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import { ref, computed } from 'vue';
|
||||
import { runCmd, LOG_FILE } from '../utils.js';
|
||||
|
||||
export function useLog() {
|
||||
const fullLog = ref('');
|
||||
const filterLevel = ref('');
|
||||
const isLoading = ref(false);
|
||||
|
||||
const filteredLog = computed(() => {
|
||||
if (!fullLog.value) return '暂无日志';
|
||||
if (!filterLevel.value) return fullLog.value;
|
||||
const lines = fullLog.value.split('\n').filter(l => l.includes(`[${filterLevel.value}]`));
|
||||
return lines.length > 0 ? lines.join('\n') : `暂无 [${filterLevel.value}] 等级的日志`;
|
||||
});
|
||||
|
||||
async function load() {
|
||||
const res = await runCmd(`tail -n 100 "${LOG_FILE}"`);
|
||||
fullLog.value = res.errno === 0 ? (res.stdout.trim() || '暂无日志') : '无法读取日志 (可能模块尚未产生日志文件)';
|
||||
}
|
||||
|
||||
async function clear(toast) {
|
||||
toast('正在清空日志...');
|
||||
const res = await runCmd(`> "${LOG_FILE}"`);
|
||||
if (res.errno === 0) { fullLog.value = ''; toast('日志已清空'); }
|
||||
else toast('清空失败: ' + (res.stderr || '未知错误'));
|
||||
}
|
||||
|
||||
async function copy(toast) {
|
||||
const res = await runCmd(`tail -n 50 "${LOG_FILE}"`);
|
||||
if (res.errno !== 0 || !res.stdout.trim()) { toast('暂无日志内容'); return; }
|
||||
try {
|
||||
await navigator.clipboard.writeText(res.stdout.trim());
|
||||
} catch {
|
||||
const ta = document.createElement('textarea');
|
||||
ta.value = res.stdout.trim();
|
||||
ta.style.cssText = 'position:fixed;opacity:0;pointer-events:none';
|
||||
document.body.appendChild(ta); ta.select(); document.execCommand('copy'); document.body.removeChild(ta);
|
||||
}
|
||||
toast('已复制最新 50 条日志');
|
||||
}
|
||||
|
||||
async function exportLog(toast) {
|
||||
toast('正在导出...');
|
||||
const res = await runCmd(`cp "${LOG_FILE}" "/sdcard/LuminPro_$(date '+%Y%m%d_%H%M%S').log"`);
|
||||
toast(res.errno === 0 ? '日志已导出到 /sdcard' : '导出失败: ' + (res.stderr || '未知错误'));
|
||||
}
|
||||
|
||||
return { fullLog, filterLevel, filteredLog, isLoading, load, clear, copy, exportLog };
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
import { ref, computed } from 'vue';
|
||||
import {
|
||||
runCmd, readConfig,
|
||||
PID_FILE, STOP_FLAG_FILE,
|
||||
DEFAULT_NOW_BRI_FILE, DEFAULT_SYS_MAX_BRI_FILE,
|
||||
} from '../utils.js';
|
||||
|
||||
export function useStatus() {
|
||||
// 亮度
|
||||
const currentBri = ref(null);
|
||||
const sysMaxBri = ref(null);
|
||||
|
||||
// 服务状态
|
||||
const inotifydPid = ref('—');
|
||||
const inotifydState = ref('—');
|
||||
const isRunning = ref(false);
|
||||
const isPaused = ref(false);
|
||||
const statusClass = computed(() => {
|
||||
if (isPaused.value) return 'status-paused';
|
||||
if (isRunning.value) return 'status-running';
|
||||
return 'status-loading';
|
||||
});
|
||||
const statusText = computed(() => {
|
||||
if (isPaused.value) return '已暂停';
|
||||
if (isRunning.value) return '运行中';
|
||||
return '未运行';
|
||||
});
|
||||
|
||||
// HDR / 睡眠状态
|
||||
const hdrRatio = ref('—');
|
||||
const sleepStatus = ref('—');
|
||||
|
||||
// 自动亮度
|
||||
const autoBriMode = ref(false);
|
||||
|
||||
// 缓存配置字段(避免每次刷新都 readConfig)
|
||||
let _nowBriFile = null;
|
||||
let _sysMaxBriFile = null;
|
||||
let _sleepTime = null;
|
||||
|
||||
async function _ensurePaths() {
|
||||
if (_nowBriFile && _sysMaxBriFile) return;
|
||||
const cfg = await readConfig();
|
||||
_nowBriFile = cfg.now_bri_file || DEFAULT_NOW_BRI_FILE;
|
||||
_sysMaxBriFile = cfg.max_bri_file || DEFAULT_SYS_MAX_BRI_FILE;
|
||||
_sleepTime = cfg.sleep_time || '';
|
||||
}
|
||||
|
||||
function invalidatePaths() {
|
||||
_nowBriFile = null;
|
||||
_sysMaxBriFile = null;
|
||||
_sleepTime = null;
|
||||
}
|
||||
|
||||
async function load(forceFull = false) {
|
||||
await _ensurePaths();
|
||||
|
||||
const needBri = forceFull || currentBri.value === null || sysMaxBri.value === null;
|
||||
|
||||
// 所有 Shell 命令一次并发,消除多轮顺序等待
|
||||
// PID + 进程状态合并为一条命令以减少 exec 次数
|
||||
const [pidStateRes, stopRes, autoBriRes, hdrRes, cBriRes, sBriRes] = await Promise.all([
|
||||
runCmd(`PID=$(cat "${PID_FILE}" 2>/dev/null || true); printf '%s\\n' "$PID"; [ -n "$PID" ] && grep '^State:' "/proc/$PID/status" 2>/dev/null | awk '{print $2}' || true`),
|
||||
runCmd(`[ -f "${STOP_FLAG_FILE}" ] && echo "1" || echo "0"`),
|
||||
runCmd(`settings get system screen_brightness_mode`),
|
||||
runCmd(`dumpsys display 2>/dev/null | sed -n 's/.*hdrSdrRatio \\([0-9.]*\\).*/\\1/p' | head -n 1`),
|
||||
needBri ? runCmd(`cat "${_nowBriFile}"`) : Promise.resolve({ errno: -1, stdout: '' }),
|
||||
needBri ? runCmd(`cat "${_sysMaxBriFile}"`) : Promise.resolve({ errno: -1, stdout: '' }),
|
||||
]);
|
||||
|
||||
if (needBri) {
|
||||
currentBri.value = cBriRes.errno === 0 ? cBriRes.stdout.trim() : '0';
|
||||
sysMaxBri.value = sBriRes.errno === 0 ? sBriRes.stdout.trim() : '255';
|
||||
}
|
||||
|
||||
const psLines = (pidStateRes.errno === 0 ? pidStateRes.stdout : '').split('\n');
|
||||
const pidStr = psLines[0]?.trim() || '';
|
||||
const stateChar = psLines[1]?.trim() || '';
|
||||
|
||||
isPaused.value = stopRes.errno === 0 && stopRes.stdout.trim() === '1';
|
||||
isRunning.value = !isPaused.value && !!pidStr;
|
||||
inotifydPid.value = pidStr || '离线';
|
||||
inotifydState.value = isRunning.value ? (stateChar || '已退出') : '离线';
|
||||
|
||||
autoBriMode.value = autoBriRes.errno === 0 && parseInt(autoBriRes.stdout.trim(), 10) === 1;
|
||||
|
||||
const hdrRaw = hdrRes.errno === 0 ? hdrRes.stdout.trim() : '';
|
||||
hdrRatio.value = (hdrRaw && /^\d+(\.\d+)?$/.test(hdrRaw)) ? parseFloat(hdrRaw).toFixed(2) : '-';
|
||||
|
||||
sleepStatus.value = _calcSleep(_sleepTime);
|
||||
}
|
||||
|
||||
function _calcSleep(sleepTime) {
|
||||
if (!sleepTime || !sleepTime.includes('-')) return '非休眠';
|
||||
const [s, e] = sleepTime.split('-');
|
||||
if (s.length !== 4 || e.length !== 4) return '非休眠';
|
||||
const now = new Date();
|
||||
const nV = now.getHours() * 100 + now.getMinutes();
|
||||
const sNum = parseInt(s.slice(0, 2), 10) * 100 + parseInt(s.slice(2), 10);
|
||||
const eNum = parseInt(e.slice(0, 2), 10) * 100 + parseInt(e.slice(2), 10);
|
||||
if (sNum > eNum) {
|
||||
return (nV >= sNum || nV < eNum) ? '休眠中' : '非休眠';
|
||||
}
|
||||
return (nV >= sNum && nV < eNum) ? '休眠中' : '非休眠';
|
||||
}
|
||||
|
||||
async function toggleService(toast) {
|
||||
const res = await runCmd(`sh /data/adb/modules/LuminPro/action.sh`);
|
||||
toast(res.errno === 0 ? (res.stdout.trim() || '状态已切换') : ('操作失败: ' + res.stderr));
|
||||
await load(true);
|
||||
}
|
||||
|
||||
async function restartService(toast) {
|
||||
toast('正在重启服务...');
|
||||
const res = await runCmd(`sh /data/adb/modules/LuminPro/script/restart.sh`);
|
||||
setTimeout(async () => { await load(true); }, 1000);
|
||||
toast(res.errno === 0 ? '服务已成功重启' : ('重启失败: ' + res.stderr));
|
||||
}
|
||||
|
||||
async function setBrightness(newBri, toast) {
|
||||
currentBri.value = String(newBri);
|
||||
const cmd = `echo -n '${newBri}' > '${_nowBriFile}' 2>/dev/null && echo 'OK'`;
|
||||
const res = await runCmd(cmd);
|
||||
if (!(res.errno === 0 && res.stdout.includes('OK'))) {
|
||||
toast('亮度设置失败,已恢复');
|
||||
await load(true);
|
||||
}
|
||||
}
|
||||
|
||||
async function setAutoBrightness(enabled, toast) {
|
||||
const mode = enabled ? 1 : 0;
|
||||
const res = await runCmd(`settings put system screen_brightness_mode ${mode}`);
|
||||
if (res.errno === 0) {
|
||||
autoBriMode.value = enabled;
|
||||
toast(enabled ? '自动亮度已启用' : '手动亮度已启用');
|
||||
} else {
|
||||
toast('设置失败: ' + (res.stderr || '未知错误'));
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
currentBri, sysMaxBri,
|
||||
inotifydPid, inotifydState,
|
||||
isRunning, isPaused,
|
||||
statusClass, statusText,
|
||||
hdrRatio, sleepStatus,
|
||||
autoBriMode,
|
||||
load, invalidatePaths,
|
||||
toggleService, restartService,
|
||||
setBrightness, setAutoBrightness,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/* Header */
|
||||
.app-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 12px;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.header-icon {
|
||||
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.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--md-sys-color-on-background);
|
||||
letter-spacing: -0.3px;
|
||||
}
|
||||
|
||||
.header-subtitle {
|
||||
margin: 0;
|
||||
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-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.header-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: var(--md-sys-color-surface-container-high);
|
||||
padding: 8px 16px;
|
||||
border-radius: 12px;
|
||||
font-size: 0.8125rem;
|
||||
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);
|
||||
}
|
||||
|
||||
.header-status-actions {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.btn-status-action {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--md-sys-color-primary);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.btn-status-action:active {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
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 {
|
||||
background-color: #4caf50;
|
||||
box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
|
||||
animation: status-pulse-green 2s infinite;
|
||||
}
|
||||
|
||||
.header-status.status-paused .status-dot,
|
||||
.header-status.status-loading .status-dot {
|
||||
animation: status-pulse 2s infinite;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-card: var(--card);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-border: var(--border);
|
||||
--color-input: var(--input);
|
||||
--color-ring: var(--ring);
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
--font-sans: Geist, system-ui, -apple-system, sans-serif;
|
||||
--font-mono: 'Geist Mono', 'Roboto Mono', monospace;
|
||||
}
|
||||
|
||||
/* ===============================
|
||||
Shadcn 主题 Token (暗色, MD3 调色板)
|
||||
=============================== */
|
||||
:root, :root.dark {
|
||||
--radius: 0.75rem;
|
||||
|
||||
/* Shadcn tokens */
|
||||
--background: #111318;
|
||||
--foreground: #e2e2e9;
|
||||
--card: #1e1f25;
|
||||
--card-foreground: #e2e2e9;
|
||||
--popover: #2b2930;
|
||||
--popover-foreground: #e2e2e9;
|
||||
--primary: #a8c7fa;
|
||||
--primary-foreground: #062e6f;
|
||||
--secondary: #2b2930;
|
||||
--secondary-foreground: #e2e2e9;
|
||||
--muted: #212429;
|
||||
--muted-foreground: #c4c6d0;
|
||||
--accent: #1b4b9b;
|
||||
--accent-foreground: #d3e3fd;
|
||||
--destructive: #ffb4ab;
|
||||
--border: #44474f;
|
||||
--input: #44474f;
|
||||
--ring: rgba(168, 199, 250, 0.5);
|
||||
|
||||
/* MD3 tokens (保留,legacy CSS 仍在使用) */
|
||||
--md-sys-color-background: #111318;
|
||||
--md-sys-color-background-rgb: 17, 19, 24;
|
||||
--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-surface-container-high-rgb: 43, 41, 48;
|
||||
--md-sys-color-on-surface: #e2e2e9;
|
||||
--md-sys-color-on-surface-variant: #c4c6d0;
|
||||
--md-sys-color-primary: #a8c7fa;
|
||||
--md-sys-color-primary-rgb: 168, 199, 250;
|
||||
--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;
|
||||
--md-sys-color-error-container: #93000a;
|
||||
--border-radius-m: 16px;
|
||||
--border-radius-s: 8px;
|
||||
--spacing-s: 8px;
|
||||
--spacing-m: 16px;
|
||||
--spacing-l: 24px;
|
||||
--color-warning: #f59e0b;
|
||||
}
|
||||
|
||||
/* ===============================
|
||||
浅色主题 Token
|
||||
=============================== */
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root:not(.dark) {
|
||||
--background: #f8f9fc;
|
||||
--foreground: #191c20;
|
||||
--card: #ffffff;
|
||||
--card-foreground: #191c20;
|
||||
--popover: #ffffff;
|
||||
--popover-foreground: #191c20;
|
||||
--primary: #0b57d0;
|
||||
--primary-foreground: #ffffff;
|
||||
--secondary: #e8eaf0;
|
||||
--secondary-foreground: #191c20;
|
||||
--muted: #eff1f6;
|
||||
--muted-foreground: #44474f;
|
||||
--accent: #d3e3fd;
|
||||
--accent-foreground: #062e6f;
|
||||
--destructive: #b3261e;
|
||||
--border: #c4c7d0;
|
||||
--input: #c4c7d0;
|
||||
--ring: rgba(11, 87, 208, 0.3);
|
||||
/* MD3 */
|
||||
--md-sys-color-background: #f8f9fc;
|
||||
--md-sys-color-background-rgb: 248, 249, 252;
|
||||
--md-sys-color-on-background: #191c20;
|
||||
--md-sys-color-surface: #ffffff;
|
||||
--md-sys-color-surface-container: #eff1f6;
|
||||
--md-sys-color-surface-container-high: #e8eaf0;
|
||||
--md-sys-color-surface-container-high-rgb: 232, 234, 240;
|
||||
--md-sys-color-on-surface: #191c20;
|
||||
--md-sys-color-on-surface-variant: #44474f;
|
||||
--md-sys-color-primary: #0b57d0;
|
||||
--md-sys-color-primary-rgb: 11, 87, 208;
|
||||
--md-sys-color-on-primary: #ffffff;
|
||||
--md-sys-color-primary-container: #d3e3fd;
|
||||
--md-sys-color-on-primary-container: #062e6f;
|
||||
--md-sys-color-outline: #74777f;
|
||||
--md-sys-color-outline-variant: #c4c7d0;
|
||||
--md-sys-color-error: #b3261e;
|
||||
--md-sys-color-on-error: #ffffff;
|
||||
--md-sys-color-error-container: #f9dedc;
|
||||
--color-warning: #b45309;
|
||||
}
|
||||
}
|
||||
|
||||
:root.light {
|
||||
--background: #f8f9fc;
|
||||
--foreground: #191c20;
|
||||
--card: #ffffff;
|
||||
--card-foreground: #191c20;
|
||||
--popover: #ffffff;
|
||||
--popover-foreground: #191c20;
|
||||
--primary: #0b57d0;
|
||||
--primary-foreground: #ffffff;
|
||||
--secondary: #e8eaf0;
|
||||
--secondary-foreground: #191c20;
|
||||
--muted: #eff1f6;
|
||||
--muted-foreground: #44474f;
|
||||
--accent: #d3e3fd;
|
||||
--accent-foreground: #062e6f;
|
||||
--destructive: #b3261e;
|
||||
--border: #c4c7d0;
|
||||
--input: #c4c7d0;
|
||||
--ring: rgba(11, 87, 208, 0.3);
|
||||
/* MD3 */
|
||||
--md-sys-color-background: #f8f9fc;
|
||||
--md-sys-color-background-rgb: 248, 249, 252;
|
||||
--md-sys-color-on-background: #191c20;
|
||||
--md-sys-color-surface: #ffffff;
|
||||
--md-sys-color-surface-container: #eff1f6;
|
||||
--md-sys-color-surface-container-high: #e8eaf0;
|
||||
--md-sys-color-surface-container-high-rgb: 232, 234, 240;
|
||||
--md-sys-color-on-surface: #191c20;
|
||||
--md-sys-color-on-surface-variant: #44474f;
|
||||
--md-sys-color-primary: #0b57d0;
|
||||
--md-sys-color-primary-rgb: 11, 87, 208;
|
||||
--md-sys-color-on-primary: #ffffff;
|
||||
--md-sys-color-primary-container: #d3e3fd;
|
||||
--md-sys-color-on-primary-container: #062e6f;
|
||||
--md-sys-color-outline: #74777f;
|
||||
--md-sys-color-outline-variant: #c4c7d0;
|
||||
--md-sys-color-error: #b3261e;
|
||||
--md-sys-color-on-error: #ffffff;
|
||||
--md-sys-color-error-container: #f9dedc;
|
||||
--color-warning: #b45309;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { clsx } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
@@ -0,0 +1,259 @@
|
||||
/* Logs */
|
||||
.log-output {
|
||||
font-family: 'Geist Mono', 'JetBrains Mono', 'Consolas', monospace;
|
||||
font-size: 0.6875rem;
|
||||
padding: var(--spacing-m);
|
||||
background-color: #0d0e12;
|
||||
color: #e3e3e3;
|
||||
border-radius: var(--border-radius-m);
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
flex: 1;
|
||||
max-height: 60vh;
|
||||
overflow-y: auto;
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
line-height: 1.5;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--md-sys-color-outline-variant) transparent;
|
||||
}
|
||||
|
||||
.log-output::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.log-output::-webkit-scrollbar-thumb {
|
||||
background-color: var(--md-sys-color-outline-variant);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.log-filter-select {
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: 8px;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-family: inherit;
|
||||
font-size: 0.8125rem;
|
||||
height: 32px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
transition: all 0.22s ease;
|
||||
}
|
||||
|
||||
.log-filter-select:focus {
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2);
|
||||
}
|
||||
|
||||
.log-output::-webkit-scrollbar {
|
||||
display: none; /* Chrome, Safari */
|
||||
}
|
||||
|
||||
/* Simple Toast */
|
||||
.top-blur {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: calc(85px + var(--safe-area-inset-top, 0px));
|
||||
z-index: 998;
|
||||
pointer-events: none;
|
||||
/* 基础暗色背景,增强状态栏文字可读性 */
|
||||
background: linear-gradient(to bottom,
|
||||
rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0.85) 0%,
|
||||
rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0.4) 40%,
|
||||
rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0) 100%
|
||||
);
|
||||
/* 核心:毛玻璃滤镜 */
|
||||
-webkit-backdrop-filter: blur(16px);
|
||||
backdrop-filter: blur(16px);
|
||||
/* 梯度蒙版:越往上越模糊的核心逻辑 */
|
||||
-webkit-mask-image: linear-gradient(to bottom,
|
||||
rgba(0,0,0,1) 0%,
|
||||
rgba(0,0,0,1) 30%,
|
||||
rgba(0,0,0,0.7) 60%,
|
||||
rgba(0,0,0,0) 100%
|
||||
);
|
||||
mask-image: linear-gradient(to bottom,
|
||||
rgba(0,0,0,1) 0%,
|
||||
rgba(0,0,0,1) 30%,
|
||||
rgba(0,0,0,0.7) 60%,
|
||||
rgba(0,0,0,0) 100%
|
||||
);
|
||||
transform: translateZ(0); /* 开启 GPU 加速 */
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.top-blur.scrolled {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.toast {
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateY(100px);
|
||||
background-color: var(--md-sys-color-on-surface);
|
||||
color: var(--md-sys-color-surface);
|
||||
padding: 12px 24px;
|
||||
border-radius: var(--border-radius-s);
|
||||
font-size: 0.875rem;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
|
||||
transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
|
||||
z-index: 1000;
|
||||
width: max-content;
|
||||
max-width: 90vw;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.toast.show {
|
||||
transform: translateX(-50%) translateY(0);
|
||||
}
|
||||
|
||||
/* Floating Navigation Bar */
|
||||
.floating-navbar {
|
||||
position: fixed;
|
||||
bottom: calc(18px + var(--safe-area-inset-bottom, 0px));
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateZ(0);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: rgba(var(--md-sys-color-surface-container-high-rgb, 43, 41, 48), 0.75);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
backdrop-filter: blur(12px);
|
||||
will-change: transform;
|
||||
padding: 8px 16px;
|
||||
border-radius: 28px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 8px 32px rgba(0, 0, 0, 0.3);
|
||||
z-index: 999;
|
||||
width: fit-content;
|
||||
max-width: calc(100% - 32px);
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
touch-action: none;
|
||||
}
|
||||
|
||||
.navbar-slider {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 8px;
|
||||
bottom: 8px;
|
||||
height: auto;
|
||||
background: var(--md-sys-color-primary-container);
|
||||
border-radius: 20px;
|
||||
transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), width 0.3s ease;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.navbar-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 5px;
|
||||
padding: 6px 12px;
|
||||
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;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.navbar-btn i, .navbar-btn svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.navbar-btn span {
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.navbar-btn:active {
|
||||
/* No scaling here, we rely on the slider feedback */
|
||||
}
|
||||
|
||||
.navbar-btn.active {
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
}
|
||||
|
||||
/* Dropdown Menu */
|
||||
.dropdown-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.dropdown-menu {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
right: 0;
|
||||
margin-top: 8px;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: var(--border-radius-s);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
|
||||
min-width: 160px;
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transform: translateY(-8px);
|
||||
transition: all 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
|
||||
z-index: 100;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.dropdown-menu.show {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.dropdown-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-size: 0.875rem;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.dropdown-item:hover {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
}
|
||||
|
||||
.dropdown-item:active {
|
||||
background-color: var(--md-sys-color-surface);
|
||||
}
|
||||
|
||||
.dropdown-item svg {
|
||||
color: var(--md-sys-color-primary);
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.dropdown-item-danger {
|
||||
color: var(--md-sys-color-error, #cf6679);
|
||||
}
|
||||
|
||||
.dropdown-item-danger svg {
|
||||
color: var(--md-sys-color-error, #cf6679);
|
||||
}
|
||||
+11
-785
@@ -1,785 +1,11 @@
|
||||
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);
|
||||
import { createApp } from 'vue';
|
||||
import App from './App.vue';
|
||||
import './index.css';
|
||||
import './style.css';
|
||||
import './header.css';
|
||||
import './components.css';
|
||||
import './about.css';
|
||||
import './apps.css';
|
||||
import './log.css';
|
||||
|
||||
createApp(App).mount('#app');
|
||||
+9
-745
@@ -1,12 +1,15 @@
|
||||
:root {
|
||||
:root, :root.dark {
|
||||
--md-sys-color-background: #111318;
|
||||
--md-sys-color-background-rgb: 17, 19, 24;
|
||||
--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-surface-container-high-rgb: 43, 41, 48;
|
||||
--md-sys-color-on-surface: #e2e2e9;
|
||||
--md-sys-color-on-surface-variant: #c4c6d0;
|
||||
--md-sys-color-primary: #a8c7fa;
|
||||
--md-sys-color-primary-rgb: 168, 199, 250;
|
||||
--md-sys-color-on-primary: #062e6f;
|
||||
--md-sys-color-primary-container: #1b4b9b;
|
||||
--md-sys-color-on-primary-container: #d3e3fd;
|
||||
@@ -24,14 +27,14 @@
|
||||
|
||||
@font-face {
|
||||
font-family: 'Geist';
|
||||
src: url('/Geist-VariableFont_wght.ttf') format('truetype');
|
||||
src: url('/Geist[wght].woff2') format('woff2');
|
||||
font-weight: 100 900;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Google Sans Code';
|
||||
src: url('/GoogleSansCode-VariableFont_wght.ttf') format('truetype');
|
||||
font-family: 'Geist Mono';
|
||||
src: url('/GeistMono[wght].woff2') format('woff2');
|
||||
font-weight: 100 900;
|
||||
font-style: normal;
|
||||
}
|
||||
@@ -70,8 +73,8 @@ body::-webkit-scrollbar {
|
||||
}
|
||||
|
||||
#app {
|
||||
padding: 20px;
|
||||
padding-bottom: calc(20px + 80px);
|
||||
padding: 12px;
|
||||
padding-bottom: calc(12px + 80px);
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
@@ -79,742 +82,3 @@ body::-webkit-scrollbar {
|
||||
gap: var(--spacing-m);
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.app-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20px 20px;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.header-icon {
|
||||
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.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--md-sys-color-on-background);
|
||||
letter-spacing: -0.3px;
|
||||
}
|
||||
|
||||
.header-subtitle {
|
||||
margin: 0;
|
||||
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: 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: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
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 */
|
||||
.card {
|
||||
background-color: var(--md-sys-color-surface);
|
||||
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 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-s);
|
||||
margin-bottom: var(--spacing-l);
|
||||
}
|
||||
|
||||
.card-header h2 {
|
||||
margin: 0;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 500;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
/* Config Items */
|
||||
.config-group {
|
||||
margin-bottom: var(--spacing-l);
|
||||
padding: var(--spacing-m);
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
border-radius: var(--border-radius-s);
|
||||
}
|
||||
|
||||
.group-title {
|
||||
margin: 0 0 var(--spacing-m) 0;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-primary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.config-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
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);
|
||||
}
|
||||
|
||||
.config-label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.config-name {
|
||||
font-size: 1rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.config-desc {
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.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);
|
||||
padding: 8px 12px;
|
||||
font-size: 1rem;
|
||||
width: 100px;
|
||||
text-align: right;
|
||||
font-family: inherit;
|
||||
outline: none;
|
||||
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);
|
||||
}
|
||||
|
||||
.config-input-wide {
|
||||
width: 140px;
|
||||
}
|
||||
|
||||
.config-item-expand {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: var(--spacing-s);
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.config-item-expand.show {
|
||||
max-height: 100px; /* 调整为适合内容的高度 */
|
||||
opacity: 1;
|
||||
margin-bottom: var(--spacing-m);
|
||||
}
|
||||
|
||||
/* Custom Time Picker Styles */
|
||||
.custom-time-picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.time-unit {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
padding: 2px 6px;
|
||||
border-radius: var(--border-radius-s);
|
||||
border: 1px solid var(--md-sys-color-outline);
|
||||
}
|
||||
|
||||
.time-input {
|
||||
width: 32px;
|
||||
background-color: transparent;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
border: none;
|
||||
font-size: 0.875rem;
|
||||
text-align: center;
|
||||
font-family: 'Google Sans Code', monospace;
|
||||
outline: none;
|
||||
-moz-appearance: textfield;
|
||||
}
|
||||
|
||||
.time-input::-webkit-outer-spin-button,
|
||||
.time-input::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.time-sep {
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
/* Switch Styles */
|
||||
.switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 52px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
transition: .4s;
|
||||
border-radius: 34px;
|
||||
border: 2px solid var(--md-sys-color-outline);
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
left: 2px;
|
||||
bottom: 2px;
|
||||
background-color: var(--md-sys-color-outline);
|
||||
transition: .4s;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
input:checked + .slider {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
border-color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
input:checked + .slider:before {
|
||||
transform: translateX(20px);
|
||||
background-color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
/* Status Grid */
|
||||
.status-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--spacing-m);
|
||||
}
|
||||
|
||||
.status-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: var(--spacing-m);
|
||||
border-radius: var(--border-radius-s);
|
||||
}
|
||||
|
||||
.status-label {
|
||||
font-size: 0.75rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.status-value {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 500;
|
||||
color: var(--md-sys-color-primary);
|
||||
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;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: var(--spacing-l);
|
||||
padding-top: var(--spacing-m);
|
||||
border-top: 1px solid var(--md-sys-color-outline-variant);
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 10px 24px;
|
||||
border-radius: 100px;
|
||||
border: none;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s, opacity 0.2s;
|
||||
}
|
||||
|
||||
.btn:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: var(--md-sys-color-primary);
|
||||
color: var(--md-sys-color-on-primary);
|
||||
}
|
||||
|
||||
.btn-outline {
|
||||
background-color: transparent;
|
||||
border: 1px solid var(--md-sys-color-outline);
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.btn-outline-s, .btn-text-s {
|
||||
background-color: transparent;
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
color: var(--md-sys-color-primary);
|
||||
padding: 4px 10px;
|
||||
min-width: 50px;
|
||||
height: 28px;
|
||||
font-size: 0.75rem;
|
||||
border-radius: var(--border-radius-s);
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn-text-s:active {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: var(--md-sys-color-error) !important;
|
||||
color: var(--md-sys-color-on-error) !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
/* Header Actions container */
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.btn-icon-only {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 1.25rem;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.btn-icon-only:active {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
}
|
||||
|
||||
.animate-spin {
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* Logs */
|
||||
.log-output {
|
||||
font-family: 'Google Sans Code', 'Consolas', 'Courier New', monospace;
|
||||
font-size: 0.75rem;
|
||||
padding: var(--spacing-s);
|
||||
border-radius: var(--border-radius-s);
|
||||
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 */
|
||||
.toast {
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateY(100px);
|
||||
background-color: var(--md-sys-color-on-surface);
|
||||
color: var(--md-sys-color-surface);
|
||||
padding: 12px 24px;
|
||||
border-radius: var(--border-radius-s);
|
||||
font-size: 0.875rem;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
|
||||
transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
|
||||
z-index: 1000;
|
||||
width: max-content;
|
||||
max-width: 90vw;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.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);
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import { exec } from 'kernelsu';
|
||||
|
||||
export const MODULE_DIR = '/data/adb/modules/LuminPro';
|
||||
export const CONFIG_DIR = `${MODULE_DIR}/config`;
|
||||
export const CONFIG_FILE = `${MODULE_DIR}/config/config.json`;
|
||||
export const BACKUP_CONFIG_FILE = `${MODULE_DIR}/config/.backup/config.json`;
|
||||
export const PID_FILE = `${MODULE_DIR}/pid/inotifyd.pid`;
|
||||
export const FLAG_FILE = `${MODULE_DIR}/pid/up.flag`;
|
||||
export const STOP_FLAG_FILE = `${MODULE_DIR}/pid/stop.flag`;
|
||||
export const LOG_FILE = `${MODULE_DIR}/service.log`;
|
||||
export const DEFAULT_NOW_BRI_FILE = '/sys/class/backlight/panel0-backlight/brightness';
|
||||
export const DEFAULT_SYS_MAX_BRI_FILE = '/sys/class/backlight/panel0-backlight/max_brightness';
|
||||
|
||||
export function showToast(msg) {
|
||||
const toast = document.getElementById('toast');
|
||||
toast.textContent = msg;
|
||||
toast.classList.add('show');
|
||||
setTimeout(() => toast.classList.remove('show'), 3000);
|
||||
}
|
||||
|
||||
export async function runCmd(cmd) {
|
||||
try {
|
||||
const res = await exec(cmd);
|
||||
return res;
|
||||
} catch (e) {
|
||||
console.warn(`[DEBUG] 执行命令失败 (可能是非 KSU 环境): ${cmd}`);
|
||||
|
||||
// JSON 配置模拟
|
||||
if (cmd.includes('cat') && cmd.includes('config.json')) {
|
||||
return { errno: 0, stdout: JSON.stringify({
|
||||
ui_max_bri: 4095, max_bri: 3500, steps_num: 100, log_max_size: 1024,
|
||||
auto_bri_sleep: 1, display_hdr_sleep: 0, sleep_time: '1900-0600',
|
||||
inotify_events: 'c',
|
||||
now_bri_file: '/sys/mock/brightness',
|
||||
max_bri_file: '/sys/mock/max_brightness',
|
||||
blacklist_apps: ['com.example.app'],
|
||||
}), stderr: '' };
|
||||
}
|
||||
|
||||
// 状态模拟
|
||||
if (cmd.includes('cat') && cmd.includes('inotifyd.pid')) return { errno: 0, stdout: '12345', stderr: '' };
|
||||
if (cmd.includes('settings get system screen_brightness_mode')) return { errno: 0, stdout: '1', stderr: '' };
|
||||
if (cmd.includes('[ -f') && cmd.includes('stop.flag')) return { errno: 0, stdout: '0', stderr: '' };
|
||||
if (cmd.includes('cat') && (cmd.includes('brightness') || cmd.includes('now_bri'))) return { errno: 0, stdout: '1200', stderr: '' };
|
||||
if (cmd.includes('cat') && (cmd.includes('max_brightness') || cmd.includes('max_bri'))) return { errno: 0, stdout: '4095', stderr: '' };
|
||||
|
||||
// 日志模拟
|
||||
if (cmd.includes('tail') && cmd.includes('service.log')) {
|
||||
return { errno: 0, stdout: '[04-07 15:40:01] [service] [INFO ] LuminPro 服务启动\n[04-07 15:41:05] [up] [INFO ] 触发提升: 当前亮度 1200 ≥ 阈値 1000\n[04-07 15:42:10] [up] [SUCCESS ] 亮度提升完成 (3500)', stderr: '' };
|
||||
}
|
||||
|
||||
// 文档模拟
|
||||
if (cmd.includes('cat') && cmd.includes('.md')) return { errno: 0, stdout: '# 调试模式\n\n当前处于 **Web 调试模式**,显示的是模拟测试数据。', stderr: '' };
|
||||
if (cmd.includes('cat') && cmd.includes('.txt')) return { errno: 0, stdout: '这是 NOTE.txt 的模拟内容。', stderr: '' };
|
||||
|
||||
return { errno: -1, stdout: '', stderr: String(e) };
|
||||
}
|
||||
}
|
||||
|
||||
// 读取完整 JSON 配置
|
||||
export async function readConfig() {
|
||||
const res = await runCmd(`cat "${CONFIG_FILE}"`);
|
||||
if (res.errno !== 0 || !res.stdout.trim()) return {};
|
||||
try { return JSON.parse(res.stdout); } catch { return {}; }
|
||||
}
|
||||
|
||||
// 写入完整 JSON 配置
|
||||
export async function writeConfig(obj) {
|
||||
const content = JSON.stringify(obj).replace(/'/g, "'\\''" );
|
||||
return runCmd(`printf '%s' '${content}' > "${CONFIG_FILE}"`);
|
||||
}
|
||||
|
||||
// 合并更新 JSON 配置(保留其他字段)
|
||||
export async function updateConfig(updates) {
|
||||
const current = await readConfig();
|
||||
return writeConfig({ ...current, ...updates });
|
||||
}
|
||||
|
||||
// 将文件内容写入指定路径
|
||||
export async function writeFile(path, content) {
|
||||
const safeContent = String(content).replace(/'/g, "'\\''" );
|
||||
return runCmd(`printf '%s' '${safeContent}' > "${path}"`);
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import Button from "@/components/ui/Button.vue";
|
||||
import { BookOpen, ScrollText, StickyNote, X, Github } from "lucide-vue-next";
|
||||
import { runCmd } from "../utils.js";
|
||||
|
||||
const MODULE_DIR = '/data/adb/modules/LuminPro';
|
||||
|
||||
const sheetOpen = ref(false);
|
||||
const sheetTitle = ref("");
|
||||
const sheetContent = ref("");
|
||||
const sheetLoading = ref(false);
|
||||
|
||||
const moduleDocs = [
|
||||
{ title: "README", file: `${MODULE_DIR}/README.md`, icon: BookOpen, md: true },
|
||||
{ title: "README (EN)", file: `${MODULE_DIR}/README_en.md`, icon: BookOpen, md: true },
|
||||
{ title: "更新日志", file: `${MODULE_DIR}/changelog.md`, icon: ScrollText, md: true },
|
||||
{ title: "NOTE", file: `${MODULE_DIR}/NOTE.txt`, icon: StickyNote, md: false },
|
||||
];
|
||||
|
||||
function mdToHtml(text) {
|
||||
return text
|
||||
.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
|
||||
.replace(/^### (.+)$/gm, "<h3>$1</h3>")
|
||||
.replace(/^## (.+)$/gm, "<h2>$1</h2>")
|
||||
.replace(/^# (.+)$/gm, "<h1>$1</h1>")
|
||||
.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>")
|
||||
.replace(/`([^`]+)`/g, "<code>$1</code>")
|
||||
.replace(/\n/g, "<br>");
|
||||
}
|
||||
|
||||
async function openModuleDoc(doc) {
|
||||
sheetTitle.value = doc.title;
|
||||
sheetContent.value = "";
|
||||
sheetLoading.value = true;
|
||||
sheetOpen.value = true;
|
||||
try {
|
||||
const res = await runCmd(`cat "${doc.file}" 2>/dev/null`);
|
||||
if (res.errno !== 0 || !res.stdout.trim()) throw new Error('文件不存在或为空');
|
||||
sheetContent.value = doc.md ? mdToHtml(res.stdout) : res.stdout.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/\n/g,'<br>');
|
||||
} catch (e) {
|
||||
sheetContent.value = `加载失败: ${e.message}`;
|
||||
} finally {
|
||||
sheetLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function closeSheet() {
|
||||
sheetOpen.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div style="display:contents">
|
||||
<section class="card" id="about-section">
|
||||
<!-- 模块文档 -->
|
||||
<div class="about-section-title">模块文档</div>
|
||||
<div class="about-list">
|
||||
<button
|
||||
v-for="doc in moduleDocs"
|
||||
:key="doc.file"
|
||||
class="about-list-item"
|
||||
@click="openModuleDoc(doc)"
|
||||
>
|
||||
<component :is="doc.icon" :size="18" class="about-list-icon" />
|
||||
<span>{{ doc.title }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 链接列表 -->
|
||||
<div class="about-section-title">链接</div>
|
||||
<div class="about-list">
|
||||
<button
|
||||
class="about-list-item"
|
||||
@click="runCmd('am start -a android.intent.action.VIEW -d \'https://github.com/YuleBest/LuminPro\'')"
|
||||
>
|
||||
<Github :size="18" class="about-list-icon" />
|
||||
<span>GitHub 项目主页</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p class="about-footer">Made with ❤ by Yule</p>
|
||||
</section>
|
||||
|
||||
<!-- 文档底部弹出抽屉 -->
|
||||
<Teleport to="body">
|
||||
<div class="doc-sheet-backdrop" :class="{ show: sheetOpen }" @click="closeSheet"></div>
|
||||
<div class="doc-sheet" :class="{ show: sheetOpen }">
|
||||
<div class="doc-sheet-header">
|
||||
<span class="doc-sheet-title">{{ sheetTitle }}</span>
|
||||
<button class="doc-sheet-close" @click="closeSheet">
|
||||
<X :size="20" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="doc-sheet-body">
|
||||
<div v-if="sheetLoading" class="doc-sheet-loading">加载中...</div>
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<div v-else class="doc-sheet-content" v-html="sheetContent"></div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,361 @@
|
||||
<script setup>
|
||||
import { inject, ref, computed, onMounted, reactive } from "vue";
|
||||
import { getPackagesInfo } from "kernelsu";
|
||||
import { useApps } from "@/composables/useApps.js";
|
||||
import { runCmd } from "../utils.js";
|
||||
import Button from "@/components/ui/Button.vue";
|
||||
import {
|
||||
RefreshCw, Eye, EyeOff, Sparkles, Plus, CheckCheck, Square,
|
||||
CheckSquare, Search, X, Check, ChevronDown, ScanSearch,
|
||||
ChevronLeft, Monitor, Clock, CircleCheck,
|
||||
} from "lucide-vue-next";
|
||||
|
||||
const showToast = inject("showToast");
|
||||
const appsMenuOpen = ref(false);
|
||||
|
||||
const {
|
||||
apps, isLoading, loadError, searchKeyword, showingSystemApps,
|
||||
savedBlacklist, activityEntries,
|
||||
load, save,
|
||||
hasActivity, getActivities, addActivity, removeActivity,
|
||||
onCheckboxChange,
|
||||
toggleSystemApps, selectAll, selectNone, invertSelection, smartSelect,
|
||||
getFilteredApps,
|
||||
} = useApps();
|
||||
|
||||
const filteredApps = computed(() => getFilteredApps());
|
||||
const appCount = computed(() => filteredApps.value.length);
|
||||
|
||||
onMounted(() => load());
|
||||
|
||||
// 关闭下拉菜单 (点击外部)
|
||||
function handleBodyClick() { appsMenuOpen.value = false; }
|
||||
|
||||
// 按活动屏蔽
|
||||
const activityInput = ref("");
|
||||
function doAddActivity() {
|
||||
const val = activityInput.value.trim();
|
||||
if (!val) return;
|
||||
const parts = val.split("/");
|
||||
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
||||
showToast("格式错误,请输入 包名/完整活动类名");
|
||||
return;
|
||||
}
|
||||
addActivity(val);
|
||||
activityInput.value = "";
|
||||
showToast(`已添加: ${val}`);
|
||||
}
|
||||
|
||||
// 手动添加包名
|
||||
async function handleManualAdd() {
|
||||
appsMenuOpen.value = false;
|
||||
const pkg = prompt("请输入完整应用包名(例如: com.example.app):");
|
||||
if (!pkg?.trim()) return;
|
||||
const realPkg = pkg.trim();
|
||||
const existing = apps.value.find((a) => a.packageName === realPkg);
|
||||
if (existing) {
|
||||
existing.checked = true;
|
||||
onCheckboxChange();
|
||||
showToast("已为你自动勾选并置顶");
|
||||
return;
|
||||
}
|
||||
showToast("正在获取应用信息...");
|
||||
let appData = {
|
||||
packageName: realPkg,
|
||||
appLabel: "未知 (手动添加)",
|
||||
isSystem: false,
|
||||
uid: "自定义",
|
||||
};
|
||||
try {
|
||||
const info = await getPackagesInfo([realPkg]);
|
||||
if (info?.length > 0) appData = info[0];
|
||||
} catch {}
|
||||
apps.value.unshift(reactive({ ...appData, checked: true, expanded: false }));
|
||||
onCheckboxChange();
|
||||
showToast("已添加到列表顶部");
|
||||
}
|
||||
|
||||
// Activity Picker
|
||||
const pickerVisible = ref(false);
|
||||
const pickerStep = ref(1);
|
||||
const pickerStatusText = ref("等待中...");
|
||||
const pickerPolling = ref(false);
|
||||
const pickerResult = ref("");
|
||||
let pollingTimer = null;
|
||||
|
||||
function openPicker() {
|
||||
stopPolling();
|
||||
pickerStep.value = 1;
|
||||
pickerStatusText.value = "等待中...";
|
||||
pickerResult.value = "";
|
||||
pickerPolling.value = false;
|
||||
pickerVisible.value = true;
|
||||
}
|
||||
function closePicker() {
|
||||
stopPolling();
|
||||
pickerVisible.value = false;
|
||||
}
|
||||
function stopPolling() {
|
||||
if (pollingTimer) {
|
||||
clearInterval(pollingTimer);
|
||||
pollingTimer = null;
|
||||
}
|
||||
}
|
||||
function startPolling() {
|
||||
pickerPolling.value = true;
|
||||
pickerStatusText.value = "检测中,请切换到目标界面...";
|
||||
stopPolling();
|
||||
pollingTimer = setInterval(async () => {
|
||||
try {
|
||||
const res = await runCmd(
|
||||
`dumpsys window 2>/dev/null | grep mCurrentFocus | sed 's/.*u[0-9][0-9]* //' | sed 's/}.*//'`
|
||||
);
|
||||
if (res.errno !== 0) return;
|
||||
const activity = res.stdout.trim();
|
||||
if (!activity || activity.toLowerCase().includes("webui")) return;
|
||||
stopPolling();
|
||||
pickerPolling.value = false;
|
||||
pickerResult.value = activity;
|
||||
pickerStep.value = 3;
|
||||
} catch {}
|
||||
}, 600);
|
||||
}
|
||||
function confirmPicker() {
|
||||
if (!pickerResult.value) return;
|
||||
addActivity(pickerResult.value);
|
||||
showToast(`已添加: ${pickerResult.value}`);
|
||||
closePicker();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div style="display:contents">
|
||||
<section class="card" id="apps-section">
|
||||
<div class="card-header" style="margin-bottom: 8px">
|
||||
<h2>黑名单</h2>
|
||||
<div class="header-actions dropdown-container">
|
||||
<Button variant="ghost" size="icon" @click="load">
|
||||
<RefreshCw :size="18" />
|
||||
</Button>
|
||||
<Button variant="ghost" size="icon" @click="appsMenuOpen = !appsMenuOpen">
|
||||
<span class="sr-only">更多</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="1" /><circle cx="12" cy="5" r="1" /><circle cx="12" cy="19" r="1" />
|
||||
</svg>
|
||||
</Button>
|
||||
<div class="dropdown-menu" :class="{ show: appsMenuOpen }" @click.stop>
|
||||
<div class="dropdown-item" @click="toggleSystemApps(); appsMenuOpen = false">
|
||||
<component :is="showingSystemApps ? EyeOff : Eye" :size="18" />
|
||||
<span>{{ showingSystemApps ? "隐藏系统应用" : "显示系统应用" }}</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="smartSelect(); appsMenuOpen = false">
|
||||
<Sparkles :size="18" /><span>智能选择</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="handleManualAdd">
|
||||
<Plus :size="18" /><span>手动添加包名</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="selectAll(); appsMenuOpen = false">
|
||||
<CheckCheck :size="18" /><span>全选</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="selectNone(); appsMenuOpen = false">
|
||||
<Square :size="18" /><span>全不选</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="invertSelection(); appsMenuOpen = false">
|
||||
<CheckSquare :size="18" /><span>反选</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="app-list-hint">
|
||||
被选中的应用将不生效本模块<br />推荐选择视频类、相册等需展示 HDR 内容的应用
|
||||
</p>
|
||||
|
||||
<!-- 按活动屏蔽 -->
|
||||
<div class="activity-block-card">
|
||||
<div class="activity-block-header">
|
||||
<span class="activity-block-label">按活动屏蔽</span>
|
||||
<button class="btn-picker-trigger" @click="openPicker">
|
||||
<ScanSearch :size="12" /> 扫描获取
|
||||
</button>
|
||||
</div>
|
||||
<div class="activity-block-row">
|
||||
<input
|
||||
v-model="activityInput"
|
||||
type="text"
|
||||
class="activity-block-input"
|
||||
placeholder="com.pkg/com.pkg.ActivityClass"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
@keydown.enter="doAddActivity"
|
||||
/>
|
||||
<Button
|
||||
style="padding: 0 14px; border-radius: var(--border-radius-s); font-size: 0.8125rem; white-space: nowrap; flex-shrink: 0"
|
||||
@click="doAddActivity"
|
||||
>确认</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 搜索栏 + 保存 -->
|
||||
<div style="display: flex; gap: 8px; align-items: stretch; margin-bottom: var(--spacing-m)">
|
||||
<div class="app-search-container" style="flex: 1; margin-bottom: 0">
|
||||
<Search :size="18" class="search-icon" />
|
||||
<input
|
||||
v-model="searchKeyword"
|
||||
type="text"
|
||||
class="app-search-input"
|
||||
placeholder="应用名称或包名"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
/>
|
||||
<span class="count-badge">{{ appCount }}</span>
|
||||
</div>
|
||||
<Button
|
||||
style="padding: 0 16px; border-radius: var(--border-radius-s); font-size: 0.8125rem; white-space: nowrap; flex-shrink: 0"
|
||||
@click="save(showToast)"
|
||||
>保存</Button
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- 应用列表 -->
|
||||
<div class="app-list-container" id="app-list-container">
|
||||
<div
|
||||
v-if="isLoading"
|
||||
style="text-align: center; padding: 20px; color: var(--md-sys-color-on-surface-variant)"
|
||||
>
|
||||
加载中...
|
||||
</div>
|
||||
<div
|
||||
v-else-if="loadError"
|
||||
style="text-align: center; padding: 20px; color: var(--md-sys-color-error)"
|
||||
>
|
||||
加载失败: {{ loadError }}
|
||||
</div>
|
||||
<div v-else v-for="app in filteredApps" :key="app.packageName" class="app-list-item">
|
||||
<div class="app-item-main-row">
|
||||
<label class="app-checkbox-label">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="app-checkbox"
|
||||
:class="{ unsaved: app.checked && !savedBlacklist?.has(app.packageName) }"
|
||||
:data-pkg="app.packageName"
|
||||
v-model="app.checked"
|
||||
@change="onCheckboxChange"
|
||||
/>
|
||||
<span
|
||||
class="app-checkbox-custom"
|
||||
:class="{ partial: !app.checked && hasActivity(app.packageName) }"
|
||||
></span>
|
||||
</label>
|
||||
<div class="app-info">
|
||||
<span class="app-name">
|
||||
{{ app.appLabel }}
|
||||
<span class="app-uid">{{ app.uid }}</span>
|
||||
</span>
|
||||
<span class="app-pkg">
|
||||
{{ app.packageName }}
|
||||
<span v-if="app.isSystem" class="app-badge">系统</span>
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
v-if="hasActivity(app.packageName)"
|
||||
class="app-activities-chevron"
|
||||
:class="{ expanded: app.expanded }"
|
||||
@click.stop="app.expanded = !app.expanded"
|
||||
>
|
||||
<ChevronDown :size="16" />
|
||||
</button>
|
||||
</div>
|
||||
<!-- 活动列表 -->
|
||||
<div
|
||||
v-if="hasActivity(app.packageName)"
|
||||
class="app-activities-list"
|
||||
:class="{ show: app.expanded }"
|
||||
>
|
||||
<div
|
||||
v-for="entry in getActivities(app.packageName)"
|
||||
:key="entry"
|
||||
class="activity-entry-item"
|
||||
>
|
||||
<span class="activity-entry-path">{{
|
||||
entry.slice(app.packageName.length + 1)
|
||||
}}</span>
|
||||
<button class="activity-entry-delete" @click="removeActivity(entry)">
|
||||
<X :size="14" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Activity Picker 覆盖层 -->
|
||||
<Teleport to="body">
|
||||
<div
|
||||
class="activity-picker-overlay"
|
||||
:class="{ show: pickerVisible }"
|
||||
id="activity-picker-overlay"
|
||||
>
|
||||
<div class="activity-picker-header">
|
||||
<button class="picker-back-btn" @click="closePicker">
|
||||
<ChevronLeft :size="20" />
|
||||
</button>
|
||||
<span class="picker-title">获取活动名</span>
|
||||
</div>
|
||||
<div class="picker-steps-indicator">
|
||||
<div
|
||||
v-for="n in 3"
|
||||
:key="n"
|
||||
class="picker-step-dot"
|
||||
:class="{ active: pickerStep === n }"
|
||||
></div>
|
||||
</div>
|
||||
<div class="activity-picker-body">
|
||||
<!-- 步骤 1 -->
|
||||
<div class="picker-step" v-show="pickerStep === 1">
|
||||
<div class="picker-step-icon"><Monitor :size="52" stroke-width="1.5" /></div>
|
||||
<h3 class="picker-step-title">将 Web UI 挂小窗</h3>
|
||||
<p class="picker-step-desc">
|
||||
在开始获取前,请先将当前 Web UI 调整为<strong>小窗模式</strong>。<br /><br />
|
||||
这样在后续步骤中,你可以同时操作目标应用并看到 Web UI 的反馈。
|
||||
</p>
|
||||
<Button class="picker-action-btn" @click="pickerStep = 2">已挂小窗,下一步</Button>
|
||||
</div>
|
||||
<!-- 步骤 2 -->
|
||||
<div class="picker-step" v-show="pickerStep === 2">
|
||||
<div class="picker-step-icon"><Clock :size="52" stroke-width="1.5" /></div>
|
||||
<h3 class="picker-step-title">切换到目标界面</h3>
|
||||
<p class="picker-step-desc">
|
||||
切换到需要屏蔽的应用界面,并点击 「开始获取」<br /><br />
|
||||
检测到非 Web UI 界面后将<strong>自动停止</strong>。<br /><br />
|
||||
<span class="picker-status-text" :class="{ polling: pickerPolling }">{{
|
||||
pickerStatusText
|
||||
}}</span>
|
||||
</p>
|
||||
<Button class="picker-action-btn" :disabled="pickerPolling" @click="startPolling"
|
||||
>开始获取</Button
|
||||
>
|
||||
</div>
|
||||
<!-- 步骤 3 -->
|
||||
<div class="picker-step" v-show="pickerStep === 3">
|
||||
<div class="picker-step-icon">
|
||||
<CircleCheck :size="52" stroke-width="1.5" />
|
||||
</div>
|
||||
<h3 class="picker-step-title">检测到活动</h3>
|
||||
<p class="picker-step-desc">以下活动将被添加到按活动屏蔽列表:</p>
|
||||
<div class="picker-result-box">{{ pickerResult }}</div>
|
||||
<div class="picker-result-actions">
|
||||
<Button
|
||||
variant="secondary"
|
||||
@click="pickerStep = 2; pickerPolling = false; stopPolling()"
|
||||
>重试</Button
|
||||
>
|
||||
<Button @click="confirmPicker"><Check :size="15" /> 确认添加</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,246 @@
|
||||
<script setup>
|
||||
import { inject, ref } from 'vue';
|
||||
import Button from '@/components/ui/Button.vue';
|
||||
import Input from '@/components/ui/Input.vue';
|
||||
import Textarea from '@/components/ui/Textarea.vue';
|
||||
import Switch from '@/components/ui/Switch.vue';
|
||||
import Label from '@/components/ui/Label.vue';
|
||||
import { Save, Settings2, ShieldCheck, FileText, Settings, Monitor, HelpCircle } from 'lucide-vue-next';
|
||||
import { runCmd } from '../utils.js';
|
||||
|
||||
const config = inject('config');
|
||||
const showToast = inject('showToast');
|
||||
const restartRefresh = inject('restartRefresh');
|
||||
|
||||
// 恢复默认二次确认
|
||||
const resetConfirming = ref(false);
|
||||
let resetTimer = null;
|
||||
function handleReset() {
|
||||
if (!resetConfirming.value) {
|
||||
resetConfirming.value = true;
|
||||
resetTimer = setTimeout(() => { resetConfirming.value = false; }, 5000);
|
||||
return;
|
||||
}
|
||||
clearTimeout(resetTimer);
|
||||
resetConfirming.value = false;
|
||||
config.resetToDefaults(showToast);
|
||||
}
|
||||
|
||||
async function viewInotifyHelp() {
|
||||
showToast('获取中...');
|
||||
const res = await runCmd('inotifyd --help');
|
||||
const out = (res.stderr || '') + (res.stdout || '');
|
||||
alert(out.trim() || '无法获取帮助信息');
|
||||
}
|
||||
|
||||
function handleSaveWebUI() {
|
||||
config.saveWebUIConfig(
|
||||
showToast,
|
||||
config.autoRefresh.value,
|
||||
config.statusRefreshInterval.value,
|
||||
config.uiZoom.value,
|
||||
config.themeMode.value,
|
||||
restartRefresh,
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div style="display:contents">
|
||||
<!-- === 亮度配置 === -->
|
||||
<section class="card" id="config-section" data-nav-group="config">
|
||||
<div class="card-header"><h2>亮度配置</h2></div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><Settings2 :size="16" /> 亮度调节</h3>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">前台最大亮度</span>
|
||||
<span class="config-desc">触发亮度提升的阈值</span>
|
||||
</div>
|
||||
<Input v-model="config.uiMaxBri.value" type="number" min="0" class="config-input" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">峰值最大亮度</span>
|
||||
<span class="config-desc">亮度提升的目标值</span>
|
||||
</div>
|
||||
<Input v-model="config.maxBri.value" type="number" min="0" class="config-input" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">亮度提升步数</span>
|
||||
<span class="config-desc">约 0.02 秒 / 步</span>
|
||||
</div>
|
||||
<Input v-model="config.stepsNum.value" type="number" min="1" max="500" class="config-input" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><ShieldCheck :size="16" /> 执行策略</h3>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">自动亮度时休眠</span>
|
||||
<span class="config-desc">开启自动亮度时不提升</span>
|
||||
</div>
|
||||
<Switch v-model="config.autoBriSleep.value" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">显示 HDR 内容时休眠</span>
|
||||
<span class="config-desc">HDR/SDR 比率 > 1 时不提升</span>
|
||||
<span class="config-desc" style="color:var(--color-warning)">建议配合去温控使用。出现闪屏时可改用黑名单功能</span>
|
||||
</div>
|
||||
<Switch v-model="config.displayHdrSleep.value" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">定时休眠</span>
|
||||
<span class="config-desc">设定时段内不提升亮度</span>
|
||||
</div>
|
||||
<Switch v-model="config.sleepMode.value" />
|
||||
</div>
|
||||
|
||||
<div class="config-item-expand" :class="{ show: config.sleepMode.value }">
|
||||
<div class="custom-time-picker">
|
||||
<div class="time-unit">
|
||||
<input type="number" v-model="config.sleepStartH.value" class="time-input" min="0" max="23" placeholder="00" />
|
||||
<span>:</span>
|
||||
<input type="number" v-model="config.sleepStartM.value" class="time-input" min="0" max="59" placeholder="00" />
|
||||
</div>
|
||||
<span class="time-sep">至</span>
|
||||
<div class="time-unit">
|
||||
<input type="number" v-model="config.sleepEndH.value" class="time-input" min="0" max="23" placeholder="00" />
|
||||
<span>:</span>
|
||||
<input type="number" v-model="config.sleepEndM.value" class="time-input" min="0" max="59" placeholder="00" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><FileText :size="16" /> 系统管理</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">日志大小限制</span>
|
||||
<span class="config-desc">单位: KB</span>
|
||||
</div>
|
||||
<Input v-model="config.logMaxSize.value" type="number" min="1" max="10240" class="config-input" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<Button variant="outline" @click="handleReset" :class="resetConfirming ? 'border-destructive text-destructive' : ''">
|
||||
{{ resetConfirming ? '确认恢复?' : '恢复默认' }}
|
||||
</Button>
|
||||
<Button @click="config.save(showToast)">
|
||||
<Save :size="15" /> 保存配置
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- === 高级设置 === -->
|
||||
<section class="card" id="advanced-section" data-nav-group="config">
|
||||
<div class="card-header"><h2>高级设置</h2></div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><Settings :size="16" /> 运行环境</h3>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">inotifyd 监听事件</span>
|
||||
<span class="config-desc">默认 c。修改需重启服务</span>
|
||||
<span class="config-desc" style="color:var(--color-warning)">修改为 c 以外时建议关闭自动刷新</span>
|
||||
<button class="btn-text-s" style="margin-top:6px;padding:2px 6px" @click="viewInotifyHelp">
|
||||
查看支持事件
|
||||
</button>
|
||||
</div>
|
||||
<Input v-model="config.inotifyEvents.value" type="text" placeholder="c" class="config-input" />
|
||||
</div>
|
||||
|
||||
<div class="config-item" id="advanced-section">
|
||||
<div class="config-label">
|
||||
<span class="config-name">当前亮度节点</span>
|
||||
<span class="config-desc">修改需重启服务</span>
|
||||
</div>
|
||||
<Textarea v-model="config.nowBriFile.value" class="config-textarea" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">最大亮度节点</span>
|
||||
<span class="config-desc">修改需重启服务</span>
|
||||
</div>
|
||||
<Textarea v-model="config.sysMaxBriFile.value" class="config-textarea" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<Button @click="config.saveAdvanced(showToast, () => {})">
|
||||
<Save :size="15" /> 保存设置
|
||||
</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">
|
||||
<h3 class="group-title"><Monitor :size="16" /> 界面设置</h3>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">自动刷新</span>
|
||||
<span class="config-desc">定时刷新状态和日志。监听非 c 事件时建议关闭</span>
|
||||
</div>
|
||||
<Switch v-model="config.autoRefresh.value" />
|
||||
</div>
|
||||
|
||||
<div class="config-item" v-show="config.autoRefresh.value">
|
||||
<div class="config-label">
|
||||
<span class="config-name">状态/日志刷新间隔</span>
|
||||
<span class="config-desc">单位: 毫秒 (最小100ms)</span>
|
||||
</div>
|
||||
<Input v-model="config.statusRefreshInterval.value" type="number" min="100" class="config-input" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">外观主题</span>
|
||||
<span class="config-desc">深色 / 浅色 / 跟随系统</span>
|
||||
</div>
|
||||
<div class="theme-seg">
|
||||
<button
|
||||
v-for="opt in [{v:'system',l:'系统'},{v:'light',l:'浅色'},{v:'dark',l:'深色'}]"
|
||||
:key="opt.v"
|
||||
class="theme-seg-btn"
|
||||
:class="{ active: config.themeMode.value === opt.v }"
|
||||
@click="config.themeMode.value = opt.v; config.applyTheme(opt.v)"
|
||||
>{{ opt.l }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">界面缩放</span>
|
||||
<span class="config-desc">50% - 150%(立即生效)</span>
|
||||
</div>
|
||||
<Input v-model="config.uiZoom.value" type="number" min="50" max="150" class="config-input" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<Button @click="handleSaveWebUI">
|
||||
<Save :size="15" /> 保存配置
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,79 @@
|
||||
<script setup>
|
||||
import { inject, ref, onMounted } from 'vue';
|
||||
import Button from '@/components/ui/Button.vue';
|
||||
import { RefreshCw, Copy, Download, Trash2 } from 'lucide-vue-next';
|
||||
|
||||
const showToast = inject('showToast');
|
||||
const log = inject('log');
|
||||
|
||||
const logMenuOpen = ref(false);
|
||||
const clearConfirming = ref(false);
|
||||
|
||||
let clearConfirmTimer = null;
|
||||
function handleClear() {
|
||||
if (!clearConfirming.value) {
|
||||
clearConfirming.value = true;
|
||||
clearConfirmTimer = setTimeout(() => { clearConfirming.value = false; }, 3000);
|
||||
return;
|
||||
}
|
||||
clearTimeout(clearConfirmTimer);
|
||||
clearConfirming.value = false;
|
||||
logMenuOpen.value = false;
|
||||
log.clear(showToast);
|
||||
}
|
||||
|
||||
// filter options
|
||||
const filterOptions = [
|
||||
{ key: 'all', label: '全部' },
|
||||
{ key: 'info', label: 'INFO' },
|
||||
{ key: 'warning', label: 'WARN' },
|
||||
{ key: 'error', label: 'ERR' },
|
||||
];
|
||||
|
||||
onMounted(() => log.load());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="card" id="log-section">
|
||||
<div class="card-header" style="margin-bottom:8px">
|
||||
<h2>运行日志</h2>
|
||||
<div class="header-actions dropdown-container">
|
||||
<Button variant="ghost" size="icon" @click="log.load">
|
||||
<RefreshCw :size="18" />
|
||||
</Button>
|
||||
<Button variant="ghost" size="icon" @click="logMenuOpen = !logMenuOpen">
|
||||
<span class="sr-only">更多操作</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>
|
||||
</Button>
|
||||
<div class="dropdown-menu" :class="{ show: logMenuOpen }" @click.stop>
|
||||
<div class="dropdown-item" @click="log.copy(showToast); logMenuOpen=false">
|
||||
<Copy :size="18" /><span>复制日志</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="log.exportLog(showToast); logMenuOpen=false">
|
||||
<Download :size="18" /><span>导出日志文件</span>
|
||||
</div>
|
||||
<div class="dropdown-item" :class="{ 'dropdown-item-danger': clearConfirming }" @click="handleClear">
|
||||
<Trash2 :size="18" />
|
||||
<span>{{ clearConfirming ? '再次点击确认清除' : '清除日志' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 过滤器 -->
|
||||
<div class="log-filter-container" style="margin-bottom:var(--spacing-s)">
|
||||
<div class="log-filter-tabs">
|
||||
<button
|
||||
v-for="opt in filterOptions"
|
||||
:key="opt.key"
|
||||
class="log-filter-tab"
|
||||
:class="{ active: log.filterLevel.value === opt.key }"
|
||||
@click="log.filterLevel.value = opt.key"
|
||||
>{{ opt.label }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 日志内容 -->
|
||||
<pre class="log-output" id="log-output">{{ log.filteredLog.value || '暂无日志' }}</pre>
|
||||
</section>
|
||||
</template>
|
||||
@@ -0,0 +1,111 @@
|
||||
<script setup>
|
||||
import { inject, computed, ref } from 'vue';
|
||||
import Button from '@/components/ui/Button.vue';
|
||||
import Switch from '@/components/ui/Switch.vue';
|
||||
import Badge from '@/components/ui/Badge.vue';
|
||||
import {
|
||||
RefreshCw, Play, RotateCcw,
|
||||
SunMedium, Smartphone, Activity, Clock, Moon, Layers,
|
||||
} from 'lucide-vue-next';
|
||||
|
||||
const status = inject('status');
|
||||
const showToast = inject('showToast');
|
||||
const config = inject('config');
|
||||
|
||||
const confirmedLowBri = ref(false);
|
||||
|
||||
// --------- 亮度滑条渐变 ----------
|
||||
const sliderStyle = computed(() => {
|
||||
const sysMax = parseInt(status.sysMaxBri.value) || 255;
|
||||
const curr = parseInt(status.currentBri.value) || 0;
|
||||
const uiMax = parseInt(config.uiMaxBri.value) || sysMax;
|
||||
const c = (curr / sysMax) * 100;
|
||||
const u = (uiMax / sysMax) * 100;
|
||||
const pri = '#a8c7fa';
|
||||
const bst = '#fb8c00';
|
||||
const trk = 'var(--md-sys-color-surface-container-high)';
|
||||
const btrk = 'rgba(251,140,0,0.15)';
|
||||
if (c <= u) {
|
||||
return `background: linear-gradient(to right, ${pri} 0%, ${pri} ${c}%, ${trk} ${c}%, ${trk} ${u}%, ${btrk} ${u}%, ${btrk} 100%)`;
|
||||
}
|
||||
return `background: linear-gradient(to right, ${pri} 0%, ${pri} ${u}%, ${bst} ${u}%, ${bst} ${c}%, ${btrk} ${c}%, ${btrk} 100%)`;
|
||||
});
|
||||
|
||||
const brightnessPercent = computed(() => {
|
||||
const sysMax = parseInt(status.sysMaxBri.value) || 255;
|
||||
const curr = parseInt(status.currentBri.value) || 0;
|
||||
return Math.round((curr / sysMax) * 100) + '%';
|
||||
});
|
||||
|
||||
async function onSliderChange(e) {
|
||||
const newBri = parseInt(e.target.value, 10);
|
||||
const sysMax = parseInt(status.sysMaxBri.value) || 255;
|
||||
const pct = Math.round((newBri / sysMax) * 100);
|
||||
if (pct < 5 && !confirmedLowBri.value) {
|
||||
const ok = confirm('⚠️ 警告:亮度低于 5% 可能导致屏幕近似黑屏。\n\n确定要继续吗?');
|
||||
if (!ok) { const safe = Math.ceil(sysMax * 0.05); e.target.value = safe; return; }
|
||||
confirmedLowBri.value = true;
|
||||
}
|
||||
if (pct >= 5) confirmedLowBri.value = false;
|
||||
await status.setBrightness(newBri, showToast);
|
||||
}
|
||||
|
||||
const statusItems = computed(() => [
|
||||
{ label: '当前亮度', value: status.currentBri.value || '—', icon: SunMedium },
|
||||
{ label: '系统最大亮度', value: status.sysMaxBri.value || '—', icon: Smartphone },
|
||||
{ label: 'inotifyd PID', value: status.inotifydPid.value, icon: Activity },
|
||||
{ label: 'inotifyd 状态', value: status.inotifydState.value, icon: Clock },
|
||||
{ label: '休眠状态', value: status.sleepStatus.value, icon: Moon },
|
||||
{ label: 'HDR/SDR 比率', value: status.hdrRatio.value, icon: Layers },
|
||||
]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="card" id="status-section" data-nav-group="status">
|
||||
<div class="card-header">
|
||||
<h2>实时状态</h2>
|
||||
<Button variant="ghost" size="icon" @click="status.load(true)">
|
||||
<RefreshCw :size="18" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<!-- 状态网格 -->
|
||||
<div class="status-grid">
|
||||
<div v-for="item in statusItems" :key="item.label" class="status-item">
|
||||
<div class="status-item-header">
|
||||
<component :is="item.icon" :size="14" aria-hidden="true" />
|
||||
<span class="status-label">{{ item.label }}</span>
|
||||
</div>
|
||||
<span class="status-value">{{ item.value }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 亮度控制 -->
|
||||
<div class="brightness-section">
|
||||
<div class="brightness-header">
|
||||
<span class="brightness-title">亮度</span>
|
||||
<span class="brightness-percent">{{ brightnessPercent }}</span>
|
||||
</div>
|
||||
<div class="brightness-container">
|
||||
<span class="brightness-label">0%</span>
|
||||
<input
|
||||
type="range"
|
||||
class="brightness-slider"
|
||||
min="0"
|
||||
:max="status.sysMaxBri.value || 255"
|
||||
:value="status.currentBri.value || 0"
|
||||
:style="sliderStyle"
|
||||
@change="onSliderChange"
|
||||
/>
|
||||
<span class="brightness-label">100%</span>
|
||||
</div>
|
||||
<div class="auto-brightness-row">
|
||||
<span class="auto-brightness-label">自动亮度调节</span>
|
||||
<Switch
|
||||
:model-value="status.autoBriMode.value"
|
||||
@update:model-value="status.setAutoBrightness($event, showToast)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,6 +1,15 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
build: {
|
||||
outDir: '../webroot',
|
||||
emptyOutDir: true,
|
||||
|
||||
Reference in new issue
Block a user