10 Commits
43 changed files with 4385 additions and 201 deletions

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
node_modules/
dist/
.vite/
*.log
*.zip
+7
View File
@@ -0,0 +1,7 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "timonwong.shellcheck",
"[shellscript]": {
"editor.defaultFormatter": "mads-hartmann.bash-ide-vscode"
}
}
+1 -1
View File
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
View File
File mode changed.
View File
File mode changed.
Executable
+50
View File
@@ -0,0 +1,50 @@
------------ 🌸🌸🌸 ------------
嗨~亲爱的伙伴!感谢你选择本喵的【日用屏幕亮度强化 (LuminPro V2.1)】ฅ^•ﻌ•^ฅ
本喵会努力帮你让屏幕更亮更清晰,但为了守护你和设备的安全,请花几分钟认真阅读以下内容哦~
------------ 🐾【使用约定】🐾 ------------
1. 授权小贴士
本喵由 Yule 精心开发,你可以自由使用、修改和分享喵~
但请遵守法律法规,并保留本喵的版权小尾巴(开发者信息不能删掉哦!(๑>ᴗ<๑))
2. 免责小贴士
本喵目前是「测试版小萌新」,可能存在未知小bug~
开发者无法对设备损伤、数据丢失或系统罢工负责,
请确认你已做好「自己承担风险」的准备啦!( •́ω•̀ )
3. 风险说明书(超重要!)
使用前请默念三遍:「我接受这些可能性!」
🔸 卡顿警告:亮度过高时,设备可能会累到「卡成PPT」!
🔸 发热警告:屏幕努力发光时,设备可能会变成暖宝宝🔥
🔸 屏幕衰老:长期高亮度会让屏幕「提前长皱纹」甚至烧屏呢(T▽T)
🔸 电量告急:亮闪闪的代价是电量咻咻掉~记得随身带充电宝!
------------ 🌼【使用小窍门】🌼 ------------
1. 原生底层监听
本喵 V2.1 起已进化为 inotifyd 事件驱动,~零后台耗电,只有你滑亮屏幕时才会默默出力!
2. KernelSU WebUI 支持
告别繁琐的配置文件修改!你只需在 KernelSU 管理器中点击模块配置,即可可视化调整「前台触发亮度」、「峰值亮度」和「休眠时间」。
3. 平滑亮度过渡
亮度提升已经过精心打磨,提供 50 步毫秒级顺滑过渡,保护眼睛绝不突兀。(๑•̀ㅂ•́)و✧
4. 时间管理大师
配置 WebUI 中的「休眠时间」(如 1900-0600),夜间不瞎眼,保证睡眠质量!🌙
5. 温度安全区
请在10°C~35°C环境使用,太冷太热都会让设备「闹脾气」!使用中记得检查设备发热和电量状况。
------------ 🌟【最后的小星星】🌟 ------------
本喵的使命是让你的屏幕更清晰明亮,
但风险与效果并存,请务必做好权衡与准备~
遇到问题欢迎通过 WebUI 面板查看运行日志,
我会摇着尾巴努力帮你解决遇到的问题!
感谢你的包容与支持,一起加油吧!ヾ(≧∇≦)ヾ
------------ 🌸🌸🌸 ------------
Executable
+51
View File
@@ -0,0 +1,51 @@
<div align="center">
# 日用屏幕亮度强化 (LuminPro)
中文简体 丨 [English](https://github.com/YuleBest/LuminPro/blob/main/README_en.md)
让你的 Android 设备随时可以使用高亮度显示屏幕内容
*基于 KernelSU WebUI + 事件驱动架构*
</div>
## 模块介绍
本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果。
## V2.1 核心特性一览
- **零耗电的底层监听 (inotifyd)**
彻底告别传统的死循环和轮询检测耗电。LuminPro 全新采用底层的 `inotifyd` 事件驱动架构,仅在屏幕亮度文件发生修改的瞬间响应,最大程度节省你的设备电量。
- **现代化的 KernelSU WebUI 参数配置**
不再需要手动修改枯燥的 `CONFIG.prop` 文本文件!打开 KernelSU 管理器的模块设置,你可以在舒适的暗色可视化面板中实时调节各项亮度参数:
- `前台最大亮度`:触发亮度提升的源阈值。
- `峰值最大亮度`:亮度触发后提升到的极致目标值。
- **护眼级平滑亮度提升**
亮度瞬间跃升不仅刺眼,还十分突兀——我们为你设计了专属的高刷新率 50 步亮度微调顺滑过渡算法,让屏幕提亮效果更显柔和。
- **勿扰休眠时段**
在 WebUI 中随时指定休眠时间段(例如 `1900-0600`)。在设定的夜间休息时间内,模块服务将静默休眠,不再打扰你的睡眠。
- **实时掌控模块状态**
支持通过前端面板直接获取监控系统的核心参数,包含了当前界面的实时亮度、底层拉起的在运行 PID 服务状态,并可以随时抓取详细的运行日志供开发者分析。
## 模块工作流程
1. **安装期自定义校准**
- 通过音量键互动脚本,主动测定你设备通用的 `前台亮度阈值` 及 `硬件峰值亮度`,同时支持无缝继承旧版设定的配置以跳过多余校准。
2. **事件监听阶段**
- 启动完毕后,`inotifyd` 会作为背景挂起精准监控屏幕亮度的物理底层节点文件变动。
3. **防抖与步进调整机制**
- 取代了早期版本的参数紊乱,当前在用户手动横滑亮度控制条停止响应后,算法会经过安全延时后计算准确的终点步进结果点亮屏幕。
## 安装方法
1. 在支持 WebUI 标准的管理器环境框架下安装本模块的 ZIP 包。
2. 在音量键安装向导中进行简单的第一步初始化按键确认校准(如果已有旧版配置按音量加直接跳过即可)。
3. 重启设备生效。
4. 如需调整参数,只需在管理器中进入模块设置页面进行更改,点击保存**立即生效**。
## 注意事项
- **长亮降频与烧屏警告**:长期处于高压力的激发峰值亮度,将指数级增加设备的耗电与发热水平,可能会导致设备卡顿并不可逆转地增加 OLED 屏幕烧屏老化几率。
- 请确保写入参数数值为你的设备安全范围内的数据,避免超出你硬件屏幕能承受的上限。
- 只有确保你在完全理解高亮度带来的体验和危害下,方可能长期启用。功能出现阻断或者其他 BUG 时,请自行保存 WebUI 日志通过社区回馈解决。
+51
View File
@@ -0,0 +1,51 @@
<div align="center">
# LuminPro
[中文简体](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*
</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.
## V2.1 Core Features
- **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.
- **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.
- **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.
- **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.
- **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.
## 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.
## 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**.
## 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.
+17 -7
View File
@@ -1,9 +1,19 @@
MODDIR=${0%/*}
#!/system/bin/sh
# 快速切换脚本
if [ -f $MODDIR/modenable ]; then
rm -f $MODDIR/modenable
echo "- 已关闭模块"
MODDIR="/data/adb/modules/LuminPro"
PID_DIR="$MODDIR/pid"
STOP_FLAG="$PID_DIR/stop.flag"
UP_FLAG="$PID_DIR/up.flag"
# 切换逻辑
if [ -f "$STOP_FLAG" ]; then
rm -f "$STOP_FLAG"
echo "LuminPro: 服务已启用"
else
touch $MODDIR/modenable
echo "- 已开启模块"
fi
touch "$STOP_FLAG"
rm -f "$UP_FLAG"
echo "LuminPro: 服务已暂停"
fi
exit 0
View File
Whitespace-only changes.
-1
View File
@@ -1 +0,0 @@
16391
View File
Whitespace-only changes.
+99
View File
@@ -0,0 +1,99 @@
import fs from 'fs';
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 version = versionMatch ? versionMatch[1].trim() : 'Unknown';
const versionCodeStr = versionCodeMatch ? versionCodeMatch[1].trim() : '0000';
const versionCode = parseInt(versionCodeStr, 10);
const zipName = `LuminPro_${version}-${versionCode}.zip`;
// --- 新增: 自动同步 update.json ---
const updateJsonPath = 'update.json';
if (fs.existsSync(updateJsonPath)) {
try {
const updateJson = JSON.parse(fs.readFileSync(updateJsonPath, 'utf-8'));
updateJson.versionCode = versionCode;
updateJson.version = version;
updateJson.zipUrl = `https://share.yule.ink/magisk/mod/luminpro/module/${zipName}`;
fs.writeFileSync(updateJsonPath, JSON.stringify(updateJson, null, 4), 'utf-8');
console.log(`>>> [1/2] 已同步 update.json (版本: ${version}, Code: ${versionCode})`);
} catch (e) {
console.error(`[错误] 无法更新 update.json: ${e.message}`);
}
}
// ---------------------------------
console.log(`\n>>> [2/2] 创建模块 ZIP 压缩包...`);
// 明确需要忽略的文件清单
const excludes = [
'docs',
'node_modules',
'package-lock.json',
'package.json',
'pnpm-lock.yaml',
'vite.config.js',
'src',
'public',
'.vscode',
'.git',
'.gitignore',
'build.ps1',
'build-module.js',
'index.html', // 根目录的 html 已构建至 webroot
zipName
];
// 初始化归档器
const output = fs.createWriteStream(zipName);
const archive = archiver('zip', {
zlib: { level: 9 } // 最高压缩等级
});
output.on('close', function () {
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);
} else {
throw err;
}
});
archive.on('error', function (err) {
throw err;
});
archive.pipe(output);
// 将没在排除列表里的文件打进去
const dirContents = fs.readdirSync('.', { withFileTypes: true });
let addedItems = [];
for (const dirent of dirContents) {
const name = dirent.name;
// 排除黑名单文件夹,同时排除当前目录下已经打包生成的其它压缩包(避免俄罗斯套娃)
if (!excludes.includes(name) && !name.endsWith('.zip')) {
addedItems.push(name);
if (dirent.isDirectory()) {
archive.directory(name, name);
} else {
archive.file(name, { name: name });
}
}
}
console.log(`正在打包以下内容: \n${addedItems.join(', ')}\n`);
archive.finalize();
+15
View File
@@ -0,0 +1,15 @@
## V2.2-2202
### 核心逻辑
- 新增: `action.sh` 支持模块管理器“操作”按钮点击快速切换开关状态
- 新增: `stop.flag` 机制,支持在不重启服务的情况下拦截亮度提升逻辑
- 重构: `up.sh` 逻辑,支持日志内容比对刷新及文件大小自动截断
- 新增: `restart.sh` 脚本,实现 PID 清理、Flag 重置及服务重启的原子化操作。
- 修复: 2.1 版本中,反复重启 inotifyd 造成的卡死问题
- 完善 `customize.sh` 的迁移逻辑,支持从 2101 版本自动补全缺失配置及备份目录
### WebUI
- 重构: 将配置划分为“亮度调节”、“执行策略”及“系统管理”三大板块
- 优化: 移除手动刷新按钮,实现 0.5s 频率的实时动态状态与日志监控
- 优化: “定时休眠”采用开关折叠设计,优化窄屏移动端布局
- 优化: “恢复默认”引入二次确认机制及安装时备份目录读取
-11
View File
@@ -1,11 +0,0 @@
# 全局峰值亮度-模块配置
# 修改时请不要删除掉双引号
# 自定义要提升到的亮度(default=测得手机峰值亮度值)
customize_maxbrightness="default"
# 自定义门槛值(default=测得前台最高亮度值)
customize_limbrightness="default"
# 刷新间隔(秒)
flash_interval="5"
Regular → Executable
+227 -14
View File
@@ -1,18 +1,231 @@
SKIPUNZIP=0
now_bri_file="/sys/devices/virtual/mi_display/disp_feature/disp-DSI-0/brightness_clone"
max_bri_file="/sys/devices/virtual/mi_display/disp_feature/disp-DSI-0/max_brightness_clone"
rm -f /data/adb/modules/LuminPro/modenable
#!/system/bin/sh
#shellcheck shell=ash
error() {
echo "! $1"
echo "! 安装出现错误"
abort
now_bri_file="/sys/class/backlight/panel0-backlight/brightness"
max_bri_file="/sys/class/backlight/panel0-backlight/max_brightness"
mod_config="$MODPATH/config"
old_config="/data/adb/modules/LuminPro/config"
# 创建配置目录
[ -d "$mod_config" ] || mkdir -p "$mod_config"
# 监听音量键函数
button_listener() {
local choose
local branch
while :; do
choose="$(getevent -qlc 1 | awk '{ print $3 }')"
case "$choose" in
KEY_VOLUMEUP) branch="0" ;;
KEY_VOLUMEDOWN) branch="1" ;;
*) continue ;;
esac
echo "$branch"
break
done
}
# 检查系统文件是否存在
if [ ! -f $now_bri_file ] && [ ! -f $max_bri_file ]; then
error "系统文件不存在 $now_bri_file,您的设备不支持本模块"
fi
# 注意事项
SHOW_CHANGELOG() {
local changelog_file="$MODPATH/changelog.md"
if [ -f "$changelog_file" ]; then
echo "--------------------------------------"
echo "- 本次更新日志:"
# 提取第一个二级标题及其内容,直到遇到下一个二级标题或文件结束
# 使用更具兼容性的 awk 逻辑
awk '/^## / { if (p) exit; p=1; print; next } p { print }' "$changelog_file"
echo "--------------------------------------"
fi
}
echo "⚠️ 刷入过程中,手机屏幕可能会变亮,这是正常现象"
. "$MODPATH/script/setup.sh"
NOTE() {
cat "$MODPATH/NOTE.txt"
echo ""
echo "* 按音量 + 进入下一步, 按音量 - 退出"
echo "* 继续则表明你已理解并接受所有风险"
if [ "$(button_listener)" = "0" ]; then
echo "- 已确认进入下一步"
else
abort "- 已退出"
fi
}
# 检查亮度节点文件
CHECK_FILES() {
sleep 1
if [ -f "$now_bri_file" ] && [ -f "$max_bri_file" ]; then
echo "- 找到亮度节点文件"
else
echo "x 未找到亮度节点文件"
abort "x 暂不支持您的设备"
fi
now_bri="$(cat "$now_bri_file")"
max_bri="$(cat "$max_bri_file")"
echo "- 当前亮度: $now_bri"
echo "- 最大亮度: $max_bri"
}
# 测试前台最大亮度
TEST_UI_MAX_BRI() {
echo ""
echo "- 开始测试前台最大亮度"
echo ""
sleep 1
echo "******** 请关闭自动亮度 ********"
echo "* 按音量 + 进入下一步, 按音量 - 退出"
if [ "$(button_listener)" = "0" ]; then
echo "- 已确认进入下一步"
else
abort "- 已退出"
fi
# 调整亮度前, 记录当前亮度用于之后恢复
restore_bri="$(cat "$now_bri_file")"
echo ""
sleep 1
echo "******** 请将屏幕亮度调至最大 ********"
echo "* 按音量 + 进入下一步, 按音量 - 退出"
if [ "$(button_listener)" = "0" ]; then
echo "- 已确认进入下一步"
else
abort "- 已退出"
fi
ui_max_bri="$(cat "$now_bri_file")"
echo "- 前台最大亮度: [ $ui_max_bri ]"
echo -n "$ui_max_bri" >"$mod_config/ui_max_bri.txt"
echo ""
echo "- 峰值最大亮度由节点文件获得: [ $max_bri ]"
echo "- 若不符合预期, 请稍后到配置文件或 Web UI 更改"
echo -n "$max_bri" >"$mod_config/max_bri.txt"
echo ""
echo "- 测试完成"
echo "- 正在为你恢复亮度..."
echo -n "$restore_bri" >"$now_bri_file"
}
# 结束
END() {
echo ""
sleep 1
echo "******** 模块策略:"
echo "- 当亮度达到 [ $(cat "$mod_config/ui_max_bri.txt") ] 时, 自动提升至 [ $(cat "$mod_config/max_bri.txt") ]"
echo "- 配置目录: /data/adb/modules/LuminPro/config"
echo "- 也可以使用 Web UI 进行配置"
echo ""
echo "* 模块已刷入, 请重启手机"
echo "- 感谢您的使用"
echo "- 作者: 酷安 @于乐yule"
echo ""
sleep 1
exit 0
}
# 导入旧配置
IMPORT_OLD_CONFIG() {
if [ -d "$old_config" ] &&
[ -s "$old_config/ui_max_bri.txt" ] &&
[ -s "$old_config/max_bri.txt" ]; then
echo ""
sleep 1
echo "- 检测到已有配置:"
echo " - 前台最大亮度: $(cat "$old_config/ui_max_bri.txt")"
echo " - 峰值最大亮度: $(cat "$old_config/max_bri.txt")"
if [ -s "$old_config/sleep_time.txt" ]; then
echo " - 休眠时间: $(cat "$old_config/sleep_time.txt")"
fi
if [ -s "$old_config/auto_bri_sleep.txt" ]; then
echo " - 自动亮度时休眠: $(cat "$old_config/auto_bri_sleep.txt" | sed 's/1/开启/;s/0/关闭/')"
fi
if [ -s "$old_config/steps_num.txt" ]; then
echo " - 亮度提升步数: $(cat "$old_config/steps_num.txt")"
fi
if [ -s "$old_config/log_max_size.txt" ]; then
echo " - 日志大小限制: $(cat "$old_config/log_max_size.txt") KB"
fi
echo ""
echo "* 按音量 + 沿用旧配置, 按音量 - 重新测试"
if [ "$(button_listener)" = "0" ]; then
echo "- 已沿用旧配置"
cp -f "$old_config/ui_max_bri.txt" "$mod_config/"
cp -f "$old_config/max_bri.txt" "$mod_config/"
[ -s "$old_config/sleep_time.txt" ] && cp -f "$old_config/sleep_time.txt" "$mod_config/"
[ -s "$old_config/auto_bri_sleep.txt" ] && cp -f "$old_config/auto_bri_sleep.txt" "$mod_config/"
[ -s "$old_config/steps_num.txt" ] && cp -f "$old_config/steps_num.txt" "$mod_config/"
[ -s "$old_config/log_max_size.txt" ] && cp -f "$old_config/log_max_size.txt" "$mod_config/"
# 版本迁移逻辑
local old_version_code
old_version_code="$(grep_get_prop versionCode "/data/adb/modules/LuminPro/module.prop")"
if [ "$old_version_code" = "2101" ] && [ ! -d "$old_config/.backup" ]; then
echo "- 检测到从 2101 版本升级, 正在补全备份目录..."
mkdir -p "$mod_config/.backup"
cp -f "$mod_config/"*.txt "$mod_config/.backup/" 2>/dev/null
else
# 正常备份同步
mkdir -p "$mod_config/.backup"
[ -d "$old_config/.backup" ] && cp -rf "$old_config/.backup/." "$mod_config/.backup/"
fi
return 0
else
echo "- 将重新测试"
return 1
fi
fi
return 1
}
# 初始化默认配置文件
INIT_CONFIG() {
mkdir -p "$mod_config"
touch "$mod_config/ui_max_bri.txt"
touch "$mod_config/max_bri.txt"
}
# 补全缺失设置并设定默认值
ENSURE_DEFAULTS() {
[ ! -s "$mod_config/sleep_time.txt" ] && echo "1900-0600" >"$mod_config/sleep_time.txt"
[ ! -s "$mod_config/auto_bri_sleep.txt" ] && echo "1" >"$mod_config/auto_bri_sleep.txt"
[ ! -s "$mod_config/steps_num.txt" ] && echo "50" >"$mod_config/steps_num.txt"
[ ! -s "$mod_config/log_max_size.txt" ] && echo "500" >"$mod_config/log_max_size.txt"
}
# 创建备份 (用于 WebUI 恢复默认)
CREATE_BACKUP() {
mkdir -p "$mod_config/.backup"
cp -f "$mod_config/ui_max_bri.txt" "$mod_config/.backup/"
cp -f "$mod_config/max_bri.txt" "$mod_config/.backup/"
cp -f "$mod_config/sleep_time.txt" "$mod_config/.backup/"
cp -f "$mod_config/auto_bri_sleep.txt" "$mod_config/.backup/"
cp -f "$mod_config/steps_num.txt" "$mod_config/.backup/"
cp -f "$mod_config/log_max_size.txt" "$mod_config/.backup/"
}
# 主函数
MAIN() {
NOTE
SHOW_CHANGELOG
if ! IMPORT_OLD_CONFIG; then
INIT_CONFIG
CHECK_FILES
TEST_UI_MAX_BRI
fi
ENSURE_DEFAULTS
CREATE_BACKUP
END
}
MAIN
+208
View File
@@ -0,0 +1,208 @@
---
title: 模块 WebUI - API 文档
shortTitle: WebUI API 文档
description: 介绍 KernelSU 模块 WebUI 的 API
isOriginal: true
author: KernelSU
date: 2026-01-25
category: ["笔记"]
tag: ["安卓", "KernelSU", "前端"]
excerpt: 这是 KernelSU 的 WebUI API 文档,由 Yule 将其翻译为中文,并新增了部分内容,方便阅读
---
> 这是 KernelSU 的 WebUI API 文档,[原文链接(英文)](https://www.npmjs.com/package/kernelsu?activeTab=readme),由 Yule 将其翻译为中文,并新增了部分内容,方便阅读。参见:[模块 WebUI](./webui)。
---
## 安装
::: code-tabs
@tab npm
```bash
npm i kernelsu
```
@tab pnpm
```bash
pnpm add kernelsu
```
@tab yarn
```bash
yarn add kernelsu
```
:::
---
## API
### `exec`
在 **root** shell 中启动一个 shell 并运行命令。返回一个 Promise,在执行完成后返回 `stdout`(标准输出)和 `stderr`(标准错误)。
- `command <string>`:要运行的命令,参数以空格分隔。
- `options <Object`>`:
- `cwd`:子进程的当前工作目录。
- `env`:环境变量键值对。
```js
import { exec } from "kernelsu";
const { errno, stdout, stderr } = await exec("ls -l", { cwd: "/tmp" });
if (errno === 0) {
// 成功时
console.log(stdout);
}
```
### `spawn`
在 root shell 中使用给定的命令产生一个新进程,参数通过 `args` 数组传递。如果省略,`args` 默认为空数组。
返回一个 `ChildProcess` 实例,代表已启动的子进程。
- `command <string>`:要运行的命令。
- `args <string[]>`:字符串参数列表。
- `options <Object>`:
- `cwd <string>`:子进程的工作目录。
- `env <Object>`:环境变量。
示例:运行 `ls -lh /data` 并捕获输出和退出码:
```js
import { spawn } from "kernelsu";
const ls = spawn("ls", ["-lh", "/data"]);
ls.stdout.on("data", (data) => {
console.log(`输出: ${data}`);
});
ls.stderr.on("data", (data) => {
console.log(`错误: ${data}`);
});
ls.on("exit", (code) => {
console.log(`子进程退出,退出码: ${code}`);
});
```
### `ChildProcess` (子进程类)
#### `Event 'exit'`
- `code <number>`:子进程自主退出时的退出码。
当进程结束时触发。如果进程正常退出,code 为退出码;否则为 `null`。
#### `Event 'error'`
- `err <Error>`:错误对象。
当进程无法启动或无法被杀死时触发。
#### `stdout`
表示子进程**标准输出**的数据流。
```js
const subprocess = spawn("ls");
subprocess.stdout.on("data", (data) => {
console.log(`数据:${data}`);
});
```
#### `stderr`
表示子进程**标准错误**的数据流。
#### `fullScreen`
请求 WebView 进入或退出全屏模式。
```js
import { fullScreen } from "kernelsu";
fullScreen(true); // 进入全屏
```
#### `enableInsets`
请求 WebView 设置内边距为 0 或适配系统状态栏/导航栏的缩进(Insets)。
- 提示:此功能默认禁用。但如果你引用了 internal/insets.css 资源,它会自动启用。
- 你可以通过以下方式自动获取 Insets 值并启用:
- 在 CSS 中添加:`@import "https://mui.kernelsu.org/internal/insets.css";`
- 或者在 HTML 中添加:`<link rel="stylesheet" type="text/css" href="/internal/insets.css" />`
```js
import { enableInsets } from "kernelsu";
enableInsets(true);
```
#### `toast`
显示一个系统级气泡消息(Toast)。
```js
import { toast } from "kernelsu";
toast("你好,世界!");
```
#### `moduleInfo`
获取当前模块的信息。
```js
import { moduleInfo } from "kernelsu";
// 在控制台打印模块 ID
console.log(moduleInfo());
```
#### `listPackages`
列出已安装的应用包名。返回一个包名数组。
- `type <string>`:要列出的包类型:"user" (用户应用), "system" (系统应用), 或 "all" (全部)。
```js
import { listPackages } from "kernelsu";
// 列出用户应用
const packages = listPackages("user");
```
- 提示:当此 API 可用时,你可以使用 `ksu://icon/{packageName}` 来获取应用图标。
```js
img.src = "ksu://icon/" + packageName;
```
#### `getPackagesInfo`
获取指定包名的详细信息。返回 PackagesInfo 对象数组。
- `packages <string[]>`:包名列表。
```js
import { getPackagesInfo } from "kernelsu";
const info = getPackagesInfo(["com.android.settings", "com.android.shell"]);
```
#### `PackagesInfo` (应用信息对象)
包含以下字段:
- `packageName <string>`:应用包名。
- `versionName <string>`:应用版本号名称。
- `versionCode <number>`:应用版本代码。
- `appLabel <string>`:应用的显示名称。
- `isSystem <boolean>`:是否为系统应用。
- `uid <number>`:应用的 UID。
+69
View File
@@ -0,0 +1,69 @@
---
title: 模块 WebUI
shortTitle: WebUI
description: 介绍 KernelSU 模块 WebUI
isOriginal: true
author: KernelSU
date: 2026-01-25
category: ["笔记"]
tag: ["安卓", "KernelSU", "前端"]
---
KernelSU 的模块除了执行启动脚本和修改系统文件之外,还支持显示 UI 界面和与用户交互。
你可以通过任何 Web 技术编写 HTML + CSS + JavaScript 页面,KernelSU 的管理器将通过 WebView 显示这些页面。此外,KernelSU 还提供了一些用于与系统交互的 JavaScript API,例如执行 shell 命令。
<!-- more -->
---
## WebUI 根目录
Web 资源文件应放置在模块根目录的 webroot 子目录中,并且其中必须有一个名为index.html的文件,该文件是模块页面入口。包含 Web 界面的最简单的模块结构如下:
```
❯ tree .
.
|-- module.prop
`-- webroot
`--index.html
```
::: warning
安装模块时,KernelSU 会自动设置 webroot 目录的权限和 SELinux context,如果您不知道自己在做什么,请不要自行设置该目录的权限!
:::
如果您的页面包含 CSS 和 JavaScript,您也需要将其放入此目录中。
---
## JavaScript API
如果只是一个显示页面,那它和普通网页没有什么区别。更重要的是,KernelSU 提供了一系列的系统 API,可以让您实现模块特有的功能。
KernelSU 提供了一个 JavaScript 库并在 npm 上发布,您可以在网页的 JavaScript 代码中使用它。
例如,您可以执行 shell 命令来获取特定配置或修改属性:
```shell
import { exec } from 'kernelsu';
const { errno, stdout } = await exec("getprop ro.product.model");
```
再比如,你可以让网页全屏显示,或者显示一个 Toast。
[API 文档](./webui-api)
如果您发现现有的 API 不能满足您的需求或者使用不方便,欢迎 [在这里](https://github.com/tiann/KernelSU/issues) 给我们提出建议!
---
## 一些技巧
1. 您可以正常使用 localStorage 存储一些数据,但卸载管理器后,这些数据将会丢失。 如果需要持久保存,可以自己将数据写入某个目录。
2. 对于简单的页面,我建议您使用 parceljs 进行打包。它零配置,使用非常方便。不过,如果你是前端高手或者有自己的喜好,那就选择你喜欢的吧!
+183
View File
@@ -0,0 +1,183 @@
<!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" />
<link rel="stylesheet" href="/src/style.css" />
</head>
<body>
<div id="app">
<!-- 顶部头 -->
<header class="app-header">
<div class="header-content">
<div class="header-icon"><i data-lucide="sun"></i></div>
<div class="header-text">
<h1>LuminPro</h1>
<p class="header-subtitle" id="module-version">日用屏幕亮度强化</p>
</div>
</div>
<div class="header-status" id="module-status">
<span class="status-dot"></span>
<span class="status-text">运行中</span>
</div>
</header>
<!-- 配置卡片 -->
<section class="card" id="config-section">
<div class="card-header">
<span class="card-icon"><i data-lucide="settings"></i></span>
<h2>亮度配置</h2>
</div>
<!-- 分类: 亮度调节 -->
<div class="config-group">
<h3 class="group-title">亮度调节</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">前台最大亮度</span>
<span class="config-desc">触发亮度提升的阈值</span>
</div>
<div class="config-value">
<input type="number" id="input-ui-max-bri" class="config-input" min="0" />
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">峰值最大亮度</span>
<span class="config-desc">亮度提升的目标值</span>
</div>
<div class="config-value">
<input type="number" id="input-max-bri" class="config-input" min="0" />
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">亮度提升步数</span>
<span class="config-desc">约 0.02 秒 / 步</span>
</div>
<div class="config-value">
<input type="number" id="input-steps-num" class="config-input" min="1" max="500" />
</div>
</div>
</div>
<!-- 分类: 执行策略 -->
<div class="config-group">
<h3 class="group-title">执行策略</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">自动亮度时休眠</span>
<span class="config-desc">开启自动亮度时不提升</span>
</div>
<div class="config-value">
<label class="switch">
<input type="checkbox" id="input-auto-bri-sleep">
<span class="slider"></span>
</label>
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">定时休眠</span>
<span class="config-desc">设定时段内不提升亮度</span>
</div>
<div class="config-value">
<label class="switch">
<input type="checkbox" id="input-sleep-mode">
<span class="slider"></span>
</label>
</div>
</div>
<div class="config-item-expand" id="sleep-time-expand">
<div class="custom-time-picker">
<div class="time-unit">
<input type="number" id="input-sleep-start-h" class="time-input" min="0" max="23" placeholder="00" />
<span>:</span>
<input type="number" id="input-sleep-start-m" class="time-input" min="0" max="59" placeholder="00" />
</div>
<span class="time-sep">至</span>
<div class="time-unit">
<input type="number" id="input-sleep-end-h" class="time-input" min="0" max="23" placeholder="00" />
<span>:</span>
<input type="number" id="input-sleep-end-m" class="time-input" min="0" max="59" placeholder="00" />
</div>
</div>
</div>
</div>
<!-- 分类: 系统管理 -->
<div class="config-group">
<h3 class="group-title">系统管理</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">日志大小限制</span>
<span class="config-desc">单位: KB</span>
</div>
<div class="config-value">
<input type="number" id="input-log-max-size" class="config-input" min="1" max="10240" />
</div>
</div>
</div>
<div class="card-actions">
<button class="btn btn-outline" id="btn-reset">
恢复默认
</button>
<button class="btn btn-primary" id="btn-save">
<span class="btn-icon"><i data-lucide="save"></i></span> 保存配置
</button>
</div>
</section>
<!-- 实时状态 -->
<section class="card" id="status-section">
<div class="card-header">
<span class="card-icon"><i data-lucide="activity"></i></span>
<h2>实时状态</h2>
<div class="header-actions">
<button class="btn-text-s" id="btn-toggle-service">暂停</button>
<button class="btn-text-s" id="btn-restart-service">重启</button>
</div>
</div>
<div class="status-grid">
<div class="status-item">
<span class="status-label">当前亮度</span>
<span class="status-value" id="status-current-bri">—</span>
</div>
<div class="status-item">
<span class="status-label">系统最大亮度</span>
<span class="status-value" id="status-sys-max-bri">—</span>
</div>
<div class="status-item">
<span class="status-label">inotifyd PID</span>
<span class="status-value" id="status-inotifyd-pid">—</span>
</div>
<div class="status-item">
<span class="status-label">休眠状态</span>
<span class="status-value" id="status-sleep">—</span>
</div>
</div>
</section>
<!-- 日志 -->
<section class="card" id="log-section">
<div class="card-header">
<span class="card-icon"><i data-lucide="file-text"></i></span>
<h2>运行日志</h2>
</div>
<pre class="log-output" id="log-output">加载中...</pre>
</section>
<!-- Toast -->
<div class="toast" id="toast"></div>
</div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
Regular → Executable
+5 -4
View File
@@ -1,6 +1,7 @@
id=LuminPro
name=日常屏幕亮度强化
version=V1.3
versionCode=13
name=LuminPro丨日用屏幕亮度强化
version=V2.2
versionCode=2202
author=酷安@Yule
description=已刷入,请重启手机。
description=本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果
updateJson=https://share.yule.ink/magisk/mod/luminpro/update.json
-6
View File
@@ -1,6 +0,0 @@
id=LuminPro
name=日常屏幕亮度强化
version=V1.3
versionCode=13
author=酷安@Yule
description=
+881
View File
@@ -0,0 +1,881 @@
{
"name": "luminpro-webui",
"version": "2.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "luminpro-webui",
"version": "2.1.0",
"devDependencies": {
"kernelsu": "^3.0.2",
"vite": "^8.0.3"
}
},
"node_modules/@emnapi/core": {
"version": "1.9.2",
"resolved": "https://registry.npmmirror.com/@emnapi/core/-/core-1.9.2.tgz",
"integrity": "sha512-UC+ZhH3XtczQYfOlu3lNEkdW/p4dsJ1r/bP7H8+rhao3TTTMO1ATq/4DdIi23XuGoFY+Cz0JmCbdVl0hz9jZcA==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"@emnapi/wasi-threads": "1.2.1",
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/runtime": {
"version": "1.9.2",
"resolved": "https://registry.npmmirror.com/@emnapi/runtime/-/runtime-1.9.2.tgz",
"integrity": "sha512-3U4+MIWHImeyu1wnmVygh5WlgfYDtyf0k8AbLhMFxOipihf6nrWC4syIm/SwEeec0mNSafiiNnMJwbza/Is6Lw==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@emnapi/wasi-threads": {
"version": "1.2.1",
"resolved": "https://registry.npmmirror.com/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz",
"integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/@napi-rs/wasm-runtime": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.2.tgz",
"integrity": "sha512-sNXv5oLJ7ob93xkZ1XnxisYhGYXfaG9f65/ZgYuAu3qt7b3NadcOEhLvx28hv31PgX8SZJRYrAIPQilQmFpLVw==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@tybys/wasm-util": "^0.10.1"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/Brooooooklyn"
},
"peerDependencies": {
"@emnapi/core": "^1.7.1",
"@emnapi/runtime": "^1.7.1"
}
},
"node_modules/@oxc-project/types": {
"version": "0.122.0",
"resolved": "https://registry.npmmirror.com/@oxc-project/types/-/types-0.122.0.tgz",
"integrity": "sha512-oLAl5kBpV4w69UtFZ9xqcmTi+GENWOcPF7FCrczTiBbmC0ibXxCwyvZGbO39rCVEuLGAZM84DH0pUIyyv/YJzA==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/Boshen"
}
},
"node_modules/@rolldown/binding-android-arm64": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0-rc.12.tgz",
"integrity": "sha512-pv1y2Fv0JybcykuiiD3qBOBdz6RteYojRFY1d+b95WVuzx211CRh+ytI/+9iVyWQ6koTh5dawe4S/yRfOFjgaA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"android"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-darwin-arm64": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0-rc.12.tgz",
"integrity": "sha512-cFYr6zTG/3PXXF3pUO+umXxt1wkRK/0AYT8lDwuqvRC+LuKYWSAQAQZjCWDQpAH172ZV6ieYrNnFzVVcnSflAg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-darwin-x64": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.0-rc.12.tgz",
"integrity": "sha512-ZCsYknnHzeXYps0lGBz8JrF37GpE9bFVefrlmDrAQhOEi4IOIlcoU1+FwHEtyXGx2VkYAvhu7dyBf75EJQffBw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-freebsd-x64": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.0-rc.12.tgz",
"integrity": "sha512-dMLeprcVsyJsKolRXyoTH3NL6qtsT0Y2xeuEA8WQJquWFXkEC4bcu1rLZZSnZRMtAqwtrF/Ib9Ddtpa/Gkge9Q==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-linux-arm-gnueabihf": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.0-rc.12.tgz",
"integrity": "sha512-YqWjAgGC/9M1lz3GR1r1rP79nMgo3mQiiA+Hfo+pvKFK1fAJ1bCi0ZQVh8noOqNacuY1qIcfyVfP6HoyBRZ85Q==",
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-linux-arm64-gnu": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0-rc.12.tgz",
"integrity": "sha512-/I5AS4cIroLpslsmzXfwbe5OmWvSsrFuEw3mwvbQ1kDxJ822hFHIx+vsN/TAzNVyepI/j/GSzrtCIwQPeKCLIg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-linux-arm64-musl": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0-rc.12.tgz",
"integrity": "sha512-V6/wZztnBqlx5hJQqNWwFdxIKN0m38p8Jas+VoSfgH54HSj9tKTt1dZvG6JRHcjh6D7TvrJPWFGaY9UBVOaWPw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-linux-ppc64-gnu": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.0-rc.12.tgz",
"integrity": "sha512-AP3E9BpcUYliZCxa3w5Kwj9OtEVDYK6sVoUzy4vTOJsjPOgdaJZKFmN4oOlX0Wp0RPV2ETfmIra9x1xuayFB7g==",
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-linux-s390x-gnu": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.0-rc.12.tgz",
"integrity": "sha512-nWwpvUSPkoFmZo0kQazZYOrT7J5DGOJ/+QHHzjvNlooDZED8oH82Yg67HvehPPLAg5fUff7TfWFHQS8IV1n3og==",
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-linux-x64-gnu": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0-rc.12.tgz",
"integrity": "sha512-RNrafz5bcwRy+O9e6P8Z/OCAJW/A+qtBczIqVYwTs14pf4iV1/+eKEjdOUta93q2TsT/FI0XYDP3TCky38LMAg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-linux-x64-musl": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0-rc.12.tgz",
"integrity": "sha512-Jpw/0iwoKWx3LJ2rc1yjFrj+T7iHZn2JDg1Yny1ma0luviFS4mhAIcd1LFNxK3EYu3DHWCps0ydXQ5i/rrJ2ig==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-openharmony-arm64": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.0-rc.12.tgz",
"integrity": "sha512-vRugONE4yMfVn0+7lUKdKvN4D5YusEiPilaoO2sgUWpCvrncvWgPMzK00ZFFJuiPgLwgFNP5eSiUlv2tfc+lpA==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"openharmony"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-wasm32-wasi": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.0-rc.12.tgz",
"integrity": "sha512-ykGiLr/6kkiHc0XnBfmFJuCjr5ZYKKofkx+chJWDjitX+KsJuAmrzWhwyOMSHzPhzOHOy7u9HlFoa5MoAOJ/Zg==",
"cpu": [
"wasm32"
],
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"@napi-rs/wasm-runtime": "^1.1.1"
},
"engines": {
"node": ">=14.0.0"
}
},
"node_modules/@rolldown/binding-win32-arm64-msvc": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0-rc.12.tgz",
"integrity": "sha512-5eOND4duWkwx1AzCxadcOrNeighiLwMInEADT0YM7xeEOOFcovWZCq8dadXgcRHSf3Ulh1kFo/qvzoFiCLOL1Q==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/binding-win32-x64-msvc": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0-rc.12.tgz",
"integrity": "sha512-PyqoipaswDLAZtot351MLhrlrh6lcZPo2LSYE+VDxbVk24LVKAGOuE4hb8xZQmrPAuEtTZW8E6D2zc5EUZX4Lw==",
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": "^20.19.0 || >=22.12.0"
}
},
"node_modules/@rolldown/pluginutils": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.12.tgz",
"integrity": "sha512-HHMwmarRKvoFsJorqYlFeFRzXZqCt2ETQlEDOb9aqssrnVBB1/+xgTGtuTrIk5vzLNX1MjMtTf7W9z3tsSbrxw==",
"dev": true,
"license": "MIT"
},
"node_modules/@tybys/wasm-util": {
"version": "0.10.1",
"resolved": "https://registry.npmmirror.com/@tybys/wasm-util/-/wasm-util-0.10.1.tgz",
"integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"tslib": "^2.4.0"
}
},
"node_modules/detect-libc": {
"version": "2.1.2",
"resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.1.2.tgz",
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": ">=8"
}
},
"node_modules/fdir": {
"version": "6.5.0",
"resolved": "https://registry.npmmirror.com/fdir/-/fdir-6.5.0.tgz",
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12.0.0"
},
"peerDependencies": {
"picomatch": "^3 || ^4"
},
"peerDependenciesMeta": {
"picomatch": {
"optional": true
}
}
},
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/kernelsu": {
"version": "3.0.2",
"resolved": "https://registry.npmmirror.com/kernelsu/-/kernelsu-3.0.2.tgz",
"integrity": "sha512-3MTGgIbl3TWCzqnJP6Fun9tHv6VULR3O188U3raeGRSMzK+G3pldL9ySwaZWhsHCtI2BTvlQuu/3p10s4a5c3w==",
"dev": true,
"license": "Apache-2.0"
},
"node_modules/lightningcss": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss/-/lightningcss-1.32.0.tgz",
"integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==",
"dev": true,
"license": "MPL-2.0",
"dependencies": {
"detect-libc": "^2.0.3"
},
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
},
"optionalDependencies": {
"lightningcss-android-arm64": "1.32.0",
"lightningcss-darwin-arm64": "1.32.0",
"lightningcss-darwin-x64": "1.32.0",
"lightningcss-freebsd-x64": "1.32.0",
"lightningcss-linux-arm-gnueabihf": "1.32.0",
"lightningcss-linux-arm64-gnu": "1.32.0",
"lightningcss-linux-arm64-musl": "1.32.0",
"lightningcss-linux-x64-gnu": "1.32.0",
"lightningcss-linux-x64-musl": "1.32.0",
"lightningcss-win32-arm64-msvc": "1.32.0",
"lightningcss-win32-x64-msvc": "1.32.0"
}
},
"node_modules/lightningcss-android-arm64": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz",
"integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"android"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-darwin-arm64": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz",
"integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-darwin-x64": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz",
"integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==",
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-freebsd-x64": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz",
"integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==",
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-arm-gnueabihf": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz",
"integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==",
"cpu": [
"arm"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-arm64-gnu": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz",
"integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-arm64-musl": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz",
"integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-x64-gnu": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz",
"integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==",
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-linux-x64-musl": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz",
"integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==",
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-win32-arm64-msvc": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz",
"integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==",
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/lightningcss-win32-x64-msvc": {
"version": "1.32.0",
"resolved": "https://registry.npmmirror.com/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz",
"integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==",
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 12.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
}
},
"node_modules/nanoid": {
"version": "3.3.11",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.11.tgz",
"integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"bin": {
"nanoid": "bin/nanoid.cjs"
},
"engines": {
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
"node_modules/picocolors": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"dev": true,
"license": "ISC"
},
"node_modules/picomatch": {
"version": "4.0.4",
"resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-4.0.4.tgz",
"integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/jonschlinkert"
}
},
"node_modules/postcss": {
"version": "8.5.8",
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.8.tgz",
"integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==",
"dev": true,
"funding": [
{
"type": "opencollective",
"url": "https://opencollective.com/postcss/"
},
{
"type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/postcss"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
"source-map-js": "^1.2.1"
},
"engines": {
"node": "^10 || ^12 || >=14"
}
},
"node_modules/rolldown": {
"version": "1.0.0-rc.12",
"resolved": "https://registry.npmmirror.com/rolldown/-/rolldown-1.0.0-rc.12.tgz",
"integrity": "sha512-yP4USLIMYrwpPHEFB5JGH1uxhcslv6/hL0OyvTuY+3qlOSJvZ7ntYnoWpehBxufkgN0cvXxppuTu5hHa/zPh+A==",
"dev": true,
"license": "MIT",
"dependencies": {
"@oxc-project/types": "=0.122.0",
"@rolldown/pluginutils": "1.0.0-rc.12"
},
"bin": {
"rolldown": "bin/cli.mjs"
},
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"optionalDependencies": {
"@rolldown/binding-android-arm64": "1.0.0-rc.12",
"@rolldown/binding-darwin-arm64": "1.0.0-rc.12",
"@rolldown/binding-darwin-x64": "1.0.0-rc.12",
"@rolldown/binding-freebsd-x64": "1.0.0-rc.12",
"@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.12",
"@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.12",
"@rolldown/binding-linux-arm64-musl": "1.0.0-rc.12",
"@rolldown/binding-linux-ppc64-gnu": "1.0.0-rc.12",
"@rolldown/binding-linux-s390x-gnu": "1.0.0-rc.12",
"@rolldown/binding-linux-x64-gnu": "1.0.0-rc.12",
"@rolldown/binding-linux-x64-musl": "1.0.0-rc.12",
"@rolldown/binding-openharmony-arm64": "1.0.0-rc.12",
"@rolldown/binding-wasm32-wasi": "1.0.0-rc.12",
"@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.12",
"@rolldown/binding-win32-x64-msvc": "1.0.0-rc.12"
}
},
"node_modules/source-map-js": {
"version": "1.2.1",
"resolved": "https://registry.npmmirror.com/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/tinyglobby": {
"version": "0.2.15",
"resolved": "https://registry.npmmirror.com/tinyglobby/-/tinyglobby-0.2.15.tgz",
"integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"fdir": "^6.5.0",
"picomatch": "^4.0.3"
},
"engines": {
"node": ">=12.0.0"
},
"funding": {
"url": "https://github.com/sponsors/SuperchupuDev"
}
},
"node_modules/tslib": {
"version": "2.8.1",
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"dev": true,
"license": "0BSD",
"optional": true
},
"node_modules/vite": {
"version": "8.0.3",
"resolved": "https://registry.npmmirror.com/vite/-/vite-8.0.3.tgz",
"integrity": "sha512-B9ifbFudT1TFhfltfaIPgjo9Z3mDynBTJSUYxTjOQruf/zHH+ezCQKcoqO+h7a9Pw9Nm/OtlXAiGT1axBgwqrQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"lightningcss": "^1.32.0",
"picomatch": "^4.0.4",
"postcss": "^8.5.8",
"rolldown": "1.0.0-rc.12",
"tinyglobby": "^0.2.15"
},
"bin": {
"vite": "bin/vite.js"
},
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"funding": {
"url": "https://github.com/vitejs/vite?sponsor=1"
},
"optionalDependencies": {
"fsevents": "~2.3.3"
},
"peerDependencies": {
"@types/node": "^20.19.0 || >=22.12.0",
"@vitejs/devtools": "^0.1.0",
"esbuild": "^0.27.0",
"jiti": ">=1.21.0",
"less": "^4.0.0",
"sass": "^1.70.0",
"sass-embedded": "^1.70.0",
"stylus": ">=0.54.8",
"sugarss": "^5.0.0",
"terser": "^5.16.0",
"tsx": "^4.8.1",
"yaml": "^2.4.2"
},
"peerDependenciesMeta": {
"@types/node": {
"optional": true
},
"@vitejs/devtools": {
"optional": true
},
"esbuild": {
"optional": true
},
"jiti": {
"optional": true
},
"less": {
"optional": true
},
"sass": {
"optional": true
},
"sass-embedded": {
"optional": true
},
"stylus": {
"optional": true
},
"sugarss": {
"optional": true
},
"terser": {
"optional": true
},
"tsx": {
"optional": true
},
"yaml": {
"optional": true
}
}
}
}
}
+19
View File
@@ -0,0 +1,19 @@
{
"name": "luminpro-webui",
"private": true,
"version": "2.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build && node build-module.js",
"preview": "vite preview"
},
"devDependencies": {
"archiver": "^7.0.1",
"kernelsu": "^3.0.2",
"vite": "^8.0.3"
},
"dependencies": {
"lucide": "^1.7.0"
}
}
+1170
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.
+34
View File
@@ -0,0 +1,34 @@
#!/system/bin/sh
# LuminPro 服务重启脚本
MODDIR="${0%/*/*}"
PID_DIR="$MODDIR/pid"
pid_file="$PID_DIR/inotifyd.pid"
flag_file="$PID_DIR/up.flag"
now_bri_file="/sys/class/backlight/panel0-backlight/brightness"
log_file="$MODDIR/service.log"
_log() {
printf '[%s] [service.restart] %s\n' "$(date '+%d %H:%M:%S.%3N')" "$1" >>"$log_file"
}
_log "正在手动重启服务..."
# 1. 杀死正在进行的 inotifyd
if [ -f "$pid_file" ]; then
kill -9 "$(cat "$pid_file")" 2>/dev/null
_log "已杀死现有 inotifyd ($(cat "$pid_file"))"
fi
# 2. 清理遗留文件
rm -f "$pid_file"
rm -f "$flag_file"
_log "已清理 pid 和 flag 文件"
# 3. 重新启动 inotifyd
inotifyd "$MODDIR/script/up.sh" "$now_bri_file:c" &
inotifyd_pid="$!"
echo "$inotifyd_pid" >"$pid_file"
_log "inotifyd ($inotifyd_pid) 重新启动成功"
exit 0
-40
View File
@@ -1,40 +0,0 @@
# By Yule
now_bri_file="/sys/devices/virtual/mi_display/disp_feature/disp-DSI-0/brightness_clone"
error() {
echo "❓ $1"
echo "❌ 安装出现错误"
exit 1
}
# 提示用户把亮度拉满进行测试
echo "😎 将进行亮度测试"
echo "1️⃣ 请下拉控制中心,关闭自动亮度后将亮度拉满"
echo "2️⃣ 等待几秒"
for i in $(seq 0 10); do
time=$(expr 10 - $i)
echo "- $time 秒后应用当前亮度"
sleep 1
done
echo ""
now_bri=$(cat $now_bri_file)
lim_bri="$now_bri"
echo ""
echo "🤓 手机前台亮度限制为: $lim_bri"
break
echo "😎 进行峰值亮度测试,手机屏幕会变亮"
echo -n "30000" > $now_bri_file
sleep 2
max_bri=$(cat $now_bri_file)
echo "🤗 手机峰值亮度为: $max_bri"
echo -n "$lim_bri" > $now_bri_file
echo -n $now_bri > $MODPATH/brightness/now
echo -n $lim_bri > $MODPATH/brightness/lim
echo -n $max_bri > $MODPATH/brightness/max
touch $MODDIR/modenable
echo "✅ 安装完成,请重启手机 ✅"
-15
View File
@@ -1,15 +0,0 @@
#!/bin/sh
SCRDIR="$(dirname $(readlink -f $0))"
MODDIR="$(dirname $(dirname $(readlink -f $0)))"
bri_max="$(cat $MODDIR/brightness/max)"
bri_now_f="/sys/devices/virtual/mi_display/disp_feature/disp-DSI-0/brightness_clone"
bri_now="$(cat $bri_now_f)"
# echo $SCRDIR
# echo $MODDIR
# echo $bri_max
echo "$bri_now" > $SCRDIR/latest-bri
echo -n "$bri_max" > $bri_now_f
exit 0
-13
View File
@@ -1,13 +0,0 @@
#!/bin/sh
SCRDIR="$(dirname $(readlink -f $0))"
MODDIR="$(dirname $(dirname $(readlink -f $0)))"
latest_bri=$(cat $SCRDIR/latest-bri)
bri_now_f="/sys/devices/virtual/mi_display/disp_feature/disp-DSI-0/brightness_clone"
bri_now="$(cat $bri_now_f)"
if [ $bri_now -gt $latest_bri ]; then
echo -n "$latest_bri" > $bri_now_f
fi
rm -f $SCRDIR/latest-bri
exit 0
+178
View File
@@ -0,0 +1,178 @@
#!/system/bin/sh
#shellcheck shell=ash
# 亮度提升脚本
MODDIR="${0%/*/*}"
CONFIG_DIR="$MODDIR/config"
PID_DIR="$MODDIR/pid"
flag_file="$PID_DIR/up.flag"
stop_file="$PID_DIR/stop.flag"
log_file="$MODDIR/service.log"
# 日志函数
_log() {
# 如果 stop.flag 存在并且不是正在清理日志,我们仍允许记录停止状态,但此处先检查基础
case "$1" in
"日志过大"*) ;;
*) if [ -f "$stop_file" ]; then return; fi ;;
esac
local max_size
max_size="$(cat "$CONFIG_DIR/log_max_size.txt" 2>/dev/null)"
[ -z "$max_size" ] && max_size="500" # 默认 500 KB
# 获取当前日志大小 (KB)
if [ -f "$log_file" ]; then
local cur_size
cur_size=$(du -k "$log_file" | cut -f1)
if [ "$cur_size" -ge "$max_size" ]; then
echo "[$(date '+%d %H:%M:%S.%3N')] [service.up] 日志过大 ($cur_size KB), 自动重置" >"$log_file"
fi
fi
printf '[%s] [service.up] %s\n' "$(date '+%d %H:%M:%S.%3N')" "$1" >>"$log_file"
}
_log "($$) 被 inotifyd 调用..."
if [ -f "$stop_file" ]; then
_log "($$) 检测到 stop.flag, 停止本次调整 (服务已暂停)"
exit 0
fi
# 建立一个 flag, 避免重复执行; 如果已经有 flag, 则退出
if [ -f "$flag_file" ]; then
_log "($$) 重复执行, 这个进程退出, 将有其他进程接管"
exit 1
fi
touch "$flag_file"
# 节点文件
now_bri_file="/sys/class/backlight/panel0-backlight/brightness"
# 读取配置 (均为数值)
ui_max_bri="$(cat "$CONFIG_DIR/ui_max_bri.txt")"
max_bri="$(cat "$CONFIG_DIR/max_bri.txt")"
sleep_time="$(cat "$CONFIG_DIR/sleep_time.txt" 2>/dev/null)"
auto_bri_sleep="$(cat "$CONFIG_DIR/auto_bri_sleep.txt" 2>/dev/null)"
# 解析休眠时间 (格式: HHMM-HHMM, 例如 1900-0600)
sleep_start="${sleep_time%-*}" # 1900
sleep_end="${sleep_time#*-}" # 0600
# 判断当前是否处于休眠时段
IS_SLEEP_TIME() {
local now
now="$(date '+%H%M')" # 当前时间, 例如 "2130"
# 未配置或格式无效则不休眠
[ -z "$sleep_start" ] || [ -z "$sleep_end" ] && return 1
# 起止相同表示不启用休眠
[ "$sleep_start" = "$sleep_end" ] && return 1
if [ "$sleep_start" -gt "$sleep_end" ]; then
# 跨午夜: 1900-0600 → 当前 >= 19:00 或 当前 < 06:00
[ "$now" -ge "$sleep_start" ] || [ "$now" -lt "$sleep_end" ]
else
# 不跨午夜: 0100-0600 → 当前 >= 01:00 且 当前 < 06:00
[ "$now" -ge "$sleep_start" ] && [ "$now" -lt "$sleep_end" ]
fi
}
# 目标亮度
target_bri="$max_bri"
steps_num="$(cat "$CONFIG_DIR/steps_num.txt" 2>/dev/null)"
[ -z "$steps_num" ] && steps_num="50" # 步数 (默认 50)
# 循环调整
update_all() {
local step
# 在调整前的这一刻读取当前亮度作为起始值
start_bri="$(cat "$now_bri_file")"
bri_diff="$((target_bri - start_bri))"
step_value="$((bri_diff / steps_num))"
# 如果步长为 0 (差值太小), 直接设置目标亮度
if [ "$step_value" -eq 0 ]; then
_log "($$) 步长为 0, 直接设置目标亮度: $target_bri"
echo -n "$target_bri" >"$now_bri_file" && return 0 || return 1
fi
_log "($$) 开始调整亮度: $start_bri -> $target_bri, 共 $steps_num 步, 每步 $step_value"
for step in $(seq 1 "$steps_num"); do
echo -n $((start_bri + step * step_value)) >"$now_bri_file"
sleep 0.02
done
# 最后一步写入目标亮度, 确保精确到位
echo -n "$target_bri" >"$now_bri_file" && return 0 || return 1
}
# 检测亮度是否符合条件
CHECK_BRI() {
local cycle_num
local now_bri
# 循环 10 次 (检查 5s)
# shellcheck disable=SC2034
for cycle_num in $(seq 1 10); do
now_bri="$(cat "$now_bri_file")"
if [ "$now_bri" -ge "$ui_max_bri" ]; then
if update_all; then
_log "($$) 亮度调整完成!"
_log "--------------------"
return 0
else
_log "($$) 亮度调整失败!"
_log "--------------------"
return 1
fi
else
sleep 0.5 # 不符合条件, 等待后再次检测
fi
done
_log "($$) 亮度 ($(cat "$now_bri_file")) 未达到条件, 本次调整取消"
return 2
}
# 判断是否开启了自动亮度且需要休眠
IS_AUTO_BRI_SLEEP() {
if [ "$auto_bri_sleep" = "1" ]; then
local mode
mode="$(settings get system screen_brightness_mode 2>/dev/null)"
if [ "$mode" = "1" ]; then
return 0 # 需要休眠
fi
fi
return 1 # 不需要休眠
}
MAIN() {
# 休眠时段内不调整亮度
if IS_SLEEP_TIME; then
_log "($$) 当前处于休眠时段 ($sleep_start-$sleep_end), 跳过本次调整"
_log "--------------------"
sleep 1
rm -f "$flag_file"
return
fi
if IS_AUTO_BRI_SLEEP; then
_log "($$) 当前为自动亮度模式, 根据设置跳过本次调整"
_log "--------------------"
sleep 1
rm -f "$flag_file"
return
fi
_log "($$) 亮度被调整, 将在 0.5s 后检测是否符合条件"
sleep 0.5
CHECK_BRI
sleep 0.5 # 稍微延迟一会避免 inotifyd 刚启动就检测到亮度变化
rm -f "$flag_file" # 删除 flag, 允许下一次调整
}
MAIN
exit 0
Regular → Executable
+58 -87
View File
@@ -1,98 +1,69 @@
#!/system/bin/sh
# 服务脚本
# By Yule
sleep 1
#shellcheck shell=ash
# 定义一些要使用的变量
MODDIR=${0%/*}
dec_file_temp="$MODDIR/more/module.prop.template"
dec_file_tempb="$MODDIR/more/module.prop.template.b"
dec_file="$MODDIR/module.prop"
now_bri_file="/sys/devices/virtual/mi_display/disp_feature/disp-DSI-0/brightness_clone"
max_bri_file="$MODDIR/brightness/max"
lim_bri_file="$MODDIR/brightness/lim"
lim_bri=$(cat $lim_bri_file)
touch $MODDIR/modenable
inj_bri=''
MODDIR="${0%/*}"
CONFIG_DIR="$MODDIR/config"
PID_DIR="$MODDIR/pid"
# 读取配置
. $MODDIR/config.prop
echo $MODDIR > $MODDIR/script/moddir
now_bri_file="/sys/class/backlight/panel0-backlight/brightness"
# 所有输出导出到日志
exec >> "$MODDIR/service.sh.log" 2>&1
# 配置文件路径
ui_max_bri_file="$CONFIG_DIR/ui_max_bri.txt"
max_bri_file="$CONFIG_DIR/max_bri.txt"
sleep_time_file="$CONFIG_DIR/sleep_time.txt"
# 识别是否自定义了亮度
custom_check() {
if [ $customize_limbrightness = "default" ]; then
lim_bri="$(cat $lim_bri_file)"
else
lim_bri="$customize_limbrightness"
fi
if [ $customize_maxbrightness = "default" ]; then
max_bri="$(cat $max_bri_file)"
else
max_bri="$customize_maxbrightness"
fi
pid_file="$PID_DIR/inotifyd.pid"
log_file="$MODDIR/service.log"
# inotifyd 用法:
# inotifyd 程序 文件[:掩码] ...
#
# 当文件发生与 掩码(MASK) 匹配的文件系统事件时,运行 程序(PROG):
# 程序 事件 文件 [目录文件]
# 如果 程序(PROG) 为 "-",则事件将发送到标准输出 (stdout)。
#
# 以下是针对“此文件”的事件:
# a 已访问 (accessed) c 已修改 (modified) e 元数据更改 (metadata change) w 已关闭 (可写)
# r 已打开 (opened) D 已删除 (deleted) M 已移动 (moved) 0 已关闭 (不可写)
# u 已卸载 (unmounted) o 溢出 (overflow) x 不可监控 (unwatchable)
#
# 以下是针对“此目录中”的文件事件:
# m 移入 (moved in) y 移出 (moved out) n 已创建 (created) d 已删除 (deleted)
# 当所有文件都发生 x 事件时,inotifyd 将退出(在等待程序运行结束后)。
# 监控当前亮度文件的日志
# # inotifyd - /sys/class/backlight/panel0-backlight/brightness
# c /sys/class/backlight/panel0-backlight/brightness # 已修改
# r /sys/class/backlight/panel0-backlight/brightness # 已打开
# a /sys/class/backlight/panel0-backlight/brightness # 已访问
# 0 /sys/class/backlight/panel0-backlight/brightness # 已关闭(不可写)
# -- 经过了 1 亮度值的调整 --
# c /sys/class/backlight/panel0-backlight/brightness
# r /sys/class/backlight/panel0-backlight/brightness
# a /sys/class/backlight/panel0-backlight/brightness
# 0 /sys/class/backlight/panel0-backlight/brightness
# ...
_log() {
printf '[%s] [service] %s\n' "$(date '+%d %H:%M:%S.%3N')" "$1" >>"$log_file"
}
dec_up() {
cp $dec_file_temp $dec_file_tempb
echo -n "$1" >> $dec_file_tempb
cp $dec_file_tempb $dec_file
}
# 等待系统就绪
sleep 30
dec_success() {
dec_up "模块状态 调整完成 | 当前亮度 ${now_bri} | 前台最高 ${lim_bri} | 峰值亮度 ${max_bri} | 刷新间隔 ${flash_interval}s"
}
_log "LuminPro 已启动"
_log "- 前台最大亮度: $(cat "$ui_max_bri_file")"
_log "- 峰值最大亮度: $(cat "$max_bri_file")"
_log "- 休眠时间: $(cat "$sleep_time_file")"
dec_failure() {
dec_up "模块状态 调整失败,请检查日志 ${MODDIR}/service.sh.log | 当前亮度 ${now_bri} | 前台最高 ${lim_bri} | 极限亮度 ${max_bri} | 刷新间隔 ${flash_interval}s"
}
mkdir -p "$PID_DIR"
[ -f "$pid_file" ] && rm -f "$pid_file"
[ -f "$PID_DIR/up.flag" ] && rm -f "$PID_DIR/up.flag"
chmod 755 "$MODDIR/script/up.sh"
bri_up() {
now_bri=$(cat "$now_bri_file")
inj_bri=$((now_bri + eve_bri))
echo -n "$inj_bri" > "$now_bri_file"
# echo "$now_bri"
}
# 启动 inotifyd 监控
inotifyd "$MODDIR/script/up.sh" "$now_bri_file:c" &
inotifyd_pid="$!"
echo "$inotifyd_pid" >"$pid_file"
bri_promot() {
mod_info="调整中"
dif_bri=$((max_bri - now_bri))
eve_bri=$((dif_bri / 50))
for step in $(seq 1 50); do
bri_up
done
now_bri=$(cat $now_bri_file)
if [ $now_bri -lt $max_bri ]; then
echo -n "$max_bri" > $now_bri_file
fi
}
# 循环检查
while true; do
. $MODDIR/config.prop
custom_check
now_bri=$(cat $now_bri_file)
lim_bri=$(cat $lim_bri_file)
if [ -f $MODDIR/modenable ]; then
mod_info="😋启用"
else
mod_info="😭关闭"
fi
dec_up "模块状态 ${mod_info} | 当前亮度 ${now_bri} | 前台最高 ${lim_bri} | 峰值亮度 ${max_bri} | 刷新间隔 ${flash_interval}s"
if [ -f $MODDIR/modenable ] && [ $now_bri -eq $lim_bri ]; then
bri_promot
if [ $? -eq 0 ]; then
dec_success
else
dec_failure
fi
fi
# echo $now_bri
echo -n $now_bri > $MODDIR/brightness/now
sleep $flash_interval
done
exit 0
View File
Whitespace-only changes.
+379
View File
@@ -0,0 +1,379 @@
import { exec } from 'kernelsu';
import { createIcons, Sun, Settings, Save, Activity, RefreshCw, FileText } from 'lucide';
const CONFIG_DIR = '/data/adb/modules/LuminPro/config';
const BACKUP_DIR = '/data/adb/modules/LuminPro/config/.backup';
const PID_FILE = '/data/adb/modules/LuminPro/pid/inotifyd.pid';
const FLAG_FILE = '/data/adb/modules/LuminPro/pid/up.flag';
const STOP_FLAG_FILE = '/data/adb/modules/LuminPro/pid/stop.flag';
const LOG_FILE = '/data/adb/modules/LuminPro/service.log';
const NOW_BRI_FILE = '/sys/class/backlight/panel0-backlight/brightness';
const SYS_MAX_BRI_FILE = '/sys/class/backlight/panel0-backlight/max_brightness';
// ==========================
// 工具函数
// ==========================
function showToast(msg) {
const toast = document.getElementById('toast');
toast.textContent = msg;
toast.classList.add('show');
setTimeout(() => toast.classList.remove('show'), 3000);
}
// 封装的 exec,按需返回真实执行结果
async function runCmd(cmd) {
try {
const res = await exec(cmd);
return res;
} catch (e) {
console.error(e);
return { errno: -1, stdout: '', stderr: String(e) };
}
}
// 写入文件
async function writeFile(path, content) {
const safeContent = String(content).replace(/'/g, "'\\''");
return runCmd(`echo -n '${safeContent}' > "${path}"`);
}
// ==========================
// 业务逻辑
// ==========================
// 1. 加载配置
async function loadConfig() {
const [uiRes, maxRes, sleepRes, autoRes, stepsRes, logSizeRes] = await Promise.all([
runCmd(`cat "${CONFIG_DIR}/ui_max_bri.txt"`),
runCmd(`cat "${CONFIG_DIR}/max_bri.txt"`),
runCmd(`cat "${CONFIG_DIR}/sleep_time.txt"`),
runCmd(`cat "${CONFIG_DIR}/auto_bri_sleep.txt"`),
runCmd(`cat "${CONFIG_DIR}/steps_num.txt"`),
runCmd(`cat "${CONFIG_DIR}/log_max_size.txt"`)
]);
if (uiRes.errno === 0) document.getElementById('input-ui-max-bri').value = uiRes.stdout.trim();
if (maxRes.errno === 0) document.getElementById('input-max-bri').value = maxRes.stdout.trim();
if (sleepRes.errno === 0) {
const timeVal = sleepRes.stdout.trim();
const modeSwitch = document.getElementById('input-sleep-mode');
const expandArea = document.getElementById('sleep-time-expand');
if(timeVal && timeVal.includes('-')) {
modeSwitch.checked = true;
expandArea.classList.add('show');
const [start, end] = timeVal.split('-');
if(start.length === 4) {
document.getElementById('input-sleep-start-h').value = start.slice(0, 2);
document.getElementById('input-sleep-start-m').value = start.slice(2);
}
if(end.length === 4) {
document.getElementById('input-sleep-end-h').value = end.slice(0, 2);
document.getElementById('input-sleep-end-m').value = end.slice(2);
}
} else {
modeSwitch.checked = false;
expandArea.classList.remove('show');
// 给个可感知的默认显示值
document.getElementById('input-sleep-start-h').value = '19';
document.getElementById('input-sleep-start-m').value = '00';
document.getElementById('input-sleep-end-h').value = '06';
document.getElementById('input-sleep-end-m').value = '00';
}
}
if (autoRes.errno === 0) document.getElementById('input-auto-bri-sleep').checked = autoRes.stdout.trim() === '1';
if (stepsRes.errno === 0) {
const v = stepsRes.stdout.trim();
document.getElementById('input-steps-num').value = v ? v : '50';
} else {
document.getElementById('input-steps-num').value = '50';
}
if (logSizeRes.errno === 0) {
const v = logSizeRes.stdout.trim();
document.getElementById('input-log-max-size').value = v ? v : '500';
} else {
document.getElementById('input-log-max-size').value = '500';
}
}
// 2. 保存配置并重启服务
async function saveConfig() {
const uiMax = document.getElementById('input-ui-max-bri').value;
const maxBri = document.getElementById('input-max-bri').value;
const pad = (v) => String(v).padStart(2, '0');
const sleepMode = document.getElementById('input-sleep-mode').checked;
let sleepTime = "";
if (sleepMode) {
const sH = pad(document.getElementById('input-sleep-start-h').value);
const sM = pad(document.getElementById('input-sleep-start-m').value);
const eH = pad(document.getElementById('input-sleep-end-h').value);
const eM = pad(document.getElementById('input-sleep-end-m').value);
sleepTime = `${sH}${sM}-${eH}${eM}`;
}
const autoBriSleep = document.getElementById('input-auto-bri-sleep').checked ? '1' : '0';
const stepsNum = document.getElementById('input-steps-num').value || '50';
const logMaxSize = document.getElementById('input-log-max-size').value || '500';
if (!uiMax || !maxBri) {
showToast('亮度值不能为空');
return;
}
showToast('保存中...');
// 保存到文件 (若不存在则可能失败,前提是模块已经建立 config 目录)
await writeFile(`${CONFIG_DIR}/ui_max_bri.txt`, uiMax);
await writeFile(`${CONFIG_DIR}/max_bri.txt`, maxBri);
await writeFile(`${CONFIG_DIR}/sleep_time.txt`, sleepTime);
await writeFile(`${CONFIG_DIR}/auto_bri_sleep.txt`, autoBriSleep);
await writeFile(`${CONFIG_DIR}/steps_num.txt`, stepsNum);
await writeFile(`${CONFIG_DIR}/log_max_size.txt`, logMaxSize);
// 通过写亮度节点一个无变化的值,强制触发 inotifyd 执行 up.sh 以重新读取配置
// 注意:需要先清除 flag 以防 up.sh 挂起
await runCmd(`rm -f "${FLAG_FILE}"`);
// 或者最干脆的办法,直接杀掉 inotifyd,然后用模块本来的启动逻辑。
// 但是 up.sh 本来就没有后台重启机制,它是通过 inotifyd 重启自己的。
// 稳妥起见:
const pidRes = await runCmd(`cat "${PID_FILE}"`);
if (pidRes.errno === 0 && pidRes.stdout.trim()) {
showToast('配置已保存 (可能需要在下次调整时生效)');
} else {
showToast('配置已保存 (服务未运行)');
}
}
// 2.5 恢复默认
let isResetConfirming = false;
let resetTimer = null;
function resetRestoreButton() {
const btn = document.getElementById('btn-reset');
btn.textContent = '恢复默认';
btn.classList.remove('btn-danger');
isResetConfirming = false;
if(resetTimer) clearTimeout(resetTimer);
}
async function handleReset() {
const btn = document.getElementById('btn-reset');
if (!isResetConfirming) {
// 进入确认状态
isResetConfirming = true;
btn.textContent = '确认';
btn.classList.add('btn-danger');
// 5秒后自动重置回原来状态
resetTimer = setTimeout(resetRestoreButton, 5000);
return;
}
// 执行恢复动作
showToast('正在恢复默认配置...');
resetRestoreButton();
// 读取备份 (或者回退到默认逻辑)
const [uiRes, maxRes, sleepRes, autoRes, stepsRes, logSizeRes] = await Promise.all([
runCmd(`cat "${BACKUP_DIR}/ui_max_bri.txt"`),
runCmd(`cat "${BACKUP_DIR}/max_bri.txt"`),
runCmd(`cat "${BACKUP_DIR}/sleep_time.txt"`),
runCmd(`cat "${BACKUP_DIR}/auto_bri_sleep.txt"`),
runCmd(`cat "${BACKUP_DIR}/steps_num.txt"`),
runCmd(`cat "${BACKUP_DIR}/log_max_size.txt"`)
]);
// 填入值
if (uiRes.errno === 0) document.getElementById('input-ui-max-bri').value = uiRes.stdout.trim();
if (maxRes.errno === 0) document.getElementById('input-max-bri').value = maxRes.stdout.trim();
if (sleepRes.errno === 0) {
const tV = sleepRes.stdout.trim();
const modeSwitch = document.getElementById('input-sleep-mode');
const expandArea = document.getElementById('sleep-time-expand');
if(tV.includes('-')) {
modeSwitch.checked = true;
expandArea.classList.add('show');
const [s, e] = tV.split('-');
if(s.length === 4) {
document.getElementById('input-sleep-start-h').value = s.slice(0, 2);
document.getElementById('input-sleep-start-m').value = s.slice(2);
}
if(e.length === 4) {
document.getElementById('input-sleep-end-h').value = e.slice(0, 2);
document.getElementById('input-sleep-end-m').value = e.slice(2);
}
}
} else {
document.getElementById('input-sleep-mode').checked = true;
document.getElementById('sleep-time-expand').classList.add('show');
document.getElementById('input-sleep-start-h').value = '19';
document.getElementById('input-sleep-start-m').value = '00';
document.getElementById('input-sleep-end-h').value = '06';
document.getElementById('input-sleep-end-m').value = '00';
}
document.getElementById('input-auto-bri-sleep').checked = (autoRes.errno === 0) ? (autoRes.stdout.trim() === '1') : true;
document.getElementById('input-steps-num').value = (stepsRes.errno === 0) ? stepsRes.stdout.trim() : '50';
document.getElementById('input-log-max-size').value = (logSizeRes.errno === 0) ? logSizeRes.stdout.trim() : '500';
// 直接触发保存
await saveConfig();
}
// 3. 刷新实时状态
async function loadStatus() {
const [curRes, sysRes, pidRes, stopRes] = await Promise.all([
runCmd(`cat "${NOW_BRI_FILE}"`),
runCmd(`cat "${SYS_MAX_BRI_FILE}"`),
runCmd(`cat "${PID_FILE}"`),
runCmd(`[ -f "${STOP_FLAG_FILE}" ] && echo "1" || echo "0"`)
]);
const isPaused = stopRes.stdout.trim() === '1';
const running = pidRes.errno === 0 && pidRes.stdout.trim();
const statusDot = document.querySelector('.header-status .status-dot');
const statusText = document.querySelector('.header-status .status-text');
const toggleBtn = document.getElementById('btn-toggle-service');
if (isPaused) {
statusDot.style.backgroundColor = 'var(--md-sys-color-error)';
statusText.textContent = '已暂停';
toggleBtn.textContent = '启用';
} else if (running) {
statusDot.style.backgroundColor = '#4caf50';
statusText.textContent = '运行中';
toggleBtn.textContent = '暂停';
} else {
statusDot.style.backgroundColor = 'var(--md-sys-color-error)';
statusText.textContent = '未运行';
toggleBtn.textContent = '暂停';
}
// 填入数值
document.getElementById('status-current-bri').textContent = curRes.errno === 0 ? curRes.stdout.trim() : '—';
document.getElementById('status-sys-max-bri').textContent = sysRes.errno === 0 ? sysRes.stdout.trim() : '—';
document.getElementById('status-inotifyd-pid').textContent = running ? pidRes.stdout.trim() : '离线';
// 简易判断当前休眠状态 (只为了前端展示,不影响后端核心)
const isEnabled = document.getElementById('input-sleep-mode').checked;
const sH = document.getElementById('input-sleep-start-h').value;
const sM = document.getElementById('input-sleep-start-m').value;
const eH = document.getElementById('input-sleep-end-h').value;
const eM = document.getElementById('input-sleep-end-m').value;
let isSleep = false;
if(isEnabled && sH && sM && eH && eM) {
const now = new Date();
const nV = now.getHours() * 100 + now.getMinutes();
const sNum = parseInt(sH, 10) * 100 + parseInt(sM, 10);
const eNum = parseInt(eH, 10) * 100 + parseInt(eM, 10);
if (sNum > eNum) {
if(nV >= sNum || nV < eNum) isSleep = true;
} else if (sNum < eNum) {
if(nV >= sNum && nV < eNum) isSleep = true;
}
}
document.getElementById('status-sleep').textContent = isSleep ? '休眠中' : '非休眠';
}
// 6. 暂停/启用服务
async function toggleService() {
const res = await runCmd(`sh /data/adb/modules/LuminPro/action.sh`);
if (res.errno === 0) {
showToast(res.stdout.trim() || '状态已切换');
} else {
showToast('操作失败: ' + res.stderr);
}
await loadStatus();
}
async function restartService() {
const btn = document.getElementById('btn-restart-service');
showToast('正在重启服务...');
btn.disabled = true;
// 执行重启脚本
const res = await runCmd(`sh /data/adb/modules/LuminPro/script/restart.sh`);
if (res.errno === 0) {
showToast('服务已成功重启');
} else {
showToast('重启失败: ' + res.stderr);
}
// 延迟刷新状态以确保 PID 文件已写入
setTimeout(async () => {
await loadStatus();
btn.disabled = false;
}, 1000);
}
async function loadLogs() {
const logEl = document.getElementById('log-output');
// 读取最后 50 行日志
const res = await runCmd(`tail -n 50 "${LOG_FILE}"`);
if (res.errno === 0) {
const freshLog = res.stdout.trim() || '暂无日志';
// 只有当日志内容变化时才更新 DOM, 减少闪烁
if(logEl.textContent !== freshLog) {
logEl.textContent = freshLog;
logEl.scrollTop = logEl.scrollHeight;
}
}
}
// 自动刷新循环
async function startAutoRefresh() {
await Promise.all([loadStatus(), loadLogs()]);
setTimeout(startAutoRefresh, 500); // 0.5s 周期
}
// ==========================
// 初始化
// ==========================
async function init() {
// 初始化 Lucide 图标
createIcons({
icons: {
Sun,
Settings,
Save,
Activity,
RefreshCw,
FileText
}
});
// 绑定事件
document.getElementById('btn-save').addEventListener('click', saveConfig);
document.getElementById('btn-reset').addEventListener('click', handleReset);
document.getElementById('btn-toggle-service').addEventListener('click', toggleService);
document.getElementById('btn-restart-service').addEventListener('click', restartService);
// 定时休眠折叠逻辑
document.getElementById('input-sleep-mode').addEventListener('change', (e) => {
const expandArea = document.getElementById('sleep-time-expand');
if (e.target.checked) {
expandArea.classList.add('show');
} else {
expandArea.classList.remove('show');
}
});
// 初次加载配置
await loadConfig();
// 开启自动刷新状态和日志 (内置了已包含 loadStatus 和 loadLogs)
startAutoRefresh();
}
// DOM 加载完成后运行
document.addEventListener('DOMContentLoaded', init);
+476
View File
@@ -0,0 +1,476 @@
:root {
--md-sys-color-background: #111318;
--md-sys-color-on-background: #e2e2e9;
--md-sys-color-surface: #1e1f25;
--md-sys-color-surface-container: #212429;
--md-sys-color-surface-container-high: #2b2930;
--md-sys-color-on-surface: #e2e2e9;
--md-sys-color-on-surface-variant: #c4c6d0;
--md-sys-color-primary: #a8c7fa;
--md-sys-color-on-primary: #062e6f;
--md-sys-color-primary-container: #1b4b9b;
--md-sys-color-on-primary-container: #d3e3fd;
--md-sys-color-outline: #8e9099;
--md-sys-color-outline-variant: #44474f;
--md-sys-color-error: #ffb4ab;
--md-sys-color-on-error: #690005;
--border-radius-m: 16px;
--border-radius-s: 8px;
--spacing-s: 8px;
--spacing-m: 16px;
--spacing-l: 24px;
}
@font-face {
font-family: 'Geist';
src: url('/Geist-VariableFont_wght.ttf') format('truetype');
font-weight: 100 900;
font-style: normal;
}
@font-face {
font-family: 'Google Sans Code';
src: url('/GoogleSansCode-VariableFont_wght.ttf') format('truetype');
font-weight: 100 900;
font-style: normal;
}
* {
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
body {
margin: 0;
padding: 0;
/* 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;
line-height: 1.5;
}
#app {
padding: var(--spacing-m);
max-width: 600px;
margin: 0 auto;
display: flex;
flex-direction: column;
gap: var(--spacing-m);
}
/* Header */
.app-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: var(--spacing-m) 0;
}
.header-content {
display: flex;
align-items: center;
gap: var(--spacing-m);
}
.header-icon {
font-size: 2rem;
background: var(--md-sys-color-surface-container-high);
width: 48px;
height: 48px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.header-text h1 {
margin: 0;
font-size: 1.25rem;
font-weight: 500;
color: var(--md-sys-color-on-background);
}
.header-subtitle {
margin: 0;
font-size: 0.875rem;
color: var(--md-sys-color-on-surface-variant);
}
.header-status {
display: flex;
align-items: center;
gap: 6px;
background: var(--md-sys-color-surface-container);
padding: 4px 12px;
border-radius: 100px;
font-size: 0.875rem;
}
.status-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background-color: var(--md-sys-color-error); /* 默认离线红色,在线动态改为绿色 #4caf50 */
}
/* Cards */
.card {
background-color: var(--md-sys-color-surface);
border-radius: var(--border-radius-m);
padding: var(--spacing-l);
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
}
.card-header {
display: flex;
align-items: center;
gap: var(--spacing-s);
margin-bottom: var(--spacing-l);
}
.card-header h2 {
margin: 0;
font-size: 1.125rem;
font-weight: 500;
color: var(--md-sys-color-on-surface);
flex-grow: 1;
}
/* Config Items */
.config-group {
margin-bottom: var(--spacing-l);
padding: var(--spacing-m);
background-color: var(--md-sys-color-surface-container);
border-radius: var(--border-radius-s);
}
.group-title {
margin: 0 0 var(--spacing-m) 0;
font-size: 0.875rem;
font-weight: 600;
color: var(--md-sys-color-primary);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.config-item {
display: flex;
justify-content: space-between;
align-items: center;
}
.config-item + .config-item {
margin-top: var(--spacing-m);
}
.config-label {
display: flex;
flex-direction: column;
}
.config-name {
font-size: 1rem;
color: var(--md-sys-color-on-surface);
}
.config-desc {
font-size: 0.875rem;
color: var(--md-sys-color-on-surface-variant);
}
.config-input {
background-color: var(--md-sys-color-surface-container-high);
color: var(--md-sys-color-on-surface);
border: 1px solid var(--md-sys-color-outline);
border-radius: var(--border-radius-s);
padding: 8px 12px;
font-size: 1rem;
width: 100px;
text-align: right;
font-family: inherit;
outline: none;
transition: border-color 0.2s, box-shadow 0.2s;
}
.config-input:focus {
border-color: var(--md-sys-color-primary);
box-shadow: 0 0 0 2px rgba(168, 199, 250, 0.3);
}
.config-input-wide {
width: 140px;
}
.config-item-expand {
display: flex;
justify-content: flex-end;
margin-top: var(--spacing-s);
max-height: 0;
overflow: hidden;
opacity: 0;
transition: all 0.3s ease;
}
.config-item-expand.show {
max-height: 100px; /* 调整为适合内容的高度 */
opacity: 1;
margin-bottom: var(--spacing-m);
}
/* Custom Time Picker Styles */
.custom-time-picker {
display: flex;
align-items: center;
gap: 8px;
}
.time-unit {
display: flex;
align-items: center;
gap: 2px;
background-color: var(--md-sys-color-surface-container-high);
padding: 2px 6px;
border-radius: var(--border-radius-s);
border: 1px solid var(--md-sys-color-outline);
}
.time-input {
width: 32px;
background-color: transparent;
color: var(--md-sys-color-on-surface);
border: none;
font-size: 0.875rem;
text-align: center;
font-family: 'Google Sans Code', monospace;
outline: none;
-moz-appearance: textfield;
}
.time-input::-webkit-outer-spin-button,
.time-input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
.time-sep {
color: var(--md-sys-color-on-surface-variant);
font-size: 0.875rem;
}
/* Switch Styles */
.switch {
position: relative;
display: inline-block;
width: 52px;
height: 32px;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: var(--md-sys-color-surface-container-high);
transition: .4s;
border-radius: 34px;
border: 2px solid var(--md-sys-color-outline);
}
.slider:before {
position: absolute;
content: "";
height: 24px;
width: 24px;
left: 2px;
bottom: 2px;
background-color: var(--md-sys-color-outline);
transition: .4s;
border-radius: 50%;
}
input:checked + .slider {
background-color: var(--md-sys-color-primary-container);
border-color: var(--md-sys-color-primary);
}
input:checked + .slider:before {
transform: translateX(20px);
background-color: var(--md-sys-color-primary);
}
/* Status Grid */
.status-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: var(--spacing-m);
}
.status-item {
display: flex;
flex-direction: column;
background-color: var(--md-sys-color-surface-container);
padding: var(--spacing-m);
border-radius: var(--border-radius-s);
}
.status-label {
font-size: 0.75rem;
color: var(--md-sys-color-on-surface-variant);
margin-bottom: 4px;
}
.status-value {
font-size: 1.125rem;
font-weight: 500;
color: var(--md-sys-color-primary);
word-break: break-all;
}
/* Actions */
.card-actions {
display: flex;
justify-content: flex-end;
gap: 12px;
margin-top: var(--spacing-l);
padding-top: var(--spacing-m);
border-top: 1px solid var(--md-sys-color-outline-variant);
}
/* Buttons */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 10px 24px;
border-radius: 100px;
border: none;
font-size: 0.875rem;
font-weight: 500;
font-family: inherit;
cursor: pointer;
transition: background-color 0.2s, opacity 0.2s;
}
.btn:active {
opacity: 0.8;
}
.btn-primary {
background-color: var(--md-sys-color-primary);
color: var(--md-sys-color-on-primary);
}
.btn-outline {
background-color: transparent;
border: 1px solid var(--md-sys-color-outline);
color: var(--md-sys-color-primary);
}
.btn-outline-s, .btn-text-s {
background-color: transparent;
border: 1px solid var(--md-sys-color-outline-variant);
color: var(--md-sys-color-primary);
padding: 4px 10px;
min-width: 50px;
height: 28px;
font-size: 0.75rem;
border-radius: var(--border-radius-s);
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
white-space: nowrap;
}
.btn-text-s:active {
background-color: var(--md-sys-color-surface-container-high);
}
.btn-danger {
background-color: var(--md-sys-color-error) !important;
color: var(--md-sys-color-on-error) !important;
border: none !important;
}
/* Header Actions container */
.header-actions {
display: flex;
align-items: center;
gap: 8px;
}
.btn-icon-only {
background: transparent;
border: none;
color: var(--md-sys-color-on-surface-variant);
font-size: 1.25rem;
cursor: pointer;
padding: 4px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.btn-icon-only:active {
background-color: var(--md-sys-color-surface-container-high);
}
.animate-spin {
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* Logs */
.log-output {
font-family: 'Google Sans Code', 'Consolas', 'Courier New', monospace;
font-size: 0.75rem;
padding: var(--spacing-s);
border-radius: var(--border-radius-s);
height: 200px;
overflow-y: auto;
margin: 0;
white-space: pre-wrap;
word-wrap: break-word;
}
/* Simple Toast */
.toast {
position: fixed;
bottom: 24px;
left: 50%;
transform: translateX(-50%) translateY(100px);
background-color: var(--md-sys-color-on-surface);
color: var(--md-sys-color-surface);
padding: 12px 24px;
border-radius: var(--border-radius-s);
font-size: 0.875rem;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
z-index: 1000;
width: max-content;
max-width: 90vw;
text-align: center;
}
.toast.show {
transform: translateX(-50%) translateY(0);
}
-2
View File
@@ -1,2 +0,0 @@
MODDIR=${0%/*}
rm -rf $MODDIR
+6
View File
@@ -0,0 +1,6 @@
{
"versionCode": 2202,
"version": "V2.2",
"zipUrl": "https://share.yule.ink/magisk/mod/luminpro/module/LuminPro_V2.2-2202.zip",
"changelog": "https://share.yule.ink/magisk/mod/luminpro/changelog.md"
}
+8
View File
@@ -0,0 +1,8 @@
import { defineConfig } from 'vite';
export default defineConfig({
build: {
outDir: 'webroot',
emptyOutDir: true,
},
});
Binary file not shown.
Binary file not shown.
+1
View File
@@ -0,0 +1 @@
:root{--md-sys-color-background:#111318;--md-sys-color-on-background:#e2e2e9;--md-sys-color-surface:#1e1f25;--md-sys-color-surface-container:#212429;--md-sys-color-surface-container-high:#2b2930;--md-sys-color-on-surface:#e2e2e9;--md-sys-color-on-surface-variant:#c4c6d0;--md-sys-color-primary:#a8c7fa;--md-sys-color-on-primary:#062e6f;--md-sys-color-primary-container:#1b4b9b;--md-sys-color-on-primary-container:#d3e3fd;--md-sys-color-outline:#8e9099;--md-sys-color-outline-variant:#44474f;--md-sys-color-error:#ffb4ab;--md-sys-color-on-error:#690005;--border-radius-m:16px;--border-radius-s:8px;--spacing-s:8px;--spacing-m:16px;--spacing-l:24px}@font-face{font-family:Geist;src:url(/Geist-VariableFont_wght.ttf)format("truetype");font-weight:100 900;font-style:normal}@font-face{font-family:Google Sans Code;src:url(/GoogleSansCode-VariableFont_wght.ttf)format("truetype");font-weight:100 900;font-style:normal}*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}body{padding:0;padding-top:var(--safe-area-inset-top,0);padding-bottom:var(--safe-area-inset-bottom,0);background-color:var(--md-sys-color-background);color:var(--md-sys-color-on-background);margin:0;font-family:Geist,system-ui,-apple-system,sans-serif;line-height:1.5}#app{padding:var(--spacing-m);gap:var(--spacing-m);flex-direction:column;max-width:600px;margin:0 auto;display:flex}.app-header{padding:var(--spacing-m) 0;justify-content:space-between;align-items:center;display:flex}.header-content{align-items:center;gap:var(--spacing-m);display:flex}.header-icon{background:var(--md-sys-color-surface-container-high);border-radius:50%;justify-content:center;align-items:center;width:48px;height:48px;font-size:2rem;display:flex}.header-text h1{color:var(--md-sys-color-on-background);margin:0;font-size:1.25rem;font-weight:500}.header-subtitle{color:var(--md-sys-color-on-surface-variant);margin:0;font-size:.875rem}.header-status{background:var(--md-sys-color-surface-container);border-radius:100px;align-items:center;gap:6px;padding:4px 12px;font-size:.875rem;display:flex}.status-dot{background-color:var(--md-sys-color-error);border-radius:50%;width:8px;height:8px}.card{background-color:var(--md-sys-color-surface);border-radius:var(--border-radius-m);padding:var(--spacing-l);box-shadow:0 1px 3px #0000004d,0 4px 8px 3px #00000026}.card-header{align-items:center;gap:var(--spacing-s);margin-bottom:var(--spacing-l);display:flex}.card-header h2{color:var(--md-sys-color-on-surface);flex-grow:1;margin:0;font-size:1.125rem;font-weight:500}.config-group{margin-bottom:var(--spacing-l);padding:var(--spacing-m);background-color:var(--md-sys-color-surface-container);border-radius:var(--border-radius-s)}.group-title{margin:0 0 var(--spacing-m) 0;color:var(--md-sys-color-primary);text-transform:uppercase;letter-spacing:.5px;font-size:.875rem;font-weight:600}.config-item{justify-content:space-between;align-items:center;display:flex}.config-item+.config-item{margin-top:var(--spacing-m)}.config-label{flex-direction:column;display:flex}.config-name{color:var(--md-sys-color-on-surface);font-size:1rem}.config-desc{color:var(--md-sys-color-on-surface-variant);font-size:.875rem}.config-input{background-color:var(--md-sys-color-surface-container-high);color:var(--md-sys-color-on-surface);border:1px solid var(--md-sys-color-outline);border-radius:var(--border-radius-s);text-align:right;outline:none;width:100px;padding:8px 12px;font-family:inherit;font-size:1rem;transition:border-color .2s,box-shadow .2s}.config-input:focus{border-color:var(--md-sys-color-primary);box-shadow:0 0 0 2px #a8c7fa4d}.config-input-wide{width:140px}.config-item-expand{margin-top:var(--spacing-s);opacity:0;justify-content:flex-end;max-height:0;transition:all .3s;display:flex;overflow:hidden}.config-item-expand.show{opacity:1;max-height:100px;margin-bottom:var(--spacing-m)}.custom-time-picker{align-items:center;gap:8px;display:flex}.time-unit{background-color:var(--md-sys-color-surface-container-high);border-radius:var(--border-radius-s);border:1px solid var(--md-sys-color-outline);align-items:center;gap:2px;padding:2px 6px;display:flex}.time-input{width:32px;color:var(--md-sys-color-on-surface);text-align:center;-moz-appearance:textfield;background-color:#0000;border:none;outline:none;font-family:Google Sans Code,monospace;font-size:.875rem}.time-input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.time-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.time-sep{color:var(--md-sys-color-on-surface-variant);font-size:.875rem}.switch{width:52px;height:32px;display:inline-block;position:relative}.switch input{opacity:0;width:0;height:0}.slider{cursor:pointer;background-color:var(--md-sys-color-surface-container-high);border:2px solid var(--md-sys-color-outline);border-radius:34px;transition:all .4s;position:absolute;inset:0}.slider:before{content:"";background-color:var(--md-sys-color-outline);border-radius:50%;width:24px;height:24px;transition:all .4s;position:absolute;bottom:2pxLine truncated
+4
View File
@@ -0,0 +1,4 @@
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=0;function t(t){return`${t}_callback_${Date.now()}_${e++}`}function n(e,n){return n===void 0&&(n={}),new Promise((r,i)=>{let a=t(`exec`);window[a]=(e,t,n)=>{r({errno:e,stdout:t,stderr:n}),o(a)};function o(e){delete window[e]}try{ksu.exec(e,JSON.stringify(n),a)}catch(e){i(e),o(a)}})}function r(){this.listeners={}}r.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},r.prototype.emit=function(e,...t){this.listeners[e]&&this.listeners[e].forEach(e=>e(...t))};function i(){this.listeners={},this.stdin=new r,this.stdout=new r,this.stderr=new r}i.prototype.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},i.prototype.emit=function(e,...t){this.listeners[e]&&this.listeners[e].forEach(e=>e(...t))};var a={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},o=([e,t,n])=>{let r=document.createElementNS(`http://www.w3.org/2000/svg`,e);return Object.keys(t).forEach(e=>{r.setAttribute(e,String(t[e]))}),n?.length&&n.forEach(e=>{let t=o(e);r.appendChild(t)}),r},s=(e,t={})=>o([`svg`,{...a,...t},e]),c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},l=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),u=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),d=e=>{let t=u(e);return t.charAt(0).toUpperCase()+t.slice(1)},f=e=>Array.from(e.attributes).reduce((e,t)=>(e[t.name]=t.value,e),{}),p=e=>typeof e==`string`?e:!e||!e.class?``:e.class&&typeof e.class==`string`?e.class.split(` `):e.class&&Array.isArray(e.class)?e.class:``,m=(e,{nameAttr:t,icons:n,attrs:r})=>{let i=e.getAttribute(t);if(i==null)return;let o=n[d(i)];if(!o)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);let u=f(e),m=c(u)?{}:{"aria-hidden":`true`},h={...a,"data-lucide":i,...m,...r,...u},g=p(u),_=p(r),v=l(`lucide`,`lucide-${i}`,...g,..._);v&&Object.assign(h,{class:v});let y=s(o,h);return e.parentNode?.replaceChild(y,e)},h=[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`}]],g=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`}],[`path`,{d:`M10 9H8`}],[`path`,{d:`M16 13H8`}],[`path`,{d:`M16 17H8`}]],_=[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`}],[`path`,{d:`M21 3v5h-5`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`}],[`path`,{d:`M8 16H3v5`}]],v=[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`}]],y=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]],b=[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]],x=({icons:e={},nameAttr:t=`data-lucide`,attrs:n={},root:r=document,inTemplates:i}={})=>{if(!Object.values(e).length)throw Error(`Please provide an icons object.
If you want to use all the icons you can import it like:
\`import { createIcons, icons } from 'lucide';
lucide.createIcons({icons});\``);if(r===void 0)throw Error("`createIcons()` only works in a browser environment.");if(Array.from(r.querySelectorAll(`[${t}]`)).forEach(r=>m(r,{nameAttr:t,icons:e,attrs:n})),i&&Array.from(r.querySelectorAll(`template`)).forEach(r=>x({icons:e,nameAttr:t,attrs:n,root:r.content,inTemplates:i})),t===`data-lucide`){let t=r.querySelectorAll(`[icon-name]`);t.length>0&&(console.warn(`[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide`),Array.from(t).forEach(t=>m(t,{nameAttr:`icon-name`,icons:e,attrs:n})))}},S=`/data/adb/modules/LuminPro/config`,C=`/data/adb/modules/LuminPro/config/.backup`,w=`/data/adb/modules/LuminPro/pid/inotifyd.pid`,T=`/data/adb/modules/LuminPro/pid/up.flag`,E=`/data/adb/modules/LuminPro/pid/stop.flag`,D=`/data/adb/modules/LuminPro/service.log`,O=`/sys/class/backlight/panel0-backlight/brightness`,k=`/sys/class/backlight/panel0-backlight/max_brightness`;function A(e){let t=document.getElementById(`toast`);t.textContent=e,t.classList.add(`show`),setTimeout(()=>t.classList.remove(`show`),3e3)}async function j(e){try{return await n(e)}catch(e){return console.error(e),{errno:-1,stdout:``,stderr:String(e)}}}async function M(e,t){return j(`echo -n '${String(t).replace(/'/g,`'\\''`)}' > "${e}"`)}async function N(){let[e,t,n,r,i,a]=await Promise.all([j(`cat "${S}/ui_max_bri.txt"`),j(`cat "${S}/max_bri.txt"`),j(`cat "${S}/sleep_time.txt"`),j(`cat "${S}/auto_bri_sleep.txt"`),j(`cat "${S}/steps_num.txt"`),j(`cat "${S}/log_max_size.txt"`)]);if(e.errno===0&&(document.getElementById(`input-ui-max-bri`).value=e.stdout.trim()),t.errno===0&&(document.getElementById(`input-max-bri`).value=t.stdout.trim()),n.errno===0){let e=n.stdout.trim(),t=document.getElementById(`input-sleep-mode`),r=document.getElementById(`sleep-time-expand`);if(e&&e.includes(`-`)){t.checked=!0,r.classList.add(`show`);let[n,i]=e.split(`-`);n.length===4&&(document.getElementById(`input-sleep-start-h`).value=n.slice(0,2),document.getElementById(`input-sleep-start-m`).value=n.slice(2)),i.length===4&&(document.getElementById(`input-sleep-end-h`).value=i.slice(0,2),document.getElementById(`input-sleep-end-m`).value=i.slice(2))}else t.checked=!1,r.classList.remove(`show`),document.getElementById(`input-sleep-start-h`).value=`19`,document.getElementById(`input-sleep-start-m`).value=`00`,document.getElementById(`input-sleep-end-h`).value=`06`,document.getElementById(`input-sleep-end-m`).value=`00`}if(r.errno===0&&(document.getElementById(`input-auto-bri-sleep`).checked=r.stdout.trim()===`1`),i.errno===0){let e=i.stdout.trim();document.getElementById(`input-steps-num`).value=e||`50`}else document.getElementById(`input-steps-num`).value=`50`;if(a.errno===0){let e=a.stdout.trim();document.getElementById(`input-log-max-size`).value=e||`500`}else document.getElementById(`input-log-max-size`).value=`500`}async function P(){let e=document.getElementById(`input-ui-max-bri`).value,t=document.getElementById(`input-max-bri`).value,n=e=>String(e).padStart(2,`0`),r=document.getElementById(`input-sleep-mode`).checked,i=``;r&&(i=`${n(document.getElementById(`input-sleep-start-h`).value)}${n(document.getElementById(`input-sleep-start-m`).value)}-${n(document.getElementById(`input-sleep-end-h`).value)}${n(document.getElementById(`input-sleep-end-m`).value)}`);let a=document.getElementById(`input-auto-bri-sleep`).checked?`1`:`0`,o=document.getElementById(`input-steps-num`).value||`50`,s=document.getElementById(`input-log-max-size`).value||`500`;if(!e||!t){A(`亮度值不能为空`);return}A(`保存中...`),await M(`${S}/ui_max_bri.txt`,e),await M(`${S}/max_bri.txt`,t),await M(`${S}/sleep_time.txt`,i),await M(`${S}/auto_bri_sleep.txt`,a),await M(`${S}/steps_num.txt`,o),await M(`${S}/log_max_size.txt`,s),await j(`rm -f "${T}"`);let c=await j(`cat "${w}"`);c.errno===0&&c.stdout.trim()?A(`配置已保存 (可能需要在下次调整时生效)`):A(`配置已保存 (服务未运行)`)}var F=!1,I=null;function L(){let e=document.getElementById(`btn-reset`);e.textContent=`恢复默认`,e.classList.remove(`btn-danger`),F=!1,I&&clearTimeout(I)}async function R(){let e=document.getElementById(`btn-reset`);if(!F){F=!0,e.textContent=`确认`,e.classList.add(`btn-danger`),I=setTimeout(L,5e3);return}A(`正在恢复默认配置...`),L();let[t,n,r,i,a,o]=await Promise.all([j(`cat "${C}/ui_max_bri.txt"`),j(`cat "${C}/max_bri.txt"`),j(`cat "${C}/sleep_time.txt"`),j(`cat "${C}/auto_bri_sleep.txt"`),j(`cat "${C}/steps_num.txt"`),j(`cat "${C}/log_max_size.txt"`)]);if(t.errno===0&&(document.getElementById(`input-ui-max-bri`).value=t.stdout.trim()),n.errno===0&&(document.getElementById(`input-max-bri`).value=n.stdout.trim()),r.errno===0){let e=r.stdout.trim(),t=document.getElementById(`input-sleep-mode`),n=document.getElementById(`sleep-time-expand`);if(e.includes(`-`)){t.checked=!0,n.classList.add(`sh Line truncated
+183
View File
@@ -0,0 +1,183 @@
<!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-GvCaVVmw.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DpSbbGTK.css">
</head>
<body>
<div id="app">
<!-- 顶部头 -->
<header class="app-header">
<div class="header-content">
<div class="header-icon"><i data-lucide="sun"></i></div>
<div class="header-text">
<h1>LuminPro</h1>
<p class="header-subtitle" id="module-version">日用屏幕亮度强化</p>
</div>
</div>
<div class="header-status" id="module-status">
<span class="status-dot"></span>
<span class="status-text">运行中</span>
</div>
</header>
<!-- 配置卡片 -->
<section class="card" id="config-section">
<div class="card-header">
<span class="card-icon"><i data-lucide="settings"></i></span>
<h2>亮度配置</h2>
</div>
<!-- 分类: 亮度调节 -->
<div class="config-group">
<h3 class="group-title">亮度调节</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">前台最大亮度</span>
<span class="config-desc">触发亮度提升的阈值</span>
</div>
<div class="config-value">
<input type="number" id="input-ui-max-bri" class="config-input" min="0" />
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">峰值最大亮度</span>
<span class="config-desc">亮度提升的目标值</span>
</div>
<div class="config-value">
<input type="number" id="input-max-bri" class="config-input" min="0" />
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">亮度提升步数</span>
<span class="config-desc">约 0.02 秒 / 步</span>
</div>
<div class="config-value">
<input type="number" id="input-steps-num" class="config-input" min="1" max="500" />
</div>
</div>
</div>
<!-- 分类: 执行策略 -->
<div class="config-group">
<h3 class="group-title">执行策略</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">自动亮度时休眠</span>
<span class="config-desc">开启自动亮度时不提升</span>
</div>
<div class="config-value">
<label class="switch">
<input type="checkbox" id="input-auto-bri-sleep">
<span class="slider"></span>
</label>
</div>
</div>
<div class="config-item">
<div class="config-label">
<span class="config-name">定时休眠</span>
<span class="config-desc">设定时段内不提升亮度</span>
</div>
<div class="config-value">
<label class="switch">
<input type="checkbox" id="input-sleep-mode">
<span class="slider"></span>
</label>
</div>
</div>
<div class="config-item-expand" id="sleep-time-expand">
<div class="custom-time-picker">
<div class="time-unit">
<input type="number" id="input-sleep-start-h" class="time-input" min="0" max="23" placeholder="00" />
<span>:</span>
<input type="number" id="input-sleep-start-m" class="time-input" min="0" max="59" placeholder="00" />
</div>
<span class="time-sep">至</span>
<div class="time-unit">
<input type="number" id="input-sleep-end-h" class="time-input" min="0" max="23" placeholder="00" />
<span>:</span>
<input type="number" id="input-sleep-end-m" class="time-input" min="0" max="59" placeholder="00" />
</div>
</div>
</div>
</div>
<!-- 分类: 系统管理 -->
<div class="config-group">
<h3 class="group-title">系统管理</h3>
<div class="config-item">
<div class="config-label">
<span class="config-name">日志大小限制</span>
<span class="config-desc">单位: KB</span>
</div>
<div class="config-value">
<input type="number" id="input-log-max-size" class="config-input" min="1" max="10240" />
</div>
</div>
</div>
<div class="card-actions">
<button class="btn btn-outline" id="btn-reset">
恢复默认
</button>
<button class="btn btn-primary" id="btn-save">
<span class="btn-icon"><i data-lucide="save"></i></span> 保存配置
</button>
</div>
</section>
<!-- 实时状态 -->
<section class="card" id="status-section">
<div class="card-header">
<span class="card-icon"><i data-lucide="activity"></i></span>
<h2>实时状态</h2>
<div class="header-actions">
<button class="btn-text-s" id="btn-toggle-service">暂停</button>
<button class="btn-text-s" id="btn-restart-service">重启</button>
</div>
</div>
<div class="status-grid">
<div class="status-item">
<span class="status-label">当前亮度</span>
<span class="status-value" id="status-current-bri">—</span>
</div>
<div class="status-item">
<span class="status-label">系统最大亮度</span>
<span class="status-value" id="status-sys-max-bri">—</span>
</div>
<div class="status-item">
<span class="status-label">inotifyd PID</span>
<span class="status-value" id="status-inotifyd-pid">—</span>
</div>
<div class="status-item">
<span class="status-label">休眠状态</span>
<span class="status-value" id="status-sleep">—</span>
</div>
</div>
</section>
<!-- 日志 -->
<section class="card" id="log-section">
<div class="card-header">
<span class="card-icon"><i data-lucide="file-text"></i></span>
<h2>运行日志</h2>
</div>
<pre class="log-output" id="log-output">加载中...</pre>
</section>
<!-- Toast -->
<div class="toast" id="toast"></div>
</div>
</body>
</html>