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,87 @@
|
||||
name: Build & Package Module
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ['v*']
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# ── 1. WebUI ────────────────────────────────────────────────────────
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
|
||||
- name: Install Node.js dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build WebUI
|
||||
run: pnpm build
|
||||
|
||||
# ── 2. lumipro 二进制 ────────────────────────────────────────────────
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-linux-android
|
||||
|
||||
- name: Setup Android NDK
|
||||
uses: nttld/setup-ndk@v1
|
||||
id: ndk
|
||||
with:
|
||||
ndk-version: r27c
|
||||
|
||||
- name: Cache Rust dependencies
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: rust
|
||||
|
||||
- name: Install cargo-ndk
|
||||
run: cargo install cargo-ndk --locked
|
||||
|
||||
- name: Build lumipro (aarch64-linux-android)
|
||||
working-directory: rust
|
||||
env:
|
||||
ANDROID_NDK_HOME: ${{ steps.ndk.outputs.ndk-path }}
|
||||
run: cargo ndk -t arm64-v8a --platform 26 build --release
|
||||
|
||||
- name: Copy binary to bin/
|
||||
run: |
|
||||
cp rust/target/aarch64-linux-android/release/lumipro bin/lumipro
|
||||
chmod +x bin/lumipro
|
||||
|
||||
# ── 3. 打包模块 ──────────────────────────────────────────────────────
|
||||
- name: Package module
|
||||
run: node build-module.js
|
||||
|
||||
# ── 4. 重命名 zip 加入 commit 短哈希 ─────────────────────────────────
|
||||
- name: Rename zip with commit hash
|
||||
id: names
|
||||
run: |
|
||||
VERSION=$(grep '^version=' module.prop | cut -d= -f2 | tr -d '[:space:]')
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
FINAL="LuminPro_${VERSION}-${SHORT_SHA}.zip"
|
||||
mv "LuminPro_${VERSION}.zip" "$FINAL"
|
||||
echo "zip=$FINAL" >> "$GITHUB_OUTPUT"
|
||||
|
||||
# ── 5. 上传 artifact(单个 zip 文件) ────────────────────────────────
|
||||
# upload-artifact 上传单个文件时仍会套一层 zip;通过 gh run download 下载
|
||||
# 后得到的即是模块 zip,直接可刷入,无需二次解压。
|
||||
- name: Upload module zip
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ steps.names.outputs.zip }}
|
||||
path: ${{ steps.names.outputs.zip }}
|
||||
if-no-files-found: error
|
||||
@@ -3,7 +3,15 @@ dist/
|
||||
.vite/
|
||||
*.log
|
||||
*.zip
|
||||
.dist
|
||||
|
||||
# 屏蔽 webroot 下的所有文件,但保留目录本身
|
||||
webroot/*
|
||||
!webroot/.gitkeep
|
||||
|
||||
# rust
|
||||
rust/target/
|
||||
|
||||
# 本地脚本
|
||||
deploy.js
|
||||
.dist-tmp
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
||||
"printWidth": 100,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2,
|
||||
"trailingComma": "all",
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||
"categories": {
|
||||
"correctness": "warn"
|
||||
},
|
||||
"rules": {
|
||||
"eslint/no-unused-vars": "warn"
|
||||
}
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["oxc.oxc-vscode", "Vue.volar", "rust-lang.rust-analyzer"]
|
||||
}
|
||||
Vendored
+8
-4
@@ -1,7 +1,11 @@
|
||||
{
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "timonwong.shellcheck",
|
||||
"[shellscript]": {
|
||||
"editor.defaultFormatter": "mads-hartmann.bash-ide-vscode"
|
||||
}
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.oxc": "always",
|
||||
},
|
||||
"[shellscript]": {
|
||||
"editor.defaultFormatter": "mads-hartmann.bash-ide-vscode",
|
||||
},
|
||||
"oxc.fmt.configPath": ".oxfmtrc.json",
|
||||
"editor.defaultFormatter": "oxc.oxc-vscode",
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
# LuminPro 开发文档 (Development Guide)
|
||||
|
||||
欢迎回到 LuminPro 的开发!本指南旨在帮助开发者快速找回开发节奏,了解项目结构、构建流程以及如何进行本地调试。
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **无需本地环境全套配置**:本项目已配置完善的 GitHub Actions,每次推送代码到 `main` 分支或发布标签 (`v*`),云端会自动完成前端编译、Rust 交叉编译及模块打包,并生成可直接刷入的 ZIP 包。
|
||||
|
||||
---
|
||||
|
||||
## 1. 项目架构概览
|
||||
|
||||
LuminPro 是一个基于 KernelSU WebUI 的 Android 亮度增强模块,结合了 Rust 底层监听与 Vue.js 前端控制。
|
||||
|
||||
- `webui/`: 基于 Vite + Vue 3 的前端源码。
|
||||
- `rust/`: 负责底层文件监听的二进制程序 (`lumipro`) 源码。
|
||||
- `bin/`: 存放预编译的二进制文件(如 `jq`, `lumipro`)。
|
||||
- `script/`: 核心逻辑 shell 脚本(守护进程、逻辑触发等)。
|
||||
- `webroot/`: WebUI 编译产物存放地,模块刷入后 KernelSU 会读取此处。
|
||||
- `module.prop`: 模块基础信息。
|
||||
- `build-module.js`: 模块自动化打包脚本。
|
||||
|
||||
---
|
||||
|
||||
## 2. 环境搭建 (本地)
|
||||
|
||||
如果你仅进行 WebUI 界面调整或脚本逻辑修改,只需安装 Node.js:
|
||||
|
||||
- **Node.js**: 推荐 v18+ (项目中使用 pnpm/npm)
|
||||
|
||||
如果你需要**在本地编译 Rust 程序**(通常不需要,建议交给云端),才需要安装以下工具:
|
||||
|
||||
- **Rust**: 需要安装 Android Target: `rustup target add aarch64-linux-android`
|
||||
- **Android NDK**: 交叉编译所需 (推荐 r27c+)。
|
||||
- **cargo-ndk**: 安装命令: `cargo install cargo-ndk`
|
||||
|
||||
---
|
||||
|
||||
## 3. WebUI 开发
|
||||
|
||||
WebUI 负责所有可视化配置与状态显示。
|
||||
|
||||
### 本地预览
|
||||
|
||||
```bash
|
||||
# 安装依赖
|
||||
npm install
|
||||
|
||||
# 启动开发服务器
|
||||
npm run dev
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> 由于 WebUI 依赖 `kernelsu` JavaScript API,在普通浏览器中预览时,部分 API 调用(如 `exec`)会失效。建议配合 KernelSU 管理器的「自定义页面」功能进行实机调试。
|
||||
|
||||
### 编译前端
|
||||
|
||||
生成的静态文件会自动同步到根目录的 `webroot/`。
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 4. 自动化构建 (推荐方式)
|
||||
|
||||
本项目依赖 GitHub Actions 进行稳定构建,避免本地环境差异导致的编译问题。
|
||||
|
||||
### 触发流程
|
||||
|
||||
1. **推送代码**:修改代码并 `git push` 后,GitHub 会自动启动 [Build & Package Module] 工作流。
|
||||
2. **下载产物**:
|
||||
- 流程结束后,在 GitHub Actions 运行记录的 **Artifacts** 栏目中可下载编译好的 ZIP 模块。
|
||||
- 产物文件名格式为:`LuminPro_V2.x.x-shortsha.zip`。
|
||||
|
||||
---
|
||||
|
||||
## 5. Rust 底层开发 (可选)
|
||||
|
||||
`lumipro` 源码位于 `rust/`。通常修改逻辑后直接推送即可,若需本地测试编译:
|
||||
|
||||
```bash
|
||||
cd rust
|
||||
cargo ndk -t arm64-v8a --platform 26 build --release
|
||||
cp target/aarch64-linux-android/release/lumipro ../bin/lumipro
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 6. 模块打包脚本
|
||||
|
||||
`build-module.js` 负责版本同步、生成校验和并打包。即便不在本地编译 Rust,你也可以用它临时打包当前目录文件:
|
||||
|
||||
```bash
|
||||
# 自动执行:前端编译 + 模块打包
|
||||
npm run build
|
||||
|
||||
# 仅打包(不重编前端):
|
||||
node build-module.js
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 7. 核心逻辑说明
|
||||
|
||||
- **service.sh**: 模块启动入口,负责拉起守护进程。
|
||||
- **script/daemon.sh**: 持续监控 `lumipro` 进程,并处理亮度提升逻辑。
|
||||
- **customize.sh**: 刷入时的安装逻辑,处理初次校准与文件权限。
|
||||
- **action.sh**: 快捷操作逻辑(音量键或管理器按钮触发)。
|
||||
|
||||
---
|
||||
|
||||
## 8. 调试技巧
|
||||
|
||||
- **查看日志**: 在 WebUI 界面、日志页,或执行 `tail -f /data/adb/modules/luminpro/luminpro.log`。
|
||||
- **手动触发逻辑**: 执行 `/data/adb/modules/luminpro/boost.sh`。
|
||||
- **配置文件**: `/data/adb/modules/luminpro/config/config.json`。
|
||||
|
||||
---
|
||||
|
||||
祝你开发愉快!如有疑问,请查阅 [README.md](./README.md) 或提交 Issue。
|
||||
@@ -1,50 +1,85 @@
|
||||
------------ 🌸🌸🌸 ------------
|
||||
=======================================
|
||||
LuminPro V2.3 — 日用屏幕亮度强化
|
||||
作者: 酷安@Yule
|
||||
=======================================
|
||||
|
||||
嗨~亲爱的伙伴!感谢你选择本喵的【日用屏幕亮度强化 (LuminPro V2.1)】ฅ^•ﻌ•^ฅ
|
||||
本喵会努力帮你让屏幕更亮更清晰,但为了守护你和设备的安全,请花几分钟认真阅读以下内容哦~
|
||||
感谢你使用 LuminPro!在开始使用前,请仔细阅读以下内容。
|
||||
|
||||
------------ 🐾【使用约定】🐾 ------------
|
||||
---------------------------------------
|
||||
【使用约定】
|
||||
---------------------------------------
|
||||
|
||||
1. 授权小贴士
|
||||
本喵由 Yule 精心开发,你可以自由使用、修改和分享喵~
|
||||
但请遵守法律法规,并保留本喵的版权小尾巴(开发者信息不能删掉哦!(๑>ᴗ<๑))
|
||||
1. 版权声明
|
||||
本模块由 Yule 开发,你可以自由使用与分享,但请保留开发者信息,
|
||||
且须遵守相关法律法规,不得用于商业用途。
|
||||
|
||||
2. 免责小贴士
|
||||
本喵目前是「测试版小萌新」,可能存在未知小bug~
|
||||
开发者无法对设备损伤、数据丢失或系统罢工负责,
|
||||
请确认你已做好「自己承担风险」的准备啦!( •́ω•̀ )
|
||||
2. 免责声明
|
||||
本模块按"现状"提供,不附带任何明示或暗示的保证。
|
||||
开发者对因使用本模块导致的设备损伤、数据丢失或系统故障不承担责任。
|
||||
使用即代表你已了解并接受相关风险。
|
||||
|
||||
3. 风险说明书(超重要!)
|
||||
使用前请默念三遍:「我接受这些可能性!」
|
||||
🔸 卡顿警告:亮度过高时,设备可能会累到「卡成PPT」!
|
||||
🔸 发热警告:屏幕努力发光时,设备可能会变成暖宝宝🔥
|
||||
🔸 屏幕衰老:长期高亮度会让屏幕「提前长皱纹」甚至烧屏呢(T▽T)
|
||||
🔸 电量告急:亮闪闪的代价是电量咻咻掉~记得随身带充电宝!
|
||||
3. 风险说明
|
||||
⚠ 发热与耗电:长期维持峰值亮度会显著增加设备发热与功耗。
|
||||
⚠ OLED 烧屏:高亮度会加速 OLED 面板老化,严重时导致永久性残影。
|
||||
⚠ 系统干预:部分设备在高亮度下可能触发系统降频或热保护机制。
|
||||
请根据实际使用场景合理配置,切勿超出硬件安全范围。
|
||||
|
||||
------------ 🌼【使用小窍门】🌼 ------------
|
||||
---------------------------------------
|
||||
【功能说明】
|
||||
---------------------------------------
|
||||
|
||||
1. 原生底层监听
|
||||
本喵 V2.1 起已进化为 inotifyd 事件驱动,~零后台耗电,只有你滑亮屏幕时才会默默出力!
|
||||
1. lumipro 底层监听
|
||||
模块采用 Rust 编写的 `lumipro` 二进制程序进行文件事件驱动,
|
||||
内置防抖动与调试模式,仅在亮度节点文件变化时响应,
|
||||
无后台轮询,对电量影响极小。
|
||||
|
||||
2. KernelSU WebUI 支持
|
||||
告别繁琐的配置文件修改!你只需在 KernelSU 管理器中点击模块配置,即可可视化调整「前台触发亮度」、「峰值亮度」和「休眠时间」。
|
||||
2. 守护进程
|
||||
daemon.sh 持续监视 lumipro 进程的存活状态,进程意外退出时
|
||||
自动重启,确保监听链路不中断。
|
||||
|
||||
3. 平滑亮度过渡
|
||||
亮度提升已经过精心打磨,提供 50 步毫秒级顺滑过渡,保护眼睛绝不突兀。(๑•̀ㅂ•́)و✧
|
||||
3. WebUI 可视化配置
|
||||
在 KernelSU 管理器的模块设置中可调整所有参数,保存后立即生效:
|
||||
· 前台最大亮度 — 触发提升的亮度阈值
|
||||
· 峰值最大亮度 — 提升后的目标硬件亮度
|
||||
· 调整步数 — 平滑过渡的步进数(默认 50 步)
|
||||
· 休眠时段 — 不触发提升的时间范围(格式 HHMM-HHMM)
|
||||
· 日志等级 — 控制日志输出量(关闭/仅错误/警告+/全部)
|
||||
· 亮度节点路径 — 非标准设备可自定义 sysfs 路径
|
||||
|
||||
4. 时间管理大师
|
||||
配置 WebUI 中的「休眠时间」(如 1900-0600),夜间不瞎眼,保证睡眠质量!🌙
|
||||
4. 智能跳过
|
||||
以下情形模块会自动跳过本次提升:
|
||||
· 系统自动亮度已开启
|
||||
· 正在播放 HDR 内容(可配置)
|
||||
· 当前前台应用在黑名单中
|
||||
· 处于配置的休眠时段内
|
||||
|
||||
5. 温度安全区
|
||||
请在10°C~35°C环境使用,太冷太热都会让设备「闹脾气」!使用中记得检查设备发热和电量状况。
|
||||
5. 应用黑名单
|
||||
在 WebUI「应用」页面管理黑名单,支持按包名搜索和 Activity 精确匹配。
|
||||
|
||||
------------ 🌟【最后的小星星】🌟 ------------
|
||||
6. 一键峰值触发 (Action)
|
||||
通过管理器的「操作」按钮或 action.sh 可即时将亮度拉至峰值;
|
||||
再次触发则恢复原始亮度。
|
||||
|
||||
本喵的使命是让你的屏幕更清晰明亮,
|
||||
但风险与效果并存,请务必做好权衡与准备~
|
||||
7. 日志管理
|
||||
WebUI「日志」页面支持按 INFO / WARN / ERROR 过滤,
|
||||
并可一键复制或导出日志文件至 /sdcard。
|
||||
可通过「日志等级」配置减少冗余日志写入。
|
||||
|
||||
遇到问题欢迎通过 WebUI 面板查看运行日志,
|
||||
我会摇着尾巴努力帮你解决遇到的问题!
|
||||
感谢你的包容与支持,一起加油吧!ヾ(≧∇≦)ヾ
|
||||
---------------------------------------
|
||||
【安装步骤】
|
||||
---------------------------------------
|
||||
|
||||
------------ 🌸🌸🌸 ------------
|
||||
1. 在支持 KernelSU WebUI 的管理器中刷入本模块 ZIP。
|
||||
2. 按照音量键向导完成亮度校准。
|
||||
(若已有旧版配置,按音量上键直接跳过即可继承原设置)
|
||||
3. 重启设备生效。
|
||||
4. 在管理器模块设置页面调整参数,保存后立即生效。
|
||||
|
||||
---------------------------------------
|
||||
【遇到问题?】
|
||||
---------------------------------------
|
||||
|
||||
请在 WebUI 日志页面导出运行日志,附带日志内容至社区反馈,
|
||||
以便开发者定位并修复问题。
|
||||
|
||||
=======================================
|
||||
@@ -1,51 +1,87 @@
|
||||
<div align="center">
|
||||
|
||||
# 日用屏幕亮度强化 (LuminPro)
|
||||
# LuminPro — 日用屏幕亮度强化
|
||||
|
||||
中文简体 丨 [English](https://github.com/YuleBest/LuminPro/blob/main/README_en.md)
|
||||
**中文简体** 丨 [English](https://github.com/YuleBest/LuminPro/blob/main/README_en.md)
|
||||
|
||||
让你的 Android 设备随时可以使用高亮度显示屏幕内容
|
||||
*基于 KernelSU WebUI + 事件驱动架构*
|
||||
让你的 Android 设备随时可以突破前台亮度上限,将屏幕提升至硬件峰值
|
||||
_基于 KernelSU WebUI + Rust 事件驱动架构_
|
||||
|
||||
</div>
|
||||
|
||||
## 模块介绍
|
||||
本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果。
|
||||
## 模块介绍
|
||||
|
||||
## V2.1 核心特性一览
|
||||
无论当前屏幕亮度如何,只要触发亮度超过设定阈值,LuminPro 便会自动且平滑地将屏幕提升至硬件支持的峰值亮度,确保你在强光户外也能获得清晰的显示效果。模块采用 Rust 编写的 `lumipro` 二进制程序进行底层文件事件监听,零轮询、零空转,配合 KernelSU WebUI 提供完整的可视化配置与状态监控。
|
||||
|
||||
- **零耗电的底层监听 (inotifyd)**
|
||||
彻底告别传统的死循环和轮询检测耗电。LuminPro 全新采用底层的 `inotifyd` 事件驱动架构,仅在屏幕亮度文件发生修改的瞬间响应,最大程度节省你的设备电量。
|
||||
> [!TIP]
|
||||
> 如果你是开发者,请参阅 [开发文档 (DEVELOPMENT.md)](./DEVELOPMENT.md) 了解构建与调试流程。
|
||||
|
||||
- **现代化的 KernelSU WebUI 参数配置**
|
||||
不再需要手动修改枯燥的 `CONFIG.prop` 文本文件!打开 KernelSU 管理器的模块设置,你可以在舒适的暗色可视化面板中实时调节各项亮度参数:
|
||||
- `前台最大亮度`:触发亮度提升的源阈值。
|
||||
- `峰值最大亮度`:亮度触发后提升到的极致目标值。
|
||||
## V2.3+ 核心特性
|
||||
|
||||
- **护眼级平滑亮度提升**
|
||||
亮度瞬间跃升不仅刺眼,还十分突兀——我们为你设计了专属的高刷新率 50 步亮度微调顺滑过渡算法,让屏幕提亮效果更显柔和。
|
||||
- **零耗电底层监听 (lumipro)**
|
||||
彻底告别死循环与轮询。使用 Rust 编写的 `lumipro` 二进制程序替代 `inotifyd`,内置防抖动与调试模式,仅在亮度节点文件发生变更的瞬间响应,守护进程 (`daemon.sh`) 负责持续监视 lumipro 进程稳定性,并具备**失效自动修复(Stale Lock 回收)**机制。
|
||||
|
||||
- **勿扰休眠时段**
|
||||
在 WebUI 中随时指定休眠时间段(例如 `1900-0600`)。在设定的夜间休息时间内,模块服务将静默休眠,不再打扰你的睡眠。
|
||||
- **兼容模式 (轮询驱动)**
|
||||
针对部分无法触发 inotify 事件的特殊机型,新增兼容模式。开启后模块切换为 2 秒一次的低频轮询,确保在任何环境下都能正常工作。
|
||||
|
||||
- **实时掌控模块状态**
|
||||
支持通过前端面板直接获取监控系统的核心参数,包含了当前界面的实时亮度、底层拉起的在运行 PID 服务状态,并可以随时抓取详细的运行日志供开发者分析。
|
||||
- **KernelSU WebUI 可视化配置**
|
||||
在管理器的模块设置页面中,通过暗色面板实时调整所有参数,保存后**立即生效**,无需重启:
|
||||
- `前台最大亮度` — 触发提升的亮度阈值
|
||||
- `峰值最大亮度` — 提升后的目标硬件亮度
|
||||
- `调整步数` — 平滑过渡的步进数(默认 50 步)
|
||||
- `休眠时段` — 指定不触发提升的时间范围(如 `2200-0700`)
|
||||
- `日志等级` — 控制日志输出量(关闭 / 仅错误 / 警告+ / 全部)
|
||||
- `亮度/最大亮度节点路径` — 支持自定义设备 sysfs 路径
|
||||
- `inotify 监测事件` — 自定义 lumipro 触发事件类型
|
||||
|
||||
## 模块工作流程
|
||||
1. **安装期自定义校准**
|
||||
- 通过音量键互动脚本,主动测定你设备通用的 `前台亮度阈值` 及 `硬件峰值亮度`,同时支持无缝继承旧版设定的配置以跳过多余校准。
|
||||
2. **事件监听阶段**
|
||||
- 启动完毕后,`inotifyd` 会作为背景挂起精准监控屏幕亮度的物理底层节点文件变动。
|
||||
3. **防抖与步进调整机制**
|
||||
- 取代了早期版本的参数紊乱,当前在用户手动横滑亮度控制条停止响应后,算法会经过安全延时后计算准确的终点步进结果点亮屏幕。
|
||||
- **平滑亮度过渡**
|
||||
毫秒级 50 步步进算法,避免亮度瞬间跃升带来的视觉不适。步数可在 WebUI 中自由调整。
|
||||
|
||||
## 安装方法
|
||||
1. 在支持 WebUI 标准的管理器环境框架下安装本模块的 ZIP 包。
|
||||
2. 在音量键安装向导中进行简单的第一步初始化按键确认校准(如果已有旧版配置按音量加直接跳过即可)。
|
||||
- **智能跳过机制**
|
||||
以下情况模块将自动跳过本次提升,避免干扰正常使用:
|
||||
- 系统自动亮度已启用
|
||||
- 当前正在播放 HDR 内容(可配置)
|
||||
- 当前前台应用在黑名单中
|
||||
- 处于配置的休眠时段内
|
||||
|
||||
- **应用黑名单**
|
||||
在 WebUI 的「应用」页面中管理黑名单,支持按包名搜索、Activity 精准匹配(可通过内置扫描工具自动获取前台 Activity 名)。黑名单内的应用处于前台时,模块不执行亮度提升。
|
||||
|
||||
- **一键峰值触发 (boost.sh)**
|
||||
通过管理器的「操作」按钮或 `action.sh` 快捷开关,可即时将亮度拉至峰值;再次触发则恢复原始亮度。
|
||||
|
||||
- **实时状态监控与日志**
|
||||
WebUI 状态页实时显示当前亮度值、lumipro 运行 PID 及服务状态。日志页支持按 `INFO` / `WARN` / `ERROR` 等级过滤,并可一键复制或导出到 `/sdcard`。
|
||||
|
||||
## 配置项说明
|
||||
|
||||
| 配置项 | 说明 | 默认值 |
|
||||
| ------------------- | ------------------------------- | ----------------- |
|
||||
| `ui_max_bri` | 前台触发阈值(UI 亮度值) | `0`(需手动校准) |
|
||||
| `max_bri` | 峰值目标亮度 | `0`(需手动校准) |
|
||||
| `compatibility_mode`| 兼容模式(轮询驱动) | `0`(禁用) |
|
||||
| `steps_num` | 亮度过渡步数 | `50` |
|
||||
| `sleep_time` | 休眠时段,格式 `HHMM-HHMM` | 空(禁用) |
|
||||
| `auto_bri_sleep` | 自动亮度开启时跳过 | `1`(启用) |
|
||||
| `display_hdr_sleep` | HDR 内容时跳过 | `0`(禁用) |
|
||||
| `log_level` | 日志等级(off/error/warn/info) | `info` |
|
||||
| `log_max_size` | 日志文件大小上限(KB) | `512` |
|
||||
| `now_bri_file` | 当前亮度节点路径 | 标准 panel0 路径 |
|
||||
| `max_bri_file` | 最大亮度节点路径 | 标准 panel0 路径 |
|
||||
| `blacklist_apps` | 黑名单包名/Activity 列表 | `[]` |
|
||||
| `inotify_events` | lumipro 监测事件 | `c` |
|
||||
|
||||
## 安装方法
|
||||
|
||||
1. 在支持 KernelSU WebUI 的管理器中刷入模块 ZIP。
|
||||
2. 在音量键安装向导中完成亮度校准(若已有旧版配置,按音量上键直接继承跳过)。
|
||||
3. 重启设备生效。
|
||||
4. 如需调整参数,只需在管理器中进入模块设置页面进行更改,点击保存**立即生效**。
|
||||
4. 在管理器模块设置页调整各项参数,点击保存立即生效。
|
||||
|
||||
## 注意事项
|
||||
- **长亮降频与烧屏警告**:长期处于高压力的激发峰值亮度,将指数级增加设备的耗电与发热水平,可能会导致设备卡顿并不可逆转地增加 OLED 屏幕烧屏老化几率。
|
||||
- 请确保写入参数数值为你的设备安全范围内的数据,避免超出你硬件屏幕能承受的上限。
|
||||
- 只有确保你在完全理解高亮度带来的体验和危害下,方可能长期启用。功能出现阻断或者其他 BUG 时,请自行保存 WebUI 日志通过社区回馈解决。
|
||||
## 注意事项
|
||||
|
||||
> ⚠️ **OLED 烧屏与发热警告**
|
||||
> 长期维持峰值亮度会显著加剧 OLED 屏幕老化与烧屏风险,并大幅增加设备发热与耗电。请根据使用场景合理配置,切勿超出设备硬件安全范围。
|
||||
|
||||
- 确保填写的亮度数值在设备硬件支持的安全范围内。
|
||||
- 遇到问题时,请通过 WebUI 日志页导出运行日志后反馈至社区。
|
||||
+64
-35
@@ -1,51 +1,80 @@
|
||||
<div align="center">
|
||||
<div align="center">
|
||||
|
||||
# LuminPro
|
||||
|
||||
[中文简体](https://github.com/YuleBest/LuminPro/blob/main/README.md) 丨 English
|
||||
[中文简体](https://github.com/YuleBest/LuminPro/blob/main/README.md) 丨 **English**
|
||||
|
||||
Enable your Android device to display content at boosted brightness anytime
|
||||
*Based on KernelSU WebUI + Event-Driven Architecture*
|
||||
Break past the Android foreground brightness cap and push your screen to its hardware peak — anytime
|
||||
_Powered by KernelSU WebUI + Rust Event-Driven Architecture_
|
||||
|
||||
</div>
|
||||
|
||||
## Module Introduction
|
||||
This module allows your Android device to constantly utilize boosted brightness for screen content display. When manually adjusting brightness over a designated threshold limit, the module automatically and smoothly elevates the screen brightness parameter to its maximum hardware-driven state, ensuring clear readability even in strong outdoor daylight.
|
||||
## Overview
|
||||
|
||||
## V2.1 Core Features
|
||||
LuminPro monitors the system brightness sysfs node via a Rust-native `lumipro` binary. Whenever the current brightness exceeds a configured threshold, it smoothly ramps the display up to the hardware maximum — ideal for outdoor readability. A resident daemon (`daemon.sh`) keeps the listener alive, and the full KernelSU WebUI lets you tune every parameter without a reboot.
|
||||
|
||||
- **Zero Drain Background Monitoring (inotifyd)**
|
||||
Say goodbye to infinite loops and heavy active polling overhead. LuminPro natively utilizes an event-driven `inotifyd` listener to respond *only* when the brightness sysfs node alters, fundamentally preserving your device's overall battery life.
|
||||
## V2.3 Core Features
|
||||
|
||||
- **Modernized KernelSU WebUI**
|
||||
No more manual text editing in generic config files! Simply tap the module settings inside your KernelSU manager to seamlessly adjust options directly in a tailored Dark Mode interface:
|
||||
- `Foreground Max Brightness`: The original UI threshold dragging point that initiates the brightness boost.
|
||||
- `Peak Maximum Brightness`: The extreme and ultimate targeted hardware brightness your screen will soar to.
|
||||
- **Zero-Overhead Event Listener (lumipro)**
|
||||
No polling loops, no background spin. LuminPro now uses a Rust-native `lumipro` binary with built-in debouncing and debug mode, replacing the old `inotifyd` approach. A companion daemon process continuously watches the listener and restarts it if it ever dies, guaranteeing an unbroken monitoring chain.
|
||||
|
||||
- **Smooth Step Transitions**
|
||||
Abrupt, rigid jumps in brightness ruin visual coherence. LuminPro operates via an embedded millisecond-level, 50-step computation curve that scales backlight inputs naturally and sequentially.
|
||||
- **KernelSU WebUI Configuration**
|
||||
Adjust all settings visually inside the module's settings page. Changes take effect **immediately** — no reboot required:
|
||||
- `Foreground Max Brightness` — UI brightness threshold that triggers a boost
|
||||
- `Peak Max Brightness` — hardware brightness value to ramp up to
|
||||
- `Transition Steps` — number of steps for smooth ramping (default: 50)
|
||||
- `Sleep Hours` — time range to suppress boosts (e.g. `2200-0700`)
|
||||
- `Log Level` — control log verbosity (off / error / warn / info)
|
||||
- `Brightness / Max-Brightness node paths` — custom sysfs paths for non-standard devices
|
||||
- `inotify Event Types` — which events `lumipro` should watch
|
||||
|
||||
- **Sleep & Quiet Hours**
|
||||
You do not need a blinding torch in bed. Tweak quiet night hours (e.g., `1900-0600`) locally via the WebUI. During your configured timeframe, the module enters a silent hibernation ensuring your retinas and sleep remain undisturbed.
|
||||
- **Smooth Step Transition**
|
||||
Millisecond-level 50-step interpolation prevents jarring brightness jumps. The step count is configurable.
|
||||
|
||||
- **Live Status & Direct Logs Dashboard**
|
||||
Capture crucial runtime performance status at a glance. Attain realtime active backlight parameters, executing daemon service PIDs, and direct service logs dynamically straight from the integrated UI.
|
||||
- **Smart Skip Logic**
|
||||
The module automatically skips boosting when:
|
||||
- System adaptive brightness is active
|
||||
- HDR content is detected on screen (configurable)
|
||||
- The foreground app is on the blacklist
|
||||
- The current time falls within the configured sleep range
|
||||
|
||||
## Operations Workflow
|
||||
1. **Initial Calibration Setup**
|
||||
- Employs minimal physical volume-key prompts during ZIP installation to read and memorize your device’s specific maximum limitations. Users upgrading smoothly bypass calibration logic if previous files are preserved.
|
||||
2. **Event Tracking Mode**
|
||||
- Submits a background `inotifyd` observer attaching safely without looping variables toward the standard Android illumination logic path.
|
||||
3. **Debounce Optimization Engine**
|
||||
- Interacting with display slider changes will safely debounce over sub-second timers, avoiding computational race-conditions. It acknowledges exactly where your sliding ends prior to activating iterative hardware boosts.
|
||||
- **App Blacklist**
|
||||
Manage a package / Activity blacklist directly in the WebUI "Apps" tab. Search by package name, pick specific activities using the built-in Activity scanner, and the module stays hands-off whenever a blacklisted app is in the foreground.
|
||||
|
||||
## Quick Installation Instructions
|
||||
1. Flash the packaged module ZIP directly through any framework manager backing WebUI specification features.
|
||||
2. Walk through standard volume physical key verification presses (you may easily skip recalibrations extending old module environments by just pressing Volume+).
|
||||
3. Soft reboot to engage operations.
|
||||
4. If parameters or constraints require tweaking, manipulate values across the internal interface view. All operations are **persisted instantly**.
|
||||
- **Instant Peak Boost (boost.sh)**
|
||||
Trigger a one-shot peak brightness via the manager's Action button or `action.sh`. A second tap restores the original brightness.
|
||||
|
||||
## Vital Precautions
|
||||
- **OLED Burn-in & Escalated Thermal Warning**: Persistently overriding and enforcing intensive display peak loads aggressively drives heat emissions up. Doing so vastly skyrockets irreversible UI ghosting & OLED burn-in permanent issues respectively.
|
||||
- Verify entered tuning numbers remain securely governed matching acceptable values on your manufacturer's specific screen limit boundaries to avert hardware blackout glitches.
|
||||
- Acknowledge inherent hazards prior to extended utilization. If irregular phenomena transpire, inspect native system output records over the built-in front-end log pane.
|
||||
- **Live Status & Log Dashboard**
|
||||
The WebUI status page shows real-time brightness, the active `lumipro` PID, and service state. The log page supports level filtering (`INFO` / `WARN` / `ERROR`) and lets you copy or export logs to `/sdcard` with one tap.
|
||||
|
||||
## Configuration Reference
|
||||
|
||||
| Key | Description | Default |
|
||||
| ------------------- | --------------------------------------- | -------------------------- |
|
||||
| `ui_max_bri` | Foreground brightness trigger threshold | `0` (requires calibration) |
|
||||
| `max_bri` | Target peak brightness value | `0` (requires calibration) |
|
||||
| `steps_num` | Ramp transition steps | `50` |
|
||||
| `sleep_time` | Sleep range, format `HHMM-HHMM` | empty (disabled) |
|
||||
| `auto_bri_sleep` | Skip when adaptive brightness is on | `1` (enabled) |
|
||||
| `display_hdr_sleep` | Skip during HDR playback | `0` (disabled) |
|
||||
| `log_level` | Log verbosity (off/error/warn/info) | `info` |
|
||||
| `log_max_size` | Log file size cap (KB) | `512` |
|
||||
| `now_bri_file` | Current brightness sysfs node path | standard panel0 path |
|
||||
| `max_bri_file` | Max brightness sysfs node path | standard panel0 path |
|
||||
| `blacklist_apps` | Blacklisted packages / activities | `[]` |
|
||||
| `inotify_events` | lumipro event mask | `c` |
|
||||
|
||||
## Installation
|
||||
|
||||
1. Flash the module ZIP in any KernelSU-compatible manager that supports WebUI.
|
||||
2. Follow the volume-key calibration wizard during installation. Press Volume Up to inherit an existing configuration and skip recalibration.
|
||||
3. Reboot to activate.
|
||||
4. Open the module settings page in your manager to adjust parameters. All changes are applied instantly on save.
|
||||
|
||||
## Warnings
|
||||
|
||||
> ⚠️ **OLED Burn-in & Thermal Warning**
|
||||
> Sustained peak brightness significantly accelerates OLED panel aging and burn-in, and substantially increases device heat output and power draw. Use responsibly and ensure all values stay within your hardware's safe operating range.
|
||||
|
||||
- Double-check that configured brightness values do not exceed your device's hardware limits.
|
||||
- If issues occur, export the runtime log from the WebUI and include it when reporting to the community.
|
||||
+4
-4
@@ -2,7 +2,7 @@ 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
|
||||
a05c860694e46891c91baac4d54805524d5234ff06bc5fcb4ff46bac542ed3c1 script/daemon.sh
|
||||
8d3c20a7404e6b5aeb423ff0a40dd3eb725b9882aa998bd0b8d5ef24dd766396 script/restart.sh
|
||||
59d0ab6f9e1d0b3a67d9c867e8ff2c7bc3bb6c051cc0642f6bf076758841be88 script/up.sh
|
||||
6631d85232e54f0066639f8ca4610c8b992e6130173563d9568ed8f9f79ab83a service.sh
|
||||
+67
-62
@@ -1,31 +1,32 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import crypto from 'crypto';
|
||||
import archiver from 'archiver';
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import crypto from 'crypto'
|
||||
import archiver from 'archiver'
|
||||
|
||||
// 读取版本信息用以命名
|
||||
const propContent = fs.readFileSync('module.prop', 'utf-8');
|
||||
const versionMatch = propContent.match(/^version=(.*)$/m);
|
||||
const versionCodeMatch = propContent.match(/^versionCode=(.*)$/m);
|
||||
const propContent = fs.readFileSync('module.prop', 'utf-8')
|
||||
const versionMatch = propContent.match(/^version=(.*)$/m)
|
||||
const versionCodeMatch = propContent.match(/^versionCode=(.*)$/m)
|
||||
|
||||
const version = versionMatch ? versionMatch[1].trim() : 'Unknown';
|
||||
const versionCodeStr = versionCodeMatch ? versionCodeMatch[1].trim() : '0000';
|
||||
const versionCode = parseInt(versionCodeStr, 10);
|
||||
const version = versionMatch ? versionMatch[1].trim() : 'Unknown'
|
||||
const versionCodeStr = versionCodeMatch ? versionCodeMatch[1].trim() : '0000'
|
||||
const versionCode = parseInt(versionCodeStr, 10)
|
||||
|
||||
const zipName = `LuminPro_${version}.zip`;
|
||||
const zipName = `LuminPro_${version}.zip`
|
||||
|
||||
// --- 新增: 自动同步 update.json ---
|
||||
const updateJsonPath = 'update.json';
|
||||
const updateJsonPath = 'update.json'
|
||||
if (fs.existsSync(updateJsonPath)) {
|
||||
try {
|
||||
const updateJson = JSON.parse(fs.readFileSync(updateJsonPath, 'utf-8'));
|
||||
updateJson.versionCode = versionCode;
|
||||
updateJson.version = version;
|
||||
updateJson.zipUrl = `https://share.yule.ink/magisk/mod/luminpro/module/${zipName}`;
|
||||
fs.writeFileSync(updateJsonPath, JSON.stringify(updateJson, null, 4), 'utf-8');
|
||||
console.log(`>>> [1/3] 已同步 update.json (版本: ${version}, Code: ${versionCode})`);
|
||||
const updateJson = JSON.parse(fs.readFileSync(updateJsonPath, 'utf-8'))
|
||||
updateJson.versionCode = versionCode
|
||||
updateJson.version = version
|
||||
updateJson.zipUrl = `https://share.yule.ink/magisk/mod/luminpro/module/${zipName}`
|
||||
updateJson.changelog = `https://raw.githubusercontent.com/YuleBest/LuminPro/main/changelog.md`
|
||||
fs.writeFileSync(updateJsonPath, JSON.stringify(updateJson, null, 4), 'utf-8')
|
||||
console.log(`>>> [1/3] 已同步 update.json (版本: ${version}, Code: ${versionCode})`)
|
||||
} catch (e) {
|
||||
console.error(`[错误] 无法更新 update.json: ${e.message}`);
|
||||
console.error(`[错误] 无法更新 update.json: ${e.message}`)
|
||||
}
|
||||
}
|
||||
// ---------------------------------
|
||||
@@ -40,102 +41,106 @@ const excludes = [
|
||||
'.vscode',
|
||||
'.git',
|
||||
'.gitignore',
|
||||
'.github',
|
||||
'.oxfmtrc.json',
|
||||
'.oxlintrc.json',
|
||||
'build.ps1',
|
||||
'build-module.js',
|
||||
'webui', // webui 目录已经构建到 webroot
|
||||
zipName
|
||||
];
|
||||
'rust', // Rust 源码,编译产物已复制到 bin/
|
||||
zipName,
|
||||
]
|
||||
|
||||
console.log(`\n>>> [2/3] 生成 SHA256SUMS...`);
|
||||
console.log(`\n>>> [2/3] 生成 SHA256SUMS...`)
|
||||
|
||||
// 计算可执行文件(所有 .sh 脚本 + bin/ 二进制)的 SHA256
|
||||
function sha256File(filePath) {
|
||||
return crypto.createHash('sha256').update(fs.readFileSync(filePath)).digest('hex');
|
||||
return crypto.createHash('sha256').update(fs.readFileSync(filePath)).digest('hex')
|
||||
}
|
||||
|
||||
function collectExecutables(dir, baseDir = dir) {
|
||||
const results = [];
|
||||
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, '/');
|
||||
const full = path.join(dir, dirent.name)
|
||||
const rel = path.relative(baseDir, full).replace(/\\/g, '/')
|
||||
if (dirent.isDirectory()) {
|
||||
results.push(...collectExecutables(full, baseDir));
|
||||
results.push(...collectExecutables(full, baseDir))
|
||||
} else if (dirent.name.endsWith('.sh') || dir.endsWith('bin')) {
|
||||
results.push(rel);
|
||||
results.push(rel)
|
||||
}
|
||||
}
|
||||
return results;
|
||||
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')}`);
|
||||
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 压缩包...`);
|
||||
console.log(`\n>>> [3/3] 创建模块 ZIP 压缩包...`)
|
||||
|
||||
// 初始化归档器
|
||||
const output = fs.createWriteStream(zipName);
|
||||
const output = fs.createWriteStream(zipName)
|
||||
const archive = archiver('zip', {
|
||||
zlib: { level: 9 } // 最高压缩等级
|
||||
});
|
||||
zlib: { level: 9 }, // 最高压缩等级
|
||||
})
|
||||
|
||||
output.on('close', function () {
|
||||
console.log(`-----------------------------------`);
|
||||
console.log(`>>> [成功] 打包完成!`);
|
||||
console.log(`输出文件: ${zipName}`);
|
||||
console.log(`文件大小: ${(archive.pointer() / 1024 / 1024).toFixed(2)} MB`);
|
||||
});
|
||||
console.log(`-----------------------------------`)
|
||||
console.log(`>>> [成功] 打包完成!`)
|
||||
console.log(`输出文件: ${zipName}`)
|
||||
console.log(`文件大小: ${(archive.pointer() / 1024 / 1024).toFixed(2)} MB`)
|
||||
})
|
||||
|
||||
archive.on('warning', function (err) {
|
||||
if (err.code === 'ENOENT') {
|
||||
console.warn('[警告]', err);
|
||||
console.warn('[警告]', err)
|
||||
} else {
|
||||
throw err;
|
||||
throw err
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
archive.on('error', function (err) {
|
||||
throw err;
|
||||
});
|
||||
throw err
|
||||
})
|
||||
|
||||
archive.pipe(output);
|
||||
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);
|
||||
const full = path.join(dir, dirent.name)
|
||||
if (dirent.isDirectory() && !excludes.includes(dirent.name)) {
|
||||
fixLineEndings(full);
|
||||
fixLineEndings(full)
|
||||
} else if (dirent.name.endsWith('.sh')) {
|
||||
const content = fs.readFileSync(full, 'utf8');
|
||||
const content = fs.readFileSync(full, 'utf8')
|
||||
if (content.includes('\r\n')) {
|
||||
fs.writeFileSync(full, content.replace(/\r\n/g, '\n'), 'utf8');
|
||||
fs.writeFileSync(full, content.replace(/\r\n/g, '\n'), 'utf8')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fixLineEndings('.');
|
||||
fixLineEndings('.')
|
||||
|
||||
// 将没在排除列表里的文件打进去
|
||||
const dirContents = fs.readdirSync('.', { withFileTypes: true });
|
||||
const dirContents = fs.readdirSync('.', { withFileTypes: true })
|
||||
|
||||
let addedItems = [];
|
||||
let addedItems = []
|
||||
|
||||
for (const dirent of dirContents) {
|
||||
const name = dirent.name;
|
||||
const name = dirent.name
|
||||
// 排除黑名单文件夹,同时排除当前目录下已经打包生成的其它压缩包(避免俄罗斯套娃)
|
||||
if (!excludes.includes(name) && !name.endsWith('.zip')) {
|
||||
addedItems.push(name);
|
||||
addedItems.push(name)
|
||||
if (dirent.isDirectory()) {
|
||||
archive.directory(name, name);
|
||||
archive.directory(name, name)
|
||||
} else {
|
||||
archive.file(name, { name: name });
|
||||
archive.file(name, { name: name })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`正在打包以下内容: \n${addedItems.join(', ')}\n`);
|
||||
console.log(`正在打包以下内容: \n${addedItems.join(', ')}\n`)
|
||||
|
||||
archive.finalize();
|
||||
archive.finalize()
|
||||
@@ -1,3 +1,24 @@
|
||||
## V2.4-2401
|
||||
|
||||
- 新增: **兼容模式 (轮询驱动)**,支持部分无法通过事件驱动监听亮度的机型,增强设备兼容性
|
||||
- 修复: 遗留文件锁 (Stale Lock) 导致脚本失效的问题,引入 PID 存活检测与自动自愈机制
|
||||
- 优化: 提升守护进程与系统服务的健壮性,开机及手动重启会自动刷新环境标记
|
||||
- 新增: 完善 **[DEVELOPMENT.md](./DEVELOPMENT.md)** 开发文档,规范化云端 GitHub Actions 自动化构建流程
|
||||
- 修复: 其他已知逻辑漏洞与 UI 细节显示优化
|
||||
|
||||
## V2.3-2301
|
||||
|
||||
- 新增: 引入 Rust 编写的 `lumipro` 二进制程序,取代 `inotifyd` 作为亮度文件监听器,内置防抖动与调试模式,提升稳定性
|
||||
- 新增: HDR 内容避让功能,播放 HDR 视频时自动退让亮度提升
|
||||
- 新增: 日志等级配置,支持 关闭 / 仅错误 / 警告+ / 全部,有效减少日志量
|
||||
- 新增: 活动级黑名单功能,可指定应用在前台时禁止模块提升亮度
|
||||
- 重构: 配置文件由多个独立文本文件合并为单一 `config.json`
|
||||
- 重构: Web UI 前端框架升级为 Vue 3 + Vite,组件化重构全部页面
|
||||
- 新增: Web UI 界面缩放、日志导出、设置卡片折叠、header 自动收起等功能
|
||||
- 优化: Web UI 页面切换动画、亮度进度条动画、底栏导航动画
|
||||
- 修复: 日志关键字过滤不生效的问题
|
||||
- 修复: 修复其他已知问题
|
||||
|
||||
## v2.2-2208
|
||||
|
||||
- 新增: 黑名单功能,可在指定应用内禁止模块工作
|
||||
@@ -20,6 +41,7 @@
|
||||
## V2.2-2202
|
||||
|
||||
### 核心逻辑
|
||||
|
||||
- 新增: `action.sh` 支持模块管理器“操作”按钮点击快速切换开关状态
|
||||
- 新增: `stop.flag` 机制,支持在不重启服务的情况下拦截亮度提升逻辑
|
||||
- 重构: `up.sh` 逻辑,支持日志内容比对刷新及文件大小自动截断
|
||||
@@ -29,6 +51,7 @@
|
||||
- 完善 `customize.sh` 的迁移逻辑,支持从 2101 版本自动补全缺失配置及备份目录
|
||||
|
||||
### WebUI
|
||||
|
||||
- 重构: 将配置划分为“亮度调节”、“执行策略”及“系统管理”三大板块
|
||||
- 优化: 移除手动刷新按钮,实现 0.5s 频率的实时动态状态与日志监控
|
||||
- 优化: “定时休眠”采用开关折叠设计,优化窄屏移动端布局
|
||||
|
||||
+75
-61
@@ -64,10 +64,12 @@ write_config_json() {
|
||||
--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 compatibility_mode "${cfg_compatibility_mode:-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}" \
|
||||
--arg log_level "${cfg_log_level:-info}" \
|
||||
--argjson blacklist_apps "${cfg_blacklist_apps:-[]}" \
|
||||
'{
|
||||
ui_max_bri: ($ui_max_bri | tonumber),
|
||||
@@ -76,10 +78,12 @@ write_config_json() {
|
||||
log_max_size: ($log_max_size | tonumber),
|
||||
auto_bri_sleep: ($auto_bri_sleep | tonumber),
|
||||
display_hdr_sleep: ($display_hdr_sleep | tonumber),
|
||||
compatibility_mode:($compatibility_mode | tonumber),
|
||||
sleep_time: $sleep_time,
|
||||
inotify_events: $inotify_events,
|
||||
now_bri_file: $now_bri_file,
|
||||
max_bri_file: $max_bri_file,
|
||||
log_level: $log_level,
|
||||
blacklist_apps: $blacklist_apps
|
||||
}' >"$CONFIG_FILE"
|
||||
}
|
||||
@@ -109,7 +113,7 @@ SHOW_CHANGELOG() {
|
||||
local f="$MODPATH/changelog.md"
|
||||
[ -f "$f" ] || return
|
||||
echo "========================================"
|
||||
echo "[*] 本次更新日志:"
|
||||
echo " ✦ 本次更新日志:"
|
||||
awk '/^## / { if (p) exit; p=1; print; next } p { print }' "$f"
|
||||
echo "========================================"
|
||||
}
|
||||
@@ -117,9 +121,9 @@ SHOW_CHANGELOG() {
|
||||
NOTE() {
|
||||
cat "$MODPATH/NOTE.txt"
|
||||
echo ""
|
||||
echo "[i] 按音量 + 进入下一步, 按音量 - 退出"
|
||||
echo "[i] 继续则表明你已理解并接受所有风险"
|
||||
[ "$(btn)" = "0" ] && echo "[OK] 已确认" || abort "[X] 已退出"
|
||||
echo " ❆ 按音量 + 进入下一步, 按音量 - 退出"
|
||||
echo " ❆ 继续则表明你已理解并接受所有风险"
|
||||
[ "$(btn)" = "0" ] && echo " ✦ 已确认" || abort " ✗ 已退出"
|
||||
}
|
||||
|
||||
CHECK_FILES() {
|
||||
@@ -128,35 +132,35 @@ CHECK_FILES() {
|
||||
max_bri_file="$(cfg_get max_bri_file "$DEFAULT_MAX_BRI_FILE")"
|
||||
|
||||
echo ""
|
||||
echo "[*] 正在验证设备亮度节点..."
|
||||
echo "- 当前亮度节点: $now_bri_file"
|
||||
echo "- 最大亮度节点: $max_bri_file"
|
||||
echo " ✦ 正在验证设备亮度节点..."
|
||||
echo " ✦ 当前亮度节点: $now_bri_file"
|
||||
echo " ✦ 最大亮度节点: $max_bri_file"
|
||||
echo ""
|
||||
|
||||
if [ -f "$now_bri_file" ] && [ -f "$max_bri_file" ]; then
|
||||
echo "[OK] 找到亮度节点文件"
|
||||
echo " ✦ 找到亮度节点文件"
|
||||
else
|
||||
[ ! -f "$now_bri_file" ] && echo "[X] 当前亮度节点不存在: $now_bri_file"
|
||||
[ ! -f "$max_bri_file" ] && echo "[X] 最大亮度节点不存在: $max_bri_file"
|
||||
[ ! -f "$now_bri_file" ] && echo " ✗ 当前亮度节点不存在: $now_bri_file"
|
||||
[ ! -f "$max_bri_file" ] && echo " ✗ 最大亮度节点不存在: $max_bri_file"
|
||||
echo ""
|
||||
echo "设备不支持默认路径,刷入后请通过 Web UI 手动配置亮度节点"
|
||||
echo "查找路径: find /sys -name '*brightness*' 2>/dev/null"
|
||||
abort "[X] 安装中止:无法找到设备亮度节点"
|
||||
echo " ◇ 设备不支持默认路径,刷入后请通过 Web UI 手动配置亮度节点"
|
||||
echo " ◇ 查找路径: find /sys -name '*brightness*' 2>/dev/null"
|
||||
abort " ✕ 安装中止:无法找到设备亮度节点"
|
||||
fi
|
||||
|
||||
echo "[OK] 当前亮度: $(cat "$now_bri_file")"
|
||||
echo "[OK] 系统最大亮度: $(cat "$max_bri_file")"
|
||||
echo " ✦ 当前亮度: $(cat "$now_bri_file")"
|
||||
echo " ✦ 系统最大亮度: $(cat "$max_bri_file")"
|
||||
}
|
||||
|
||||
TEST_UI_MAX_BRI() {
|
||||
echo ""
|
||||
echo "[*] 开始测试前台最大亮度"
|
||||
echo " ✿ 开始测试前台最大亮度"
|
||||
echo ""
|
||||
sleep 1
|
||||
|
||||
echo "======== 请关闭自动亮度 ========"
|
||||
echo "[i] 按音量 + 进入下一步, 按音量 - 退出"
|
||||
[ "$(btn)" = "0" ] && echo "[OK] 已确认" || abort "[X] 已退出"
|
||||
echo " ❆ 按音量 + 进入下一步, 按音量 - 退出"
|
||||
[ "$(btn)" = "0" ] && echo " ✦ 已确认" || abort " ✗ 已退出"
|
||||
|
||||
local restore_bri
|
||||
restore_bri="$(cat "$now_bri_file")"
|
||||
@@ -164,23 +168,23 @@ TEST_UI_MAX_BRI() {
|
||||
sleep 1
|
||||
|
||||
echo "======== 请将屏幕亮度调至最大 ========"
|
||||
echo "[i] 按音量 + 进入下一步, 按音量 - 退出"
|
||||
[ "$(btn)" = "0" ] && echo "[OK] 已确认" || abort "[X] 已退出"
|
||||
echo " ❆ 按音量 + 进入下一步, 按音量 - 退出"
|
||||
[ "$(btn)" = "0" ] && echo " ✦ 已确认" || abort " ✗ 已退出"
|
||||
|
||||
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 更改"
|
||||
echo " ✦ 前台最大亮度: [ $measured_ui ]"
|
||||
echo " ✦ 峰值最大亮度由节点文件获得: [ $measured_max ]"
|
||||
echo " ✦ 若不符合预期,请稍后到 Web UI 更改"
|
||||
|
||||
# 写入 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 " ✦ 正在恢复亮度..."
|
||||
echo -n "$restore_bri" >"$now_bri_file"
|
||||
}
|
||||
|
||||
@@ -193,14 +197,14 @@ IMPORT_OLD_CONFIG() {
|
||||
if [ "${old_ui:-0}" -gt 0 ] 2>/dev/null; then
|
||||
echo ""
|
||||
sleep 1
|
||||
echo "[i] 检测到已有 JSON 配置:"
|
||||
echo " ✦ 检测到已有 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 "[?] 按音量 + 沿用旧配置, 按音量 - 重新测试"
|
||||
echo " ❆ 按音量 + 沿用旧配置, 按音量 - 重新测试"
|
||||
if [ "$(btn)" = "0" ]; then
|
||||
cp -f "$old_config/config.json" "$CONFIG_FILE"
|
||||
# 若旧 JSON 缺少 blacklist_apps 字段,尝试从 blacklist_apps.txt 补入
|
||||
@@ -216,10 +220,10 @@ IMPORT_OLD_CONFIG() {
|
||||
"$JQ" --argjson bl "$bl_arr" '. + {blacklist_apps: $bl}' \
|
||||
"$CONFIG_FILE" >"$tmp_cfg" && mv -f "$tmp_cfg" "$CONFIG_FILE"
|
||||
fi
|
||||
echo "[OK] 已导入 JSON 配置"
|
||||
echo " ✦ 已导入 JSON 配置"
|
||||
return 0
|
||||
else
|
||||
echo "[*] 将重新测试"
|
||||
echo " ❆ 将重新测试"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
@@ -230,7 +234,7 @@ IMPORT_OLD_CONFIG() {
|
||||
if [ -d "$old_config" ] && [ -s "$old_config/ui_max_bri.txt" ] && [ -s "$old_config/max_bri.txt" ]; then
|
||||
echo ""
|
||||
sleep 1
|
||||
echo "[i] 检测到旧格式配置,将迁移至 JSON:"
|
||||
echo " ✦ 检测到旧格式配置,将迁移至 JSON:"
|
||||
echo " - 前台最大亮度: $(cat "$old_config/ui_max_bri.txt")"
|
||||
echo " - 峰值最大亮度: $(cat "$old_config/max_bri.txt")"
|
||||
[ -s "$old_config/sleep_time.txt" ] && echo " - 休眠时间: $(cat "$old_config/sleep_time.txt")"
|
||||
@@ -239,7 +243,7 @@ IMPORT_OLD_CONFIG() {
|
||||
[ -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 "[?] 按音量 + 沿用旧配置, 按音量 - 重新测试"
|
||||
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')"
|
||||
@@ -247,6 +251,7 @@ IMPORT_OLD_CONFIG() {
|
||||
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_compatibility_mode="$(read_old_txt compatibility_mode.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")"
|
||||
@@ -265,10 +270,10 @@ IMPORT_OLD_CONFIG() {
|
||||
# 删除旧 txt 配置文件
|
||||
rm -f "$old_config/"*.txt 2>/dev/null
|
||||
rm -rf "$old_config/path" 2>/dev/null
|
||||
echo "[OK] 配置已迁移至 JSON,旧文件已清理"
|
||||
echo " ✦ 配置已迁移至 JSON, 旧文件已清理"
|
||||
return 0
|
||||
else
|
||||
echo "[*] 将重新测试"
|
||||
echo " ❆ 将重新测试"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
@@ -286,11 +291,13 @@ INIT_CONFIG() {
|
||||
cfg_log_max_size=512
|
||||
cfg_auto_bri_sleep=1
|
||||
cfg_display_hdr_sleep=0
|
||||
cfg_compatibility_mode=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="[]"
|
||||
cfg_log_level="info"
|
||||
write_config_json
|
||||
fi
|
||||
}
|
||||
@@ -302,8 +309,10 @@ ENSURE_DEFAULTS() {
|
||||
.log_max_size = (.log_max_size // 512) |
|
||||
.auto_bri_sleep = (.auto_bri_sleep // 1) |
|
||||
.display_hdr_sleep = (.display_hdr_sleep // 0) |
|
||||
.compatibility_mode= (.compatibility_mode // 0) |
|
||||
.sleep_time = (.sleep_time // "") |
|
||||
.inotify_events = (.inotify_events // "c") |
|
||||
.log_level = (.log_level // "info") |
|
||||
.blacklist_apps = (.blacklist_apps // [])
|
||||
' "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
|
||||
}
|
||||
@@ -316,13 +325,13 @@ CHECK_DEVICE_COMPATIBILITY() {
|
||||
|
||||
if [ "$prefix" = "25128PNA1" ] || [ "$prefix" = "2512BPNDA" ]; then
|
||||
echo ""
|
||||
echo "[!] 您可能是 Xiaomi 17 Ultra 用户,建议使用 '0' 事件作为监测对象"
|
||||
echo "[?] 是否将 inotifyd 监测事件修改为 '0'? (音量 + 确认,音量 - 跳过)"
|
||||
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 事件监测"
|
||||
echo " ✦ 已设置为 0 事件监测"
|
||||
else
|
||||
echo "[*] 已跳过"
|
||||
echo " ✦ 已跳过"
|
||||
fi
|
||||
sleep 1
|
||||
fi
|
||||
@@ -348,12 +357,12 @@ END() {
|
||||
|
||||
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 "======== 配置不完整 ========"
|
||||
[ -z "$final_max" ] && echo " ✕ 峰值最大亮度: 未配置" || echo " ✦ 峰值最大亮度: $final_max"
|
||||
[ -z "$final_ui" ] && echo " ✕ 前台最大亮度: 未配置" || echo " ✦ 前台最大亮度: $final_ui"
|
||||
echo ""
|
||||
echo "[i] 配置缺失,请重启后通过 Web UI 手动配置"
|
||||
echo "[i] 或按音量 + 现在进行测试, 按音量 - 跳过"
|
||||
echo " ❆ 配置缺失, 请重启后通过 Web UI 手动配置"
|
||||
echo " ❆ 或按音量 + 现在进行测试, 按音量 - 跳过"
|
||||
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)
|
||||
@@ -363,8 +372,8 @@ END() {
|
||||
|
||||
echo ""
|
||||
echo "======== 将要应用的配置 ========"
|
||||
echo "[*] 前台最大亮度: $final_ui"
|
||||
echo "[*] 峰值最大亮度: $final_max"
|
||||
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")
|
||||
@@ -377,34 +386,39 @@ END() {
|
||||
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"
|
||||
echo " - 亮度渐变步数: $steps"
|
||||
echo " - 日志大小上限: ${log_size} KB"
|
||||
if [ "$auto_bri" = "1" ]; then
|
||||
echo "[*] 自动亮度时跳过: 开启"
|
||||
echo " - 自动亮度时跳过: 开启"
|
||||
else
|
||||
echo "[*] 自动亮度时跳过: 关闭"
|
||||
echo " - 自动亮度时跳过: 关闭"
|
||||
fi
|
||||
if [ "$disp_hdr" = "1" ]; then
|
||||
echo "[*] HDR 内容时跳过: 开启"
|
||||
echo " - HDR 内容时跳过: 开启"
|
||||
else
|
||||
echo "[*] HDR 内容时跳过: 关闭"
|
||||
echo " - HDR 内容时跳过: 关闭"
|
||||
fi
|
||||
if [ "$("$JQ" -re '.compatibility_mode' "$CONFIG_FILE" 2>/dev/null || echo "0")" = "1" ]; then
|
||||
echo " - 兼容模式 (轮询): 开启"
|
||||
else
|
||||
echo " - 兼容模式 (轮询): 关闭"
|
||||
fi
|
||||
if [ -n "$st" ]; then
|
||||
echo "[*] 休眠时段: $st"
|
||||
echo " - 休眠时段: $st"
|
||||
else
|
||||
echo "[*] 休眠时段: 未配置"
|
||||
echo " - 休眠时段: 未配置"
|
||||
fi
|
||||
echo "[*] inotifyd 事件: $inotify"
|
||||
echo "[*] 当前亮度节点: $now_path"
|
||||
echo "[*] 最大亮度节点: $max_path"
|
||||
echo "[*] 黑名单应用: ${bl_count} 个"
|
||||
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 " ❆ 配置文件: /data/adb/modules/LuminPro/config/config.json"
|
||||
echo " ❆ 也可以使用 Web UI 进行配置"
|
||||
echo ""
|
||||
echo "[OK] 模块已刷入,请重启手机"
|
||||
echo "[i] 感谢您的使用"
|
||||
echo "[i] 作者: 酷安 @于乐yule"
|
||||
echo " ✦ 模块已刷入,请重启手机"
|
||||
echo " ❆ 感谢您的使用"
|
||||
echo " ❆ 作者: 酷安 @于乐yule"
|
||||
echo ""
|
||||
sleep 1
|
||||
exit 0
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
id=LuminPro
|
||||
name=LuminPro丨日用屏幕亮度强化
|
||||
version=V2.2-2208
|
||||
versionCode=2208
|
||||
version=V2.4-2401
|
||||
versionCode=2401
|
||||
author=酷安@Yule
|
||||
description=本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果
|
||||
updateJson=https://share.yule.ink/magisk/mod/luminpro/update.json
|
||||
updateJson=https://raw.githubusercontent.com/YuleBest/LuminPro/main/update.json
|
||||
+7
-1
@@ -6,12 +6,18 @@
|
||||
"scripts": {
|
||||
"dev": "cd webui && vite",
|
||||
"build": "cd webui && vite build && cd .. && node build-module.js",
|
||||
"preview": "cd webui && vite preview"
|
||||
"preview": "cd webui && vite preview",
|
||||
"lint": "oxlint webui/",
|
||||
"lint:fix": "oxlint --fix webui/",
|
||||
"fmt": "oxfmt webui/",
|
||||
"fmt:check": "oxfmt webui/ --check"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/vite": "^4.2.2",
|
||||
"archiver": "^7.0.1",
|
||||
"kernelsu": "^3.0.2",
|
||||
"oxfmt": "^0.44.0",
|
||||
"oxlint": "^1.59.0",
|
||||
"tailwindcss": "^4.2.2",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"vite": "^8.0.3"
|
||||
|
||||
Generated
+431
@@ -45,6 +45,12 @@ importers:
|
||||
kernelsu:
|
||||
specifier: ^3.0.2
|
||||
version: 3.0.2
|
||||
oxfmt:
|
||||
specifier: ^0.44.0
|
||||
version: 0.44.0
|
||||
oxlint:
|
||||
specifier: ^1.59.0
|
||||
version: 1.59.0
|
||||
tailwindcss:
|
||||
specifier: ^4.2.2
|
||||
version: 4.2.2
|
||||
@@ -112,6 +118,250 @@ packages:
|
||||
'@oxc-project/types@0.122.0':
|
||||
resolution: {integrity: sha512-oLAl5kBpV4w69UtFZ9xqcmTi+GENWOcPF7FCrczTiBbmC0ibXxCwyvZGbO39rCVEuLGAZM84DH0pUIyyv/YJzA==}
|
||||
|
||||
'@oxfmt/binding-android-arm-eabi@0.44.0':
|
||||
resolution: {integrity: sha512-5UvghMd9SA/yvKTWCAxMAPXS1d2i054UeOf4iFjZjfayTwCINcC3oaSXjtbZfCaEpxgJod7XiOjTtby5yEv/BQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm]
|
||||
os: [android]
|
||||
|
||||
'@oxfmt/binding-android-arm64@0.44.0':
|
||||
resolution: {integrity: sha512-IVudM1BWfvrYO++Khtzr8q9n5Rxu7msUvoFMqzGJVdX7HfUXUDHwaH2zHZNB58svx2J56pmCUzophyaPFkcG/A==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
'@oxfmt/binding-darwin-arm64@0.44.0':
|
||||
resolution: {integrity: sha512-eWCLAIKAHfx88EqEP1Ga2yz7qVcqDU5lemn4xck+07bH182hDdprOHjbogyk0In1Djys3T0/pO2JepFnRJ41Mg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@oxfmt/binding-darwin-x64@0.44.0':
|
||||
resolution: {integrity: sha512-eHTBznHLM49++dwz07MblQ2cOXyIgeedmE3Wgy4ptUESj38/qYZyRi1MPwC9olQJWssMeY6WI3UZ7YmU5ggvyQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@oxfmt/binding-freebsd-x64@0.44.0':
|
||||
resolution: {integrity: sha512-jLMmbj0u0Ft43QpkUVr/0v1ZfQCGWAvU+WznEHcN3wZC/q6ox7XeSJtk9P36CCpiDSUf3sGnzbIuG1KdEMEDJQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@oxfmt/binding-linux-arm-gnueabihf@0.44.0':
|
||||
resolution: {integrity: sha512-n+A/u/ByK1qV8FVGOwyaSpw5NPNl0qlZfgTBqHeGIqr8Qzq1tyWZ4lAaxPoe5mZqE3w88vn3+jZtMxriHPE7tg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@oxfmt/binding-linux-arm-musleabihf@0.44.0':
|
||||
resolution: {integrity: sha512-5eax+FkxyCqAi3Rw0mrZFr7+KTt/XweFsbALR+B5ljWBLBl8nHe4ADrUnb1gLEfQCJLl+Ca5FIVD4xEt95AwIw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@oxfmt/binding-linux-arm64-gnu@0.44.0':
|
||||
resolution: {integrity: sha512-58l8JaHxSGOmOMOG2CIrNsnkRJAj0YcHQCmvNACniOa/vd1iRHhlPajczegzS5jwMENlqgreyiTR9iNlke8qCw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@oxfmt/binding-linux-arm64-musl@0.44.0':
|
||||
resolution: {integrity: sha512-AlObQIXyVRZ96LbtVljtFq0JqH5B92NU+BQeDFrXWBUWlCKAM0wF5GLfIhCLT5kQ3Sl+U0YjRJ7Alqj5hGQaCg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@oxfmt/binding-linux-ppc64-gnu@0.44.0':
|
||||
resolution: {integrity: sha512-YcFE8/q/BbrCiIiM5piwbkA6GwJc5QqhMQp2yDrqQ2fuVkZ7CInb1aIijZ/k8EXc72qXMSwKpVlBv1w/MsGO/A==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@oxfmt/binding-linux-riscv64-gnu@0.44.0':
|
||||
resolution: {integrity: sha512-eOdzs6RqkRzuqNHUX5C8ISN5xfGh4xDww8OEd9YAmc3OWN8oAe5bmlIqQ+rrHLpv58/0BuU48bxkhnIGjA/ATQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@oxfmt/binding-linux-riscv64-musl@0.44.0':
|
||||
resolution: {integrity: sha512-YBgNTxntD/QvlFUfgvh8bEdwOhXiquX8gaofZJAwYa/Xp1S1DQrFVZEeck7GFktr24DztsSp8N8WtWCBwxs0Hw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@oxfmt/binding-linux-s390x-gnu@0.44.0':
|
||||
resolution: {integrity: sha512-GLIh1R6WHWshl/i4QQDNgj0WtT25aRO4HNUWEoitxiywyRdhTFmFEYT2rXlcl9U6/26vhmOqG5cRlMLG3ocaIA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@oxfmt/binding-linux-x64-gnu@0.44.0':
|
||||
resolution: {integrity: sha512-gZOpgTlOsLcLfAF9qgpTr7FIIFSKnQN3hDf/0JvQ4CIwMY7h+eilNjxq/CorqvYcEOu+LRt1W4ZS7KccEHLOdA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@oxfmt/binding-linux-x64-musl@0.44.0':
|
||||
resolution: {integrity: sha512-1CyS9JTB+pCUFYFI6pkQGGZaT/AY5gnhHVrQQLhFba6idP9AzVYm1xbdWfywoldTYvjxQJV6x4SuduCIfP3W+A==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@oxfmt/binding-openharmony-arm64@0.44.0':
|
||||
resolution: {integrity: sha512-bmEv70Ak6jLr1xotCbF5TxIKjsmQaiX+jFRtnGtfA03tJPf6VG3cKh96S21boAt3JZc+Vjx8PYcDuLj39vM2Pw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [openharmony]
|
||||
|
||||
'@oxfmt/binding-win32-arm64-msvc@0.44.0':
|
||||
resolution: {integrity: sha512-yWzB+oCpSnP/dmw85eFLAT5o35Ve5pkGS2uF/UCISpIwDqf1xa7OpmtomiqY/Vzg8VyvMbuf6vroF2khF/+1Vg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@oxfmt/binding-win32-ia32-msvc@0.44.0':
|
||||
resolution: {integrity: sha512-TcWpo18xEIE3AmIG2kpr3kz5IEhQgnx0lazl2+8L+3eTopOAUevQcmlr4nhguImNWz0OMeOZrYZOhJNCf16nlQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
|
||||
'@oxfmt/binding-win32-x64-msvc@0.44.0':
|
||||
resolution: {integrity: sha512-oj8aLkPJZppIM4CMQNsyir9ybM1Xw/CfGPTSsTnzpVGyljgfbdP0EVUlURiGM0BDrmw5psQ6ArmGCcUY/yABaQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@oxlint/binding-android-arm-eabi@1.59.0':
|
||||
resolution: {integrity: sha512-etYDw/UaEv936AQUd/CRMBVd+e+XuuU6wC+VzOv1STvsTyZenLChepLWqLtnyTTp4YMlM22ypzogDDwqYxv5cg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm]
|
||||
os: [android]
|
||||
|
||||
'@oxlint/binding-android-arm64@1.59.0':
|
||||
resolution: {integrity: sha512-TgLc7XVLKH2a4h8j3vn1MDjfK33i9MY60f/bKhRGWyVzbk5LCZ4X01VZG7iHrMmi5vYbAp8//Ponigx03CLsdw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
'@oxlint/binding-darwin-arm64@1.59.0':
|
||||
resolution: {integrity: sha512-DXyFPf5ZKldMLloRHx/B9fsxsiTQomaw7cmEW3YIJko2HgCh+GUhp9gGYwHrqlLJPsEe3dYj9JebjX92D3j3AA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@oxlint/binding-darwin-x64@1.59.0':
|
||||
resolution: {integrity: sha512-LgvrsdgVLX1qWqIEmNsSmMXJhpAWdtUQ0M+oR0CySwi+9IHWyOGuIL8w8+u/kbZNMyZr4WUyYB5i0+D+AKgkLg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@oxlint/binding-freebsd-x64@1.59.0':
|
||||
resolution: {integrity: sha512-bOJhqX/ny4hrFuTPlyk8foSRx/vLRpxJh0jOOKN2NWW6FScXHPAA5rQbrwdQPcgGB5V8Ua51RS03fke8ssBcug==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@oxlint/binding-linux-arm-gnueabihf@1.59.0':
|
||||
resolution: {integrity: sha512-vVUXxYMF9trXCsz4m9H6U0IjehosVHxBzVgJUxly1uz4W1PdDyicaBnpC0KRXsHYretLVe+uS9pJy8iM57Kujw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@oxlint/binding-linux-arm-musleabihf@1.59.0':
|
||||
resolution: {integrity: sha512-TULQW8YBPGRWg5yZpFPL54HLOnJ3/HiX6VenDPi6YfxB/jlItwSMFh3/hCeSNbh+DAMaE1Py0j5MOaivHkI/9Q==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@oxlint/binding-linux-arm64-gnu@1.59.0':
|
||||
resolution: {integrity: sha512-Gt54Y4eqSgYJ90xipm24xeyaPV854706o/kiT8oZvUt3VDY7qqxdqyGqchMaujd87ib+/MXvnl9WkK8Cc1BExg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@oxlint/binding-linux-arm64-musl@1.59.0':
|
||||
resolution: {integrity: sha512-3CtsKp7NFB3OfqQzbuAecrY7GIZeiv7AD+xutU4tefVQzlfmTI7/ygWLrvkzsDEjTlMq41rYHxgsn6Yh8tybmA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@oxlint/binding-linux-ppc64-gnu@1.59.0':
|
||||
resolution: {integrity: sha512-K0diOpT3ncDmOfl9I1HuvpEsAuTxkts0VYwIv/w6Xiy9CdwyPBVX88Ga9l8VlGgMrwBMnSY4xIvVlVY/fkQk7Q==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@oxlint/binding-linux-riscv64-gnu@1.59.0':
|
||||
resolution: {integrity: sha512-xAU7+QDU6kTJJ7mJLOGgo7oOjtAtkKyFZ0Yjdb5cEo3DiCCPFLvyr08rWiQh6evZ7RiUTf+o65NY/bqttzJiQQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@oxlint/binding-linux-riscv64-musl@1.59.0':
|
||||
resolution: {integrity: sha512-KUmZmKlTTyauOnvUNVxK7G40sSSx0+w5l1UhaGsC6KPpOYHenx2oqJTnabmpLJicok7IC+3Y6fXAUOMyexaeJQ==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@oxlint/binding-linux-s390x-gnu@1.59.0':
|
||||
resolution: {integrity: sha512-4usRxC8gS0PGdkHnRmwJt/4zrQNZyk6vL0trCxwZSsAKM+OxhB8nKiR+mhjdBbl8lbMh2gc3bZpNN/ik8c4c2A==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@oxlint/binding-linux-x64-gnu@1.59.0':
|
||||
resolution: {integrity: sha512-s/rNE2gDmbwAOOP493xk2X7M8LZfI1LJFSSW1+yanz3vuQCFPiHkx4GY+O1HuLUDtkzGlhtMrIcxxzyYLv308w==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@oxlint/binding-linux-x64-musl@1.59.0':
|
||||
resolution: {integrity: sha512-+yYj1udJa2UvvIUmEm0IcKgc0UlPMgz0nsSTvkPL2y6n0uU5LgIHSwVu4AHhrve6j9BpVSoRksnz8c9QcvITJA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@oxlint/binding-openharmony-arm64@1.59.0':
|
||||
resolution: {integrity: sha512-bUplUb48LYsB3hHlQXP2ZMOenpieWoOyppLAnnAhuPag3MGPnt+7caxE3w/Vl9wpQsTA3gzLntQi9rxWrs7Xqg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [openharmony]
|
||||
|
||||
'@oxlint/binding-win32-arm64-msvc@1.59.0':
|
||||
resolution: {integrity: sha512-/HLsLuz42rWl7h7ePdmMTpHm2HIDmPtcEMYgm5BBEHiEiuNOrzMaUpd2z7UnNni5LGN9obJy2YoAYBLXQwazrA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@oxlint/binding-win32-ia32-msvc@1.59.0':
|
||||
resolution: {integrity: sha512-rUPy+JnanpPwV/aJCPnxAD1fW50+XPI0VkWr7f0vEbqcdsS8NpB24Rw6RsS7SdpFv8Dw+8ugCwao5nCFbqOUSg==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
|
||||
'@oxlint/binding-win32-x64-msvc@1.59.0':
|
||||
resolution: {integrity: sha512-xkE7puteDS/vUyRngLXW0t8WgdWoS/tfxXjhP/P7SMqPDx+hs44SpssO3h3qmTqECYEuXBUPzcAw5257Ka+ofA==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@pkgjs/parseargs@0.11.0':
|
||||
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
|
||||
engines: {node: '>=14'}
|
||||
@@ -709,6 +959,21 @@ packages:
|
||||
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
oxfmt@0.44.0:
|
||||
resolution: {integrity: sha512-lnncqvHewyRvaqdrnntVIrZV2tEddz8lbvPsQzG/zlkfvgZkwy0HP1p/2u1aCDToeg1jb9zBpbJdfkV73Itw+w==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
hasBin: true
|
||||
|
||||
oxlint@1.59.0:
|
||||
resolution: {integrity: sha512-0xBLeGGjP4vD9pygRo8iuOkOzEU1MqOnfiOl7KYezL/QvWL8NUg6n03zXc7ZVqltiOpUxBk2zgHI3PnRIEdAvw==}
|
||||
engines: {node: ^20.19.0 || >=22.12.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
oxlint-tsgolint: '>=0.18.0'
|
||||
peerDependenciesMeta:
|
||||
oxlint-tsgolint:
|
||||
optional: true
|
||||
|
||||
package-json-from-dist@1.0.1:
|
||||
resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==}
|
||||
|
||||
@@ -830,6 +1095,10 @@ packages:
|
||||
resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
|
||||
tinypool@2.1.0:
|
||||
resolution: {integrity: sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==}
|
||||
engines: {node: ^20.0.0 || >=22.0.0}
|
||||
|
||||
tslib@2.8.1:
|
||||
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
||||
|
||||
@@ -978,6 +1247,120 @@ snapshots:
|
||||
|
||||
'@oxc-project/types@0.122.0': {}
|
||||
|
||||
'@oxfmt/binding-android-arm-eabi@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-android-arm64@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-darwin-arm64@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-darwin-x64@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-freebsd-x64@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-linux-arm-gnueabihf@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-linux-arm-musleabihf@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-linux-arm64-gnu@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-linux-arm64-musl@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-linux-ppc64-gnu@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-linux-riscv64-gnu@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-linux-riscv64-musl@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-linux-s390x-gnu@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-linux-x64-gnu@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-linux-x64-musl@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-openharmony-arm64@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-win32-arm64-msvc@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-win32-ia32-msvc@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxfmt/binding-win32-x64-msvc@0.44.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-android-arm-eabi@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-android-arm64@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-darwin-arm64@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-darwin-x64@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-freebsd-x64@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-linux-arm-gnueabihf@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-linux-arm-musleabihf@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-linux-arm64-gnu@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-linux-arm64-musl@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-linux-ppc64-gnu@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-linux-riscv64-gnu@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-linux-riscv64-musl@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-linux-s390x-gnu@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-linux-x64-gnu@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-linux-x64-musl@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-openharmony-arm64@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-win32-arm64-msvc@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-win32-ia32-msvc@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@oxlint/binding-win32-x64-msvc@1.59.0':
|
||||
optional: true
|
||||
|
||||
'@pkgjs/parseargs@0.11.0':
|
||||
optional: true
|
||||
|
||||
@@ -1468,6 +1851,52 @@ snapshots:
|
||||
|
||||
normalize-path@3.0.0: {}
|
||||
|
||||
oxfmt@0.44.0:
|
||||
dependencies:
|
||||
tinypool: 2.1.0
|
||||
optionalDependencies:
|
||||
'@oxfmt/binding-android-arm-eabi': 0.44.0
|
||||
'@oxfmt/binding-android-arm64': 0.44.0
|
||||
'@oxfmt/binding-darwin-arm64': 0.44.0
|
||||
'@oxfmt/binding-darwin-x64': 0.44.0
|
||||
'@oxfmt/binding-freebsd-x64': 0.44.0
|
||||
'@oxfmt/binding-linux-arm-gnueabihf': 0.44.0
|
||||
'@oxfmt/binding-linux-arm-musleabihf': 0.44.0
|
||||
'@oxfmt/binding-linux-arm64-gnu': 0.44.0
|
||||
'@oxfmt/binding-linux-arm64-musl': 0.44.0
|
||||
'@oxfmt/binding-linux-ppc64-gnu': 0.44.0
|
||||
'@oxfmt/binding-linux-riscv64-gnu': 0.44.0
|
||||
'@oxfmt/binding-linux-riscv64-musl': 0.44.0
|
||||
'@oxfmt/binding-linux-s390x-gnu': 0.44.0
|
||||
'@oxfmt/binding-linux-x64-gnu': 0.44.0
|
||||
'@oxfmt/binding-linux-x64-musl': 0.44.0
|
||||
'@oxfmt/binding-openharmony-arm64': 0.44.0
|
||||
'@oxfmt/binding-win32-arm64-msvc': 0.44.0
|
||||
'@oxfmt/binding-win32-ia32-msvc': 0.44.0
|
||||
'@oxfmt/binding-win32-x64-msvc': 0.44.0
|
||||
|
||||
oxlint@1.59.0:
|
||||
optionalDependencies:
|
||||
'@oxlint/binding-android-arm-eabi': 1.59.0
|
||||
'@oxlint/binding-android-arm64': 1.59.0
|
||||
'@oxlint/binding-darwin-arm64': 1.59.0
|
||||
'@oxlint/binding-darwin-x64': 1.59.0
|
||||
'@oxlint/binding-freebsd-x64': 1.59.0
|
||||
'@oxlint/binding-linux-arm-gnueabihf': 1.59.0
|
||||
'@oxlint/binding-linux-arm-musleabihf': 1.59.0
|
||||
'@oxlint/binding-linux-arm64-gnu': 1.59.0
|
||||
'@oxlint/binding-linux-arm64-musl': 1.59.0
|
||||
'@oxlint/binding-linux-ppc64-gnu': 1.59.0
|
||||
'@oxlint/binding-linux-riscv64-gnu': 1.59.0
|
||||
'@oxlint/binding-linux-riscv64-musl': 1.59.0
|
||||
'@oxlint/binding-linux-s390x-gnu': 1.59.0
|
||||
'@oxlint/binding-linux-x64-gnu': 1.59.0
|
||||
'@oxlint/binding-linux-x64-musl': 1.59.0
|
||||
'@oxlint/binding-openharmony-arm64': 1.59.0
|
||||
'@oxlint/binding-win32-arm64-msvc': 1.59.0
|
||||
'@oxlint/binding-win32-ia32-msvc': 1.59.0
|
||||
'@oxlint/binding-win32-x64-msvc': 1.59.0
|
||||
|
||||
package-json-from-dist@1.0.1: {}
|
||||
|
||||
path-key@3.1.1: {}
|
||||
@@ -1627,6 +2056,8 @@ snapshots:
|
||||
fdir: 6.5.0(picomatch@4.0.4)
|
||||
picomatch: 4.0.4
|
||||
|
||||
tinypool@2.1.0: {}
|
||||
|
||||
tslib@2.8.1:
|
||||
optional: true
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[target.x86_64-pc-windows-msvc]
|
||||
linker = "rust-lld"
|
||||
rustflags = ["-C", "linker-flavor=lld-link"]
|
||||
Generated
+112
@@ -0,0 +1,112 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d"
|
||||
|
||||
[[package]]
|
||||
name = "inotify"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdd168d97690d0b8c412d6b6c10360277f4d7ee495c5d0d5d5fe0854923255cc"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"futures-core",
|
||||
"inotify-sys",
|
||||
"libc",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "inotify-sys"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.184"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "48f5d2a454e16a5ea0f4ced81bd44e4cfc7bd3a507b61887c99fd3538b28e4af"
|
||||
|
||||
[[package]]
|
||||
name = "lumipro"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"inotify",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.51.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f66bf9585cda4b724d3e78ab34b73fb2bbaba9011b9bfdf69dc836382ea13b8c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"mio",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.1+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
@@ -0,0 +1,20 @@
|
||||
[package]
|
||||
name = "lumipro"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "lumipro"
|
||||
path = "src/main.rs"
|
||||
|
||||
# Linux/Android 专用依赖(本地 Windows 不编译,仅 GitHub Actions 使用)
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
|
||||
inotify = "0.10"
|
||||
libc = "0.2"
|
||||
|
||||
[profile.release]
|
||||
opt-level = "z"
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
strip = true
|
||||
panic = "abort"
|
||||
@@ -0,0 +1,237 @@
|
||||
//! lumipro: 带防抖的 inotify 监听工具
|
||||
//!
|
||||
//! 用法: lumipro [--debug] [--debounce <ms>] <handler> <path:events> [<path:events>...]
|
||||
//!
|
||||
//! 事件字母与 Android toybox inotifyd 完全兼容:
|
||||
//! a=ACCESS c=MODIFY e=ATTRIB w=CLOSE_WRITE
|
||||
//! 0=CLOSE_NOWRITE r=OPEN n=CREATE d=DELETE
|
||||
//! D=DELETE_SELF M=MOVE_SELF m=MOVED_TO y=MOVED_FROM
|
||||
//! u=UNMOUNT o=OVERFLOW x=IGNORED *=ALL
|
||||
//!
|
||||
//! 防抖机制: 在指定窗口期内多次触发时,只执行最后一次;handler 执行期间
|
||||
//! 积压的事件(如亮度渐变写入)在 handler 返回后统一丢弃。
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
mod linux {
|
||||
use std::collections::HashMap;
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use inotify::{EventMask, Inotify, WatchDescriptor, WatchMask};
|
||||
|
||||
fn letters_to_mask(letters: &str) -> WatchMask {
|
||||
let mut mask = WatchMask::empty();
|
||||
for c in letters.chars() {
|
||||
mask |= match c {
|
||||
'a' => WatchMask::ACCESS,
|
||||
'c' => WatchMask::MODIFY, // toybox: modified
|
||||
'e' => WatchMask::ATTRIB, // toybox: metadata change
|
||||
'w' => WatchMask::CLOSE_WRITE, // toybox: closed (writable)
|
||||
'0' => WatchMask::CLOSE_NOWRITE, // toybox: closed (unwritable)
|
||||
'r' => WatchMask::OPEN, // toybox: opened
|
||||
'n' => WatchMask::CREATE,
|
||||
'd' => WatchMask::DELETE,
|
||||
'D' => WatchMask::DELETE_SELF,
|
||||
'M' => WatchMask::MOVE_SELF,
|
||||
'm' => WatchMask::MOVED_TO, // toybox: moved in
|
||||
'y' => WatchMask::MOVED_FROM, // toybox: moved out
|
||||
'u' => WatchMask::empty(), // toybox: unmounted — 内核产生,不设置 watch mask
|
||||
'*' => WatchMask::ALL_EVENTS,
|
||||
// 'o'=overflow 'x'=ignored 为内核产生,不设置 watch mask
|
||||
_ => WatchMask::empty(),
|
||||
};
|
||||
}
|
||||
mask
|
||||
}
|
||||
|
||||
fn mask_to_letters(mask: EventMask) -> String {
|
||||
let mut s = String::new();
|
||||
if mask.contains(EventMask::ACCESS) { s.push('a'); }
|
||||
if mask.contains(EventMask::MODIFY) { s.push('c'); }
|
||||
if mask.contains(EventMask::ATTRIB) { s.push('e'); }
|
||||
if mask.contains(EventMask::CLOSE_WRITE) { s.push('w'); }
|
||||
if mask.contains(EventMask::CLOSE_NOWRITE) { s.push('0'); }
|
||||
if mask.contains(EventMask::OPEN) { s.push('r'); }
|
||||
if mask.contains(EventMask::MOVED_FROM) { s.push('y'); }
|
||||
if mask.contains(EventMask::MOVED_TO) { s.push('m'); }
|
||||
if mask.contains(EventMask::CREATE) { s.push('n'); }
|
||||
if mask.contains(EventMask::DELETE) { s.push('d'); }
|
||||
if mask.contains(EventMask::DELETE_SELF) { s.push('D'); }
|
||||
if mask.contains(EventMask::MOVE_SELF) { s.push('M'); }
|
||||
if mask.contains(EventMask::UNMOUNT) { s.push('u'); }
|
||||
if mask.contains(EventMask::Q_OVERFLOW) { s.push('o'); }
|
||||
if mask.contains(EventMask::IGNORED) { s.push('x'); }
|
||||
if s.is_empty() { s.push('?'); }
|
||||
s
|
||||
}
|
||||
|
||||
/// 对 inotify fd 执行 poll,返回是否有可读事件。
|
||||
/// timeout_ms = -1 为永久阻塞,0 为立即返回。
|
||||
fn poll_readable(fd: i32, timeout_ms: i32) -> bool {
|
||||
let mut pfd = libc::pollfd {
|
||||
fd,
|
||||
events: libc::POLLIN,
|
||||
revents: 0,
|
||||
};
|
||||
// SAFETY: pfd 为合法的 pollfd,nfds=1,fd 由 Inotify 保证有效。
|
||||
unsafe { libc::poll(&mut pfd as *mut libc::pollfd, 1, timeout_ms) > 0 }
|
||||
}
|
||||
|
||||
struct Pending {
|
||||
triggered_at: Instant,
|
||||
event_letters: String,
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
pub fn run() {
|
||||
let args: Vec<String> = std::env::args().skip(1).collect();
|
||||
let mut idx = 0;
|
||||
|
||||
let mut debounce_ms: u64 = 300;
|
||||
let mut debug = false;
|
||||
|
||||
loop {
|
||||
match args.get(idx).map(String::as_str) {
|
||||
Some("--debug") => { debug = true; idx += 1; }
|
||||
Some("--debounce") => {
|
||||
idx += 1;
|
||||
debounce_ms = args.get(idx).and_then(|s| s.parse().ok()).unwrap_or(300);
|
||||
idx += 1;
|
||||
}
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
|
||||
let handler = match args.get(idx) {
|
||||
Some(h) => h.clone(),
|
||||
None => {
|
||||
eprintln!("Usage: lumipro [--debounce <ms>] <handler> <path:events>...");
|
||||
std::process::exit(1);
|
||||
}
|
||||
};
|
||||
idx += 1;
|
||||
|
||||
if idx >= args.len() {
|
||||
eprintln!("Error: no watch targets specified");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
let mut inotify = Inotify::init().expect("inotify_init failed");
|
||||
|
||||
// 设置 O_NONBLOCK,使 read_events 在无数据时立即返回 WouldBlock,
|
||||
// 避免 drain 循环阻塞。
|
||||
let inotify_fd = inotify.as_raw_fd();
|
||||
unsafe {
|
||||
let flags = libc::fcntl(inotify_fd, libc::F_GETFL, 0);
|
||||
libc::fcntl(inotify_fd, libc::F_SETFL, flags | libc::O_NONBLOCK);
|
||||
}
|
||||
|
||||
let mut watches: HashMap<WatchDescriptor, (PathBuf, String)> = HashMap::new();
|
||||
for spec in &args[idx..] {
|
||||
let (path_str, letters) = match spec.find(':') {
|
||||
Some(i) => (&spec[..i], &spec[i + 1..]),
|
||||
None => (spec.as_str(), "c"),
|
||||
};
|
||||
let path = PathBuf::from(path_str);
|
||||
let mask = letters_to_mask(letters);
|
||||
match inotify.watches().add(&path, mask) {
|
||||
Ok(wd) => {
|
||||
if debug {
|
||||
eprintln!("[lumipro] watching: {} events: {}", path_str, letters);
|
||||
}
|
||||
watches.insert(wd, (path, letters.to_string()));
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Failed to watch {path_str}: {e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if debug {
|
||||
eprintln!("[lumipro] debounce={}ms handler={}", debounce_ms, handler);
|
||||
}
|
||||
|
||||
let debounce = Duration::from_millis(debounce_ms);
|
||||
let mut pending: Option<Pending> = None;
|
||||
let mut buffer = [0u8; 4096];
|
||||
|
||||
loop {
|
||||
// ── 1. 计算本次 poll 超时 ──────────────────────────────────────────
|
||||
let timeout_ms: i32 = match &pending {
|
||||
// 无待触发事件:永久阻塞直到新事件到来
|
||||
None => -1,
|
||||
Some(p) => {
|
||||
let elapsed = p.triggered_at.elapsed();
|
||||
if elapsed >= debounce {
|
||||
0 // 防抖窗口已过期,跳过 poll 直接触发
|
||||
} else {
|
||||
(debounce - elapsed).as_millis().min(i32::MAX as u128) as i32
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// timeout_ms == 0 时跳过 poll(防抖已到期),直接进入触发分支
|
||||
let has_data = timeout_ms != 0 && poll_readable(inotify_fd, timeout_ms);
|
||||
|
||||
if has_data {
|
||||
// ── 2. 有新事件:读取并重置防抖计时器 ───────────────────────
|
||||
match inotify.read_events(&mut buffer) {
|
||||
Ok(events) => {
|
||||
for event in events {
|
||||
if let Some((path, _)) = watches.get(&event.wd) {
|
||||
let letters = mask_to_letters(event.mask);
|
||||
if debug {
|
||||
eprintln!("[lumipro] event: {} path: {}", letters, path.display());
|
||||
}
|
||||
pending = Some(Pending {
|
||||
triggered_at: Instant::now(),
|
||||
event_letters: letters,
|
||||
path: path.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(ref e) if e.kind() == std::io::ErrorKind::WouldBlock => {}
|
||||
Err(e) => eprintln!("read_events: {e}"),
|
||||
}
|
||||
} else if let Some(p) = pending.take() {
|
||||
// ── 3. 防抖窗口结束:同步执行 handler ───────────────────────
|
||||
if debug {
|
||||
eprintln!("[lumipro] debounce fired → handler: {} {}", p.event_letters, p.path.display());
|
||||
}
|
||||
let _ = Command::new(&handler)
|
||||
.arg(&p.event_letters)
|
||||
.arg(&p.path)
|
||||
.status();
|
||||
|
||||
// ── 4. 丢弃 handler 执行期间(亮度渐变写入)积压的全部事件 ─
|
||||
let mut drained = 0usize;
|
||||
loop {
|
||||
match inotify.read_events(&mut buffer) {
|
||||
Ok(events) => {
|
||||
for _ in events { drained += 1; }
|
||||
}
|
||||
Err(_) => break, // WouldBlock:积压已清空
|
||||
}
|
||||
}
|
||||
if debug && drained > 0 {
|
||||
eprintln!("[lumipro] drain: discarded {} event(s)", drained);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
linux::run();
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "android")))]
|
||||
{
|
||||
eprintln!("lumipro: only supported on Linux/Android");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
+44
-11
@@ -36,6 +36,13 @@ get_config_hash() {
|
||||
|
||||
_log() {
|
||||
local level="${2:-INFO}"
|
||||
local ll
|
||||
ll="$(get_cfg log_level "info")"
|
||||
case "$ll" in
|
||||
off) return ;;
|
||||
error) case "$level" in ERROR) ;; *) return ;; esac ;;
|
||||
warn) case "$level" in ERROR | WARN) ;; *) return ;; esac ;;
|
||||
esac
|
||||
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "daemon" "$level" "$1" >>"$log_file"
|
||||
}
|
||||
|
||||
@@ -74,20 +81,46 @@ while true; do
|
||||
echo "$current_config" >"$config_cache_file"
|
||||
fi
|
||||
|
||||
_log "正在启动 inotifyd 监听" "INFO"
|
||||
now_bri_file="${current_config%|*}"
|
||||
inotify_events="${current_config#*|}"
|
||||
compatibility_mode="$(get_cfg compatibility_mode "0")"
|
||||
|
||||
# 缓存当前监听路径(供 up.sh 参考)
|
||||
echo -n "$now_bri_file" >"$MODDIR/config/.cached_path"
|
||||
if [ "$compatibility_mode" = "1" ]; then
|
||||
_log "兼容模式已开启 (轮询驱动)" "WARN"
|
||||
# 写入一个特殊的 PID 标识轮询模式
|
||||
echo "polling" >"$pid_file"
|
||||
while true; do
|
||||
if [ -f "$stop_file" ] || [ -f "$pause_file" ]; then
|
||||
break
|
||||
fi
|
||||
# 检查配置哈希是否变化
|
||||
new_config="$(get_config_hash)"
|
||||
if [ "$new_config" != "$current_config" ]; then
|
||||
break
|
||||
fi
|
||||
sh "$MODDIR/script/up.sh" &
|
||||
sleep 2
|
||||
done
|
||||
_log "轮询模式已退出" "INFO"
|
||||
else
|
||||
_log "正在启动 lumipro 监听" "INFO"
|
||||
now_bri_file="${current_config%|*}"
|
||||
inotify_events="${current_config#*|}"
|
||||
debug_mode="$(get_cfg debug_mode "0")"
|
||||
|
||||
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), 监听: $now_bri_file, 事件: $inotify_events" "SUCCESS"
|
||||
# 缓存当前监听路径(供参考)
|
||||
echo -n "$now_bri_file" >"$MODDIR/config/.cached_path"
|
||||
|
||||
wait "$inotify_pid"
|
||||
_log "监听进程 (PID: $inotify_pid) 已退出,即将重启" "WARN"
|
||||
if [ "$debug_mode" = "1" ]; then
|
||||
"$MODDIR/bin/lumipro" --debug "$MODDIR/script/up.sh" "$now_bri_file:$inotify_events" >>"$log_file" 2>&1 &
|
||||
else
|
||||
"$MODDIR/bin/lumipro" "$MODDIR/script/up.sh" "$now_bri_file:$inotify_events" >>"$log_file" 2>&1 &
|
||||
fi
|
||||
inotify_pid=$!
|
||||
echo "$inotify_pid" >"$pid_file"
|
||||
_log "lumipro 已启动 (PID: $inotify_pid), 监听: $now_bri_file, 事件: $inotify_events" "SUCCESS"
|
||||
|
||||
wait "$inotify_pid"
|
||||
_log "lumipro 进程 (PID: $inotify_pid) 已退出,即将重启" "WARN"
|
||||
fi
|
||||
|
||||
sleep 0.5
|
||||
done
|
||||
+4
-6
@@ -15,17 +15,15 @@ _log "收到手动重启请求"
|
||||
|
||||
pause_file="$PID_DIR/daemon.pause"
|
||||
|
||||
# 1. 强制通知守护进程并执行清理
|
||||
_log "通知守护进程挂起,清理残余进程"
|
||||
# 1. 通知守护进程挂起,终止 lumipro 实例
|
||||
_log "通知守护进程挂起,清理 lumipro 实例"
|
||||
touch "$pause_file"
|
||||
killall -9 inotifyd 2>/dev/null
|
||||
for p in $(pgrep -f "up.sh"); do
|
||||
[ "$p" != "$$" ] && kill -9 "$p" 2>/dev/null
|
||||
done
|
||||
[ -f "$pid_file" ] && kill -9 "$(cat "$pid_file")" 2>/dev/null
|
||||
|
||||
# 2. 清理遗留标记
|
||||
rm -f "$pid_file"
|
||||
rm -f "$flag_file"
|
||||
rm -f "$PID_DIR/up.lock"
|
||||
_log "已清理锁文件"
|
||||
|
||||
# 3. 恢复守护进程 (它会自动拉起新 inotifyd)
|
||||
|
||||
+20
-32
@@ -6,10 +6,8 @@ MODDIR="${0%/*/*}"
|
||||
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"
|
||||
|
||||
@@ -24,6 +22,7 @@ get_cfg() {
|
||||
}
|
||||
|
||||
now_bri_file="$(get_cfg now_bri_file "$DEFAULT_NOW_BRI_FILE")"
|
||||
log_level="$(get_cfg log_level "info")"
|
||||
|
||||
_log() {
|
||||
local level="${2:-INFO}"
|
||||
@@ -33,6 +32,12 @@ _log() {
|
||||
*) if [ -f "$stop_file" ]; then return; fi ;;
|
||||
esac
|
||||
|
||||
case "$log_level" in
|
||||
off) return ;;
|
||||
error) case "$level" in ERROR) ;; *) return ;; esac ;;
|
||||
warn) case "$level" in ERROR | WARN) ;; *) return ;; esac ;;
|
||||
esac
|
||||
|
||||
local max_size
|
||||
max_size="$(get_cfg log_max_size 500)"
|
||||
if [ -f "$log_file" ]; then
|
||||
@@ -45,24 +50,25 @@ _log() {
|
||||
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "up" "$level" "$1" >>"$log_file"
|
||||
}
|
||||
|
||||
_log "收到 inotifyd 事件通知 (PID: $$)" "INFO"
|
||||
_log "正在接管控制权,清理残余进程..." "INFO"
|
||||
touch "$pause_file"
|
||||
killall -9 inotifyd 2>/dev/null
|
||||
for p in $(pgrep -f "up.sh"); do
|
||||
[ "$p" != "$$" ] && kill -9 "$p" 2>/dev/null
|
||||
done
|
||||
|
||||
if [ -f "$stop_file" ]; then
|
||||
_log "服务已暂停,跳过本次处理" "WARN"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f "$flag_file" ]; then
|
||||
_log "检测到并发执行,当前进程退出" "WARN"
|
||||
exit 1
|
||||
# 防止 up.sh 自身读写亮度节点时触发 inotify 事件导致递归调用
|
||||
lock_file="$PID_DIR/up.lock"
|
||||
if [ -f "$lock_file" ]; then
|
||||
old_pid=$(cat "$lock_file" 2>/dev/null)
|
||||
if [ -n "$old_pid" ] && [ -d "/proc/$old_pid" ]; then
|
||||
exit 0
|
||||
fi
|
||||
# PID 不存在,说明是遗留的锁,清理之
|
||||
_log "检测到遗留的锁文件 (PID: $old_pid 不存在),已自动清除" "WARN"
|
||||
rm -f "$lock_file"
|
||||
fi
|
||||
touch "$flag_file"
|
||||
echo $$ >"$lock_file"
|
||||
# shellcheck disable=SC2064
|
||||
trap "rm -f '$lock_file'" EXIT HUP INT TERM
|
||||
|
||||
# 读取配置
|
||||
ui_max_bri="$(get_cfg ui_max_bri 0)"
|
||||
@@ -126,14 +132,12 @@ CHECK_BRI() {
|
||||
fi
|
||||
sleep 0.3
|
||||
done
|
||||
_log "检测超时: 亮度未持续达到提升阈値" "INFO"
|
||||
return 1
|
||||
}
|
||||
|
||||
MAIN() {
|
||||
if IS_SLEEP_TIME; then
|
||||
_log "处于休眠时段 ($sleep_start-$sleep_end),跳过提升" "INFO"
|
||||
rm -f "$flag_file" "$pause_file"
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -142,7 +146,6 @@ MAIN() {
|
||||
mode="$(settings get system screen_brightness_mode 2>/dev/null)"
|
||||
if [ "$mode" = "1" ]; then
|
||||
_log "自动亮度已启用,跳过提升" "INFO"
|
||||
rm -f "$flag_file" "$pause_file"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
@@ -159,7 +162,6 @@ MAIN() {
|
||||
'.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
|
||||
@@ -173,7 +175,6 @@ MAIN() {
|
||||
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"
|
||||
@@ -194,25 +195,12 @@ MAIN() {
|
||||
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
|
||||
local current_now_bri cached_now_bri
|
||||
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" "INFO"
|
||||
killall -9 inotifyd 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
MAIN
|
||||
|
||||
+9
-1
@@ -21,6 +21,13 @@ get_cfg() {
|
||||
|
||||
_log() {
|
||||
local level="${2:-INFO}"
|
||||
local ll
|
||||
ll="$(get_cfg log_level "info")"
|
||||
case "$ll" in
|
||||
off) return ;;
|
||||
error) case "$level" in ERROR) ;; *) return ;; esac ;;
|
||||
warn) case "$level" in ERROR | WARN) ;; *) return ;; esac ;;
|
||||
esac
|
||||
printf '[%s] [%s] [%s] %s\n' "$(date '+%m-%d %H:%M:%S')" "service" "$level" "$1" >>"$log_file"
|
||||
}
|
||||
|
||||
@@ -28,7 +35,7 @@ _log() {
|
||||
sleep 30
|
||||
|
||||
# 清理上次遗留的标记文件
|
||||
rm -f "$MODDIR/pid/"*.flag "$MODDIR/pid/"*.pause "$MODDIR/pid/.hdr_ratio_cache"
|
||||
rm -f "$MODDIR/pid/"*.flag "$MODDIR/pid/"*.pause "$MODDIR/pid/"*.lock "$MODDIR/pid/.hdr_ratio_cache"
|
||||
|
||||
_log "LuminPro 服务启动" "INFO"
|
||||
_log "前台最大亮度: $(get_cfg ui_max_bri 0)" "INFO"
|
||||
@@ -43,6 +50,7 @@ _log "最大亮度节点: $max_bri_file" "INFO"
|
||||
_log "正在启动守护进程" "INFO"
|
||||
chmod 755 "$MODDIR/script/up.sh"
|
||||
chmod 755 "$MODDIR/script/daemon.sh"
|
||||
chmod 755 "$MODDIR/bin/lumipro"
|
||||
|
||||
sh "$MODDIR/script/daemon.sh" &
|
||||
_log "守护进程已启动 (PID: $!)" "SUCCESS"
|
||||
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
"versionCode": 2401,
|
||||
"version": "V2.4-2401",
|
||||
"zipUrl": "https://share.yule.ink/magisk/mod/luminpro/module/LuminPro_V2.4-2401.zip",
|
||||
"changelog": "https://raw.githubusercontent.com/YuleBest/LuminPro/main/changelog.md"
|
||||
}
|
||||
+12
-14
@@ -1,17 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
||||
<title>LuminPro</title>
|
||||
<link rel="stylesheet" type="text/css" href="/internal/insets.css" />
|
||||
<script type="module" crossorigin src="/assets/index-BNI29h1d.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-CKxst9ow.css">
|
||||
</head>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
||||
<title>LuminPro</title>
|
||||
<link rel="stylesheet" type="text/css" href="/internal/insets.css" />
|
||||
<script type="module" crossorigin src="/assets/index-DR4CWo6g.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-N1q1T35U.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
+11
-13
@@ -1,16 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
||||
<title>LuminPro</title>
|
||||
<link rel="stylesheet" type="text/css" href="/internal/insets.css" />
|
||||
</head>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
||||
<title>LuminPro</title>
|
||||
<link rel="stylesheet" type="text/css" href="/internal/insets.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
+109
-69
@@ -1,98 +1,130 @@
|
||||
<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';
|
||||
import { ref, computed, 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();
|
||||
const NAV_ORDER = ['status', 'config', 'apps', 'log', 'about']
|
||||
const currentView = ref('status')
|
||||
const headerEl = ref(null)
|
||||
const headerHidden = ref(false)
|
||||
|
||||
const trackStyle = computed(() => {
|
||||
const idx = NAV_ORDER.indexOf(currentView.value)
|
||||
return { transform: `translateX(${-idx * 100}%)` }
|
||||
})
|
||||
const moduleVersion = ref('')
|
||||
const status = useStatus()
|
||||
const config = useConfig()
|
||||
const log = useLog()
|
||||
|
||||
// 供子组件使用
|
||||
provide('showToast', showToast);
|
||||
provide('status', status);
|
||||
provide('config', config);
|
||||
provide('log', log);
|
||||
provide('showToast', showToast)
|
||||
provide('status', status)
|
||||
provide('config', config)
|
||||
provide('log', log)
|
||||
|
||||
let refreshTimer = null;
|
||||
let refreshTimer = null
|
||||
|
||||
function startRefresh() {
|
||||
stopRefresh();
|
||||
if (!config.autoRefresh.value) return;
|
||||
const interval = config.statusRefreshInterval.value;
|
||||
stopRefresh()
|
||||
if (!config.autoRefresh.value) return
|
||||
const interval = config.statusRefreshInterval.value
|
||||
refreshTimer = setInterval(async () => {
|
||||
try {
|
||||
await Promise.all([status.load(), log.load()]);
|
||||
await Promise.all([status.load(), log.load()])
|
||||
} catch {}
|
||||
}, interval);
|
||||
}, interval)
|
||||
}
|
||||
|
||||
function stopRefresh() {
|
||||
if (refreshTimer) { clearInterval(refreshTimer); refreshTimer = null; }
|
||||
if (refreshTimer) {
|
||||
clearInterval(refreshTimer)
|
||||
refreshTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
function restartRefresh(enabled, interval) {
|
||||
config.autoRefresh.value = enabled;
|
||||
config.statusRefreshInterval.value = interval;
|
||||
startRefresh();
|
||||
config.autoRefresh.value = enabled
|
||||
config.statusRefreshInterval.value = interval
|
||||
startRefresh()
|
||||
}
|
||||
provide('restartRefresh', restartRefresh);
|
||||
provide('restartRefresh', restartRefresh)
|
||||
|
||||
// 跟随系统色彩偏好变化
|
||||
let _mq = null;
|
||||
let _mq = null
|
||||
function _onSystemTheme() {
|
||||
if (config.themeMode.value === 'system') config.applyTheme('system');
|
||||
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);
|
||||
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 || '';
|
||||
const info = JSON.parse(moduleInfo())
|
||||
moduleVersion.value = info.version || ''
|
||||
} catch {
|
||||
moduleVersion.value = '[debug]';
|
||||
moduleVersion.value = '[debug]'
|
||||
}
|
||||
|
||||
// 页面滚动监听
|
||||
window.addEventListener('scroll', onScroll, { passive: true });
|
||||
window.removeEventListener('scroll', onPageScroll)
|
||||
|
||||
// 测量 header 高度,用于隐藏时 viewport 补位
|
||||
if (headerEl.value) {
|
||||
const h = headerEl.value.offsetHeight
|
||||
const appEl = document.getElementById('app')
|
||||
if (appEl) appEl.style.setProperty('--header-height', h + 'px')
|
||||
}
|
||||
|
||||
// 初始加载
|
||||
try {
|
||||
await Promise.all([status.load(true), config.load(), log.load()]);
|
||||
await Promise.all([status.load(true), config.load(), log.load()])
|
||||
} catch {}
|
||||
|
||||
startRefresh();
|
||||
});
|
||||
startRefresh()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
stopRefresh();
|
||||
window.removeEventListener('scroll', onScroll);
|
||||
_mq?.removeEventListener('change', _onSystemTheme);
|
||||
});
|
||||
stopRefresh()
|
||||
_mq?.removeEventListener('change', _onSystemTheme)
|
||||
})
|
||||
|
||||
function onScroll() {
|
||||
const topBlur = document.querySelector('.top-blur');
|
||||
if (topBlur) topBlur.classList.toggle('scrolled', window.scrollY > 10);
|
||||
function onPageScroll(e) {
|
||||
// 只响应 .page-slide 的滚动,忽略内部子滚动容器(如应用列表)
|
||||
if (!e.target.classList.contains('page-slide')) return
|
||||
const topBlur = document.querySelector('.top-blur')
|
||||
const { scrollTop } = e.target
|
||||
if (topBlur) topBlur.classList.toggle('scrolled', scrollTop > 10)
|
||||
headerHidden.value = scrollTop > 0
|
||||
}
|
||||
|
||||
function handleViewChange(view) {
|
||||
currentView.value = view;
|
||||
currentView.value = view
|
||||
headerHidden.value = false // 切换页面时恢复显示 header
|
||||
|
||||
const idx = NAV_ORDER.indexOf(view)
|
||||
const slides = document.querySelectorAll('.page-slide')
|
||||
const slide = slides[idx]
|
||||
|
||||
// 切换页面时回顶
|
||||
if (slide) slide.scrollTop = 0
|
||||
|
||||
// 切换后 top-blur 跟随新页面状态(已回顶故一定为 false)
|
||||
const topBlur = document.querySelector('.top-blur')
|
||||
if (topBlur) topBlur.classList.remove('scrolled')
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -101,9 +133,9 @@ function handleViewChange(view) {
|
||||
<!-- 顶部状态栏渐变模糊 -->
|
||||
<div class="top-blur"></div>
|
||||
|
||||
<div id="app">
|
||||
<div id="app" :class="{ 'header-hidden': headerHidden }">
|
||||
<!-- 顶部头 -->
|
||||
<header class="app-header">
|
||||
<header class="app-header" ref="headerEl">
|
||||
<div class="header-content">
|
||||
<div class="header-text">
|
||||
<h1>LuminPro</h1>
|
||||
@@ -112,31 +144,39 @@ function handleViewChange(view) {
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-status-container">
|
||||
<div
|
||||
class="header-status"
|
||||
id="module-status"
|
||||
:class="status.statusClass.value"
|
||||
>
|
||||
<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)">
|
||||
<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
|
||||
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 class="page-viewport" @scroll.capture.passive="onPageScroll">
|
||||
<div class="page-track" :style="trackStyle">
|
||||
<div class="page-slide"><StatusView /></div>
|
||||
<div class="page-slide"><ConfigView /></div>
|
||||
<div class="page-slide"><AppsView /></div>
|
||||
<div class="page-slide"><LogView /></div>
|
||||
<div class="page-slide"><AboutView /></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 底栏导航 -->
|
||||
|
||||
+75
-11
@@ -12,7 +12,11 @@
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
border-radius: 20px;
|
||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
var(--md-sys-color-primary-container),
|
||||
var(--md-sys-color-secondary-container)
|
||||
);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -73,7 +77,7 @@
|
||||
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);
|
||||
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);
|
||||
@@ -103,7 +107,7 @@
|
||||
.doc-sheet-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.5);
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
backdrop-filter: blur(4px);
|
||||
z-index: 1999;
|
||||
opacity: 0;
|
||||
@@ -127,7 +131,7 @@
|
||||
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);
|
||||
box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
|
||||
overflow: hidden;
|
||||
}
|
||||
.doc-sheet.show {
|
||||
@@ -137,7 +141,7 @@
|
||||
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);
|
||||
border-bottom: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.07);
|
||||
gap: 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
@@ -183,13 +187,33 @@
|
||||
color: var(--md-sys-color-on-surface);
|
||||
word-break: break-word;
|
||||
}
|
||||
.doc-sheet-content h1, .doc-sheet-content h2 {
|
||||
.doc-sheet-content h1,
|
||||
.doc-sheet-content h2 {
|
||||
color: var(--md-sys-color-primary);
|
||||
margin-top: 1.4em;
|
||||
margin-bottom: 0.4em;
|
||||
}
|
||||
.doc-sheet-content h3 {
|
||||
color: var(--md-sys-color-secondary);
|
||||
.doc-sheet-content h3,
|
||||
.doc-sheet-content h4 {
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
margin-top: 1.2em;
|
||||
margin-bottom: 0.3em;
|
||||
}
|
||||
.doc-sheet-content p {
|
||||
margin: 0.6em 0;
|
||||
}
|
||||
.doc-sheet-content a {
|
||||
color: var(--md-sys-color-primary);
|
||||
text-decoration: underline;
|
||||
word-break: break-all;
|
||||
}
|
||||
.doc-sheet-content ul,
|
||||
.doc-sheet-content ol {
|
||||
padding-left: 1.4em;
|
||||
margin: 0.5em 0;
|
||||
}
|
||||
.doc-sheet-content li {
|
||||
margin: 0.25em 0;
|
||||
}
|
||||
.doc-sheet-content code {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
@@ -198,6 +222,49 @@
|
||||
font-family: 'Geist Mono', monospace;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
.doc-sheet-content pre {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
border-radius: 8px;
|
||||
padding: 12px 14px;
|
||||
overflow-x: auto;
|
||||
margin: 0.75em 0;
|
||||
}
|
||||
.doc-sheet-content pre code {
|
||||
background: none;
|
||||
padding: 0;
|
||||
border-radius: 0;
|
||||
font-size: 0.82em;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.doc-sheet-content blockquote {
|
||||
border-left: 3px solid var(--md-sys-color-primary-container);
|
||||
margin: 0.75em 0;
|
||||
padding: 0.2em 0.75em;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
background-color: rgba(var(--md-sys-color-primary-rgb), 0.06);
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
.doc-sheet-content hr {
|
||||
border: none;
|
||||
border-top: 1px solid var(--md-sys-color-outline-variant);
|
||||
margin: 1.2em 0;
|
||||
}
|
||||
.doc-sheet-content table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
margin: 0.75em 0;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
.doc-sheet-content th,
|
||||
.doc-sheet-content td {
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
padding: 6px 10px;
|
||||
text-align: left;
|
||||
}
|
||||
.doc-sheet-content th {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
Log Filter Tabs
|
||||
@@ -232,7 +299,6 @@
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
/* ==========================================
|
||||
Theme Segmented Button
|
||||
========================================== */
|
||||
@@ -262,5 +328,3 @@
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
+28
-8
@@ -14,7 +14,9 @@
|
||||
border-radius: var(--border-radius-m);
|
||||
padding: 8px 12px;
|
||||
margin-bottom: var(--spacing-m);
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
transition:
|
||||
border-color 0.2s,
|
||||
box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.app-search-container:focus-within {
|
||||
@@ -188,7 +190,11 @@
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 8px;
|
||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), rgba(168, 199, 250, 0.5));
|
||||
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;
|
||||
@@ -239,7 +245,9 @@
|
||||
border-radius: var(--border-radius-s);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
cursor: pointer;
|
||||
transition: transform 0.2s, background-color 0.2s;
|
||||
transition:
|
||||
transform 0.2s,
|
||||
background-color 0.2s;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
@@ -337,7 +345,9 @@
|
||||
font-weight: 500;
|
||||
padding: 3px 8px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s, border-color 0.2s;
|
||||
transition:
|
||||
background-color 0.2s,
|
||||
border-color 0.2s;
|
||||
white-space: nowrap;
|
||||
font-family: inherit;
|
||||
}
|
||||
@@ -363,7 +373,9 @@
|
||||
font-size: 0.8125rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
outline: none;
|
||||
transition: border-color 0.2s, box-shadow 0.2s;
|
||||
transition:
|
||||
border-color 0.2s,
|
||||
box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.activity-block-input:focus {
|
||||
@@ -437,7 +449,10 @@
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--md-sys-color-outline-variant);
|
||||
transition: background-color 0.3s, transform 0.3s, width 0.3s;
|
||||
transition:
|
||||
background-color 0.3s,
|
||||
transform 0.3s,
|
||||
width 0.3s;
|
||||
}
|
||||
|
||||
.picker-step-dot.active {
|
||||
@@ -504,8 +519,13 @@
|
||||
}
|
||||
|
||||
@keyframes picker-pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.35; }
|
||||
0%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.35;
|
||||
}
|
||||
}
|
||||
|
||||
.picker-result-box {
|
||||
|
||||
+492
-404
File diff suppressed because it is too large.
Load diff
+121
-28
@@ -3,11 +3,54 @@
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
/* Collapsible card header */
|
||||
.card-header-toggle {
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
border-radius: var(--border-radius-s);
|
||||
transition: background-color 0.15s;
|
||||
margin: calc(-1 * var(--spacing-l));
|
||||
padding: var(--spacing-l);
|
||||
}
|
||||
.card-header-toggle:active {
|
||||
background-color: rgba(var(--md-sys-color-primary-rgb), 0.06);
|
||||
}
|
||||
.collapse-chevron {
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.collapse-chevron.open {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
/* grid-template-rows collapse animation */
|
||||
.collapsible-body {
|
||||
display: grid;
|
||||
grid-template-rows: 0fr;
|
||||
transition: grid-template-rows 0.35s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
}
|
||||
.collapsible-body.open {
|
||||
grid-template-rows: 1fr;
|
||||
}
|
||||
.collapsible-body > div {
|
||||
overflow: hidden;
|
||||
padding-top: 0;
|
||||
transition: padding-top 0.35s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
}
|
||||
.collapsible-body.open > div {
|
||||
padding-top: var(--spacing-l);
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/* Page Transitions */
|
||||
.card-animate-in {
|
||||
animation: cardFadeIn 0.4s cubic-bezier(0.2, 0, 0, 1) forwards;
|
||||
@@ -37,7 +80,6 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-s);
|
||||
margin-bottom: var(--spacing-l);
|
||||
}
|
||||
|
||||
.card-header h2 {
|
||||
@@ -50,24 +92,26 @@
|
||||
|
||||
/* Config Items */
|
||||
.config-group {
|
||||
margin-bottom: var(--spacing-l);
|
||||
padding: var(--spacing-m);
|
||||
margin-top: 12px;
|
||||
margin-bottom: 0;
|
||||
padding: 12px;
|
||||
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);
|
||||
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;
|
||||
margin: 0 0 10px 0;
|
||||
color: var(--md-sys-color-primary);
|
||||
font-size: 0.9rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.group-title i, .group-title svg {
|
||||
.group-title i,
|
||||
.group-title svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
@@ -91,9 +135,9 @@
|
||||
}
|
||||
|
||||
.config-item + .config-item {
|
||||
margin-top: var(--spacing-m);
|
||||
margin-top: 10px;
|
||||
border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 142, 144, 153), 0.1);
|
||||
padding-top: var(--spacing-m);
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.config-label {
|
||||
@@ -131,6 +175,25 @@
|
||||
background-color: var(--md-sys-color-surface);
|
||||
}
|
||||
|
||||
.config-select {
|
||||
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;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.config-select: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;
|
||||
@@ -241,20 +304,20 @@
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
transition: .4s;
|
||||
transition: 0.4s;
|
||||
border-radius: 34px;
|
||||
border: 2px solid var(--md-sys-color-outline);
|
||||
}
|
||||
|
||||
.slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
content: '';
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
left: 2px;
|
||||
bottom: 2px;
|
||||
background-color: var(--md-sys-color-outline);
|
||||
transition: .4s;
|
||||
transition: 0.4s;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
@@ -273,6 +336,7 @@ input:checked + .slider:before {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--spacing-m);
|
||||
margin-top: var(--spacing-m);
|
||||
}
|
||||
|
||||
.status-item {
|
||||
@@ -282,7 +346,7 @@ input:checked + .slider:before {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.04);
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.04);
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
@@ -319,7 +383,11 @@ input:checked + .slider:before {
|
||||
.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%);
|
||||
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);
|
||||
}
|
||||
@@ -370,14 +438,17 @@ input:checked + .slider:before {
|
||||
height: 24px;
|
||||
border-radius: 12px;
|
||||
/* 背景将由 JS 通过 linear-gradient 动态更新实现进度条效果 */
|
||||
background: var(--md-sys-color-surface-container-high);
|
||||
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;
|
||||
transition:
|
||||
background 0.35s ease,
|
||||
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);
|
||||
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
|
||||
overflow: hidden; /* 确保进度条颜色不溢出圆角 */
|
||||
}
|
||||
|
||||
@@ -406,12 +477,16 @@ input:checked + .slider:before {
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -442,12 +517,23 @@ input:checked + .slider:before {
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
.unsaved-dot {
|
||||
display: inline-block;
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: var(--md-sys-color-error);
|
||||
margin-left: 6px;
|
||||
vertical-align: middle;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: var(--spacing-l);
|
||||
padding-top: var(--spacing-m);
|
||||
margin-top: 16px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--md-sys-color-outline-variant);
|
||||
}
|
||||
|
||||
@@ -464,7 +550,9 @@ input:checked + .slider:before {
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s, opacity 0.2s;
|
||||
transition:
|
||||
background-color 0.2s,
|
||||
opacity 0.2s;
|
||||
}
|
||||
|
||||
.btn:active {
|
||||
@@ -482,7 +570,8 @@ input:checked + .slider:before {
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.btn-outline-s, .btn-text-s {
|
||||
.btn-outline-s,
|
||||
.btn-text-s {
|
||||
background-color: transparent;
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
color: var(--md-sys-color-primary);
|
||||
@@ -548,7 +637,8 @@ input:checked + .slider:before {
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.btn-icon-only-s i, .btn-icon-only-s svg {
|
||||
.btn-icon-only-s i,
|
||||
.btn-icon-only-s svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
@@ -557,8 +647,11 @@ input:checked + .slider:before {
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
@@ -1,111 +1,120 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted, watch } from 'vue';
|
||||
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';
|
||||
} from 'lucide-vue-next'
|
||||
|
||||
const props = defineProps({ modelValue: { type: String, default: 'status' } });
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
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 },
|
||||
];
|
||||
{ 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([]);
|
||||
const navbarEl = ref(null)
|
||||
const sliderEl = ref(null)
|
||||
const btnRefs = ref([])
|
||||
|
||||
const TRANSITION_ON = 'transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), width 0.3s ease'
|
||||
|
||||
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 = ''; });
|
||||
const idx = navItems.findIndex((n) => n.key === key)
|
||||
if (idx < 0) return
|
||||
const btn = btnRefs.value[idx]
|
||||
if (!btn || !sliderEl.value) return
|
||||
sliderEl.value.style.transition = animate ? TRANSITION_ON : 'none'
|
||||
sliderEl.value.style.width = btn.offsetWidth + 'px'
|
||||
sliderEl.value.style.transform = `translateX(${btn.offsetLeft}px)`
|
||||
}
|
||||
|
||||
function select(key) {
|
||||
emit('update:modelValue', key);
|
||||
emit('update:modelValue', key)
|
||||
}
|
||||
|
||||
watch(() => props.modelValue, v => updateSlider(v));
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(v) => updateSlider(v),
|
||||
)
|
||||
|
||||
// ---- 拖拽逻辑 ----
|
||||
let isDragging = false;
|
||||
let isActuallyDragging = false;
|
||||
let startX = 0;
|
||||
let startSliderX = 0;
|
||||
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;
|
||||
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 (!isDragging) return
|
||||
const dx = e.clientX - startX
|
||||
if (!isActuallyDragging && Math.abs(dx) > 10) {
|
||||
isActuallyDragging = true;
|
||||
navbarEl.value?.setPointerCapture(e.pointerId);
|
||||
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)`;
|
||||
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 (!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;
|
||||
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);
|
||||
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);
|
||||
updateSlider(props.modelValue)
|
||||
}
|
||||
}
|
||||
|
||||
function onResize() { updateSlider(props.modelValue, false); }
|
||||
function onResize() {
|
||||
updateSlider(props.modelValue, false)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
updateSlider(props.modelValue, false);
|
||||
window.addEventListener('resize', onResize);
|
||||
});
|
||||
updateSlider(props.modelValue, false)
|
||||
window.addEventListener('resize', onResize)
|
||||
})
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', onResize);
|
||||
});
|
||||
window.removeEventListener('resize', onResize)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -121,7 +130,7 @@ onUnmounted(() => {
|
||||
<button
|
||||
v-for="(item, i) in navItems"
|
||||
:key="item.key"
|
||||
:ref="el => btnRefs[i] = el"
|
||||
:ref="(el) => (btnRefs[i] = el)"
|
||||
class="navbar-btn"
|
||||
:class="{ active: modelValue === item.key }"
|
||||
:data-section="item.key"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cva } from 'class-variance-authority';
|
||||
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',
|
||||
@@ -16,13 +16,13 @@ const badgeVariants = cva(
|
||||
},
|
||||
},
|
||||
defaultVariants: { variant: 'default' },
|
||||
}
|
||||
);
|
||||
},
|
||||
)
|
||||
|
||||
const props = defineProps({
|
||||
variant: { type: String, default: 'default' },
|
||||
class: { type: String, default: '' },
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cva } from 'class-variance-authority';
|
||||
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',
|
||||
@@ -8,8 +8,10 @@ const buttonVariants = cva(
|
||||
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',
|
||||
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',
|
||||
@@ -26,8 +28,8 @@ const buttonVariants = cva(
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
},
|
||||
}
|
||||
);
|
||||
},
|
||||
)
|
||||
|
||||
const props = defineProps({
|
||||
variant: { type: String, default: 'default' },
|
||||
@@ -36,7 +38,7 @@ const props = defineProps({
|
||||
disabled: { type: Boolean, default: false },
|
||||
type: { type: String, default: 'button' },
|
||||
as: { type: String, default: 'button' },
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
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)">
|
||||
<div
|
||||
:class="
|
||||
cn('rounded-xl border border-border/40 bg-card text-card-foreground shadow-md', props.class)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
@@ -11,9 +11,9 @@ const props = defineProps({
|
||||
max: { type: [String, Number], default: undefined },
|
||||
autocomplete: { type: String, default: 'off' },
|
||||
spellcheck: { type: Boolean, default: false },
|
||||
});
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -27,10 +27,12 @@ const emit = defineEmits(['update:modelValue']);
|
||||
: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
|
||||
)"
|
||||
: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>
|
||||
@@ -1,14 +1,22 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
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)">
|
||||
<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>
|
||||
@@ -1,19 +1,21 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
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
|
||||
)"
|
||||
:class="
|
||||
cn(
|
||||
vertical ? 'inline-flex h-full w-px' : 'flex h-px w-full',
|
||||
'bg-border shrink-0',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
/>
|
||||
</template>
|
||||
@@ -1,14 +1,14 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
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']);
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -18,22 +18,26 @@ const emit = defineEmits(['update:modelValue']);
|
||||
: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
|
||||
)"
|
||||
: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'
|
||||
)"
|
||||
: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>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
@@ -7,9 +7,9 @@ const props = defineProps({
|
||||
placeholder: { type: String, default: '' },
|
||||
disabled: { type: Boolean, default: false },
|
||||
rows: { type: Number, default: 2 },
|
||||
});
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -19,10 +19,12 @@ const emit = defineEmits(['update: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
|
||||
)"
|
||||
: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>
|
||||
@@ -1,159 +1,220 @@
|
||||
import { ref, reactive } from 'vue';
|
||||
import { listPackages, getPackagesInfo } from 'kernelsu';
|
||||
import PinyinMatch from 'pinyin-match';
|
||||
import { runCmd, readConfig, updateConfig } from '../utils.js';
|
||||
import { ref, reactive } from 'vue'
|
||||
import { listPackages, getPackagesInfo } from 'kernelsu'
|
||||
import PinyinMatch from 'pinyin-match'
|
||||
import { 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());
|
||||
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 = '';
|
||||
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('/')));
|
||||
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 = [];
|
||||
let infoList = []
|
||||
try {
|
||||
const pkgs = await listPackages();
|
||||
if (pkgs && pkgs.length > 0) infoList = await getPackagesInfo(pkgs);
|
||||
else throw new Error('no pkgs');
|
||||
const pkgs = await listPackages()
|
||||
if (pkgs && pkgs.length > 0) infoList = await getPackagesInfo(pkgs)
|
||||
else throw new Error('no pkgs')
|
||||
} catch {
|
||||
console.log('[DEBUG] 使用模拟数据');
|
||||
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);
|
||||
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 || '');
|
||||
});
|
||||
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;
|
||||
});
|
||||
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,
|
||||
}));
|
||||
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();
|
||||
_reorder()
|
||||
} catch (e) {
|
||||
loadError.value = e.message || String(e);
|
||||
loadError.value = e.message || String(e)
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
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;
|
||||
});
|
||||
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 + '/'));
|
||||
return [...activityEntries.value].some((e) => e.startsWith(pkg + '/'))
|
||||
}
|
||||
|
||||
function getActivities(pkg) {
|
||||
return [...activityEntries.value].filter(e => e.startsWith(pkg + '/'));
|
||||
return [...activityEntries.value].filter((e) => e.startsWith(pkg + '/'))
|
||||
}
|
||||
|
||||
function addActivity(entry) {
|
||||
activityEntries.value.add(entry);
|
||||
_reorder();
|
||||
activityEntries.value.add(entry)
|
||||
_reorder()
|
||||
}
|
||||
|
||||
function removeActivity(entry) {
|
||||
activityEntries.value.delete(entry);
|
||||
_reorder();
|
||||
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 });
|
||||
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('黑名单保存成功');
|
||||
savedBlacklist.value = new Set(allEntries)
|
||||
toast('黑名单保存成功')
|
||||
} else {
|
||||
toast('保存失败: ' + res.stderr);
|
||||
toast('保存失败: ' + res.stderr)
|
||||
}
|
||||
}
|
||||
|
||||
function onCheckboxChange() { _reorder(); }
|
||||
|
||||
function toggleSystemApps() {
|
||||
showingSystemApps.value = !showingSystemApps.value;
|
||||
load();
|
||||
function onCheckboxChange() {
|
||||
_reorder()
|
||||
}
|
||||
|
||||
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(); }
|
||||
function toggleSystemApps() {
|
||||
showingSystemApps.value = !showingSystemApps.value
|
||||
load()
|
||||
}
|
||||
|
||||
const smartKeywords = ['抖音', 'tiktok', '爱奇艺', '优酷', '腾讯视频', '哔哩', 'bilibili',
|
||||
'youku', 'iqiyi', '芒果', '西瓜', '快手', 'kuaishou', '小红书',
|
||||
'netflix', 'youtube', 'hulu', 'disney', 'prime', '相册', 'gallery', 'photos', 'x'];
|
||||
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();
|
||||
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; }
|
||||
if (name === 'x' || name === 'x (twitter)') {
|
||||
a.checked = true
|
||||
break
|
||||
}
|
||||
} else if (name.includes(kw) || pkg.includes(kw)) {
|
||||
a.checked = true
|
||||
break
|
||||
}
|
||||
}
|
||||
});
|
||||
_reorder();
|
||||
})
|
||||
_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);
|
||||
});
|
||||
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,
|
||||
apps,
|
||||
isLoading,
|
||||
loadError,
|
||||
searchKeyword,
|
||||
showingSystemApps,
|
||||
savedBlacklist,
|
||||
activityEntries,
|
||||
load,
|
||||
save,
|
||||
hasActivity,
|
||||
getActivities,
|
||||
addActivity,
|
||||
removeActivity,
|
||||
onCheckboxChange,
|
||||
toggleSystemApps, selectAll, selectNone, invertSelection, smartSelect,
|
||||
toggleSystemApps,
|
||||
selectAll,
|
||||
selectNone,
|
||||
invertSelection,
|
||||
smartSelect,
|
||||
getFilteredApps,
|
||||
};
|
||||
}
|
||||
}
|
||||
+224
-121
@@ -1,174 +1,277 @@
|
||||
import { ref } from 'vue';
|
||||
import { ref, watch } 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';
|
||||
runCmd,
|
||||
readConfig,
|
||||
writeConfig,
|
||||
updateConfig,
|
||||
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 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 autoBriSleep = ref(false)
|
||||
const displayHdrSleep = ref(false)
|
||||
const compatibilityMode = 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');
|
||||
const nowBriFile = ref(DEFAULT_NOW_BRI_FILE)
|
||||
const sysMaxBriFile = ref(DEFAULT_SYS_MAX_BRI_FILE)
|
||||
const inotifyEvents = ref('c')
|
||||
const debugMode = ref(false)
|
||||
const logLevel = ref('info')
|
||||
|
||||
// 脸污标记
|
||||
const dirty = ref(false)
|
||||
const dirtyAdvanced = ref(false)
|
||||
let _silent = false
|
||||
|
||||
// Web UI 配置 (localStorage 持久化)
|
||||
const autoRefresh = ref(localStorage.getItem('autoRefresh') !== 'false');
|
||||
const autoRefresh = ref(localStorage.getItem('autoRefresh') !== 'false')
|
||||
const statusRefreshInterval = ref(
|
||||
Math.max(100, parseInt(localStorage.getItem('statusLogRefreshInterval') || '1000', 10))
|
||||
);
|
||||
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');
|
||||
Math.min(150, Math.max(50, parseInt(localStorage.getItem('uiZoom') || '100', 10))),
|
||||
)
|
||||
const themeMode = ref(localStorage.getItem('themeMode') || 'system')
|
||||
|
||||
// 监听主配置字段
|
||||
watch(
|
||||
[
|
||||
uiMaxBri,
|
||||
maxBri,
|
||||
stepsNum,
|
||||
logMaxSize,
|
||||
autoBriSleep,
|
||||
displayHdrSleep,
|
||||
compatibilityMode,
|
||||
sleepMode,
|
||||
sleepStartH,
|
||||
sleepStartM,
|
||||
sleepEndH,
|
||||
sleepEndM,
|
||||
logLevel,
|
||||
],
|
||||
() => {
|
||||
if (!_silent) dirty.value = true
|
||||
},
|
||||
)
|
||||
// 监听高级设置字段
|
||||
watch([nowBriFile, sysMaxBriFile, inotifyEvents, debugMode], () => {
|
||||
if (!_silent) dirtyAdvanced.value = true
|
||||
})
|
||||
|
||||
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;
|
||||
_silent = true
|
||||
const cfg = await readConfig()
|
||||
if (!cfg || Object.keys(cfg).length === 0) {
|
||||
_silent = false
|
||||
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
|
||||
compatibilityMode.value = cfg.compatibility_mode === 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'
|
||||
debugMode.value = cfg.debug_mode === 1
|
||||
logLevel.value = cfg.log_level || 'info'
|
||||
|
||||
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
|
||||
}
|
||||
dirty.value = false
|
||||
dirtyAdvanced.value = false
|
||||
_silent = 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)}`;
|
||||
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('保存中...');
|
||||
if (!uiMaxBri.value || !maxBri.value) {
|
||||
toast('亮度値不能为空')
|
||||
return
|
||||
}
|
||||
toast('保存中...')
|
||||
// 读取当前配置(保留 blacklist_apps 等其他字段)
|
||||
const current = await readConfig();
|
||||
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,
|
||||
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() ? '配置已保存 (下次调整时生效)' : '配置已保存 (服务未运行)');
|
||||
compatibility_mode: compatibilityMode.value ? 1 : 0,
|
||||
sleep_time: getSleepTimeStr(),
|
||||
log_level: logLevel.value,
|
||||
})
|
||||
await runCmd(`rm -f "${FLAG_FILE}"`)
|
||||
const pidRes = await runCmd(`cat "${PID_FILE}"`)
|
||||
toast(
|
||||
pidRes.errno === 0 && pidRes.stdout.trim()
|
||||
? '配置已保存 (下次重启或触发时生效)'
|
||||
: '配置已保存 (服务未运行)',
|
||||
)
|
||||
dirty.value = false
|
||||
}
|
||||
|
||||
async function saveAdvanced(toast, onPathsChanged) {
|
||||
toast('保存中...');
|
||||
toast('保存中...')
|
||||
await updateConfig({
|
||||
now_bri_file: nowBriFile.value || DEFAULT_NOW_BRI_FILE,
|
||||
max_bri_file: sysMaxBriFile.value || DEFAULT_SYS_MAX_BRI_FILE,
|
||||
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('高级设置已保存,需重启服务生效');
|
||||
debug_mode: debugMode.value ? 1 : 0,
|
||||
})
|
||||
onPathsChanged?.()
|
||||
toast('高级设置已保存,需重启服务生效')
|
||||
dirtyAdvanced.value = false
|
||||
}
|
||||
|
||||
async function resetToDefaults(toast) {
|
||||
toast('正在恢复默认配置...');
|
||||
const backupRes = await runCmd(`cat "${BACKUP_CONFIG_FILE}"`);
|
||||
toast('正在恢复默认配置...')
|
||||
const backupRes = await runCmd(`cat "${BACKUP_CONFIG_FILE}"`)
|
||||
if (backupRes.errno !== 0 || !backupRes.stdout.trim()) {
|
||||
toast('备份文件不存在,无法恢复');
|
||||
return;
|
||||
toast('备份文件不存在,无法恢复')
|
||||
return
|
||||
}
|
||||
let backup
|
||||
try {
|
||||
backup = JSON.parse(backupRes.stdout)
|
||||
} catch {
|
||||
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';
|
||||
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
|
||||
compatibilityMode.value = backup.compatibility_mode === 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 || '';
|
||||
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); }
|
||||
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';
|
||||
sleepMode.value = true
|
||||
sleepStartH.value = '19'
|
||||
sleepStartM.value = '00'
|
||||
sleepEndH.value = '06'
|
||||
sleepEndM.value = '00'
|
||||
}
|
||||
await save(toast);
|
||||
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 配置已保存');
|
||||
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;
|
||||
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');
|
||||
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,
|
||||
};
|
||||
uiMaxBri,
|
||||
maxBri,
|
||||
stepsNum,
|
||||
logMaxSize,
|
||||
autoBriSleep,
|
||||
displayHdrSleep,
|
||||
compatibilityMode,
|
||||
sleepMode,
|
||||
sleepStartH,
|
||||
sleepStartM,
|
||||
sleepEndH,
|
||||
sleepEndM,
|
||||
nowBriFile,
|
||||
sysMaxBriFile,
|
||||
inotifyEvents,
|
||||
debugMode,
|
||||
logLevel,
|
||||
dirty,
|
||||
dirtyAdvanced,
|
||||
autoRefresh,
|
||||
statusRefreshInterval,
|
||||
uiZoom,
|
||||
themeMode,
|
||||
load,
|
||||
save,
|
||||
saveAdvanced,
|
||||
resetToDefaults,
|
||||
saveWebUIConfig,
|
||||
applyZoom,
|
||||
applyTheme,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,49 +1,58 @@
|
||||
import { ref, computed } from 'vue';
|
||||
import { runCmd, LOG_FILE } from '../utils.js';
|
||||
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 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}] 等级的日志`;
|
||||
});
|
||||
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() || '暂无日志') : '无法读取日志 (可能模块尚未产生日志文件)';
|
||||
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 || '未知错误'));
|
||||
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);
|
||||
const res = await runCmd(`tail -n 50 "${LOG_FILE}"`)
|
||||
if (res.errno !== 0 || !res.stdout.trim()) {
|
||||
toast('暂无日志内容')
|
||||
return
|
||||
}
|
||||
toast('已复制最新 50 条日志');
|
||||
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 || '未知错误'));
|
||||
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 };
|
||||
return { fullLog, filterLevel, filteredLog, isLoading, load, clear, copy, exportLog }
|
||||
}
|
||||
@@ -1,152 +1,169 @@
|
||||
import { ref, computed } from 'vue';
|
||||
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';
|
||||
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 currentBri = ref(null)
|
||||
const sysMaxBri = ref(null)
|
||||
|
||||
// 服务状态
|
||||
const inotifydPid = ref('—');
|
||||
const inotifydState = ref('—');
|
||||
const isRunning = ref(false);
|
||||
const isPaused = ref(false);
|
||||
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';
|
||||
});
|
||||
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 '未运行';
|
||||
});
|
||||
if (isPaused.value) return '已暂停'
|
||||
if (isRunning.value) return '运行中'
|
||||
return '未运行'
|
||||
})
|
||||
|
||||
// HDR / 睡眠状态
|
||||
const hdrRatio = ref('—');
|
||||
const sleepStatus = ref('—');
|
||||
const hdrRatio = ref('—')
|
||||
const sleepStatus = ref('—')
|
||||
|
||||
// 自动亮度
|
||||
const autoBriMode = ref(false);
|
||||
const autoBriMode = ref(false)
|
||||
|
||||
// 缓存配置字段(避免每次刷新都 readConfig)
|
||||
let _nowBriFile = null;
|
||||
let _sysMaxBriFile = null;
|
||||
let _sleepTime = null;
|
||||
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 || '';
|
||||
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;
|
||||
_nowBriFile = null
|
||||
_sysMaxBriFile = null
|
||||
_sleepTime = null
|
||||
}
|
||||
|
||||
async function load(forceFull = false) {
|
||||
await _ensurePaths();
|
||||
await _ensurePaths()
|
||||
|
||||
const needBri = forceFull || currentBri.value === null || sysMaxBri.value === null;
|
||||
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(
|
||||
`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: '' }),
|
||||
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';
|
||||
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() || '';
|
||||
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 || '已退出') : '离线';
|
||||
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;
|
||||
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) : '-';
|
||||
const hdrRaw = hdrRes.errno === 0 ? hdrRes.stdout.trim() : ''
|
||||
hdrRatio.value = hdrRaw && /^\d+(\.\d+)?$/.test(hdrRaw) ? parseFloat(hdrRaw).toFixed(2) : '-'
|
||||
|
||||
sleepStatus.value = _calcSleep(_sleepTime);
|
||||
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 (!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 ? '休眠中' : '非休眠'
|
||||
}
|
||||
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);
|
||||
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));
|
||||
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);
|
||||
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);
|
||||
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}`);
|
||||
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 ? '自动亮度已启用' : '手动亮度已启用');
|
||||
autoBriMode.value = enabled
|
||||
toast(enabled ? '自动亮度已启用' : '手动亮度已启用')
|
||||
} else {
|
||||
toast('设置失败: ' + (res.stderr || '未知错误'));
|
||||
toast('设置失败: ' + (res.stderr || '未知错误'))
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
currentBri, sysMaxBri,
|
||||
inotifydPid, inotifydState,
|
||||
isRunning, isPaused,
|
||||
statusClass, statusText,
|
||||
hdrRatio, sleepStatus,
|
||||
currentBri,
|
||||
sysMaxBri,
|
||||
inotifydPid,
|
||||
inotifydState,
|
||||
isRunning,
|
||||
isPaused,
|
||||
statusClass,
|
||||
statusText,
|
||||
hdrRatio,
|
||||
sleepStatus,
|
||||
autoBriMode,
|
||||
load, invalidatePaths,
|
||||
toggleService, restartService,
|
||||
setBrightness, setAutoBrightness,
|
||||
};
|
||||
load,
|
||||
invalidatePaths,
|
||||
toggleService,
|
||||
restartService,
|
||||
setBrightness,
|
||||
setAutoBrightness,
|
||||
}
|
||||
}
|
||||
+17
-5
@@ -1,9 +1,16 @@
|
||||
/* Header */
|
||||
.app-header {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 12px;
|
||||
padding: 25px 25px;
|
||||
transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
@@ -15,7 +22,11 @@
|
||||
|
||||
.header-icon {
|
||||
font-size: 2.5rem;
|
||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
var(--md-sys-color-primary-container),
|
||||
var(--md-sys-color-secondary-container)
|
||||
);
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 12px;
|
||||
@@ -110,7 +121,8 @@
|
||||
}
|
||||
|
||||
@keyframes status-pulse {
|
||||
0%, 100% {
|
||||
0%,
|
||||
100% {
|
||||
box-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
|
||||
}
|
||||
50% {
|
||||
@@ -119,7 +131,8 @@
|
||||
}
|
||||
|
||||
@keyframes status-pulse-green {
|
||||
0%, 100% {
|
||||
0%,
|
||||
100% {
|
||||
box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
|
||||
}
|
||||
50% {
|
||||
@@ -137,4 +150,3 @@
|
||||
.header-status.status-loading .status-dot {
|
||||
animation: status-pulse 2s infinite;
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
@import 'tailwindcss';
|
||||
@import 'tw-animate-css';
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
/* ===============================
|
||||
Shadcn 主题 Token (暗色, MD3 调色板)
|
||||
=============================== */
|
||||
:root, :root.dark {
|
||||
:root,
|
||||
:root.dark {
|
||||
--radius: 0.75rem;
|
||||
|
||||
/* Shadcn tokens */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { clsx } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
import { clsx } from 'clsx'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
|
||||
export function cn(...inputs) {
|
||||
return twMerge(clsx(inputs));
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
+21
-15
@@ -60,8 +60,9 @@
|
||||
z-index: 998;
|
||||
pointer-events: none;
|
||||
/* 基础暗色背景,增强状态栏文字可读性 */
|
||||
background: linear-gradient(to bottom,
|
||||
rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0.85) 0%,
|
||||
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%
|
||||
);
|
||||
@@ -69,17 +70,19 @@
|
||||
-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%
|
||||
-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%
|
||||
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;
|
||||
@@ -129,7 +132,9 @@
|
||||
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);
|
||||
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);
|
||||
@@ -147,7 +152,7 @@
|
||||
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;
|
||||
will-change: transform, width;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
@@ -173,7 +178,8 @@
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.navbar-btn i, .navbar-btn svg {
|
||||
.navbar-btn i,
|
||||
.navbar-btn svg {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
display: flex;
|
||||
|
||||
+10
-10
@@ -1,11 +1,11 @@
|
||||
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';
|
||||
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');
|
||||
createApp(App).mount('#app')
|
||||
+51
-4
@@ -1,4 +1,5 @@
|
||||
:root, :root.dark {
|
||||
:root,
|
||||
:root.dark {
|
||||
--md-sys-color-background: #111318;
|
||||
--md-sys-color-background-rgb: 17, 19, 24;
|
||||
--md-sys-color-on-background: #e2e2e9;
|
||||
@@ -48,6 +49,7 @@
|
||||
html {
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE/Edge */
|
||||
background-color: var(--md-sys-color-background);
|
||||
}
|
||||
|
||||
html::-webkit-scrollbar {
|
||||
@@ -57,12 +59,17 @@ html::-webkit-scrollbar {
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
zoom: 0.95;
|
||||
/* insets 会在这里被 internal/insets.css 处理,我们预留顶底内边距 */
|
||||
padding-top: var(--safe-area-inset-top, 0);
|
||||
padding-bottom: var(--safe-area-inset-bottom, 0);
|
||||
background-color: var(--md-sys-color-background);
|
||||
color: var(--md-sys-color-on-background);
|
||||
font-family: 'Geist', system-ui, -apple-system, sans-serif;
|
||||
font-family:
|
||||
'Geist',
|
||||
system-ui,
|
||||
-apple-system,
|
||||
sans-serif;
|
||||
line-height: 1.5;
|
||||
scrollbar-width: none; /* Firefox */
|
||||
-ms-overflow-style: none; /* IE/Edge */
|
||||
@@ -73,12 +80,52 @@ body::-webkit-scrollbar {
|
||||
}
|
||||
|
||||
#app {
|
||||
padding: 12px;
|
||||
padding-bottom: calc(12px + 80px);
|
||||
position: relative;
|
||||
padding: 0;
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: calc(100dvh / 0.95);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* header 自动隐藏 */
|
||||
#app.header-hidden .app-header {
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
|
||||
/* 滑动页面轨道 */
|
||||
.page-viewport {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.page-track {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
transition: transform 0.38s cubic-bezier(0.25, 1, 0.5, 1);
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.page-slide {
|
||||
width: 100%;
|
||||
flex-shrink: 0;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
padding: 12px;
|
||||
padding-top: var(--header-height, 120px);
|
||||
padding-bottom: calc(16px + 80px + var(--safe-area-inset-bottom, 0px));
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-m);
|
||||
}
|
||||
|
||||
.page-slide::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
+73
-44
@@ -1,83 +1,112 @@
|
||||
import { exec } from 'kernelsu';
|
||||
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 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);
|
||||
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;
|
||||
const res = await exec(cmd)
|
||||
return res
|
||||
} catch (e) {
|
||||
console.warn(`[DEBUG] 执行命令失败 (可能是非 KSU 环境): ${cmd}`);
|
||||
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: '' };
|
||||
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('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: '' };
|
||||
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: '' };
|
||||
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) };
|
||||
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 {}; }
|
||||
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}"`);
|
||||
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 });
|
||||
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}"`);
|
||||
const safeContent = String(content).replace(/'/g, "'\\''")
|
||||
return runCmd(`printf '%s' '${safeContent}' > "${path}"`)
|
||||
}
|
||||
@@ -1,103 +1,105 @@
|
||||
<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";
|
||||
import { ref } from 'vue'
|
||||
import MarkdownIt from 'markdown-it'
|
||||
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 MODULE_DIR = '/data/adb/modules/LuminPro'
|
||||
|
||||
const sheetOpen = ref(false);
|
||||
const sheetTitle = ref("");
|
||||
const sheetContent = ref("");
|
||||
const sheetLoading = ref(false);
|
||||
const sheetOpen = ref(false)
|
||||
const sheetTitle = ref('')
|
||||
const sheetContent = ref('')
|
||||
const sheetLoading = ref(false)
|
||||
|
||||
const md = new MarkdownIt({ html: true, linkify: true, typographer: true })
|
||||
|
||||
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>");
|
||||
}
|
||||
{ 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 },
|
||||
]
|
||||
|
||||
async function openModuleDoc(doc) {
|
||||
sheetTitle.value = doc.title;
|
||||
sheetContent.value = "";
|
||||
sheetLoading.value = true;
|
||||
sheetOpen.value = true;
|
||||
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>');
|
||||
const res = await runCmd(`cat "${doc.file}" 2>/dev/null`)
|
||||
if (res.errno !== 0 || !res.stdout.trim()) throw new Error('文件不存在或为空')
|
||||
sheetContent.value = doc.md
|
||||
? md.render(res.stdout)
|
||||
: res.stdout
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/\n/g, '<br>')
|
||||
} catch (e) {
|
||||
sheetContent.value = `加载失败: ${e.message}`;
|
||||
sheetContent.value = `加载失败: ${e.message}`
|
||||
} finally {
|
||||
sheetLoading.value = false;
|
||||
sheetLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function closeSheet() {
|
||||
sheetOpen.value = false;
|
||||
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" />
|
||||
<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="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 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>
|
||||
</div>
|
||||
</Teleport>
|
||||
|
||||
<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>
|
||||
+367
-294
@@ -1,361 +1,434 @@
|
||||
<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 { 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";
|
||||
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 showToast = inject('showToast')
|
||||
const appsMenuOpen = ref(false)
|
||||
|
||||
const {
|
||||
apps, isLoading, loadError, searchKeyword, showingSystemApps,
|
||||
savedBlacklist, activityEntries,
|
||||
load, save,
|
||||
hasActivity, getActivities, addActivity, removeActivity,
|
||||
apps,
|
||||
isLoading,
|
||||
loadError,
|
||||
searchKeyword,
|
||||
showingSystemApps,
|
||||
savedBlacklist,
|
||||
activityEntries,
|
||||
load,
|
||||
save,
|
||||
hasActivity,
|
||||
getActivities,
|
||||
addActivity,
|
||||
removeActivity,
|
||||
onCheckboxChange,
|
||||
toggleSystemApps, selectAll, selectNone, invertSelection, smartSelect,
|
||||
toggleSystemApps,
|
||||
selectAll,
|
||||
selectNone,
|
||||
invertSelection,
|
||||
smartSelect,
|
||||
getFilteredApps,
|
||||
} = useApps();
|
||||
} = useApps()
|
||||
|
||||
const filteredApps = computed(() => getFilteredApps());
|
||||
const appCount = computed(() => filteredApps.value.length);
|
||||
const filteredApps = computed(() => getFilteredApps())
|
||||
const appCount = computed(() => filteredApps.value.length)
|
||||
|
||||
onMounted(() => load());
|
||||
onMounted(() => load())
|
||||
|
||||
// 关闭下拉菜单 (点击外部)
|
||||
function handleBodyClick() { appsMenuOpen.value = false; }
|
||||
function handleBodyClick() {
|
||||
appsMenuOpen.value = false
|
||||
}
|
||||
|
||||
// 按活动屏蔽
|
||||
const activityInput = ref("");
|
||||
const activityInput = ref('')
|
||||
function doAddActivity() {
|
||||
const val = activityInput.value.trim();
|
||||
if (!val) return;
|
||||
const parts = val.split("/");
|
||||
const val = activityInput.value.trim()
|
||||
if (!val) return
|
||||
const parts = val.split('/')
|
||||
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
||||
showToast("格式错误,请输入 包名/完整活动类名");
|
||||
return;
|
||||
showToast('格式错误,请输入 包名/完整活动类名')
|
||||
return
|
||||
}
|
||||
addActivity(val);
|
||||
activityInput.value = "";
|
||||
showToast(`已添加: ${val}`);
|
||||
addActivity(val)
|
||||
activityInput.value = ''
|
||||
showToast(`已添加: ${val}`)
|
||||
}
|
||||
|
||||
function menuToggleSystemApps() {
|
||||
toggleSystemApps()
|
||||
appsMenuOpen.value = false
|
||||
}
|
||||
function menuSmartSelect() {
|
||||
smartSelect()
|
||||
appsMenuOpen.value = false
|
||||
}
|
||||
function menuSelectAll() {
|
||||
selectAll()
|
||||
appsMenuOpen.value = false
|
||||
}
|
||||
function menuSelectNone() {
|
||||
selectNone()
|
||||
appsMenuOpen.value = false
|
||||
}
|
||||
function menuInvertSelection() {
|
||||
invertSelection()
|
||||
appsMenuOpen.value = false
|
||||
}
|
||||
|
||||
// 手动添加包名
|
||||
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);
|
||||
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;
|
||||
existing.checked = true
|
||||
onCheckboxChange()
|
||||
showToast('已为你自动勾选并置顶')
|
||||
return
|
||||
}
|
||||
showToast("正在获取应用信息...");
|
||||
showToast('正在获取应用信息...')
|
||||
let appData = {
|
||||
packageName: realPkg,
|
||||
appLabel: "未知 (手动添加)",
|
||||
appLabel: '未知 (手动添加)',
|
||||
isSystem: false,
|
||||
uid: "自定义",
|
||||
};
|
||||
uid: '自定义',
|
||||
}
|
||||
try {
|
||||
const info = await getPackagesInfo([realPkg]);
|
||||
if (info?.length > 0) appData = info[0];
|
||||
const info = await getPackagesInfo([realPkg])
|
||||
if (info?.length > 0) appData = info[0]
|
||||
} catch {}
|
||||
apps.value.unshift(reactive({ ...appData, checked: true, expanded: false }));
|
||||
onCheckboxChange();
|
||||
showToast("已添加到列表顶部");
|
||||
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;
|
||||
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;
|
||||
stopPolling()
|
||||
pickerStep.value = 1
|
||||
pickerStatusText.value = '等待中...'
|
||||
pickerResult.value = ''
|
||||
pickerPolling.value = false
|
||||
pickerVisible.value = true
|
||||
}
|
||||
function closePicker() {
|
||||
stopPolling();
|
||||
pickerVisible.value = false;
|
||||
stopPolling()
|
||||
pickerVisible.value = false
|
||||
}
|
||||
function stopPolling() {
|
||||
if (pollingTimer) {
|
||||
clearInterval(pollingTimer);
|
||||
pollingTimer = null;
|
||||
clearInterval(pollingTimer)
|
||||
pollingTimer = null
|
||||
}
|
||||
}
|
||||
function startPolling() {
|
||||
pickerPolling.value = true;
|
||||
pickerStatusText.value = "检测中,请切换到目标界面...";
|
||||
stopPolling();
|
||||
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;
|
||||
`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);
|
||||
}, 600)
|
||||
}
|
||||
function confirmPicker() {
|
||||
if (!pickerResult.value) return;
|
||||
addActivity(pickerResult.value);
|
||||
showToast(`已添加: ${pickerResult.value}`);
|
||||
closePicker();
|
||||
if (!pickerResult.value) return
|
||||
addActivity(pickerResult.value)
|
||||
showToast(`已添加: ${pickerResult.value}`)
|
||||
closePicker()
|
||||
}
|
||||
function retryPicker() {
|
||||
pickerStep.value = 2
|
||||
pickerPolling.value = false
|
||||
stopPolling()
|
||||
}
|
||||
</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 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="menuToggleSystemApps">
|
||||
<component :is="showingSystemApps ? EyeOff : Eye" :size="18" />
|
||||
<span>{{ showingSystemApps ? '隐藏系统应用' : '显示系统应用' }}</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="menuSmartSelect">
|
||||
<Sparkles :size="18" /><span>智能选择</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="handleManualAdd">
|
||||
<Plus :size="18" /><span>手动添加包名</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="menuSelectAll">
|
||||
<CheckCheck :size="18" /><span>全选</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="menuSelectNone">
|
||||
<Square :size="18" /><span>全不选</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="menuInvertSelection">
|
||||
<CheckSquare :size="18" /><span>反选</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="app-list-hint">
|
||||
被选中的应用将不生效本模块<br />推荐选择视频类、相册等需展示 HDR 内容的应用
|
||||
</p>
|
||||
<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" />
|
||||
<!-- 按活动屏蔽 -->
|
||||
<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
|
||||
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"
|
||||
<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
|
||||
>
|
||||
<span class="activity-entry-path">{{
|
||||
entry.slice(app.packageName.length + 1)
|
||||
}}</span>
|
||||
<button class="activity-entry-delete" @click="removeActivity(entry)">
|
||||
<X :size="14" />
|
||||
</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>
|
||||
</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
|
||||
v-if="hasActivity(app.packageName)"
|
||||
class="app-activities-list"
|
||||
:class="{ show: app.expanded }"
|
||||
>
|
||||
</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
|
||||
<div
|
||||
v-for="entry in getActivities(app.packageName)"
|
||||
:key="entry"
|
||||
class="activity-entry-item"
|
||||
>
|
||||
<Button @click="confirmPicker"><Check :size="15" /> 确认添加</Button>
|
||||
<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>
|
||||
</div>
|
||||
</Teleport>
|
||||
</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="retryPicker">重试</Button>
|
||||
<Button @click="confirmPicker"><Check :size="15" /> 确认添加</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
+355
-205
@@ -1,36 +1,69 @@
|
||||
<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';
|
||||
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,
|
||||
ChevronDown,
|
||||
} from 'lucide-vue-next'
|
||||
import { runCmd } from '../utils.js'
|
||||
|
||||
const config = inject('config');
|
||||
const showToast = inject('showToast');
|
||||
const restartRefresh = inject('restartRefresh');
|
||||
const config = inject('config')
|
||||
const showToast = inject('showToast')
|
||||
const restartRefresh = inject('restartRefresh')
|
||||
|
||||
const advancedOpen = ref(false)
|
||||
const webuiOpen = ref(false)
|
||||
|
||||
// 恢复默认二次确认
|
||||
const resetConfirming = ref(false);
|
||||
let resetTimer = null;
|
||||
const resetConfirming = ref(false)
|
||||
let resetTimer = null
|
||||
function handleReset() {
|
||||
if (!resetConfirming.value) {
|
||||
resetConfirming.value = true;
|
||||
resetTimer = setTimeout(() => { resetConfirming.value = false; }, 5000);
|
||||
return;
|
||||
resetConfirming.value = true
|
||||
resetTimer = setTimeout(() => {
|
||||
resetConfirming.value = false
|
||||
}, 5000)
|
||||
return
|
||||
}
|
||||
clearTimeout(resetTimer);
|
||||
resetConfirming.value = false;
|
||||
config.resetToDefaults(showToast);
|
||||
clearTimeout(resetTimer)
|
||||
resetConfirming.value = false
|
||||
config.resetToDefaults(showToast)
|
||||
}
|
||||
|
||||
function setTheme(v) {
|
||||
config.themeMode.value = v
|
||||
config.applyTheme(v)
|
||||
}
|
||||
|
||||
async function viewInotifyHelp() {
|
||||
showToast('获取中...');
|
||||
const res = await runCmd('inotifyd --help');
|
||||
const out = (res.stderr || '') + (res.stdout || '');
|
||||
alert(out.trim() || '无法获取帮助信息');
|
||||
const msg = `支持的事件字母 (toybox/busybox inotifyd 兼容):
|
||||
a = accessed 读取
|
||||
c = modified 内容修改 (亮度节点推荐用此)
|
||||
e = metadata change 属性变更
|
||||
w = closed (writable) 写入后关闭
|
||||
0 = closed (unwritable) 查看后关闭
|
||||
r = opened 打开
|
||||
n = created 创建
|
||||
d = deleted 删除(目录内)
|
||||
D = deleted (self) 自身被删除
|
||||
M = moved (self) 自身被移动
|
||||
m = moved in 移入目录
|
||||
y = moved out 移出目录
|
||||
u = unmounted 挂载卷卸载
|
||||
* = all events
|
||||
|
||||
提示: sysfs 亮度节点使用 c (MODIFY),这也是默认值`
|
||||
alert(msg)
|
||||
}
|
||||
|
||||
function handleSaveWebUI() {
|
||||
@@ -41,206 +74,323 @@ function handleSaveWebUI() {
|
||||
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 style="display: contents">
|
||||
<!-- === 亮度配置 === -->
|
||||
<section class="card" id="config-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<h2>
|
||||
亮度配置<span v-if="config.dirty.value" class="unsaved-dot" title="有未保存的更改"></span>
|
||||
</h2>
|
||||
</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-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">约 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 class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">前台最大亮度</span>
|
||||
<span class="config-desc">触发亮度提升的阈值</span>
|
||||
</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" />
|
||||
<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">不使用事件监听,改用 2 秒一次轮询</span>
|
||||
<span class="config-desc" style="color: var(--color-warning)"
|
||||
>仅在事件驱动失效时开启,会略微增加耗电</span
|
||||
>
|
||||
</div>
|
||||
<Switch v-model="config.compatibilityMode.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>
|
||||
|
||||
<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 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>
|
||||
<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 class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">日志等级</span>
|
||||
<span class="config-desc">低于此级别不写入日志</span>
|
||||
</div>
|
||||
<select v-model="config.logLevel.value" class="config-select">
|
||||
<option value="off">关闭</option>
|
||||
<option value="error">仅错误</option>
|
||||
<option value="warn">警告+</option>
|
||||
<option value="info">全部</option>
|
||||
</select>
|
||||
</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 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>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="card-actions">
|
||||
<Button @click="handleSaveWebUI">
|
||||
<Save :size="15" /> 保存配置
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
<!-- === 高级设置 === -->
|
||||
<section class="card" id="advanced-section" data-nav-group="config">
|
||||
<div class="card-header card-header-toggle" @click="advancedOpen = !advancedOpen">
|
||||
<h2>
|
||||
高级设置<span
|
||||
v-if="config.dirtyAdvanced.value"
|
||||
class="unsaved-dot"
|
||||
title="有未保存的更改"
|
||||
></span>
|
||||
</h2>
|
||||
<ChevronDown :size="18" class="collapse-chevron" :class="{ open: advancedOpen }" />
|
||||
</div>
|
||||
<div class="collapsible-body" :class="{ open: advancedOpen }">
|
||||
<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">调试模式</span>
|
||||
<span class="config-desc">记录详细 inotify 事件到日志</span>
|
||||
<span class="config-desc" style="color: var(--color-warning)"
|
||||
>需重启生效,用完请关闭</span
|
||||
>
|
||||
</div>
|
||||
<Switch v-model="config.debugMode.value" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">lumipro 监听事件</span>
|
||||
<span class="config-desc">默认 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>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- === Web UI 配置 === -->
|
||||
<section class="card" id="webui-config-section" data-nav-group="config">
|
||||
<div class="card-header card-header-toggle" @click="webuiOpen = !webuiOpen">
|
||||
<h2>Web UI 配置</h2>
|
||||
<ChevronDown :size="18" class="collapse-chevron" :class="{ open: webuiOpen }" />
|
||||
</div>
|
||||
<div class="collapsible-body" :class="{ open: webuiOpen }">
|
||||
<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">定时拉取状态和日志</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">ms,最小 100</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>
|
||||
</div>
|
||||
<select
|
||||
class="config-select"
|
||||
:value="config.themeMode.value"
|
||||
@change="setTheme($event.target.value)"
|
||||
>
|
||||
<option value="system">跟随系统</option>
|
||||
<option value="light">浅色</option>
|
||||
<option value="dark">深色</option>
|
||||
</select>
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
+58
-30
@@ -1,41 +1,51 @@
|
||||
<script setup>
|
||||
import { inject, ref, onMounted } from 'vue';
|
||||
import Button from '@/components/ui/Button.vue';
|
||||
import { RefreshCw, Copy, Download, Trash2 } from 'lucide-vue-next';
|
||||
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 showToast = inject('showToast')
|
||||
const log = inject('log')
|
||||
|
||||
const logMenuOpen = ref(false);
|
||||
const clearConfirming = ref(false);
|
||||
const logMenuOpen = ref(false)
|
||||
const clearConfirming = ref(false)
|
||||
|
||||
let clearConfirmTimer = null;
|
||||
let clearConfirmTimer = null
|
||||
function copyLog() {
|
||||
log.copy(showToast)
|
||||
logMenuOpen.value = false
|
||||
}
|
||||
function exportLog() {
|
||||
log.exportLog(showToast)
|
||||
logMenuOpen.value = false
|
||||
}
|
||||
function handleClear() {
|
||||
if (!clearConfirming.value) {
|
||||
clearConfirming.value = true;
|
||||
clearConfirmTimer = setTimeout(() => { clearConfirming.value = false; }, 3000);
|
||||
return;
|
||||
clearConfirming.value = true
|
||||
clearConfirmTimer = setTimeout(() => {
|
||||
clearConfirming.value = false
|
||||
}, 3000)
|
||||
return
|
||||
}
|
||||
clearTimeout(clearConfirmTimer);
|
||||
clearConfirming.value = false;
|
||||
logMenuOpen.value = false;
|
||||
log.clear(showToast);
|
||||
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' },
|
||||
];
|
||||
{ key: '', label: '全部' },
|
||||
{ key: 'INFO', label: 'INFO' },
|
||||
{ key: 'WARN', label: 'WARN' },
|
||||
{ key: 'ERROR', label: 'ERROR' },
|
||||
]
|
||||
|
||||
onMounted(() => log.load());
|
||||
onMounted(() => log.load())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="card" id="log-section">
|
||||
<div class="card-header" style="margin-bottom:8px">
|
||||
<div class="card-header" style="margin-bottom: 8px">
|
||||
<h2>运行日志</h2>
|
||||
<div class="header-actions dropdown-container">
|
||||
<Button variant="ghost" size="icon" @click="log.load">
|
||||
@@ -43,16 +53,32 @@ onMounted(() => log.load());
|
||||
</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>
|
||||
<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">
|
||||
<div class="dropdown-item" @click="copyLog"><Copy :size="18" /><span>复制日志</span></div>
|
||||
<div class="dropdown-item" @click="exportLog">
|
||||
<Download :size="18" /><span>导出日志文件</span>
|
||||
</div>
|
||||
<div class="dropdown-item" :class="{ 'dropdown-item-danger': clearConfirming }" @click="handleClear">
|
||||
<div
|
||||
class="dropdown-item"
|
||||
:class="{ 'dropdown-item-danger': clearConfirming }"
|
||||
@click="handleClear"
|
||||
>
|
||||
<Trash2 :size="18" />
|
||||
<span>{{ clearConfirming ? '再次点击确认清除' : '清除日志' }}</span>
|
||||
</div>
|
||||
@@ -61,7 +87,7 @@ onMounted(() => log.load());
|
||||
</div>
|
||||
|
||||
<!-- 过滤器 -->
|
||||
<div class="log-filter-container" style="margin-bottom:var(--spacing-s)">
|
||||
<div class="log-filter-container" style="margin-bottom: var(--spacing-s)">
|
||||
<div class="log-filter-tabs">
|
||||
<button
|
||||
v-for="opt in filterOptions"
|
||||
@@ -69,7 +95,9 @@ onMounted(() => log.load());
|
||||
class="log-filter-tab"
|
||||
:class="{ active: log.filterLevel.value === opt.key }"
|
||||
@click="log.filterLevel.value = opt.key"
|
||||
>{{ opt.label }}</button>
|
||||
>
|
||||
{{ opt.label }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,63 +1,74 @@
|
||||
<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 { 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';
|
||||
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 status = inject('status')
|
||||
const showToast = inject('showToast')
|
||||
const config = inject('config')
|
||||
|
||||
const confirmedLowBri = ref(false);
|
||||
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)';
|
||||
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} ${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%)`;
|
||||
});
|
||||
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) + '%';
|
||||
});
|
||||
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);
|
||||
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;
|
||||
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);
|
||||
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: 'lumipro PID', value: status.inotifydPid.value, icon: Activity },
|
||||
{ label: 'lumipro 状态', value: status.inotifydState.value, icon: Clock },
|
||||
{ label: '休眠状态', value: status.sleepStatus.value, icon: Moon },
|
||||
{ label: 'HDR/SDR 比率', value: status.hdrRatio.value, icon: Layers },
|
||||
]);
|
||||
])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
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()],
|
||||
@@ -13,5 +13,6 @@ export default defineConfig({
|
||||
build: {
|
||||
outDir: '../webroot',
|
||||
emptyOutDir: true,
|
||||
minify: 'oxc',
|
||||
},
|
||||
});
|
||||
})
|
||||
Reference in new issue
Block a user