mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
refactor(webui): 重构WebUI,引入Vue3和ShadcnUI
This commit is contained in:
1 parent
7aeee35044
commit
a206c9e831
32 files changed
+3685
-3244
No files matched your search
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://shadcn-vue.com/schema.json",
|
||||
"style": "default",
|
||||
"typescript": false,
|
||||
"tailwind": {
|
||||
"config": "",
|
||||
"css": "src/index.css",
|
||||
"baseColor": "slate",
|
||||
"cssVariables": true,
|
||||
"prefix": ""
|
||||
},
|
||||
"aliases": {
|
||||
"components": "@/components",
|
||||
"utils": "@/lib/utils",
|
||||
"ui": "@/components/ui",
|
||||
"lib": "@/lib",
|
||||
"composables": "@/composables"
|
||||
},
|
||||
"registries": []
|
||||
}
|
||||
+1
-563
@@ -6,572 +6,10 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
||||
<title>LuminPro</title>
|
||||
<link rel="stylesheet" type="text/css" href="/internal/insets.css" />
|
||||
<link rel="stylesheet" href="/src/style.css" />
|
||||
<link rel="stylesheet" href="/src/log.css" />
|
||||
<link rel="stylesheet" href="/src/apps.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- 顶部状态栏渐变模糊 -->
|
||||
<div class="top-blur"></div>
|
||||
|
||||
<div id="app">
|
||||
<!-- 顶部头 -->
|
||||
<header class="app-header">
|
||||
<div class="header-content">
|
||||
<div class="header-text">
|
||||
<h1>LuminPro</h1>
|
||||
<p class="header-subtitle">日用屏幕亮度强化</p>
|
||||
<p class="header-version" id="module-version">V2.2-2208</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-status-container">
|
||||
<div class="header-status" id="module-status">
|
||||
<span class="status-dot"></span>
|
||||
<span class="status-text">运行中</span>
|
||||
</div>
|
||||
<div class="header-status-actions">
|
||||
<button class="btn-status-action" id="btn-refresh-status">刷新</button>
|
||||
<button class="btn-status-action" id="btn-toggle-service">暂停</button>
|
||||
<button class="btn-status-action" id="btn-restart-service">重启</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 实时状态 -->
|
||||
<section class="card" id="status-section" data-nav-group="status">
|
||||
<div class="card-header">
|
||||
<h2>实时状态</h2>
|
||||
</div>
|
||||
|
||||
<div class="status-grid">
|
||||
<div class="status-item">
|
||||
<div class="status-item-header">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="4"></circle><path d="M12 2v2"></path><path d="M12 20v2"></path><path d="m4.93 4.93 1.41 1.41"></path><path d="m17.66 17.66 1.41 1.41"></path><path d="M2 12h2"></path><path d="M20 12h2"></path><path d="m6.34 17.66-1.41 1.41"></path><path d="m19.07 4.93-1.41 1.41"></path></svg>
|
||||
<span class="status-label">当前亮度</span>
|
||||
</div>
|
||||
<span class="status-value" id="status-current-bri">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<div class="status-item-header">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="20" x="5" y="2" rx="2" ry="2"></rect><path d="M12 18h.01"></path></svg>
|
||||
<span class="status-label">系统最大亮度</span>
|
||||
</div>
|
||||
<span class="status-value" id="status-sys-max-bri">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<div class="status-item-header">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 12h-4l-3 9L9 3l-3 9H2"></path></svg>
|
||||
<span class="status-label">inotifyd PID</span>
|
||||
</div>
|
||||
<span class="status-value" id="status-inotifyd-pid">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<div class="status-item-header">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"></circle><path d="M12 6v6l4 2"></path></svg>
|
||||
<span class="status-label">inotifyd 状态</span>
|
||||
</div>
|
||||
<span class="status-value" id="status-inotifyd-state">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<div class="status-item-header">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path></svg>
|
||||
<span class="status-label">休眠状态</span>
|
||||
</div>
|
||||
<span class="status-value" id="status-sleep">—</span>
|
||||
</div>
|
||||
<div class="status-item">
|
||||
<div class="status-item-header">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"></path><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"></path><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"></path></svg>
|
||||
<span class="status-label">HDR/SDR 比率</span>
|
||||
</div>
|
||||
<span class="status-value" id="status-hdr-ratio">—</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 亮度控制区 -->
|
||||
<div class="brightness-section">
|
||||
<div class="brightness-header">
|
||||
<span class="brightness-title">亮度</span>
|
||||
<span class="brightness-percent" id="brightness-display">—%</span>
|
||||
</div>
|
||||
<div class="brightness-container">
|
||||
<span class="brightness-label">0%</span>
|
||||
<input type="range" id="brightness-slider" class="brightness-slider" min="0" max="255" />
|
||||
<span class="brightness-label">100%</span>
|
||||
</div>
|
||||
<div class="auto-brightness-row">
|
||||
<span class="auto-brightness-label">自动亮度调节</span>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="auto-brightness-toggle">
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 配置卡片 -->
|
||||
<section class="card" id="config-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<h2>亮度配置</h2>
|
||||
</div>
|
||||
|
||||
<!-- 分类: 亮度调节 -->
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><i data-lucide="settings-2"></i> 亮度调节</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"><i data-lucide="shield-check"></i> 执行策略</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">显示 HDR 内容时休眠</span>
|
||||
<span class="config-desc">HDR/SDR 比率 > 1 时不提升</span>
|
||||
<span class="config-desc" style="color: var(--color-warning, #f59e0b);">建议配合去温控使用(部分系统温控策略较严格,高温时可能不显示 HDR 但仍提升亮度,导致闪屏。出现此情况时,可以使用活动黑名单/应用黑名单功能)</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="input-display-hdr-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"><i data-lucide="file-text"></i> 系统管理</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">日志大小限制</span>
|
||||
<span class="config-desc">单位: KB</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-log-max-size" class="config-input" min="1" max="10240" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<button class="btn btn-outline" id="btn-reset">
|
||||
恢复默认
|
||||
</button>
|
||||
<button class="btn btn-primary" id="btn-save">
|
||||
<span class="btn-icon"><i data-lucide="save"></i></span> 保存配置
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 高级设置卡片 -->
|
||||
<section class="card" id="advanced-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<h2>高级设置</h2>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><i data-lucide="settings"></i> 运行环境</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">inotifyd 监听事件</span>
|
||||
<span class="config-desc">默认 c。修改需重启服务</span>
|
||||
<span class="config-desc" style="color: var(--color-warning, #f59e0b);">为避免性能消耗,修改为 c 以外的事件时建议关闭 Web UI 配置 - 自动刷新</span>
|
||||
<button class="btn-text-s" id="btn-view-inotifyd-help" style="margin-top: 6px; padding: 2px 6px;">查看支持事件</button>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="text" id="input-inotify-events" class="config-input" placeholder="c" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">当前亮度节点</span>
|
||||
<span class="config-desc">修改需重启服务</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<textarea id="input-now-bri-file" class="config-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">最大亮度节点</span>
|
||||
<span class="config-desc">修改需重启服务</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<textarea id="input-sys-max-bri-file" class="config-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<button class="btn btn-primary" id="btn-save-advanced">
|
||||
<span class="btn-icon"><i data-lucide="save"></i></span> 保存设置
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Web UI 配置卡片 -->
|
||||
<section class="card" id="webui-config-section" data-nav-group="config">
|
||||
<div class="card-header">
|
||||
<h2>Web UI 配置</h2>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><i data-lucide="monitor"></i> 界面设置</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">自动刷新</span>
|
||||
<span class="config-desc">定时刷新状态和日志。监听非 c 事件时建议关闭</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<label class="switch"><input type="checkbox" id="input-auto-refresh" checked /><span class="slider"></span></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item" id="item-status-refresh-interval">
|
||||
<div class="config-label">
|
||||
<span class="config-name">状态/日志刷新间隔</span>
|
||||
<span class="config-desc">单位: 毫秒 (最小100ms)</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-status-refresh-interval" class="config-input" min="100" value="1000" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">界面缩放</span>
|
||||
<span class="config-desc">50% - 150% (立即生效)</span>
|
||||
</div>
|
||||
<div class="config-value">
|
||||
<input type="number" id="input-ui-zoom" class="config-input" min="50" max="150" value="100" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<button class="btn btn-primary" id="btn-save-webui-config">
|
||||
<span class="btn-icon"><i data-lucide="save"></i></span> 保存配置
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 黑名单页卡片 -->
|
||||
<section class="card" id="apps-section" data-nav-group="apps" style="display: none;">
|
||||
<div class="card-header" style="margin-bottom: 8px;">
|
||||
<h2>黑名单</h2>
|
||||
<div class="header-actions dropdown-container">
|
||||
<button class="btn-icon-only" id="btn-apps-refresh">
|
||||
<i data-lucide="refresh-cw"></i>
|
||||
</button>
|
||||
<button class="btn-icon-only" id="btn-apps-menu">
|
||||
<i data-lucide="more-vertical"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" id="apps-dropdown-menu">
|
||||
<div class="dropdown-item" id="btn-toggle-sys-apps">
|
||||
<i data-lucide="eye-off" id="sys-apps-icon"></i>
|
||||
<span id="sys-apps-text">隐藏系统应用</span>
|
||||
</div>
|
||||
<div class="dropdown-item" id="btn-smart-select">
|
||||
<i data-lucide="sparkles"></i>
|
||||
<span>智能选择</span>
|
||||
</div>
|
||||
<div class="dropdown-item" id="btn-manual-add">
|
||||
<i data-lucide="plus"></i>
|
||||
<span>手动添加包名</span>
|
||||
</div>
|
||||
<div class="dropdown-item" id="btn-select-all">
|
||||
<i data-lucide="check-check"></i>
|
||||
<span>全选</span>
|
||||
</div>
|
||||
<div class="dropdown-item" id="btn-select-none">
|
||||
<i data-lucide="square"></i>
|
||||
<span>全不选</span>
|
||||
</div>
|
||||
<div class="dropdown-item" id="btn-invert-selection">
|
||||
<i data-lucide="check-square"></i>
|
||||
<span>反选</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="app-list-hint">
|
||||
被选中的应用将不生效本模块</br>
|
||||
推荐选择视频类、相册等需展示 HDR 内容的应用
|
||||
</p>
|
||||
|
||||
<!-- 按活动屏蔽 -->
|
||||
<div class="activity-block-card">
|
||||
<div class="activity-block-header">
|
||||
<span class="activity-block-label">按活动屏蔽</span>
|
||||
<button class="btn-picker-trigger" id="btn-pick-activity">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
|
||||
扫描获取
|
||||
</button>
|
||||
</div>
|
||||
<div class="activity-block-row">
|
||||
<input type="text" id="input-activity-entry" class="activity-block-input" placeholder="com.pkg/com.pkg.ActivityClass" autocomplete="off" spellcheck="false" />
|
||||
<button class="btn btn-primary" id="btn-add-activity" style="padding: 0 14px; border-radius: var(--border-radius-m); font-size: 0.8125rem; white-space: nowrap; flex-shrink: 0;">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 搜索栏 -->
|
||||
<div style="display: flex; gap: 8px; align-items: stretch; margin-bottom: var(--spacing-m);">
|
||||
<div class="app-search-container" style="flex: 1; margin-bottom: 0;">
|
||||
<i data-lucide="search" class="search-icon"></i>
|
||||
<input type="text" id="input-app-search" class="app-search-input" placeholder="应用名称或包名" autocomplete="off" spellcheck="false" />
|
||||
<span id="app-count-badge" class="count-badge">0</span>
|
||||
</div>
|
||||
<button class="btn btn-primary" id="btn-save-blacklist" style="padding: 0 16px; border-radius: var(--border-radius-m); font-size: 0.8125rem; white-space: nowrap; flex-shrink: 0;">保存</button>
|
||||
</div>
|
||||
|
||||
<div class="app-list-container" id="app-list-container">
|
||||
<!-- 动态渲染应用项 -->
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 日志 -->
|
||||
<section class="card" id="log-section" data-nav-group="log">
|
||||
<div class="card-header">
|
||||
<h2>运行日志</h2>
|
||||
<div class="header-actions dropdown-container">
|
||||
<select id="log-level-filter" class="log-filter-select">
|
||||
<option value="">全部等级</option>
|
||||
<option value="INFO">INFO</option>
|
||||
<option value="WARN">WARN</option>
|
||||
<option value="ERROR">ERROR</option>
|
||||
<option value="SUCCESS">SUCCESS</option>
|
||||
</select>
|
||||
<button class="btn-icon-only" id="btn-log-menu">
|
||||
<i data-lucide="more-vertical"></i>
|
||||
</button>
|
||||
<div class="dropdown-menu" id="log-dropdown-menu">
|
||||
<div class="dropdown-item" id="btn-copy-log">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"></rect><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"></path></svg>
|
||||
<span>复制日志</span>
|
||||
</div>
|
||||
<div class="dropdown-item" id="btn-export-log">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" x2="12" y1="15" y2="3"></line></svg>
|
||||
<span>导出日志</span>
|
||||
</div>
|
||||
<div class="dropdown-item" id="btn-clear-logs">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"></path><path d="m6 6 12 12"></path></svg>
|
||||
<span>清空日志</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<pre class="log-output" id="log-output">加载中...</pre>
|
||||
</section>
|
||||
|
||||
<!-- 关于 -->
|
||||
<section class="card" id="about-section" data-nav-group="about">
|
||||
<div class="card-header">
|
||||
<h2>关于项目</h2>
|
||||
</div>
|
||||
|
||||
<div class="about-links">
|
||||
<a href="https://github.com/YuleBest/LuminPro" target="_blank" class="about-link-item">
|
||||
<i data-lucide="code"></i>
|
||||
<div class="link-info">
|
||||
<span class="link-label">项目 GitHub</span>
|
||||
<span class="link-url">YuleBest/LuminPro</span>
|
||||
</div>
|
||||
</a>
|
||||
<a href="https://github.com/YuleBest" target="_blank" class="about-link-item">
|
||||
<i data-lucide="user"></i>
|
||||
<div class="link-info">
|
||||
<span class="link-label">作者</span>
|
||||
<span class="link-url">于乐 Yule</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="config-group" style="margin-top: var(--spacing-l);">
|
||||
<h3 class="group-title"><i data-lucide="book-open"></i> 相关文档</h3>
|
||||
<div class="about-doc-list">
|
||||
<div class="about-doc-item" data-doc="README.md">
|
||||
<i data-lucide="file-text"></i>
|
||||
<span>README</span>
|
||||
</div>
|
||||
<div class="about-doc-item" data-doc="README_en.md">
|
||||
<i data-lucide="globe"></i>
|
||||
<span>README (English)</span>
|
||||
</div>
|
||||
<div class="about-doc-item" data-doc="changelog.md">
|
||||
<i data-lucide="sparkles"></i>
|
||||
<span>更新日志</span>
|
||||
</div>
|
||||
<div class="about-doc-item" data-doc="NOTE.txt">
|
||||
<i data-lucide="file-text"></i>
|
||||
<span>声明与注意事项</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 文档查看抽屉 (Bottom Sheet) -->
|
||||
<div class="drawer-backdrop" id="doc-drawer-backdrop"></div>
|
||||
<div class="doc-drawer" id="doc-drawer">
|
||||
<div class="drawer-handle"></div>
|
||||
<header class="drawer-header">
|
||||
<h2 id="drawer-title">文档查看</h2>
|
||||
<button class="btn-icon-only-s" id="btn-close-drawer">
|
||||
<i data-lucide="x"></i>
|
||||
</button>
|
||||
</header>
|
||||
<div class="drawer-content" id="drawer-content">
|
||||
<!-- 内容将动态渲染 -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 获取活动名向导 -->
|
||||
<div class="activity-picker-overlay" id="activity-picker-overlay">
|
||||
<div class="activity-picker-header">
|
||||
<button class="picker-back-btn" id="btn-picker-back">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>
|
||||
</button>
|
||||
<span class="picker-title">获取活动名</span>
|
||||
</div>
|
||||
<div class="picker-steps-indicator">
|
||||
<div class="picker-step-dot" id="picker-dot-1"></div>
|
||||
<div class="picker-step-dot" id="picker-dot-2"></div>
|
||||
<div class="picker-step-dot" id="picker-dot-3"></div>
|
||||
</div>
|
||||
<div class="activity-picker-body">
|
||||
<!-- 步骤 1: 挂小窗 -->
|
||||
<div class="picker-step" id="picker-step-1">
|
||||
<div class="picker-step-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="14" x="3" y="5" rx="2"/><path d="M8 19h8"/><path d="M12 15v4"/><path d="M3 9h18"/></svg>
|
||||
</div>
|
||||
<h3 class="picker-step-title">将 Web UI 挂小窗</h3>
|
||||
<p class="picker-step-desc">
|
||||
在开始获取前,请先将当前 Web UI 调整为<strong>小窗模式</strong>。<br><br>
|
||||
这样在后续步骤中,你可以同时操作目标应用并看到 Web UI 的反馈。
|
||||
</p>
|
||||
<button class="btn btn-primary picker-action-btn" id="btn-picker-step1-next">已挂小窗,下一步</button>
|
||||
</div>
|
||||
<!-- 步骤 2: 获取活动 -->
|
||||
<div class="picker-step" id="picker-step-2">
|
||||
<div class="picker-step-icon" id="picker-step2-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 18 0 9 9 0 0 0-18 0"/><path d="M12 8v4l2 2"/></svg>
|
||||
</div>
|
||||
<h3 class="picker-step-title">切换到目标界面</h3>
|
||||
<p class="picker-step-desc">
|
||||
点击「开始获取」后,切换到需要屏蔽的应用界面。<br><br>
|
||||
检测到非 Web UI 界面后将<strong>自动停止</strong>。<br><br>
|
||||
<span id="picker-status-text" class="picker-status-text">等待中...</span>
|
||||
</p>
|
||||
<button class="btn btn-primary picker-action-btn" id="btn-picker-start">开始获取</button>
|
||||
</div>
|
||||
<!-- 步骤 3: 确认结果 -->
|
||||
<div class="picker-step" id="picker-step-3">
|
||||
<div class="picker-step-icon">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><path d="m9 11 3 3L22 4"/></svg>
|
||||
</div>
|
||||
<h3 class="picker-step-title">检测到活动</h3>
|
||||
<p class="picker-step-desc">以下活动将被添加到按活动屏蔽列表:</p>
|
||||
<div class="picker-result-box" id="picker-result-text"></div>
|
||||
<div class="picker-result-actions">
|
||||
<button class="btn btn-secondary" id="btn-picker-retry">重试</button>
|
||||
<button class="btn btn-primary" id="btn-picker-confirm">确认添加</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Toast -->
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<!-- 浮动底栏 -->
|
||||
<div class="floating-navbar">
|
||||
<div class="navbar-slider"></div>
|
||||
<button class="navbar-btn active" data-section="status">
|
||||
<i data-lucide="activity"></i>
|
||||
<span>状态</span>
|
||||
</button>
|
||||
<button class="navbar-btn" data-section="config">
|
||||
<i data-lucide="settings"></i>
|
||||
<span>配置</span>
|
||||
</button>
|
||||
<button class="navbar-btn" data-section="apps">
|
||||
<i data-lucide="smartphone"></i>
|
||||
<span>黑名单</span>
|
||||
</button>
|
||||
<button class="navbar-btn" data-section="log">
|
||||
<i data-lucide="file-text"></i>
|
||||
<span>日志</span>
|
||||
</button>
|
||||
<button class="navbar-btn" data-section="about">
|
||||
<i data-lucide="info"></i>
|
||||
<span>关于</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
<script setup>
|
||||
import { ref, provide, onMounted, onUnmounted, watch } from 'vue';
|
||||
import { moduleInfo } from 'kernelsu';
|
||||
import { runCmd, showToast } from './utils.js';
|
||||
import { useStatus } from './composables/useStatus.js';
|
||||
import { useConfig } from './composables/useConfig.js';
|
||||
import { useLog } from './composables/useLog.js';
|
||||
import BottomNav from './components/BottomNav.vue';
|
||||
import StatusView from './views/StatusView.vue';
|
||||
import ConfigView from './views/ConfigView.vue';
|
||||
import AppsView from './views/AppsView.vue';
|
||||
import LogView from './views/LogView.vue';
|
||||
import AboutView from './views/AboutView.vue';
|
||||
|
||||
const currentView = ref('status');
|
||||
const moduleVersion = ref('');
|
||||
const status = useStatus();
|
||||
const config = useConfig();
|
||||
const log = useLog();
|
||||
|
||||
// 供子组件使用
|
||||
provide('showToast', showToast);
|
||||
provide('status', status);
|
||||
provide('config', config);
|
||||
provide('log', log);
|
||||
|
||||
let refreshTimer = null;
|
||||
|
||||
function startRefresh() {
|
||||
stopRefresh();
|
||||
if (!config.autoRefresh.value) return;
|
||||
const interval = config.statusRefreshInterval.value;
|
||||
refreshTimer = setInterval(async () => {
|
||||
try {
|
||||
await Promise.all([status.load(), log.load()]);
|
||||
} catch {}
|
||||
}, interval);
|
||||
}
|
||||
|
||||
function stopRefresh() {
|
||||
if (refreshTimer) { clearInterval(refreshTimer); refreshTimer = null; }
|
||||
}
|
||||
|
||||
function restartRefresh(enabled, interval) {
|
||||
config.autoRefresh.value = enabled;
|
||||
config.statusRefreshInterval.value = interval;
|
||||
startRefresh();
|
||||
}
|
||||
provide('restartRefresh', restartRefresh);
|
||||
|
||||
// 跟随系统色彩偏好变化
|
||||
let _mq = null;
|
||||
function _onSystemTheme() {
|
||||
if (config.themeMode.value === 'system') config.applyTheme('system');
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
// 应用 UI 缩放 + 主题
|
||||
config.applyZoom();
|
||||
config.applyTheme(config.themeMode.value);
|
||||
_mq = window.matchMedia('(prefers-color-scheme: light)');
|
||||
_mq.addEventListener('change', _onSystemTheme);
|
||||
|
||||
// 读取模块版本
|
||||
try {
|
||||
const info = JSON.parse(moduleInfo());
|
||||
moduleVersion.value = info.version || '';
|
||||
} catch {
|
||||
moduleVersion.value = '[debug]';
|
||||
}
|
||||
|
||||
// 页面滚动监听
|
||||
window.addEventListener('scroll', onScroll, { passive: true });
|
||||
|
||||
// 初始加载
|
||||
try {
|
||||
await Promise.all([status.load(true), config.load(), log.load()]);
|
||||
} catch {}
|
||||
|
||||
startRefresh();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
stopRefresh();
|
||||
window.removeEventListener('scroll', onScroll);
|
||||
_mq?.removeEventListener('change', _onSystemTheme);
|
||||
});
|
||||
|
||||
function onScroll() {
|
||||
const topBlur = document.querySelector('.top-blur');
|
||||
if (topBlur) topBlur.classList.toggle('scrolled', window.scrollY > 10);
|
||||
}
|
||||
|
||||
function handleViewChange(view) {
|
||||
currentView.value = view;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="min-h-screen bg-background text-foreground">
|
||||
<!-- 顶部状态栏渐变模糊 -->
|
||||
<div class="top-blur"></div>
|
||||
|
||||
<div id="app">
|
||||
<!-- 顶部头 -->
|
||||
<header class="app-header">
|
||||
<div class="header-content">
|
||||
<div class="header-text">
|
||||
<h1>LuminPro</h1>
|
||||
<p class="header-subtitle">日用屏幕亮度强化</p>
|
||||
<p class="header-version">{{ moduleVersion || 'V2.2' }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-status-container">
|
||||
<div
|
||||
class="header-status"
|
||||
id="module-status"
|
||||
:class="status.statusClass.value"
|
||||
>
|
||||
<span class="status-dot"></span>
|
||||
<span class="status-text">{{ status.statusText.value }}</span>
|
||||
</div>
|
||||
<div class="header-status-actions">
|
||||
<button class="btn-status-action" id="btn-toggle-service" @click="status.toggleService(showToast)">
|
||||
{{ status.isPaused.value ? '启用' : '暂停' }}
|
||||
</button>
|
||||
<button class="btn-status-action" id="btn-restart-service" @click="status.restartService(showToast)">
|
||||
重启
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 各视图(v-show 保持 DOM 以维持状态) -->
|
||||
<StatusView v-show="currentView === 'status'" />
|
||||
<ConfigView v-show="currentView === 'config'" />
|
||||
<AppsView v-show="currentView === 'apps'" />
|
||||
<LogView v-show="currentView === 'log'" />
|
||||
<AboutView v-show="currentView === 'about'" />
|
||||
</div>
|
||||
|
||||
<!-- 底栏导航 -->
|
||||
<BottomNav v-model="currentView" @update:model-value="handleViewChange" />
|
||||
|
||||
<!-- Toast (保持 id="toast" 供 utils.js showToast 使用) -->
|
||||
<div class="toast" id="toast"></div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,266 @@
|
||||
/* ==========================================
|
||||
About View Styles
|
||||
========================================== */
|
||||
.about-hero {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: var(--spacing-l) 0 var(--spacing-m);
|
||||
gap: 8px;
|
||||
}
|
||||
.about-logo {
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
border-radius: 20px;
|
||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--md-sys-color-primary);
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.about-name {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
.about-desc {
|
||||
margin: 0;
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
.about-version-badge {
|
||||
display: inline-block;
|
||||
padding: 2px 10px;
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
border-radius: 100px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
.about-section-title {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-primary);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin: var(--spacing-l) 0 var(--spacing-s);
|
||||
}
|
||||
.about-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
border-radius: var(--border-radius-m);
|
||||
overflow: hidden;
|
||||
}
|
||||
.about-list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 14px 16px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-size: 0.9375rem;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
transition: background-color 0.15s;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
}
|
||||
.about-list-item + .about-list-item {
|
||||
border-top: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.06);
|
||||
}
|
||||
.about-list-item:active {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
}
|
||||
.about-list-icon {
|
||||
color: var(--md-sys-color-primary);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.about-list-chevron {
|
||||
margin-left: auto;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
opacity: 0.5;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.about-footer {
|
||||
text-align: center;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 0.8125rem;
|
||||
margin-top: var(--spacing-l);
|
||||
padding-top: var(--spacing-m);
|
||||
border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 142, 144, 153), 0.15);
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
Doc Sheet (Bottom drawer)
|
||||
========================================== */
|
||||
.doc-sheet-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0,0,0,0.5);
|
||||
backdrop-filter: blur(4px);
|
||||
z-index: 1999;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
.doc-sheet-backdrop.show {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
.doc-sheet {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
max-height: 90vh;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
border-radius: 28px 28px 0 0;
|
||||
z-index: 2000;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transform: translateY(100%);
|
||||
transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
|
||||
box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
|
||||
overflow: hidden;
|
||||
}
|
||||
.doc-sheet.show {
|
||||
transform: translateY(0);
|
||||
}
|
||||
.doc-sheet-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16px 16px 12px;
|
||||
border-bottom: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.07);
|
||||
gap: 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.doc-sheet-title {
|
||||
font-size: 1.0625rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
flex: 1;
|
||||
}
|
||||
.doc-sheet-close {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s;
|
||||
}
|
||||
.doc-sheet-close:active {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
}
|
||||
.doc-sheet-body {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 20px 20px 48px;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
.doc-sheet-body::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
.doc-sheet-loading {
|
||||
text-align: center;
|
||||
padding: 48px 20px;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
.doc-sheet-content {
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.75;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
word-break: break-word;
|
||||
}
|
||||
.doc-sheet-content h1, .doc-sheet-content h2 {
|
||||
color: var(--md-sys-color-primary);
|
||||
margin-top: 1.4em;
|
||||
}
|
||||
.doc-sheet-content h3 {
|
||||
color: var(--md-sys-color-secondary);
|
||||
margin-top: 1.2em;
|
||||
}
|
||||
.doc-sheet-content code {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: 'Google Sans Code', monospace;
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
/* ==========================================
|
||||
Log Filter Tabs
|
||||
========================================== */
|
||||
.log-filter-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-s);
|
||||
}
|
||||
.log-filter-tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: 4px;
|
||||
border-radius: var(--border-radius-s);
|
||||
}
|
||||
.log-filter-tab {
|
||||
padding: 4px 12px;
|
||||
border-radius: calc(var(--border-radius-s) - 2px);
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
.log-filter-tab.active {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
color: var(--md-sys-color-primary);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
/* ==========================================
|
||||
Theme Segmented Button
|
||||
========================================== */
|
||||
.theme-seg {
|
||||
display: flex;
|
||||
gap: 2px;
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: 3px;
|
||||
border-radius: var(--border-radius-s);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.theme-seg-btn {
|
||||
padding: 4px 12px;
|
||||
border-radius: calc(var(--border-radius-s) - 2px);
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.18s ease;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.theme-seg-btn.active {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,564 @@
|
||||
/* Cards */
|
||||
.card {
|
||||
background-color: var(--md-sys-color-surface);
|
||||
border-radius: var(--border-radius-m);
|
||||
padding: var(--spacing-l);
|
||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* Page Transitions */
|
||||
.card-animate-in {
|
||||
animation: cardFadeIn 0.4s cubic-bezier(0.2, 0, 0, 1) forwards;
|
||||
}
|
||||
|
||||
.navbar-slider {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
@keyframes cardFadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(12px) scale(0.985);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
#log-section {
|
||||
flex: 1;
|
||||
min-height: calc(100vh - 220px);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-s);
|
||||
margin-bottom: var(--spacing-l);
|
||||
}
|
||||
|
||||
.card-header h2 {
|
||||
margin: 0;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 500;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
/* Config Items */
|
||||
.config-group {
|
||||
margin-bottom: var(--spacing-l);
|
||||
padding: var(--spacing-m);
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
border-radius: var(--border-radius-m);
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.05);
|
||||
}
|
||||
|
||||
.group-title {
|
||||
margin: 0 0 var(--spacing-m) 0;
|
||||
color: var(--md-sys-color-primary);
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.group-title i, .group-title svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.config-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
#advanced-section .config-item {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#advanced-section .config-value {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.config-item + .config-item {
|
||||
margin-top: var(--spacing-m);
|
||||
border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 142, 144, 153), 0.1);
|
||||
padding-top: var(--spacing-m);
|
||||
}
|
||||
|
||||
.config-label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.config-name {
|
||||
font-size: 1rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.config-desc {
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.config-input {
|
||||
width: 100px;
|
||||
padding: 8px 12px;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: var(--border-radius-s);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-size: 1rem;
|
||||
font-family: inherit;
|
||||
text-align: right;
|
||||
outline: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.config-input:focus {
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2);
|
||||
background-color: var(--md-sys-color-surface);
|
||||
}
|
||||
|
||||
#advanced-section .config-input {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.config-textarea {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
width: 100%;
|
||||
min-height: 60px;
|
||||
max-height: 300px;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: var(--border-radius-m);
|
||||
resize: vertical;
|
||||
padding: 10px 14px;
|
||||
font-family: 'Google Sans Code', system-ui, monospace;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.4;
|
||||
transition: all 0.2s ease;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.config-textarea:focus {
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2);
|
||||
background-color: var(--md-sys-color-surface);
|
||||
}
|
||||
|
||||
.config-input-wide {
|
||||
width: 140px;
|
||||
}
|
||||
|
||||
.config-item-expand {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: var(--spacing-s);
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.config-item-expand.show {
|
||||
max-height: 100px; /* 调整为适合内容的高度 */
|
||||
opacity: 1;
|
||||
margin-bottom: var(--spacing-m);
|
||||
}
|
||||
|
||||
/* Custom Time Picker Styles */
|
||||
.custom-time-picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.time-unit {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
padding: 2px 6px;
|
||||
border-radius: var(--border-radius-s);
|
||||
border: 1px solid var(--md-sys-color-outline);
|
||||
}
|
||||
|
||||
.time-input {
|
||||
width: 32px;
|
||||
background-color: transparent;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
border: none;
|
||||
font-size: 0.875rem;
|
||||
text-align: center;
|
||||
font-family: '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 {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: var(--spacing-m);
|
||||
border-radius: var(--border-radius-m);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.04);
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.status-item:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.status-item-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.status-item-header svg {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.status-label {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.status-value {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-primary);
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* Brightness Section */
|
||||
.brightness-section {
|
||||
margin-top: var(--spacing-l);
|
||||
padding: var(--spacing-m);
|
||||
background: linear-gradient(135deg, var(--md-sys-color-surface-container-high) 0%, var(--md-sys-color-surface-container) 100%);
|
||||
border-radius: var(--border-radius-m);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
}
|
||||
|
||||
.brightness-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: var(--spacing-m);
|
||||
}
|
||||
|
||||
.brightness-title {
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.brightness-percent {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
color: var(--md-sys-color-primary);
|
||||
min-width: 50px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Brightness Slider Container */
|
||||
.brightness-container {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: var(--spacing-m);
|
||||
padding: var(--spacing-s) 0;
|
||||
}
|
||||
|
||||
.brightness-label {
|
||||
font-size: 0.75rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
min-width: 24px;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Brightness Slider (Progress Bar Style) */
|
||||
.brightness-slider {
|
||||
flex: 1;
|
||||
height: 24px;
|
||||
border-radius: 12px;
|
||||
/* 背景将由 JS 通过 linear-gradient 动态更新实现进度条效果 */
|
||||
background: var(--md-sys-color-surface-container-high);
|
||||
outline: none;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
cursor: grab;
|
||||
transition: height 0.2s, box-shadow 0.2s;
|
||||
border: 1px solid rgba(255, 255, 255, 0.03);
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
|
||||
overflow: hidden; /* 确保进度条颜色不溢出圆角 */
|
||||
}
|
||||
|
||||
.brightness-slider:hover {
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.brightness-slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 0;
|
||||
height: 0;
|
||||
background: transparent;
|
||||
cursor: grab;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.brightness-slider::-webkit-slider-thumb:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-thumb {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
background: var(--md-sys-color-primary);
|
||||
cursor: grab;
|
||||
border: 2px solid var(--md-sys-color-surface);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-thumb:hover {
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-thumb:active {
|
||||
cursor: grabbing;
|
||||
box-shadow: 0 0 0 10px rgba(168, 199, 250, 0.2);
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-track {
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Auto Brightness Row */
|
||||
.auto-brightness-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: var(--spacing-s) var(--spacing-m);
|
||||
background-color: rgba(var(--md-sys-color-primary-rgb), 0.08);
|
||||
border-radius: var(--border-radius-s);
|
||||
}
|
||||
|
||||
.auto-brightness-label {
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
.card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: var(--spacing-l);
|
||||
padding-top: var(--spacing-m);
|
||||
border-top: 1px solid var(--md-sys-color-outline-variant);
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 10px 24px;
|
||||
border-radius: 100px;
|
||||
border: none;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s, opacity 0.2s;
|
||||
}
|
||||
|
||||
.btn:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: var(--md-sys-color-primary);
|
||||
color: var(--md-sys-color-on-primary);
|
||||
}
|
||||
|
||||
.btn-outline {
|
||||
background-color: transparent;
|
||||
border: 1px solid var(--md-sys-color-outline);
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.btn-outline-s, .btn-text-s {
|
||||
background-color: transparent;
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
color: var(--md-sys-color-primary);
|
||||
padding: 4px 10px;
|
||||
min-width: 50px;
|
||||
height: 28px;
|
||||
font-size: 0.75rem;
|
||||
border-radius: var(--border-radius-s);
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn-text-s:active {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: var(--md-sys-color-error) !important;
|
||||
color: var(--md-sys-color-on-error) !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
/* Header Actions container */
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.btn-icon-only {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 1.25rem;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.btn-icon-only-s {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
color: var(--md-sys-color-primary);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.btn-icon-only-s:active {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.btn-icon-only-s i, .btn-icon-only-s svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.animate-spin {
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, onUnmounted, watch } from 'vue';
|
||||
import {
|
||||
Activity as IconActivity,
|
||||
Settings as IconSettings,
|
||||
AppWindow as IconApps,
|
||||
ScrollText as IconLog,
|
||||
Info as IconInfo,
|
||||
} from 'lucide-vue-next';
|
||||
|
||||
const props = defineProps({ modelValue: { type: String, default: 'status' } });
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
|
||||
const navItems = [
|
||||
{ key: 'status', label: '状态', icon: IconActivity },
|
||||
{ key: 'config', label: '配置', icon: IconSettings },
|
||||
{ key: 'apps', label: '黑名单', icon: IconApps },
|
||||
{ key: 'log', label: '日志', icon: IconLog },
|
||||
{ key: 'about', label: '关于', icon: IconInfo },
|
||||
];
|
||||
|
||||
const navbarEl = ref(null);
|
||||
const sliderEl = ref(null);
|
||||
const btnRefs = ref([]);
|
||||
|
||||
function updateSlider(key, animate = true) {
|
||||
const idx = navItems.findIndex(n => n.key === key);
|
||||
if (idx < 0) return;
|
||||
const btn = btnRefs.value[idx];
|
||||
if (!btn || !sliderEl.value) return;
|
||||
if (!animate) sliderEl.value.style.transition = 'none';
|
||||
sliderEl.value.style.width = btn.offsetWidth + 'px';
|
||||
sliderEl.value.style.transform = `translateX(${btn.offsetLeft}px)`;
|
||||
if (!animate) requestAnimationFrame(() => { if (sliderEl.value) sliderEl.value.style.transition = ''; });
|
||||
}
|
||||
|
||||
function select(key) {
|
||||
emit('update:modelValue', key);
|
||||
}
|
||||
|
||||
watch(() => props.modelValue, v => updateSlider(v));
|
||||
|
||||
// ---- 拖拽逻辑 ----
|
||||
let isDragging = false;
|
||||
let isActuallyDragging = false;
|
||||
let startX = 0;
|
||||
let startSliderX = 0;
|
||||
|
||||
function onPointerDown(e) {
|
||||
isDragging = true;
|
||||
isActuallyDragging = false;
|
||||
startX = e.clientX;
|
||||
const idx = navItems.findIndex(n => n.key === props.modelValue);
|
||||
startSliderX = idx >= 0 && btnRefs.value[idx] ? btnRefs.value[idx].offsetLeft : 0;
|
||||
}
|
||||
|
||||
function onPointerMove(e) {
|
||||
if (!isDragging) return;
|
||||
const dx = e.clientX - startX;
|
||||
if (!isActuallyDragging && Math.abs(dx) > 10) {
|
||||
isActuallyDragging = true;
|
||||
navbarEl.value?.setPointerCapture(e.pointerId);
|
||||
}
|
||||
if (!isActuallyDragging || !sliderEl.value) return;
|
||||
const first = btnRefs.value[0];
|
||||
const last = btnRefs.value[btnRefs.value.length - 1];
|
||||
const minX = first ? first.offsetLeft : 0;
|
||||
const maxX = last ? last.offsetLeft : 0;
|
||||
let tx = startSliderX + dx;
|
||||
if (tx < minX) tx = minX + (tx - minX) * 0.3;
|
||||
if (tx > maxX) tx = maxX + (tx - maxX) * 0.3;
|
||||
sliderEl.value.style.transition = 'none';
|
||||
sliderEl.value.style.transform = `translateX(${tx}px)`;
|
||||
}
|
||||
|
||||
function onPointerUp(e) {
|
||||
if (!isDragging) return;
|
||||
const wasDragging = isActuallyDragging;
|
||||
isDragging = false;
|
||||
isActuallyDragging = false;
|
||||
navbarEl.value?.releasePointerCapture(e.pointerId);
|
||||
|
||||
if (wasDragging && sliderEl.value) {
|
||||
const sliderRect = sliderEl.value.getBoundingClientRect();
|
||||
const navRect = navbarEl.value?.getBoundingClientRect();
|
||||
const currentX = navRect ? sliderRect.left - navRect.left : 0;
|
||||
let closest = navItems[0].key;
|
||||
let minDist = Infinity;
|
||||
btnRefs.value.forEach((btn, i) => {
|
||||
if (!btn) return;
|
||||
const dist = Math.abs(btn.offsetLeft - currentX);
|
||||
if (dist < minDist) { minDist = dist; closest = navItems[i].key; }
|
||||
});
|
||||
select(closest);
|
||||
} else {
|
||||
updateSlider(props.modelValue);
|
||||
}
|
||||
}
|
||||
|
||||
function onResize() { updateSlider(props.modelValue, false); }
|
||||
|
||||
onMounted(() => {
|
||||
updateSlider(props.modelValue, false);
|
||||
window.addEventListener('resize', onResize);
|
||||
});
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', onResize);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<nav
|
||||
class="floating-navbar"
|
||||
ref="navbarEl"
|
||||
@pointerdown="onPointerDown"
|
||||
@pointermove="onPointerMove"
|
||||
@pointerup="onPointerUp"
|
||||
>
|
||||
<div class="navbar-slider" ref="sliderEl"></div>
|
||||
|
||||
<button
|
||||
v-for="(item, i) in navItems"
|
||||
:key="item.key"
|
||||
:ref="el => btnRefs[i] = el"
|
||||
class="navbar-btn"
|
||||
:class="{ active: modelValue === item.key }"
|
||||
:data-section="item.key"
|
||||
@click="select(item.key)"
|
||||
>
|
||||
<component :is="item.icon" :size="20" :stroke-width="1.75" />
|
||||
<span>{{ item.label }}</span>
|
||||
</button>
|
||||
</nav>
|
||||
</template>
|
||||
@@ -0,0 +1,32 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cva } from 'class-variance-authority';
|
||||
|
||||
const badgeVariants = cva(
|
||||
'inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium transition-colors',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'bg-primary/20 text-primary border border-primary/30',
|
||||
secondary: 'bg-secondary text-secondary-foreground',
|
||||
destructive: 'bg-destructive/20 text-destructive border border-destructive/30',
|
||||
outline: 'border border-border text-foreground',
|
||||
success: 'bg-green-500/20 text-green-400 border border-green-500/30',
|
||||
warning: 'bg-amber-500/20 text-amber-400 border border-amber-500/30',
|
||||
},
|
||||
},
|
||||
defaultVariants: { variant: 'default' },
|
||||
}
|
||||
);
|
||||
|
||||
const props = defineProps({
|
||||
variant: { type: String, default: 'default' },
|
||||
class: { type: String, default: '' },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span :class="cn(badgeVariants({ variant }), props.class)">
|
||||
<slot />
|
||||
</span>
|
||||
</template>
|
||||
@@ -0,0 +1,51 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cva } from 'class-variance-authority';
|
||||
|
||||
const buttonVariants = cva(
|
||||
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80',
|
||||
destructive: 'bg-destructive/20 text-destructive border border-destructive/40 hover:bg-destructive/30',
|
||||
outline: 'border border-border bg-transparent hover:bg-secondary hover:text-secondary-foreground',
|
||||
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
||||
ghost: 'hover:bg-secondary hover:text-secondary-foreground',
|
||||
link: 'text-primary underline-offset-4 hover:underline',
|
||||
},
|
||||
size: {
|
||||
default: 'h-9 px-4 py-2',
|
||||
sm: 'h-8 rounded-md px-3 text-xs',
|
||||
lg: 'h-10 rounded-md px-8',
|
||||
icon: 'h-9 w-9',
|
||||
'icon-sm': 'h-8 w-8',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const props = defineProps({
|
||||
variant: { type: String, default: 'default' },
|
||||
size: { type: String, default: 'default' },
|
||||
class: { type: String, default: '' },
|
||||
disabled: { type: Boolean, default: false },
|
||||
type: { type: String, default: 'button' },
|
||||
as: { type: String, default: 'button' },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<component
|
||||
:is="as"
|
||||
:type="as === 'button' ? type : undefined"
|
||||
:disabled="disabled || undefined"
|
||||
:class="cn(buttonVariants({ variant, size }), props.class)"
|
||||
>
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
@@ -0,0 +1,13 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div :class="cn('rounded-xl border border-border/40 bg-card text-card-foreground shadow-md', props.class)">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,36 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
modelValue: { type: [String, Number], default: '' },
|
||||
type: { type: String, default: 'text' },
|
||||
placeholder: { type: String, default: '' },
|
||||
disabled: { type: Boolean, default: false },
|
||||
min: { type: [String, Number], default: undefined },
|
||||
max: { type: [String, Number], default: undefined },
|
||||
autocomplete: { type: String, default: 'off' },
|
||||
spellcheck: { type: Boolean, default: false },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<input
|
||||
v-bind="$attrs"
|
||||
:type="type"
|
||||
:value="modelValue"
|
||||
:placeholder="placeholder"
|
||||
:disabled="disabled"
|
||||
:min="min"
|
||||
:max="max"
|
||||
:autocomplete="autocomplete"
|
||||
:spellcheck="spellcheck"
|
||||
:class="cn(
|
||||
'flex h-9 w-full rounded-md border border-input bg-muted px-3 py-1 text-sm text-foreground shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-primary disabled:cursor-not-allowed disabled:opacity-50',
|
||||
props.class
|
||||
)"
|
||||
@input="emit('update:modelValue', $event.target.value)"
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,14 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
for: { type: String, default: undefined },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<label :for="props.for" :class="cn('text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70', props.class)">
|
||||
<slot />
|
||||
</label>
|
||||
</template>
|
||||
@@ -0,0 +1,19 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
vertical: { type: Boolean, default: false },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
:role="'separator'"
|
||||
:class="cn(
|
||||
vertical ? 'inline-flex h-full w-px' : 'flex h-px w-full',
|
||||
'bg-border shrink-0',
|
||||
props.class
|
||||
)"
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,39 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
modelValue: { type: Boolean, default: false },
|
||||
disabled: { type: Boolean, default: false },
|
||||
id: { type: String, default: undefined },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
:aria-checked="modelValue"
|
||||
:disabled="disabled"
|
||||
:id="id"
|
||||
:class="cn(
|
||||
'relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50',
|
||||
modelValue
|
||||
? 'bg-primary border-2 border-transparent'
|
||||
: 'bg-transparent border-2 border-muted-foreground/40',
|
||||
props.class
|
||||
)"
|
||||
@click="emit('update:modelValue', !modelValue)"
|
||||
>
|
||||
<span
|
||||
:class="cn(
|
||||
'pointer-events-none block rounded-full shadow-sm ring-0 transition-all duration-200',
|
||||
modelValue
|
||||
? 'h-5 w-5 translate-x-5 bg-white'
|
||||
: 'h-4 w-4 translate-x-0.5 bg-muted-foreground/60'
|
||||
)"
|
||||
/>
|
||||
</button>
|
||||
</template>
|
||||
@@ -0,0 +1,28 @@
|
||||
<script setup>
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
const props = defineProps({
|
||||
class: { type: String, default: '' },
|
||||
modelValue: { type: String, default: '' },
|
||||
placeholder: { type: String, default: '' },
|
||||
disabled: { type: Boolean, default: false },
|
||||
rows: { type: Number, default: 2 },
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<textarea
|
||||
v-bind="$attrs"
|
||||
:value="modelValue"
|
||||
:placeholder="placeholder"
|
||||
:disabled="disabled"
|
||||
:rows="rows"
|
||||
:class="cn(
|
||||
'flex min-h-15 w-full rounded-md border border-input bg-muted px-3 py-2 text-sm font-mono text-foreground shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:border-primary disabled:cursor-not-allowed disabled:opacity-50 resize-vertical',
|
||||
props.class
|
||||
)"
|
||||
@input="emit('update:modelValue', $event.target.value)"
|
||||
/>
|
||||
</template>
|
||||
@@ -0,0 +1,159 @@
|
||||
import { ref, reactive } from 'vue';
|
||||
import { listPackages, getPackagesInfo } from 'kernelsu';
|
||||
import PinyinMatch from 'pinyin-match';
|
||||
import { runCmd, writeFile, CONFIG_DIR } from '../utils.js';
|
||||
|
||||
export function useApps() {
|
||||
const apps = ref([]);
|
||||
const isLoading = ref(false);
|
||||
const loadError = ref('');
|
||||
const searchKeyword = ref('');
|
||||
const showingSystemApps = ref(true);
|
||||
const savedBlacklist = ref(new Set());
|
||||
const activityEntries = ref(new Set());
|
||||
|
||||
/** 每个 app 条目结构: { packageName, appLabel, isSystem, uid, checked, hasActivities } */
|
||||
|
||||
async function load() {
|
||||
isLoading.value = true;
|
||||
loadError.value = '';
|
||||
try {
|
||||
const blRes = await runCmd(`cat "${CONFIG_DIR}/blacklist_apps.txt"`);
|
||||
const allSaved = blRes.errno === 0 ? blRes.stdout.trim().split('\n').filter(Boolean) : [];
|
||||
savedBlacklist.value = new Set(allSaved);
|
||||
const savedPkgSet = new Set(allSaved.filter(e => !e.includes('/')));
|
||||
activityEntries.value = new Set(allSaved.filter(e => e.includes('/')));
|
||||
|
||||
let infoList = [];
|
||||
try {
|
||||
const pkgs = await listPackages();
|
||||
if (pkgs && pkgs.length > 0) infoList = await getPackagesInfo(pkgs);
|
||||
else throw new Error('no pkgs');
|
||||
} catch {
|
||||
console.log('[DEBUG] 使用模拟数据');
|
||||
infoList = Array.from({ length: 150 }, (_, i) => ({
|
||||
packageName: `com.mock.app${i}`,
|
||||
appLabel: i % 10 === 0 ? `测试应用 ${i} (含抖音关键字)` : `模拟应用 ${i}`,
|
||||
isSystem: i % 5 === 0,
|
||||
uid: 10000 + i,
|
||||
}));
|
||||
}
|
||||
|
||||
if (!showingSystemApps.value) infoList = infoList.filter(a => !a.isSystem);
|
||||
|
||||
infoList.sort((a, b) => {
|
||||
if (a.isSystem !== b.isSystem) return a.isSystem ? 1 : -1;
|
||||
return (a.appLabel || '').localeCompare(b.appLabel || '');
|
||||
});
|
||||
|
||||
const seenUids = new Set();
|
||||
infoList = infoList.filter(a => {
|
||||
if (a.uid == null) return true;
|
||||
if (seenUids.has(a.uid)) return false;
|
||||
seenUids.add(a.uid); return true;
|
||||
});
|
||||
|
||||
apps.value = infoList.map(a => reactive({
|
||||
packageName: a.packageName,
|
||||
appLabel: a.appLabel || 'Unknown',
|
||||
isSystem: a.isSystem,
|
||||
uid: a.uid,
|
||||
checked: savedPkgSet.has(a.packageName),
|
||||
expanded: false,
|
||||
}));
|
||||
|
||||
_reorder();
|
||||
} catch (e) {
|
||||
loadError.value = e.message || String(e);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function _reorder() {
|
||||
apps.value.sort((a, b) => {
|
||||
const stateA = a.checked ? 2 : (hasActivity(a.packageName) ? 1 : 0);
|
||||
const stateB = b.checked ? 2 : (hasActivity(b.packageName) ? 1 : 0);
|
||||
return stateB - stateA;
|
||||
});
|
||||
}
|
||||
|
||||
function hasActivity(pkg) {
|
||||
return [...activityEntries.value].some(e => e.startsWith(pkg + '/'));
|
||||
}
|
||||
|
||||
function getActivities(pkg) {
|
||||
return [...activityEntries.value].filter(e => e.startsWith(pkg + '/'));
|
||||
}
|
||||
|
||||
function addActivity(entry) {
|
||||
activityEntries.value.add(entry);
|
||||
_reorder();
|
||||
}
|
||||
|
||||
function removeActivity(entry) {
|
||||
activityEntries.value.delete(entry);
|
||||
_reorder();
|
||||
}
|
||||
|
||||
async function save(toast) {
|
||||
toast('保存中...');
|
||||
const selectedPkgs = apps.value.filter(a => a.checked).map(a => a.packageName);
|
||||
const allEntries = [...selectedPkgs, ...activityEntries.value];
|
||||
const res = await writeFile(`${CONFIG_DIR}/blacklist_apps.txt`, allEntries.join('\n'));
|
||||
if (res.errno === 0 || res.stdout?.includes('OK')) {
|
||||
savedBlacklist.value = new Set(allEntries);
|
||||
toast('黑名单保存成功');
|
||||
} else {
|
||||
toast('保存失败: ' + res.stderr);
|
||||
}
|
||||
}
|
||||
|
||||
function onCheckboxChange() { _reorder(); }
|
||||
|
||||
function toggleSystemApps() {
|
||||
showingSystemApps.value = !showingSystemApps.value;
|
||||
load();
|
||||
}
|
||||
|
||||
function selectAll() { apps.value.forEach(a => { a.checked = true; }); _reorder(); }
|
||||
function selectNone() { apps.value.forEach(a => { a.checked = false; }); _reorder(); }
|
||||
function invertSelection() { apps.value.forEach(a => { a.checked = !a.checked; }); _reorder(); }
|
||||
|
||||
const smartKeywords = ['抖音', 'tiktok', '爱奇艺', '优酷', '腾讯视频', '哔哩', 'bilibili',
|
||||
'youku', 'iqiyi', '芒果', '西瓜', '快手', 'kuaishou', '小红书',
|
||||
'netflix', 'youtube', 'hulu', 'disney', 'prime', '相册', 'gallery', 'photos', 'x'];
|
||||
|
||||
function smartSelect() {
|
||||
apps.value.forEach(a => {
|
||||
const name = (a.appLabel || '').toLowerCase();
|
||||
const pkg = (a.packageName || '').toLowerCase();
|
||||
for (const kw of smartKeywords) {
|
||||
if (kw === 'x') {
|
||||
if (name === 'x' || name === 'x (twitter)') { a.checked = true; break; }
|
||||
} else if (name.includes(kw) || pkg.includes(kw)) { a.checked = true; break; }
|
||||
}
|
||||
});
|
||||
_reorder();
|
||||
}
|
||||
|
||||
// 过滤后的列表
|
||||
function getFilteredApps() {
|
||||
const kw = searchKeyword.value.trim().toLowerCase();
|
||||
if (!kw) return apps.value;
|
||||
return apps.value.filter(a => {
|
||||
const pkg = a.packageName.toLowerCase();
|
||||
return pkg.includes(kw) || PinyinMatch.match(a.appLabel, kw);
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
apps, isLoading, loadError, searchKeyword, showingSystemApps,
|
||||
savedBlacklist, activityEntries,
|
||||
load, save,
|
||||
hasActivity, getActivities, addActivity, removeActivity,
|
||||
onCheckboxChange,
|
||||
toggleSystemApps, selectAll, selectNone, invertSelection, smartSelect,
|
||||
getFilteredApps,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
import { ref } from 'vue';
|
||||
import {
|
||||
runCmd, writeFile,
|
||||
CONFIG_DIR, PATH_CONFIG_DIR, BACKUP_DIR, PID_FILE, FLAG_FILE,
|
||||
DEFAULT_NOW_BRI_FILE, DEFAULT_SYS_MAX_BRI_FILE,
|
||||
} from '../utils.js';
|
||||
|
||||
export function useConfig() {
|
||||
// 亮度配置
|
||||
const uiMaxBri = ref('');
|
||||
const maxBri = ref('');
|
||||
const stepsNum = ref('50');
|
||||
const logMaxSize = ref('500');
|
||||
|
||||
// 执行策略
|
||||
const autoBriSleep = ref(false);
|
||||
const displayHdrSleep = ref(false);
|
||||
const sleepMode = ref(false);
|
||||
const sleepStartH = ref('19');
|
||||
const sleepStartM = ref('00');
|
||||
const sleepEndH = ref('06');
|
||||
const sleepEndM = ref('00');
|
||||
|
||||
// 高级设置
|
||||
const nowBriFile = ref(DEFAULT_NOW_BRI_FILE);
|
||||
const sysMaxBriFile = ref(DEFAULT_SYS_MAX_BRI_FILE);
|
||||
const inotifyEvents = ref('c');
|
||||
|
||||
// Web UI 配置 (localStorage 持久化)
|
||||
const autoRefresh = ref(localStorage.getItem('autoRefresh') !== 'false');
|
||||
const statusRefreshInterval = ref(
|
||||
Math.max(100, parseInt(localStorage.getItem('statusLogRefreshInterval') || '1000', 10))
|
||||
);
|
||||
const uiZoom = ref(
|
||||
Math.min(150, Math.max(50, parseInt(localStorage.getItem('uiZoom') || '100', 10)))
|
||||
);
|
||||
const themeMode = ref(localStorage.getItem('themeMode') || 'system');
|
||||
|
||||
async function load() {
|
||||
const [pathNowRes, pathMaxRes, eventsRes] = await Promise.all([
|
||||
runCmd(`cat "${PATH_CONFIG_DIR}/now_bri_file.txt"`),
|
||||
runCmd(`cat "${PATH_CONFIG_DIR}/max_bri_file.txt"`),
|
||||
runCmd(`cat "${CONFIG_DIR}/inotify_events.txt"`),
|
||||
]);
|
||||
if (pathNowRes.errno === 0 && pathNowRes.stdout.trim()) nowBriFile.value = pathNowRes.stdout.trim();
|
||||
if (pathMaxRes.errno === 0 && pathMaxRes.stdout.trim()) sysMaxBriFile.value = pathMaxRes.stdout.trim();
|
||||
inotifyEvents.value = (eventsRes.errno === 0 && eventsRes.stdout.trim()) ? eventsRes.stdout.trim() : 'c';
|
||||
|
||||
const [uiRes, maxRes, sleepRes, autoRes, stepsRes, logSizeRes, hdrRes] = 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"`),
|
||||
runCmd(`cat "${CONFIG_DIR}/display_hdr_sleep.txt"`),
|
||||
]);
|
||||
|
||||
if (uiRes.errno === 0) uiMaxBri.value = uiRes.stdout.trim();
|
||||
if (maxRes.errno === 0) maxBri.value = maxRes.stdout.trim();
|
||||
if (autoRes.errno === 0) autoBriSleep.value = autoRes.stdout.trim() === '1';
|
||||
if (hdrRes.errno === 0) displayHdrSleep.value = hdrRes.stdout.trim() === '1';
|
||||
stepsNum.value = (stepsRes.errno === 0 && stepsRes.stdout.trim()) ? stepsRes.stdout.trim() : '50';
|
||||
logMaxSize.value = (logSizeRes.errno === 0 && logSizeRes.stdout.trim()) ? logSizeRes.stdout.trim() : '500';
|
||||
|
||||
if (sleepRes.errno === 0) {
|
||||
const tv = sleepRes.stdout.trim();
|
||||
if (tv && tv.includes('-')) {
|
||||
sleepMode.value = true;
|
||||
const [s, e] = tv.split('-');
|
||||
if (s.length === 4) { sleepStartH.value = s.slice(0, 2); sleepStartM.value = s.slice(2); }
|
||||
if (e.length === 4) { sleepEndH.value = e.slice(0, 2); sleepEndM.value = e.slice(2); }
|
||||
} else {
|
||||
sleepMode.value = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSleepTimeStr() {
|
||||
if (!sleepMode.value) return '';
|
||||
const pad = v => String(v).padStart(2, '0');
|
||||
return `${pad(sleepStartH.value)}${pad(sleepStartM.value)}-${pad(sleepEndH.value)}${pad(sleepEndM.value)}`;
|
||||
}
|
||||
|
||||
async function save(toast) {
|
||||
if (!uiMaxBri.value || !maxBri.value) { toast('亮度值不能为空'); return; }
|
||||
toast('保存中...');
|
||||
await Promise.all([
|
||||
writeFile(`${CONFIG_DIR}/ui_max_bri.txt`, uiMaxBri.value),
|
||||
writeFile(`${CONFIG_DIR}/max_bri.txt`, maxBri.value),
|
||||
writeFile(`${CONFIG_DIR}/sleep_time.txt`, getSleepTimeStr()),
|
||||
writeFile(`${CONFIG_DIR}/auto_bri_sleep.txt`, autoBriSleep.value ? '1' : '0'),
|
||||
writeFile(`${CONFIG_DIR}/display_hdr_sleep.txt`, displayHdrSleep.value ? '1' : '0'),
|
||||
writeFile(`${CONFIG_DIR}/steps_num.txt`, stepsNum.value || '50'),
|
||||
writeFile(`${CONFIG_DIR}/log_max_size.txt`, logMaxSize.value || '500'),
|
||||
]);
|
||||
await runCmd(`rm -f "${FLAG_FILE}"`);
|
||||
const pidRes = await runCmd(`cat "${PID_FILE}"`);
|
||||
toast(pidRes.errno === 0 && pidRes.stdout.trim() ? '配置已保存 (下次调整时生效)' : '配置已保存 (服务未运行)');
|
||||
}
|
||||
|
||||
async function saveAdvanced(toast, onPathsChanged) {
|
||||
const nowV = nowBriFile.value || DEFAULT_NOW_BRI_FILE;
|
||||
const maxV = sysMaxBriFile.value || DEFAULT_SYS_MAX_BRI_FILE;
|
||||
const evtV = inotifyEvents.value || 'c';
|
||||
toast('保存中...');
|
||||
await Promise.all([
|
||||
writeFile(`${PATH_CONFIG_DIR}/now_bri_file.txt`, nowV),
|
||||
writeFile(`${PATH_CONFIG_DIR}/max_bri_file.txt`, maxV),
|
||||
writeFile(`${CONFIG_DIR}/inotify_events.txt`, evtV),
|
||||
]);
|
||||
onPathsChanged?.();
|
||||
toast('高级设置已保存,需重启服务生效');
|
||||
}
|
||||
|
||||
async function resetToDefaults(toast) {
|
||||
toast('正在恢复默认配置...');
|
||||
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) uiMaxBri.value = uiRes.stdout.trim();
|
||||
if (maxRes.errno === 0) maxBri.value = maxRes.stdout.trim();
|
||||
autoBriSleep.value = autoRes.errno === 0 ? autoRes.stdout.trim() === '1' : true;
|
||||
stepsNum.value = stepsRes.errno === 0 ? stepsRes.stdout.trim() : '50';
|
||||
logMaxSize.value = logSizeRes.errno === 0 ? logSizeRes.stdout.trim() : '500';
|
||||
if (sleepRes.errno === 0 && sleepRes.stdout.trim().includes('-')) {
|
||||
sleepMode.value = true;
|
||||
const [s, e] = sleepRes.stdout.trim().split('-');
|
||||
if (s.length === 4) { sleepStartH.value = s.slice(0, 2); sleepStartM.value = s.slice(2); }
|
||||
if (e.length === 4) { sleepEndH.value = e.slice(0, 2); sleepEndM.value = e.slice(2); }
|
||||
} else {
|
||||
sleepMode.value = true;
|
||||
sleepStartH.value = '19'; sleepStartM.value = '00';
|
||||
sleepEndH.value = '06'; sleepEndM.value = '00';
|
||||
}
|
||||
await save(toast);
|
||||
}
|
||||
|
||||
function saveWebUIConfig(toast, newAutoRefresh, newInterval, newZoom, newTheme, onRestart) {
|
||||
const interval = Math.max(100, parseInt(newInterval, 10) || 1000);
|
||||
const zoom = Math.min(150, Math.max(50, parseInt(newZoom, 10) || 100));
|
||||
localStorage.setItem('autoRefresh', newAutoRefresh);
|
||||
localStorage.setItem('statusLogRefreshInterval', interval);
|
||||
localStorage.setItem('uiZoom', zoom);
|
||||
localStorage.setItem('themeMode', newTheme);
|
||||
autoRefresh.value = newAutoRefresh;
|
||||
statusRefreshInterval.value = interval;
|
||||
uiZoom.value = zoom;
|
||||
themeMode.value = newTheme;
|
||||
document.documentElement.style.zoom = zoom / 100;
|
||||
applyTheme(newTheme);
|
||||
onRestart?.(newAutoRefresh, interval);
|
||||
toast('Web UI 配置已保存');
|
||||
}
|
||||
|
||||
function applyZoom() {
|
||||
document.documentElement.style.zoom = uiZoom.value / 100;
|
||||
}
|
||||
|
||||
function applyTheme(mode) {
|
||||
const html = document.documentElement;
|
||||
html.classList.remove('light', 'dark');
|
||||
if (mode === 'light') html.classList.add('light');
|
||||
else if (mode === 'dark') html.classList.add('dark');
|
||||
// 'system': no class, CSS @media handles it
|
||||
}
|
||||
|
||||
return {
|
||||
uiMaxBri, maxBri, stepsNum, logMaxSize,
|
||||
autoBriSleep, displayHdrSleep,
|
||||
sleepMode, sleepStartH, sleepStartM, sleepEndH, sleepEndM,
|
||||
nowBriFile, sysMaxBriFile, inotifyEvents,
|
||||
autoRefresh, statusRefreshInterval, uiZoom, themeMode,
|
||||
load, save, saveAdvanced, resetToDefaults,
|
||||
saveWebUIConfig, applyZoom, applyTheme,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import { ref, computed } from 'vue';
|
||||
import { runCmd, LOG_FILE } from '../utils.js';
|
||||
|
||||
export function useLog() {
|
||||
const fullLog = ref('');
|
||||
const filterLevel = ref('');
|
||||
const isLoading = ref(false);
|
||||
|
||||
const filteredLog = computed(() => {
|
||||
if (!fullLog.value) return '暂无日志';
|
||||
if (!filterLevel.value) return fullLog.value;
|
||||
const lines = fullLog.value.split('\n').filter(l => l.includes(`[${filterLevel.value}]`));
|
||||
return lines.length > 0 ? lines.join('\n') : `暂无 [${filterLevel.value}] 等级的日志`;
|
||||
});
|
||||
|
||||
async function load() {
|
||||
const res = await runCmd(`tail -n 100 "${LOG_FILE}"`);
|
||||
fullLog.value = res.errno === 0 ? (res.stdout.trim() || '暂无日志') : '无法读取日志 (可能模块尚未产生日志文件)';
|
||||
}
|
||||
|
||||
async function clear(toast) {
|
||||
toast('正在清空日志...');
|
||||
const res = await runCmd(`> "${LOG_FILE}"`);
|
||||
if (res.errno === 0) { fullLog.value = ''; toast('日志已清空'); }
|
||||
else toast('清空失败: ' + (res.stderr || '未知错误'));
|
||||
}
|
||||
|
||||
async function copy(toast) {
|
||||
const res = await runCmd(`tail -n 50 "${LOG_FILE}"`);
|
||||
if (res.errno !== 0 || !res.stdout.trim()) { toast('暂无日志内容'); return; }
|
||||
try {
|
||||
await navigator.clipboard.writeText(res.stdout.trim());
|
||||
} catch {
|
||||
const ta = document.createElement('textarea');
|
||||
ta.value = res.stdout.trim();
|
||||
ta.style.cssText = 'position:fixed;opacity:0;pointer-events:none';
|
||||
document.body.appendChild(ta); ta.select(); document.execCommand('copy'); document.body.removeChild(ta);
|
||||
}
|
||||
toast('已复制最新 50 条日志');
|
||||
}
|
||||
|
||||
async function exportLog(toast) {
|
||||
toast('正在导出...');
|
||||
const res = await runCmd(`cp "${LOG_FILE}" "/sdcard/LuminPro_$(date '+%Y%m%d_%H%M%S').log"`);
|
||||
toast(res.errno === 0 ? '日志已导出到 /sdcard' : '导出失败: ' + (res.stderr || '未知错误'));
|
||||
}
|
||||
|
||||
return { fullLog, filterLevel, filteredLog, isLoading, load, clear, copy, exportLog };
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
import { ref, computed } from 'vue';
|
||||
import {
|
||||
runCmd,
|
||||
CONFIG_DIR, PATH_CONFIG_DIR, PID_FILE,
|
||||
STOP_FLAG_FILE,
|
||||
DEFAULT_NOW_BRI_FILE, DEFAULT_SYS_MAX_BRI_FILE,
|
||||
} from '../utils.js';
|
||||
|
||||
export function useStatus() {
|
||||
// 亮度
|
||||
const currentBri = ref(null);
|
||||
const sysMaxBri = ref(null);
|
||||
|
||||
// 服务状态
|
||||
const inotifydPid = ref('—');
|
||||
const inotifydState = ref('—');
|
||||
const isRunning = ref(false);
|
||||
const isPaused = ref(false);
|
||||
const statusClass = computed(() => {
|
||||
if (isPaused.value) return 'status-paused';
|
||||
if (isRunning.value) return 'status-running';
|
||||
return 'status-loading';
|
||||
});
|
||||
const statusText = computed(() => {
|
||||
if (isPaused.value) return '已暂停';
|
||||
if (isRunning.value) return '运行中';
|
||||
return '未运行';
|
||||
});
|
||||
|
||||
// HDR / 睡眠状态
|
||||
const hdrRatio = ref('—');
|
||||
const sleepStatus = ref('—');
|
||||
|
||||
// 自动亮度
|
||||
const autoBriMode = ref(false);
|
||||
|
||||
// 缓存文件路径(避免每次都读)
|
||||
let _nowBriFile = null;
|
||||
let _sysMaxBriFile = null;
|
||||
|
||||
async function _ensurePaths() {
|
||||
if (_nowBriFile && _sysMaxBriFile) return;
|
||||
const [r1, r2] = await Promise.all([
|
||||
runCmd(`cat "${PATH_CONFIG_DIR}/now_bri_file.txt"`),
|
||||
runCmd(`cat "${PATH_CONFIG_DIR}/max_bri_file.txt"`),
|
||||
]);
|
||||
_nowBriFile = (r1.errno === 0 && r1.stdout.trim()) ? r1.stdout.trim() : DEFAULT_NOW_BRI_FILE;
|
||||
_sysMaxBriFile = (r2.errno === 0 && r2.stdout.trim()) ? r2.stdout.trim() : DEFAULT_SYS_MAX_BRI_FILE;
|
||||
}
|
||||
|
||||
function invalidatePaths() {
|
||||
_nowBriFile = null;
|
||||
_sysMaxBriFile = null;
|
||||
}
|
||||
|
||||
async function load(forceFull = false) {
|
||||
await _ensurePaths();
|
||||
|
||||
if (forceFull || currentBri.value === null || sysMaxBri.value === null) {
|
||||
const [cRes, sRes] = await Promise.all([
|
||||
runCmd(`cat "${_nowBriFile}"`),
|
||||
runCmd(`cat "${_sysMaxBriFile}"`),
|
||||
]);
|
||||
currentBri.value = cRes.errno === 0 ? cRes.stdout.trim() : '0';
|
||||
sysMaxBri.value = sRes.errno === 0 ? sRes.stdout.trim() : '255';
|
||||
}
|
||||
|
||||
const [pidRes, stopRes, autoBriRes, hdrRes, sleepRes] = await Promise.all([
|
||||
runCmd(`cat "${PID_FILE}"`),
|
||||
runCmd(`[ -f "${STOP_FLAG_FILE}" ] && echo "1" || echo "0"`),
|
||||
runCmd(`settings get system screen_brightness_mode`),
|
||||
runCmd(`dumpsys display 2>/dev/null | sed -n 's/.*hdrSdrRatio \\([0-9.]*\\).*/\\1/p' | head -n 1`),
|
||||
runCmd(`cat "${CONFIG_DIR}/sleep_time.txt"`),
|
||||
]);
|
||||
|
||||
isPaused.value = stopRes.errno === 0 && stopRes.stdout.trim() === '1';
|
||||
const pidStr = pidRes.errno === 0 ? pidRes.stdout.trim() : '';
|
||||
isRunning.value = !isPaused.value && !!pidStr;
|
||||
inotifydPid.value = pidStr || '离线';
|
||||
|
||||
if (isRunning.value && pidStr) {
|
||||
const stateRes = await runCmd(`cat /proc/${pidStr}/status 2>/dev/null | grep "State:" | sed 's/.*((\\(.*\\)))/\\1/'`);
|
||||
inotifydState.value = (stateRes.errno === 0 && stateRes.stdout.trim()) ? stateRes.stdout.trim() : '已退出';
|
||||
} else {
|
||||
inotifydState.value = '离线';
|
||||
}
|
||||
|
||||
const autoBriVal = autoBriRes.errno === 0 ? parseInt(autoBriRes.stdout.trim(), 10) : 0;
|
||||
autoBriMode.value = autoBriVal === 1;
|
||||
|
||||
const hdrRaw = hdrRes.errno === 0 ? hdrRes.stdout.trim() : '';
|
||||
hdrRatio.value = (hdrRaw && /^\d+(\.\d+)?$/.test(hdrRaw)) ? parseFloat(hdrRaw).toFixed(2) : '-';
|
||||
|
||||
// 计算睡眠状态
|
||||
const sleepTime = sleepRes.errno === 0 ? sleepRes.stdout.trim() : '';
|
||||
sleepStatus.value = _calcSleep(sleepTime);
|
||||
}
|
||||
|
||||
function _calcSleep(sleepTime) {
|
||||
if (!sleepTime || !sleepTime.includes('-')) return '非休眠';
|
||||
const [s, e] = sleepTime.split('-');
|
||||
if (s.length !== 4 || e.length !== 4) return '非休眠';
|
||||
const now = new Date();
|
||||
const nV = now.getHours() * 100 + now.getMinutes();
|
||||
const sNum = parseInt(s.slice(0, 2), 10) * 100 + parseInt(s.slice(2), 10);
|
||||
const eNum = parseInt(e.slice(0, 2), 10) * 100 + parseInt(e.slice(2), 10);
|
||||
if (sNum > eNum) {
|
||||
return (nV >= sNum || nV < eNum) ? '休眠中' : '非休眠';
|
||||
}
|
||||
return (nV >= sNum && nV < eNum) ? '休眠中' : '非休眠';
|
||||
}
|
||||
|
||||
async function toggleService(toast) {
|
||||
const res = await runCmd(`sh /data/adb/modules/LuminPro/action.sh`);
|
||||
toast(res.errno === 0 ? (res.stdout.trim() || '状态已切换') : ('操作失败: ' + res.stderr));
|
||||
await load(true);
|
||||
}
|
||||
|
||||
async function restartService(toast) {
|
||||
toast('正在重启服务...');
|
||||
const res = await runCmd(`sh /data/adb/modules/LuminPro/script/restart.sh`);
|
||||
setTimeout(async () => { await load(true); }, 1000);
|
||||
toast(res.errno === 0 ? '服务已成功重启' : ('重启失败: ' + res.stderr));
|
||||
}
|
||||
|
||||
async function setBrightness(newBri, toast) {
|
||||
currentBri.value = String(newBri);
|
||||
const cmd = `echo -n '${newBri}' > '${_nowBriFile}' 2>/dev/null && echo 'OK'`;
|
||||
const res = await runCmd(cmd);
|
||||
if (!(res.errno === 0 && res.stdout.includes('OK'))) {
|
||||
toast('亮度设置失败,已恢复');
|
||||
await load(true);
|
||||
}
|
||||
}
|
||||
|
||||
async function setAutoBrightness(enabled, toast) {
|
||||
const mode = enabled ? 1 : 0;
|
||||
const res = await runCmd(`settings put system screen_brightness_mode ${mode}`);
|
||||
if (res.errno === 0) {
|
||||
autoBriMode.value = enabled;
|
||||
toast(enabled ? '自动亮度已启用' : '手动亮度已启用');
|
||||
} else {
|
||||
toast('设置失败: ' + (res.stderr || '未知错误'));
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
currentBri, sysMaxBri,
|
||||
inotifydPid, inotifydState,
|
||||
isRunning, isPaused,
|
||||
statusClass, statusText,
|
||||
hdrRatio, sleepStatus,
|
||||
autoBriMode,
|
||||
load, invalidatePaths,
|
||||
toggleService, restartService,
|
||||
setBrightness, setAutoBrightness,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
/* Header */
|
||||
.app-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20px 20px;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.header-icon {
|
||||
font-size: 2.5rem;
|
||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.header-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.header-text h1 {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--md-sys-color-on-background);
|
||||
letter-spacing: -0.3px;
|
||||
}
|
||||
|
||||
.header-subtitle {
|
||||
margin: 0;
|
||||
font-size: 0.9rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.header-version {
|
||||
margin: 0;
|
||||
font-size: 0.75rem;
|
||||
color: var(--md-sys-color-primary);
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.header-status-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.header-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: var(--md-sys-color-surface-container-high);
|
||||
padding: 8px 16px;
|
||||
border-radius: 12px;
|
||||
font-size: 0.8125rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-weight: 500;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.08);
|
||||
}
|
||||
|
||||
.header-status-actions {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.btn-status-action {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--md-sys-color-primary);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.btn-status-action:active {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--md-sys-color-error);
|
||||
box-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
|
||||
animation: status-pulse 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes status-pulse {
|
||||
0%, 100% {
|
||||
box-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 12px rgba(244, 67, 54, 0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes status-pulse-green {
|
||||
0%, 100% {
|
||||
box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 12px rgba(76, 175, 80, 0.8);
|
||||
}
|
||||
}
|
||||
|
||||
.header-status.status-running .status-dot {
|
||||
animation: status-pulse-green 2s infinite;
|
||||
}
|
||||
|
||||
.header-status.status-paused .status-dot,
|
||||
.header-status.status-loading .status-dot {
|
||||
animation: status-pulse 2s infinite;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
@import "tailwindcss";
|
||||
@import "tw-animate-css";
|
||||
|
||||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--color-card: var(--card);
|
||||
--color-card-foreground: var(--card-foreground);
|
||||
--color-popover: var(--popover);
|
||||
--color-popover-foreground: var(--popover-foreground);
|
||||
--color-primary: var(--primary);
|
||||
--color-primary-foreground: var(--primary-foreground);
|
||||
--color-secondary: var(--secondary);
|
||||
--color-secondary-foreground: var(--secondary-foreground);
|
||||
--color-muted: var(--muted);
|
||||
--color-muted-foreground: var(--muted-foreground);
|
||||
--color-accent: var(--accent);
|
||||
--color-accent-foreground: var(--accent-foreground);
|
||||
--color-destructive: var(--destructive);
|
||||
--color-border: var(--border);
|
||||
--color-input: var(--input);
|
||||
--color-ring: var(--ring);
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
--radius-xl: calc(var(--radius) + 4px);
|
||||
--font-sans: Geist, system-ui, -apple-system, sans-serif;
|
||||
--font-mono: 'Google Sans Code', 'Roboto Mono', monospace;
|
||||
}
|
||||
|
||||
/* ===============================
|
||||
Shadcn 主题 Token (暗色, MD3 调色板)
|
||||
=============================== */
|
||||
:root, :root.dark {
|
||||
--radius: 0.75rem;
|
||||
|
||||
/* Shadcn tokens */
|
||||
--background: #111318;
|
||||
--foreground: #e2e2e9;
|
||||
--card: #1e1f25;
|
||||
--card-foreground: #e2e2e9;
|
||||
--popover: #2b2930;
|
||||
--popover-foreground: #e2e2e9;
|
||||
--primary: #a8c7fa;
|
||||
--primary-foreground: #062e6f;
|
||||
--secondary: #2b2930;
|
||||
--secondary-foreground: #e2e2e9;
|
||||
--muted: #212429;
|
||||
--muted-foreground: #c4c6d0;
|
||||
--accent: #1b4b9b;
|
||||
--accent-foreground: #d3e3fd;
|
||||
--destructive: #ffb4ab;
|
||||
--border: #44474f;
|
||||
--input: #44474f;
|
||||
--ring: rgba(168, 199, 250, 0.5);
|
||||
|
||||
/* MD3 tokens (保留,legacy CSS 仍在使用) */
|
||||
--md-sys-color-background: #111318;
|
||||
--md-sys-color-background-rgb: 17, 19, 24;
|
||||
--md-sys-color-on-background: #e2e2e9;
|
||||
--md-sys-color-surface: #1e1f25;
|
||||
--md-sys-color-surface-container: #212429;
|
||||
--md-sys-color-surface-container-high: #2b2930;
|
||||
--md-sys-color-surface-container-high-rgb: 43, 41, 48;
|
||||
--md-sys-color-on-surface: #e2e2e9;
|
||||
--md-sys-color-on-surface-variant: #c4c6d0;
|
||||
--md-sys-color-primary: #a8c7fa;
|
||||
--md-sys-color-primary-rgb: 168, 199, 250;
|
||||
--md-sys-color-on-primary: #062e6f;
|
||||
--md-sys-color-primary-container: #1b4b9b;
|
||||
--md-sys-color-on-primary-container: #d3e3fd;
|
||||
--md-sys-color-outline: #8e9099;
|
||||
--md-sys-color-outline-variant: #44474f;
|
||||
--md-sys-color-error: #ffb4ab;
|
||||
--md-sys-color-on-error: #690005;
|
||||
--md-sys-color-error-container: #93000a;
|
||||
--border-radius-m: 16px;
|
||||
--border-radius-s: 8px;
|
||||
--spacing-s: 8px;
|
||||
--spacing-m: 16px;
|
||||
--spacing-l: 24px;
|
||||
--color-warning: #f59e0b;
|
||||
}
|
||||
|
||||
/* ===============================
|
||||
浅色主题 Token
|
||||
=============================== */
|
||||
@media (prefers-color-scheme: light) {
|
||||
:root:not(.dark) {
|
||||
--background: #f8f9fc;
|
||||
--foreground: #191c20;
|
||||
--card: #ffffff;
|
||||
--card-foreground: #191c20;
|
||||
--popover: #ffffff;
|
||||
--popover-foreground: #191c20;
|
||||
--primary: #0b57d0;
|
||||
--primary-foreground: #ffffff;
|
||||
--secondary: #e8eaf0;
|
||||
--secondary-foreground: #191c20;
|
||||
--muted: #eff1f6;
|
||||
--muted-foreground: #44474f;
|
||||
--accent: #d3e3fd;
|
||||
--accent-foreground: #062e6f;
|
||||
--destructive: #b3261e;
|
||||
--border: #c4c7d0;
|
||||
--input: #c4c7d0;
|
||||
--ring: rgba(11, 87, 208, 0.3);
|
||||
/* MD3 */
|
||||
--md-sys-color-background: #f8f9fc;
|
||||
--md-sys-color-background-rgb: 248, 249, 252;
|
||||
--md-sys-color-on-background: #191c20;
|
||||
--md-sys-color-surface: #ffffff;
|
||||
--md-sys-color-surface-container: #eff1f6;
|
||||
--md-sys-color-surface-container-high: #e8eaf0;
|
||||
--md-sys-color-surface-container-high-rgb: 232, 234, 240;
|
||||
--md-sys-color-on-surface: #191c20;
|
||||
--md-sys-color-on-surface-variant: #44474f;
|
||||
--md-sys-color-primary: #0b57d0;
|
||||
--md-sys-color-primary-rgb: 11, 87, 208;
|
||||
--md-sys-color-on-primary: #ffffff;
|
||||
--md-sys-color-primary-container: #d3e3fd;
|
||||
--md-sys-color-on-primary-container: #062e6f;
|
||||
--md-sys-color-outline: #74777f;
|
||||
--md-sys-color-outline-variant: #c4c7d0;
|
||||
--md-sys-color-error: #b3261e;
|
||||
--md-sys-color-on-error: #ffffff;
|
||||
--md-sys-color-error-container: #f9dedc;
|
||||
--color-warning: #b45309;
|
||||
}
|
||||
}
|
||||
|
||||
:root.light {
|
||||
--background: #f8f9fc;
|
||||
--foreground: #191c20;
|
||||
--card: #ffffff;
|
||||
--card-foreground: #191c20;
|
||||
--popover: #ffffff;
|
||||
--popover-foreground: #191c20;
|
||||
--primary: #0b57d0;
|
||||
--primary-foreground: #ffffff;
|
||||
--secondary: #e8eaf0;
|
||||
--secondary-foreground: #191c20;
|
||||
--muted: #eff1f6;
|
||||
--muted-foreground: #44474f;
|
||||
--accent: #d3e3fd;
|
||||
--accent-foreground: #062e6f;
|
||||
--destructive: #b3261e;
|
||||
--border: #c4c7d0;
|
||||
--input: #c4c7d0;
|
||||
--ring: rgba(11, 87, 208, 0.3);
|
||||
/* MD3 */
|
||||
--md-sys-color-background: #f8f9fc;
|
||||
--md-sys-color-background-rgb: 248, 249, 252;
|
||||
--md-sys-color-on-background: #191c20;
|
||||
--md-sys-color-surface: #ffffff;
|
||||
--md-sys-color-surface-container: #eff1f6;
|
||||
--md-sys-color-surface-container-high: #e8eaf0;
|
||||
--md-sys-color-surface-container-high-rgb: 232, 234, 240;
|
||||
--md-sys-color-on-surface: #191c20;
|
||||
--md-sys-color-on-surface-variant: #44474f;
|
||||
--md-sys-color-primary: #0b57d0;
|
||||
--md-sys-color-primary-rgb: 11, 87, 208;
|
||||
--md-sys-color-on-primary: #ffffff;
|
||||
--md-sys-color-primary-container: #d3e3fd;
|
||||
--md-sys-color-on-primary-container: #062e6f;
|
||||
--md-sys-color-outline: #74777f;
|
||||
--md-sys-color-outline-variant: #c4c7d0;
|
||||
--md-sys-color-error: #b3261e;
|
||||
--md-sys-color-on-error: #ffffff;
|
||||
--md-sys-color-error-container: #f9dedc;
|
||||
--color-warning: #b45309;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { clsx } from 'clsx';
|
||||
import { twMerge } from 'tailwind-merge';
|
||||
|
||||
export function cn(...inputs) {
|
||||
return twMerge(clsx(inputs));
|
||||
}
|
||||
+11
-1196
File diff suppressed because it is too large.
Load diff
+1
-920
@@ -1,4 +1,4 @@
|
||||
:root {
|
||||
:root, :root.dark {
|
||||
--md-sys-color-background: #111318;
|
||||
--md-sys-color-background-rgb: 17, 19, 24;
|
||||
--md-sys-color-on-background: #e2e2e9;
|
||||
@@ -82,922 +82,3 @@ body::-webkit-scrollbar {
|
||||
gap: var(--spacing-m);
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.app-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20px 20px;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.header-icon {
|
||||
font-size: 2.5rem;
|
||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.header-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.header-text h1 {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 700;
|
||||
color: var(--md-sys-color-on-background);
|
||||
letter-spacing: -0.3px;
|
||||
}
|
||||
|
||||
.header-subtitle {
|
||||
margin: 0;
|
||||
font-size: 0.9rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.header-version {
|
||||
margin: 0;
|
||||
font-size: 0.75rem;
|
||||
color: var(--md-sys-color-primary);
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.header-status-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.header-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: var(--md-sys-color-surface-container-high);
|
||||
padding: 8px 16px;
|
||||
border-radius: 12px;
|
||||
font-size: 0.8125rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-weight: 500;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.08);
|
||||
}
|
||||
|
||||
.header-status-actions {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.btn-status-action {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--md-sys-color-primary);
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
transition: all 0.2s;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.btn-status-action:active {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--md-sys-color-error);
|
||||
box-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
|
||||
animation: status-pulse 2s infinite;
|
||||
}
|
||||
|
||||
@keyframes status-pulse {
|
||||
0%, 100% {
|
||||
box-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 12px rgba(244, 67, 54, 0.8);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes status-pulse-green {
|
||||
0%, 100% {
|
||||
box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
|
||||
}
|
||||
50% {
|
||||
box-shadow: 0 0 12px rgba(76, 175, 80, 0.8);
|
||||
}
|
||||
}
|
||||
|
||||
.header-status.status-running .status-dot {
|
||||
animation: status-pulse-green 2s infinite;
|
||||
}
|
||||
|
||||
.header-status.status-paused .status-dot,
|
||||
.header-status.status-loading .status-dot {
|
||||
animation: status-pulse 2s infinite;
|
||||
}
|
||||
|
||||
/* Cards */
|
||||
.card {
|
||||
background-color: var(--md-sys-color-surface);
|
||||
border-radius: var(--border-radius-m);
|
||||
padding: var(--spacing-l);
|
||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* Page Transitions */
|
||||
.card-animate-in {
|
||||
animation: cardFadeIn 0.4s cubic-bezier(0.2, 0, 0, 1) forwards;
|
||||
}
|
||||
|
||||
.navbar-slider {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
@keyframes cardFadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(12px) scale(0.985);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
#log-section {
|
||||
flex: 1;
|
||||
min-height: calc(100vh - 220px);
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-s);
|
||||
margin-bottom: var(--spacing-l);
|
||||
}
|
||||
|
||||
.card-header h2 {
|
||||
margin: 0;
|
||||
font-size: 1.125rem;
|
||||
font-weight: 500;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
/* Config Items */
|
||||
.config-group {
|
||||
margin-bottom: var(--spacing-l);
|
||||
padding: var(--spacing-m);
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
border-radius: var(--border-radius-m);
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.05);
|
||||
}
|
||||
|
||||
.group-title {
|
||||
margin: 0 0 var(--spacing-m) 0;
|
||||
color: var(--md-sys-color-primary);
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.group-title i, .group-title svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.config-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
#advanced-section .config-item {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#advanced-section .config-value {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.config-item + .config-item {
|
||||
margin-top: var(--spacing-m);
|
||||
border-top: 1px solid rgba(var(--md-sys-color-outline-variant-rgb, 142, 144, 153), 0.1);
|
||||
padding-top: var(--spacing-m);
|
||||
}
|
||||
|
||||
.config-label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.config-name {
|
||||
font-size: 1rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.config-desc {
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.config-input {
|
||||
width: 100px;
|
||||
padding: 8px 12px;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: var(--border-radius-s);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-size: 1rem;
|
||||
font-family: inherit;
|
||||
text-align: right;
|
||||
outline: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.config-input:focus {
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2);
|
||||
background-color: var(--md-sys-color-surface);
|
||||
}
|
||||
|
||||
#advanced-section .config-input {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.config-textarea {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
width: 100%;
|
||||
min-height: 60px;
|
||||
max-height: 300px;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
border-radius: var(--border-radius-m);
|
||||
resize: vertical;
|
||||
padding: 10px 14px;
|
||||
font-family: 'Google Sans Code', system-ui, monospace;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.4;
|
||||
transition: all 0.2s ease;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.config-textarea:focus {
|
||||
border-color: var(--md-sys-color-primary);
|
||||
box-shadow: 0 0 0 2px rgba(var(--md-sys-color-primary-rgb), 0.2);
|
||||
background-color: var(--md-sys-color-surface);
|
||||
}
|
||||
|
||||
.config-input-wide {
|
||||
width: 140px;
|
||||
}
|
||||
|
||||
.config-item-expand {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: var(--spacing-s);
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
opacity: 0;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.config-item-expand.show {
|
||||
max-height: 100px; /* 调整为适合内容的高度 */
|
||||
opacity: 1;
|
||||
margin-bottom: var(--spacing-m);
|
||||
}
|
||||
|
||||
/* Custom Time Picker Styles */
|
||||
.custom-time-picker {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.time-unit {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
padding: 2px 6px;
|
||||
border-radius: var(--border-radius-s);
|
||||
border: 1px solid var(--md-sys-color-outline);
|
||||
}
|
||||
|
||||
.time-input {
|
||||
width: 32px;
|
||||
background-color: transparent;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
border: none;
|
||||
font-size: 0.875rem;
|
||||
text-align: center;
|
||||
font-family: '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 {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: var(--spacing-m);
|
||||
border-radius: var(--border-radius-m);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.04);
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.status-item:active {
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.status-item-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.status-item-header svg {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.status-label {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.status-value {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-primary);
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* Brightness Section */
|
||||
.brightness-section {
|
||||
margin-top: var(--spacing-l);
|
||||
padding: var(--spacing-m);
|
||||
background: linear-gradient(135deg, var(--md-sys-color-surface-container-high) 0%, var(--md-sys-color-surface-container) 100%);
|
||||
border-radius: var(--border-radius-m);
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
}
|
||||
|
||||
.brightness-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: var(--spacing-m);
|
||||
}
|
||||
|
||||
.brightness-title {
|
||||
font-size: 1rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.brightness-percent {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
color: var(--md-sys-color-primary);
|
||||
min-width: 50px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Brightness Slider Container */
|
||||
.brightness-container {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: var(--spacing-m);
|
||||
padding: var(--spacing-s) 0;
|
||||
}
|
||||
|
||||
.brightness-label {
|
||||
font-size: 0.75rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
min-width: 24px;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Brightness Slider (Progress Bar Style) */
|
||||
.brightness-slider {
|
||||
flex: 1;
|
||||
height: 24px;
|
||||
border-radius: 12px;
|
||||
/* 背景将由 JS 通过 linear-gradient 动态更新实现进度条效果 */
|
||||
background: var(--md-sys-color-surface-container-high);
|
||||
outline: none;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
cursor: grab;
|
||||
transition: height 0.2s, box-shadow 0.2s;
|
||||
border: 1px solid rgba(255, 255, 255, 0.03);
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
|
||||
overflow: hidden; /* 确保进度条颜色不溢出圆角 */
|
||||
}
|
||||
|
||||
.brightness-slider:hover {
|
||||
height: 28px;
|
||||
}
|
||||
|
||||
.brightness-slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 0;
|
||||
height: 0;
|
||||
background: transparent;
|
||||
cursor: grab;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.brightness-slider::-webkit-slider-thumb:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-thumb {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
background: var(--md-sys-color-primary);
|
||||
cursor: grab;
|
||||
border: 2px solid var(--md-sys-color-surface);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-thumb:hover {
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-thumb:active {
|
||||
cursor: grabbing;
|
||||
box-shadow: 0 0 0 10px rgba(168, 199, 250, 0.2);
|
||||
}
|
||||
|
||||
.brightness-slider::-moz-range-track {
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/* Auto Brightness Row */
|
||||
.auto-brightness-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: var(--spacing-s) var(--spacing-m);
|
||||
background-color: rgba(var(--md-sys-color-primary-rgb), 0.08);
|
||||
border-radius: var(--border-radius-s);
|
||||
}
|
||||
|
||||
.auto-brightness-label {
|
||||
font-size: 0.875rem;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Actions */
|
||||
.card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
margin-top: var(--spacing-l);
|
||||
padding-top: var(--spacing-m);
|
||||
border-top: 1px solid var(--md-sys-color-outline-variant);
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
padding: 10px 24px;
|
||||
border-radius: 100px;
|
||||
border: none;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s, opacity 0.2s;
|
||||
}
|
||||
|
||||
.btn:active {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: var(--md-sys-color-primary);
|
||||
color: var(--md-sys-color-on-primary);
|
||||
}
|
||||
|
||||
.btn-outline {
|
||||
background-color: transparent;
|
||||
border: 1px solid var(--md-sys-color-outline);
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.btn-outline-s, .btn-text-s {
|
||||
background-color: transparent;
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
color: var(--md-sys-color-primary);
|
||||
padding: 4px 10px;
|
||||
min-width: 50px;
|
||||
height: 28px;
|
||||
font-size: 0.75rem;
|
||||
border-radius: var(--border-radius-s);
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.2s;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.btn-text-s:active {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: var(--md-sys-color-error) !important;
|
||||
color: var(--md-sys-color-on-error) !important;
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
/* Header Actions container */
|
||||
.header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.btn-icon-only {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 1.25rem;
|
||||
cursor: pointer;
|
||||
padding: 4px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.btn-icon-only-s {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
color: var(--md-sys-color-primary);
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.btn-icon-only-s:active {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.btn-icon-only-s i, .btn-icon-only-s svg {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.animate-spin {
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
/* About section */
|
||||
.about-links {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-m);
|
||||
}
|
||||
|
||||
.about-link-item {
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: 16px;
|
||||
border-radius: var(--border-radius-m);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
text-decoration: none;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
border: 1px solid rgba(var(--md-sys-color-primary-rgb), 0.05);
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.about-link-item:active {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.about-link-item svg {
|
||||
color: var(--md-sys-color-primary);
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
.link-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.link-label {
|
||||
font-weight: 600;
|
||||
font-size: 0.9375rem;
|
||||
}
|
||||
|
||||
.link-url {
|
||||
font-size: 0.75rem;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.about-doc-list {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: var(--spacing-m);
|
||||
}
|
||||
|
||||
.about-doc-item {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
padding: 16px;
|
||||
border-radius: var(--border-radius-m);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
cursor: pointer;
|
||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.05);
|
||||
transition: all 0.2s;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.about-doc-item:active {
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
.about-doc-item svg {
|
||||
color: var(--md-sys-color-primary);
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.about-doc-item span {
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
/* Document Drawer (Bottom Sheet) */
|
||||
.doc-drawer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 90vh;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
z-index: 2000;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transform: translateY(100%);
|
||||
transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
|
||||
border-radius: 28px 28px 0 0;
|
||||
box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.doc-drawer.show {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.drawer-backdrop {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0,0,0,0.5);
|
||||
backdrop-filter: blur(4px);
|
||||
z-index: 1999;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.drawer-backdrop.show {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.drawer-handle {
|
||||
width: 32px;
|
||||
height: 4px;
|
||||
background-color: var(--md-sys-color-outline-variant);
|
||||
border-radius: 2px;
|
||||
margin: 12px auto 4px auto;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.drawer-header {
|
||||
height: 56px;
|
||||
padding: 0 16px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
background-color: transparent;
|
||||
border-bottom: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.05);
|
||||
}
|
||||
|
||||
.drawer-header h2 {
|
||||
font-size: 1.125rem;
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
margin: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.drawer-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 32px 24px 64px 24px;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.doc-loading {
|
||||
text-align: center;
|
||||
padding: 64px 20px;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
/* Markdown Rendering */
|
||||
.markdown-body {
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
|
||||
color: var(--md-sys-color-primary);
|
||||
margin-top: 1.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.markdown-body p {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.markdown-body code {
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: 'Google Sans Code', monospace;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.markdown-body pre {
|
||||
background-color: #0d0e12;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
overflow-x: auto;
|
||||
margin-bottom: 1.5em;
|
||||
border: 1px solid rgba(255,255,255,0.05);
|
||||
}
|
||||
|
||||
.markdown-body pre code {
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
.markdown-body ul, .markdown-body ol {
|
||||
padding-left: 1.5em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.markdown-body blockquote {
|
||||
border-left: 4px solid var(--md-sys-color-primary);
|
||||
padding-left: 16px;
|
||||
margin: 0 0 16px 0;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding: 12px 16px;
|
||||
border-radius: 0 8px 8px 0;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import Button from "@/components/ui/Button.vue";
|
||||
import { ExternalLink, FileText, BookOpen, ScrollText, StickyNote, X, Github } from "lucide-vue-next";
|
||||
import { moduleInfo } from "kernelsu";
|
||||
import { runCmd } from "../utils.js";
|
||||
|
||||
const MODULE_DIR = '/data/adb/modules/LuminPro';
|
||||
|
||||
const moduleVersion = ref("");
|
||||
const sheetOpen = ref(false);
|
||||
const sheetTitle = ref("");
|
||||
const sheetContent = ref("");
|
||||
const sheetLoading = ref(false);
|
||||
|
||||
onMounted(() => {
|
||||
try {
|
||||
const info = JSON.parse(moduleInfo());
|
||||
moduleVersion.value = info.version || '';
|
||||
} catch {
|
||||
moduleVersion.value = '[debug]';
|
||||
}
|
||||
});
|
||||
|
||||
// 通过 KernelSU runCmd 读取模块本地文件
|
||||
const moduleDocs = [
|
||||
{ title: "README", file: `${MODULE_DIR}/README.md`, icon: BookOpen, md: true },
|
||||
{ title: "README (EN)", file: `${MODULE_DIR}/README_en.md`, icon: BookOpen, md: true },
|
||||
{ title: "更新日志", file: `${MODULE_DIR}/changelog.md`, icon: ScrollText, md: true },
|
||||
{ title: "NOTE", file: `${MODULE_DIR}/NOTE.txt`, icon: StickyNote, md: false },
|
||||
];
|
||||
|
||||
// 通过 fetch 读取 webroot/docs/
|
||||
const webDocs = [
|
||||
{ title: "Web UI 使用文档", path: "/docs/webui.md", icon: FileText },
|
||||
{ title: "Web UI API 文档", path: "/docs/webui-api.md", icon: FileText },
|
||||
];
|
||||
|
||||
function mdToHtml(text) {
|
||||
return text
|
||||
.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
|
||||
.replace(/^### (.+)$/gm, "<h3>$1</h3>")
|
||||
.replace(/^## (.+)$/gm, "<h2>$1</h2>")
|
||||
.replace(/^# (.+)$/gm, "<h1>$1</h1>")
|
||||
.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>")
|
||||
.replace(/`([^`]+)`/g, "<code>$1</code>")
|
||||
.replace(/\n/g, "<br>");
|
||||
}
|
||||
|
||||
async function openModuleDoc(doc) {
|
||||
sheetTitle.value = doc.title;
|
||||
sheetContent.value = "";
|
||||
sheetLoading.value = true;
|
||||
sheetOpen.value = true;
|
||||
try {
|
||||
const res = await runCmd(`cat "${doc.file}" 2>/dev/null`);
|
||||
if (res.errno !== 0 || !res.stdout.trim()) throw new Error('文件不存在或为空');
|
||||
sheetContent.value = doc.md ? mdToHtml(res.stdout) : res.stdout.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/\n/g,'<br>');
|
||||
} catch (e) {
|
||||
sheetContent.value = `加载失败: ${e.message}`;
|
||||
} finally {
|
||||
sheetLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function openWebDoc(doc) {
|
||||
sheetTitle.value = doc.title;
|
||||
sheetContent.value = "";
|
||||
sheetLoading.value = true;
|
||||
sheetOpen.value = true;
|
||||
try {
|
||||
const res = await fetch(doc.path);
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
sheetContent.value = mdToHtml(await res.text());
|
||||
} catch (e) {
|
||||
sheetContent.value = `加载失败: ${e.message}`;
|
||||
} finally {
|
||||
sheetLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function closeSheet() {
|
||||
sheetOpen.value = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div style="display:contents">
|
||||
<section class="card" id="about-section">
|
||||
<!-- 项目信息 -->
|
||||
<div class="about-hero">
|
||||
<div class="about-logo">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<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"/>
|
||||
</svg>
|
||||
</div>
|
||||
<h2 class="about-name">LuminPro</h2>
|
||||
<p class="about-desc">日用屏幕亮度强化</p>
|
||||
<span class="about-version-badge">{{ moduleVersion ? `v${moduleVersion}` : "V2.2" }}</span>
|
||||
</div>
|
||||
|
||||
<!-- 模块文档 -->
|
||||
<div class="about-section-title">模块文档</div>
|
||||
<div class="about-list">
|
||||
<button
|
||||
v-for="doc in moduleDocs"
|
||||
:key="doc.file"
|
||||
class="about-list-item"
|
||||
@click="openModuleDoc(doc)"
|
||||
>
|
||||
<component :is="doc.icon" :size="18" class="about-list-icon" />
|
||||
<span>{{ doc.title }}</span>
|
||||
<ExternalLink :size="14" class="about-list-chevron" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Web UI 文档 -->
|
||||
<div class="about-section-title">Web UI 文档</div>
|
||||
<div class="about-list">
|
||||
<button
|
||||
v-for="doc in webDocs"
|
||||
:key="doc.path"
|
||||
class="about-list-item"
|
||||
@click="openWebDoc(doc)"
|
||||
>
|
||||
<component :is="doc.icon" :size="18" class="about-list-icon" />
|
||||
<span>{{ doc.title }}</span>
|
||||
<ExternalLink :size="14" class="about-list-chevron" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 链接列表 -->
|
||||
<div class="about-section-title">链接</div>
|
||||
<div class="about-list">
|
||||
<a
|
||||
class="about-list-item"
|
||||
href="https://github.com/YuleBest/LuminPro"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
>
|
||||
<Github :size="18" class="about-list-icon" />
|
||||
<span>GitHub 项目主页</span>
|
||||
<ExternalLink :size="14" class="about-list-chevron" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<p class="about-footer">Made with ❤ by Yule</p>
|
||||
</section>
|
||||
|
||||
<!-- 文档底部弹出抽屉 -->
|
||||
<Teleport to="body">
|
||||
<div class="doc-sheet-backdrop" :class="{ show: sheetOpen }" @click="closeSheet"></div>
|
||||
<div class="doc-sheet" :class="{ show: sheetOpen }">
|
||||
<div class="doc-sheet-header">
|
||||
<span class="doc-sheet-title">{{ sheetTitle }}</span>
|
||||
<button class="doc-sheet-close" @click="closeSheet">
|
||||
<X :size="20" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="doc-sheet-body">
|
||||
<div v-if="sheetLoading" class="doc-sheet-loading">加载中...</div>
|
||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||
<div v-else class="doc-sheet-content" v-html="sheetContent"></div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,361 @@
|
||||
<script setup>
|
||||
import { inject, ref, computed, onMounted, reactive } from "vue";
|
||||
import { getPackagesInfo } from "kernelsu";
|
||||
import { useApps } from "@/composables/useApps.js";
|
||||
import { runCmd } from "../utils.js";
|
||||
import Button from "@/components/ui/Button.vue";
|
||||
import {
|
||||
RefreshCw, Eye, EyeOff, Sparkles, Plus, CheckCheck, Square,
|
||||
CheckSquare, Search, X, Check, ChevronDown, ScanSearch,
|
||||
ChevronLeft, Monitor, Clock, CircleCheck,
|
||||
} from "lucide-vue-next";
|
||||
|
||||
const showToast = inject("showToast");
|
||||
const appsMenuOpen = ref(false);
|
||||
|
||||
const {
|
||||
apps, isLoading, loadError, searchKeyword, showingSystemApps,
|
||||
savedBlacklist, activityEntries,
|
||||
load, save,
|
||||
hasActivity, getActivities, addActivity, removeActivity,
|
||||
onCheckboxChange,
|
||||
toggleSystemApps, selectAll, selectNone, invertSelection, smartSelect,
|
||||
getFilteredApps,
|
||||
} = useApps();
|
||||
|
||||
const filteredApps = computed(() => getFilteredApps());
|
||||
const appCount = computed(() => filteredApps.value.length);
|
||||
|
||||
onMounted(() => load());
|
||||
|
||||
// 关闭下拉菜单 (点击外部)
|
||||
function handleBodyClick() { appsMenuOpen.value = false; }
|
||||
|
||||
// 按活动屏蔽
|
||||
const activityInput = ref("");
|
||||
function doAddActivity() {
|
||||
const val = activityInput.value.trim();
|
||||
if (!val) return;
|
||||
const parts = val.split("/");
|
||||
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
||||
showToast("格式错误,请输入 包名/完整活动类名");
|
||||
return;
|
||||
}
|
||||
addActivity(val);
|
||||
activityInput.value = "";
|
||||
showToast(`已添加: ${val}`);
|
||||
}
|
||||
|
||||
// 手动添加包名
|
||||
async function handleManualAdd() {
|
||||
appsMenuOpen.value = false;
|
||||
const pkg = prompt("请输入完整应用包名(例如: com.example.app):");
|
||||
if (!pkg?.trim()) return;
|
||||
const realPkg = pkg.trim();
|
||||
const existing = apps.value.find((a) => a.packageName === realPkg);
|
||||
if (existing) {
|
||||
existing.checked = true;
|
||||
onCheckboxChange();
|
||||
showToast("已为你自动勾选并置顶");
|
||||
return;
|
||||
}
|
||||
showToast("正在获取应用信息...");
|
||||
let appData = {
|
||||
packageName: realPkg,
|
||||
appLabel: "未知 (手动添加)",
|
||||
isSystem: false,
|
||||
uid: "自定义",
|
||||
};
|
||||
try {
|
||||
const info = await getPackagesInfo([realPkg]);
|
||||
if (info?.length > 0) appData = info[0];
|
||||
} catch {}
|
||||
apps.value.unshift(reactive({ ...appData, checked: true, expanded: false }));
|
||||
onCheckboxChange();
|
||||
showToast("已添加到列表顶部");
|
||||
}
|
||||
|
||||
// Activity Picker
|
||||
const pickerVisible = ref(false);
|
||||
const pickerStep = ref(1);
|
||||
const pickerStatusText = ref("等待中...");
|
||||
const pickerPolling = ref(false);
|
||||
const pickerResult = ref("");
|
||||
let pollingTimer = null;
|
||||
|
||||
function openPicker() {
|
||||
stopPolling();
|
||||
pickerStep.value = 1;
|
||||
pickerStatusText.value = "等待中...";
|
||||
pickerResult.value = "";
|
||||
pickerPolling.value = false;
|
||||
pickerVisible.value = true;
|
||||
}
|
||||
function closePicker() {
|
||||
stopPolling();
|
||||
pickerVisible.value = false;
|
||||
}
|
||||
function stopPolling() {
|
||||
if (pollingTimer) {
|
||||
clearInterval(pollingTimer);
|
||||
pollingTimer = null;
|
||||
}
|
||||
}
|
||||
function startPolling() {
|
||||
pickerPolling.value = true;
|
||||
pickerStatusText.value = "检测中,请切换到目标界面...";
|
||||
stopPolling();
|
||||
pollingTimer = setInterval(async () => {
|
||||
try {
|
||||
const res = await runCmd(
|
||||
`dumpsys window 2>/dev/null | grep mCurrentFocus | sed 's/.*u0 \\(.*\\)}/\\1/'`
|
||||
);
|
||||
if (res.errno !== 0) return;
|
||||
const activity = res.stdout.trim();
|
||||
if (!activity || activity.toLowerCase().includes("webui")) return;
|
||||
stopPolling();
|
||||
pickerPolling.value = false;
|
||||
pickerResult.value = activity;
|
||||
pickerStep.value = 3;
|
||||
} catch {}
|
||||
}, 600);
|
||||
}
|
||||
function confirmPicker() {
|
||||
if (!pickerResult.value) return;
|
||||
addActivity(pickerResult.value);
|
||||
showToast(`已添加: ${pickerResult.value}`);
|
||||
closePicker();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div style="display:contents">
|
||||
<section class="card" id="apps-section">
|
||||
<div class="card-header" style="margin-bottom: 8px">
|
||||
<h2>黑名单</h2>
|
||||
<div class="header-actions dropdown-container">
|
||||
<Button variant="ghost" size="icon" @click="load">
|
||||
<RefreshCw :size="18" />
|
||||
</Button>
|
||||
<Button variant="ghost" size="icon" @click="appsMenuOpen = !appsMenuOpen">
|
||||
<span class="sr-only">更多</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="1" /><circle cx="12" cy="5" r="1" /><circle cx="12" cy="19" r="1" />
|
||||
</svg>
|
||||
</Button>
|
||||
<div class="dropdown-menu" :class="{ show: appsMenuOpen }" @click.stop>
|
||||
<div class="dropdown-item" @click="toggleSystemApps(); appsMenuOpen = false">
|
||||
<component :is="showingSystemApps ? EyeOff : Eye" :size="18" />
|
||||
<span>{{ showingSystemApps ? "隐藏系统应用" : "显示系统应用" }}</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="smartSelect(); appsMenuOpen = false">
|
||||
<Sparkles :size="18" /><span>智能选择</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="handleManualAdd">
|
||||
<Plus :size="18" /><span>手动添加包名</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="selectAll(); appsMenuOpen = false">
|
||||
<CheckCheck :size="18" /><span>全选</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="selectNone(); appsMenuOpen = false">
|
||||
<Square :size="18" /><span>全不选</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="invertSelection(); appsMenuOpen = false">
|
||||
<CheckSquare :size="18" /><span>反选</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p class="app-list-hint">
|
||||
被选中的应用将不生效本模块<br />推荐选择视频类、相册等需展示 HDR 内容的应用
|
||||
</p>
|
||||
|
||||
<!-- 按活动屏蔽 -->
|
||||
<div class="activity-block-card">
|
||||
<div class="activity-block-header">
|
||||
<span class="activity-block-label">按活动屏蔽</span>
|
||||
<button class="btn-picker-trigger" @click="openPicker">
|
||||
<ScanSearch :size="12" /> 扫描获取
|
||||
</button>
|
||||
</div>
|
||||
<div class="activity-block-row">
|
||||
<input
|
||||
v-model="activityInput"
|
||||
type="text"
|
||||
class="activity-block-input"
|
||||
placeholder="com.pkg/com.pkg.ActivityClass"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
@keydown.enter="doAddActivity"
|
||||
/>
|
||||
<Button
|
||||
style="padding: 0 14px; border-radius: var(--border-radius-s); font-size: 0.8125rem; white-space: nowrap; flex-shrink: 0"
|
||||
@click="doAddActivity"
|
||||
>确认</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 搜索栏 + 保存 -->
|
||||
<div style="display: flex; gap: 8px; align-items: stretch; margin-bottom: var(--spacing-m)">
|
||||
<div class="app-search-container" style="flex: 1; margin-bottom: 0">
|
||||
<Search :size="18" class="search-icon" />
|
||||
<input
|
||||
v-model="searchKeyword"
|
||||
type="text"
|
||||
class="app-search-input"
|
||||
placeholder="应用名称或包名"
|
||||
autocomplete="off"
|
||||
spellcheck="false"
|
||||
/>
|
||||
<span class="count-badge">{{ appCount }}</span>
|
||||
</div>
|
||||
<Button
|
||||
style="padding: 0 16px; border-radius: var(--border-radius-s); font-size: 0.8125rem; white-space: nowrap; flex-shrink: 0"
|
||||
@click="save(showToast)"
|
||||
>保存</Button
|
||||
>
|
||||
</div>
|
||||
|
||||
<!-- 应用列表 -->
|
||||
<div class="app-list-container" id="app-list-container">
|
||||
<div
|
||||
v-if="isLoading"
|
||||
style="text-align: center; padding: 20px; color: var(--md-sys-color-on-surface-variant)"
|
||||
>
|
||||
加载中...
|
||||
</div>
|
||||
<div
|
||||
v-else-if="loadError"
|
||||
style="text-align: center; padding: 20px; color: var(--md-sys-color-error)"
|
||||
>
|
||||
加载失败: {{ loadError }}
|
||||
</div>
|
||||
<div v-else v-for="app in filteredApps" :key="app.packageName" class="app-list-item">
|
||||
<div class="app-item-main-row">
|
||||
<label class="app-checkbox-label">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="app-checkbox"
|
||||
:class="{ unsaved: app.checked && !savedBlacklist?.has(app.packageName) }"
|
||||
:data-pkg="app.packageName"
|
||||
v-model="app.checked"
|
||||
@change="onCheckboxChange"
|
||||
/>
|
||||
<span
|
||||
class="app-checkbox-custom"
|
||||
:class="{ partial: !app.checked && hasActivity(app.packageName) }"
|
||||
></span>
|
||||
</label>
|
||||
<div class="app-info">
|
||||
<span class="app-name">
|
||||
{{ app.appLabel }}
|
||||
<span class="app-uid">{{ app.uid }}</span>
|
||||
</span>
|
||||
<span class="app-pkg">
|
||||
{{ app.packageName }}
|
||||
<span v-if="app.isSystem" class="app-badge">系统</span>
|
||||
</span>
|
||||
</div>
|
||||
<button
|
||||
v-if="hasActivity(app.packageName)"
|
||||
class="app-activities-chevron"
|
||||
:class="{ expanded: app.expanded }"
|
||||
@click.stop="app.expanded = !app.expanded"
|
||||
>
|
||||
<ChevronDown :size="16" />
|
||||
</button>
|
||||
</div>
|
||||
<!-- 活动列表 -->
|
||||
<div
|
||||
v-if="hasActivity(app.packageName)"
|
||||
class="app-activities-list"
|
||||
:class="{ show: app.expanded }"
|
||||
>
|
||||
<div
|
||||
v-for="entry in getActivities(app.packageName)"
|
||||
:key="entry"
|
||||
class="activity-entry-item"
|
||||
>
|
||||
<span class="activity-entry-path">{{
|
||||
entry.slice(app.packageName.length + 1)
|
||||
}}</span>
|
||||
<button class="activity-entry-delete" @click="removeActivity(entry)">
|
||||
<X :size="14" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Activity Picker 覆盖层 -->
|
||||
<Teleport to="body">
|
||||
<div
|
||||
class="activity-picker-overlay"
|
||||
:class="{ show: pickerVisible }"
|
||||
id="activity-picker-overlay"
|
||||
>
|
||||
<div class="activity-picker-header">
|
||||
<button class="picker-back-btn" @click="closePicker">
|
||||
<ChevronLeft :size="20" />
|
||||
</button>
|
||||
<span class="picker-title">获取活动名</span>
|
||||
</div>
|
||||
<div class="picker-steps-indicator">
|
||||
<div
|
||||
v-for="n in 3"
|
||||
:key="n"
|
||||
class="picker-step-dot"
|
||||
:class="{ active: pickerStep === n }"
|
||||
></div>
|
||||
</div>
|
||||
<div class="activity-picker-body">
|
||||
<!-- 步骤 1 -->
|
||||
<div class="picker-step" v-show="pickerStep === 1">
|
||||
<div class="picker-step-icon"><Monitor :size="52" stroke-width="1.5" /></div>
|
||||
<h3 class="picker-step-title">将 Web UI 挂小窗</h3>
|
||||
<p class="picker-step-desc">
|
||||
在开始获取前,请先将当前 Web UI 调整为<strong>小窗模式</strong>。<br /><br />
|
||||
这样在后续步骤中,你可以同时操作目标应用并看到 Web UI 的反馈。
|
||||
</p>
|
||||
<Button class="picker-action-btn" @click="pickerStep = 2">已挂小窗,下一步</Button>
|
||||
</div>
|
||||
<!-- 步骤 2 -->
|
||||
<div class="picker-step" v-show="pickerStep === 2">
|
||||
<div class="picker-step-icon"><Clock :size="52" stroke-width="1.5" /></div>
|
||||
<h3 class="picker-step-title">切换到目标界面</h3>
|
||||
<p class="picker-step-desc">
|
||||
点击「开始获取」后,切换到需要屏蔽的应用界面。<br /><br />
|
||||
检测到非 Web UI 界面后将<strong>自动停止</strong>。<br /><br />
|
||||
<span class="picker-status-text" :class="{ polling: pickerPolling }">{{
|
||||
pickerStatusText
|
||||
}}</span>
|
||||
</p>
|
||||
<Button class="picker-action-btn" :disabled="pickerPolling" @click="startPolling"
|
||||
>开始获取</Button
|
||||
>
|
||||
</div>
|
||||
<!-- 步骤 3 -->
|
||||
<div class="picker-step" v-show="pickerStep === 3">
|
||||
<div class="picker-step-icon">
|
||||
<CircleCheck :size="52" stroke-width="1.5" />
|
||||
</div>
|
||||
<h3 class="picker-step-title">检测到活动</h3>
|
||||
<p class="picker-step-desc">以下活动将被添加到按活动屏蔽列表:</p>
|
||||
<div class="picker-result-box">{{ pickerResult }}</div>
|
||||
<div class="picker-result-actions">
|
||||
<Button
|
||||
variant="secondary"
|
||||
@click="pickerStep = 2; pickerPolling = false; stopPolling()"
|
||||
>重试</Button
|
||||
>
|
||||
<Button @click="confirmPicker"><Check :size="15" /> 确认添加</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,246 @@
|
||||
<script setup>
|
||||
import { inject, ref } from 'vue';
|
||||
import Button from '@/components/ui/Button.vue';
|
||||
import Input from '@/components/ui/Input.vue';
|
||||
import Textarea from '@/components/ui/Textarea.vue';
|
||||
import Switch from '@/components/ui/Switch.vue';
|
||||
import Label from '@/components/ui/Label.vue';
|
||||
import { Save, Settings2, ShieldCheck, FileText, Settings, Monitor, HelpCircle } from 'lucide-vue-next';
|
||||
import { runCmd } from '../utils.js';
|
||||
|
||||
const config = inject('config');
|
||||
const showToast = inject('showToast');
|
||||
const restartRefresh = inject('restartRefresh');
|
||||
|
||||
// 恢复默认二次确认
|
||||
const resetConfirming = ref(false);
|
||||
let resetTimer = null;
|
||||
function handleReset() {
|
||||
if (!resetConfirming.value) {
|
||||
resetConfirming.value = true;
|
||||
resetTimer = setTimeout(() => { resetConfirming.value = false; }, 5000);
|
||||
return;
|
||||
}
|
||||
clearTimeout(resetTimer);
|
||||
resetConfirming.value = false;
|
||||
config.resetToDefaults(showToast);
|
||||
}
|
||||
|
||||
async function viewInotifyHelp() {
|
||||
showToast('获取中...');
|
||||
const res = await runCmd('inotifyd --help');
|
||||
const out = (res.stderr || '') + (res.stdout || '');
|
||||
alert(out.trim() || '无法获取帮助信息');
|
||||
}
|
||||
|
||||
function handleSaveWebUI() {
|
||||
config.saveWebUIConfig(
|
||||
showToast,
|
||||
config.autoRefresh.value,
|
||||
config.statusRefreshInterval.value,
|
||||
config.uiZoom.value,
|
||||
config.themeMode.value,
|
||||
restartRefresh,
|
||||
);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div style="display:contents">
|
||||
<!-- === 亮度配置 === -->
|
||||
<section class="card" id="config-section" data-nav-group="config">
|
||||
<div class="card-header"><h2>亮度配置</h2></div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><Settings2 :size="16" /> 亮度调节</h3>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">前台最大亮度</span>
|
||||
<span class="config-desc">触发亮度提升的阈值</span>
|
||||
</div>
|
||||
<Input v-model="config.uiMaxBri.value" type="number" min="0" class="config-input" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">峰值最大亮度</span>
|
||||
<span class="config-desc">亮度提升的目标值</span>
|
||||
</div>
|
||||
<Input v-model="config.maxBri.value" type="number" min="0" class="config-input" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">亮度提升步数</span>
|
||||
<span class="config-desc">约 0.02 秒 / 步</span>
|
||||
</div>
|
||||
<Input v-model="config.stepsNum.value" type="number" min="1" max="500" class="config-input" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><ShieldCheck :size="16" /> 执行策略</h3>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">自动亮度时休眠</span>
|
||||
<span class="config-desc">开启自动亮度时不提升</span>
|
||||
</div>
|
||||
<Switch v-model="config.autoBriSleep.value" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">显示 HDR 内容时休眠</span>
|
||||
<span class="config-desc">HDR/SDR 比率 > 1 时不提升</span>
|
||||
<span class="config-desc" style="color:var(--color-warning)">建议配合去温控使用。出现闪屏时可改用黑名单功能</span>
|
||||
</div>
|
||||
<Switch v-model="config.displayHdrSleep.value" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">定时休眠</span>
|
||||
<span class="config-desc">设定时段内不提升亮度</span>
|
||||
</div>
|
||||
<Switch v-model="config.sleepMode.value" />
|
||||
</div>
|
||||
|
||||
<div class="config-item-expand" :class="{ show: config.sleepMode.value }">
|
||||
<div class="custom-time-picker">
|
||||
<div class="time-unit">
|
||||
<input type="number" v-model="config.sleepStartH.value" class="time-input" min="0" max="23" placeholder="00" />
|
||||
<span>:</span>
|
||||
<input type="number" v-model="config.sleepStartM.value" class="time-input" min="0" max="59" placeholder="00" />
|
||||
</div>
|
||||
<span class="time-sep">至</span>
|
||||
<div class="time-unit">
|
||||
<input type="number" v-model="config.sleepEndH.value" class="time-input" min="0" max="23" placeholder="00" />
|
||||
<span>:</span>
|
||||
<input type="number" v-model="config.sleepEndM.value" class="time-input" min="0" max="59" placeholder="00" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><FileText :size="16" /> 系统管理</h3>
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">日志大小限制</span>
|
||||
<span class="config-desc">单位: KB</span>
|
||||
</div>
|
||||
<Input v-model="config.logMaxSize.value" type="number" min="1" max="10240" class="config-input" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<Button variant="outline" @click="handleReset" :class="resetConfirming ? 'border-destructive text-destructive' : ''">
|
||||
{{ resetConfirming ? '确认恢复?' : '恢复默认' }}
|
||||
</Button>
|
||||
<Button @click="config.save(showToast)">
|
||||
<Save :size="15" /> 保存配置
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- === 高级设置 === -->
|
||||
<section class="card" id="advanced-section" data-nav-group="config">
|
||||
<div class="card-header"><h2>高级设置</h2></div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><Settings :size="16" /> 运行环境</h3>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">inotifyd 监听事件</span>
|
||||
<span class="config-desc">默认 c。修改需重启服务</span>
|
||||
<span class="config-desc" style="color:var(--color-warning)">修改为 c 以外时建议关闭自动刷新</span>
|
||||
<button class="btn-text-s" style="margin-top:6px;padding:2px 6px" @click="viewInotifyHelp">
|
||||
查看支持事件
|
||||
</button>
|
||||
</div>
|
||||
<Input v-model="config.inotifyEvents.value" type="text" placeholder="c" class="config-input" />
|
||||
</div>
|
||||
|
||||
<div class="config-item" id="advanced-section">
|
||||
<div class="config-label">
|
||||
<span class="config-name">当前亮度节点</span>
|
||||
<span class="config-desc">修改需重启服务</span>
|
||||
</div>
|
||||
<Textarea v-model="config.nowBriFile.value" class="config-textarea" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">最大亮度节点</span>
|
||||
<span class="config-desc">修改需重启服务</span>
|
||||
</div>
|
||||
<Textarea v-model="config.sysMaxBriFile.value" class="config-textarea" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<Button @click="config.saveAdvanced(showToast, () => {})">
|
||||
<Save :size="15" /> 保存设置
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- === Web UI 配置 === -->
|
||||
<section class="card" id="webui-config-section" data-nav-group="config">
|
||||
<div class="card-header"><h2>Web UI 配置</h2></div>
|
||||
|
||||
<div class="config-group">
|
||||
<h3 class="group-title"><Monitor :size="16" /> 界面设置</h3>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">自动刷新</span>
|
||||
<span class="config-desc">定时刷新状态和日志。监听非 c 事件时建议关闭</span>
|
||||
</div>
|
||||
<Switch v-model="config.autoRefresh.value" />
|
||||
</div>
|
||||
|
||||
<div class="config-item" v-show="config.autoRefresh.value">
|
||||
<div class="config-label">
|
||||
<span class="config-name">状态/日志刷新间隔</span>
|
||||
<span class="config-desc">单位: 毫秒 (最小100ms)</span>
|
||||
</div>
|
||||
<Input v-model="config.statusRefreshInterval.value" type="number" min="100" class="config-input" />
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">外观主题</span>
|
||||
<span class="config-desc">深色 / 浅色 / 跟随系统</span>
|
||||
</div>
|
||||
<div class="theme-seg">
|
||||
<button
|
||||
v-for="opt in [{v:'system',l:'系统'},{v:'light',l:'浅色'},{v:'dark',l:'深色'}]"
|
||||
:key="opt.v"
|
||||
class="theme-seg-btn"
|
||||
:class="{ active: config.themeMode.value === opt.v }"
|
||||
@click="config.themeMode.value = opt.v; config.applyTheme(opt.v)"
|
||||
>{{ opt.l }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="config-item">
|
||||
<div class="config-label">
|
||||
<span class="config-name">界面缩放</span>
|
||||
<span class="config-desc">50% - 150%(立即生效)</span>
|
||||
</div>
|
||||
<Input v-model="config.uiZoom.value" type="number" min="50" max="150" class="config-input" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-actions">
|
||||
<Button @click="handleSaveWebUI">
|
||||
<Save :size="15" /> 保存配置
|
||||
</Button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,79 @@
|
||||
<script setup>
|
||||
import { inject, ref, onMounted } from 'vue';
|
||||
import Button from '@/components/ui/Button.vue';
|
||||
import { RefreshCw, Copy, Download, Trash2 } from 'lucide-vue-next';
|
||||
|
||||
const showToast = inject('showToast');
|
||||
const log = inject('log');
|
||||
|
||||
const logMenuOpen = ref(false);
|
||||
const clearConfirming = ref(false);
|
||||
|
||||
let clearConfirmTimer = null;
|
||||
function handleClear() {
|
||||
if (!clearConfirming.value) {
|
||||
clearConfirming.value = true;
|
||||
clearConfirmTimer = setTimeout(() => { clearConfirming.value = false; }, 3000);
|
||||
return;
|
||||
}
|
||||
clearTimeout(clearConfirmTimer);
|
||||
clearConfirming.value = false;
|
||||
logMenuOpen.value = false;
|
||||
log.clear(showToast);
|
||||
}
|
||||
|
||||
// filter options
|
||||
const filterOptions = [
|
||||
{ key: 'all', label: '全部' },
|
||||
{ key: 'info', label: 'INFO' },
|
||||
{ key: 'warning', label: 'WARN' },
|
||||
{ key: 'error', label: 'ERR' },
|
||||
];
|
||||
|
||||
onMounted(() => log.load());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="card" id="log-section">
|
||||
<div class="card-header" style="margin-bottom:8px">
|
||||
<h2>运行日志</h2>
|
||||
<div class="header-actions dropdown-container">
|
||||
<Button variant="ghost" size="icon" @click="log.load">
|
||||
<RefreshCw :size="18" />
|
||||
</Button>
|
||||
<Button variant="ghost" size="icon" @click="logMenuOpen = !logMenuOpen">
|
||||
<span class="sr-only">更多操作</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>
|
||||
</Button>
|
||||
<div class="dropdown-menu" :class="{ show: logMenuOpen }" @click.stop>
|
||||
<div class="dropdown-item" @click="log.copy(showToast); logMenuOpen=false">
|
||||
<Copy :size="18" /><span>复制日志</span>
|
||||
</div>
|
||||
<div class="dropdown-item" @click="log.exportLog(showToast); logMenuOpen=false">
|
||||
<Download :size="18" /><span>导出日志文件</span>
|
||||
</div>
|
||||
<div class="dropdown-item" :class="{ 'dropdown-item-danger': clearConfirming }" @click="handleClear">
|
||||
<Trash2 :size="18" />
|
||||
<span>{{ clearConfirming ? '再次点击确认清除' : '清除日志' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 过滤器 -->
|
||||
<div class="log-filter-container" style="margin-bottom:var(--spacing-s)">
|
||||
<div class="log-filter-tabs">
|
||||
<button
|
||||
v-for="opt in filterOptions"
|
||||
:key="opt.key"
|
||||
class="log-filter-tab"
|
||||
:class="{ active: log.filterLevel.value === opt.key }"
|
||||
@click="log.filterLevel.value = opt.key"
|
||||
>{{ opt.label }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 日志内容 -->
|
||||
<pre class="log-output" id="log-output">{{ log.filteredLog.value || '暂无日志' }}</pre>
|
||||
</section>
|
||||
</template>
|
||||
@@ -0,0 +1,111 @@
|
||||
<script setup>
|
||||
import { inject, computed, ref } from 'vue';
|
||||
import Button from '@/components/ui/Button.vue';
|
||||
import Switch from '@/components/ui/Switch.vue';
|
||||
import Badge from '@/components/ui/Badge.vue';
|
||||
import {
|
||||
RefreshCw, Play, RotateCcw,
|
||||
SunMedium, Smartphone, Activity, Clock, Moon, Layers,
|
||||
} from 'lucide-vue-next';
|
||||
|
||||
const status = inject('status');
|
||||
const showToast = inject('showToast');
|
||||
const config = inject('config');
|
||||
|
||||
const confirmedLowBri = ref(false);
|
||||
|
||||
// --------- 亮度滑条渐变 ----------
|
||||
const sliderStyle = computed(() => {
|
||||
const sysMax = parseInt(status.sysMaxBri.value) || 255;
|
||||
const curr = parseInt(status.currentBri.value) || 0;
|
||||
const uiMax = parseInt(config.uiMaxBri.value) || sysMax;
|
||||
const c = (curr / sysMax) * 100;
|
||||
const u = (uiMax / sysMax) * 100;
|
||||
const pri = '#a8c7fa';
|
||||
const bst = '#fb8c00';
|
||||
const trk = 'var(--md-sys-color-surface-container-high)';
|
||||
const btrk = 'rgba(251,140,0,0.15)';
|
||||
if (c <= u) {
|
||||
return `background: linear-gradient(to right, ${pri} 0%, ${pri} ${c}%, ${trk} ${c}%, ${trk} ${u}%, ${btrk} ${u}%, ${btrk} 100%)`;
|
||||
}
|
||||
return `background: linear-gradient(to right, ${pri} 0%, ${pri} ${u}%, ${bst} ${u}%, ${bst} ${c}%, ${btrk} ${c}%, ${btrk} 100%)`;
|
||||
});
|
||||
|
||||
const brightnessPercent = computed(() => {
|
||||
const sysMax = parseInt(status.sysMaxBri.value) || 255;
|
||||
const curr = parseInt(status.currentBri.value) || 0;
|
||||
return Math.round((curr / sysMax) * 100) + '%';
|
||||
});
|
||||
|
||||
async function onSliderChange(e) {
|
||||
const newBri = parseInt(e.target.value, 10);
|
||||
const sysMax = parseInt(status.sysMaxBri.value) || 255;
|
||||
const pct = Math.round((newBri / sysMax) * 100);
|
||||
if (pct < 5 && !confirmedLowBri.value) {
|
||||
const ok = confirm('⚠️ 警告:亮度低于 5% 可能导致屏幕近似黑屏。\n\n确定要继续吗?');
|
||||
if (!ok) { const safe = Math.ceil(sysMax * 0.05); e.target.value = safe; return; }
|
||||
confirmedLowBri.value = true;
|
||||
}
|
||||
if (pct >= 5) confirmedLowBri.value = false;
|
||||
await status.setBrightness(newBri, showToast);
|
||||
}
|
||||
|
||||
const statusItems = computed(() => [
|
||||
{ label: '当前亮度', value: status.currentBri.value || '—', icon: SunMedium },
|
||||
{ label: '系统最大亮度', value: status.sysMaxBri.value || '—', icon: Smartphone },
|
||||
{ label: 'inotifyd PID', value: status.inotifydPid.value, icon: Activity },
|
||||
{ label: 'inotifyd 状态', value: status.inotifydState.value, icon: Clock },
|
||||
{ label: '休眠状态', value: status.sleepStatus.value, icon: Moon },
|
||||
{ label: 'HDR/SDR 比率', value: status.hdrRatio.value, icon: Layers },
|
||||
]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="card" id="status-section" data-nav-group="status">
|
||||
<div class="card-header">
|
||||
<h2>实时状态</h2>
|
||||
<Button variant="ghost" size="icon" @click="status.load(true)">
|
||||
<RefreshCw :size="18" />
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<!-- 状态网格 -->
|
||||
<div class="status-grid">
|
||||
<div v-for="item in statusItems" :key="item.label" class="status-item">
|
||||
<div class="status-item-header">
|
||||
<component :is="item.icon" :size="14" aria-hidden="true" />
|
||||
<span class="status-label">{{ item.label }}</span>
|
||||
</div>
|
||||
<span class="status-value">{{ item.value }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 亮度控制 -->
|
||||
<div class="brightness-section">
|
||||
<div class="brightness-header">
|
||||
<span class="brightness-title">亮度</span>
|
||||
<span class="brightness-percent">{{ brightnessPercent }}</span>
|
||||
</div>
|
||||
<div class="brightness-container">
|
||||
<span class="brightness-label">0%</span>
|
||||
<input
|
||||
type="range"
|
||||
class="brightness-slider"
|
||||
min="0"
|
||||
:max="status.sysMaxBri.value || 255"
|
||||
:value="status.currentBri.value || 0"
|
||||
:style="sliderStyle"
|
||||
@change="onSliderChange"
|
||||
/>
|
||||
<span class="brightness-label">100%</span>
|
||||
</div>
|
||||
<div class="auto-brightness-row">
|
||||
<span class="auto-brightness-label">自动亮度调节</span>
|
||||
<Switch
|
||||
:model-value="status.autoBriMode.value"
|
||||
@update:model-value="status.setAutoBrightness($event, showToast)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,6 +1,15 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import { fileURLToPath, URL } from 'node:url';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue(), tailwindcss()],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
build: {
|
||||
outDir: '../webroot',
|
||||
emptyOutDir: true,
|
||||
|
||||
Reference in new issue
Block a user