mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
style: 代码格式调整
This commit is contained in:
1 parent
21b4ad314a
commit
0882c89150
38 files changed
+2708
-1692
No files matched your search
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
||||||
|
"printWidth": 100,
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true,
|
||||||
|
"tabWidth": 2
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||||
|
"categories": {
|
||||||
|
"correctness": "warn"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"eslint/no-unused-vars": "warn"
|
||||||
|
}
|
||||||
|
}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"recommendations": ["oxc.oxc-vscode", "Vue.volar", "rust-lang.rust-analyzer"]
|
||||||
|
}
|
||||||
Vendored
+5
-3
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
"editor.defaultFormatter": "timonwong.shellcheck",
|
"editor.codeActionsOnSave": {
|
||||||
"[shellscript]": {
|
"source.fixAll.oxc": "always"
|
||||||
|
},
|
||||||
|
"[shellscript]": {
|
||||||
"editor.defaultFormatter": "mads-hartmann.bash-ide-vscode"
|
"editor.defaultFormatter": "mads-hartmann.bash-ide-vscode"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+7
-1
@@ -6,12 +6,18 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cd webui && vite",
|
"dev": "cd webui && vite",
|
||||||
"build": "cd webui && vite build && cd .. && node build-module.js",
|
"build": "cd webui && vite build && cd .. && node build-module.js",
|
||||||
"preview": "cd webui && vite preview"
|
"preview": "cd webui && vite preview",
|
||||||
|
"lint": "oxlint",
|
||||||
|
"lint:fix": "oxlint --fix",
|
||||||
|
"fmt": "oxfmt webui/",
|
||||||
|
"fmt:check": "oxfmt webui/ --check"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tailwindcss/vite": "^4.2.2",
|
"@tailwindcss/vite": "^4.2.2",
|
||||||
"archiver": "^7.0.1",
|
"archiver": "^7.0.1",
|
||||||
"kernelsu": "^3.0.2",
|
"kernelsu": "^3.0.2",
|
||||||
|
"oxfmt": "^0.44.0",
|
||||||
|
"oxlint": "^1.59.0",
|
||||||
"tailwindcss": "^4.2.2",
|
"tailwindcss": "^4.2.2",
|
||||||
"tw-animate-css": "^1.4.0",
|
"tw-animate-css": "^1.4.0",
|
||||||
"vite": "^8.0.3"
|
"vite": "^8.0.3"
|
||||||
|
|||||||
Generated
+431
@@ -45,6 +45,12 @@ importers:
|
|||||||
kernelsu:
|
kernelsu:
|
||||||
specifier: ^3.0.2
|
specifier: ^3.0.2
|
||||||
version: 3.0.2
|
version: 3.0.2
|
||||||
|
oxfmt:
|
||||||
|
specifier: ^0.44.0
|
||||||
|
version: 0.44.0
|
||||||
|
oxlint:
|
||||||
|
specifier: ^1.59.0
|
||||||
|
version: 1.59.0
|
||||||
tailwindcss:
|
tailwindcss:
|
||||||
specifier: ^4.2.2
|
specifier: ^4.2.2
|
||||||
version: 4.2.2
|
version: 4.2.2
|
||||||
@@ -112,6 +118,250 @@ packages:
|
|||||||
'@oxc-project/types@0.122.0':
|
'@oxc-project/types@0.122.0':
|
||||||
resolution: {integrity: sha512-oLAl5kBpV4w69UtFZ9xqcmTi+GENWOcPF7FCrczTiBbmC0ibXxCwyvZGbO39rCVEuLGAZM84DH0pUIyyv/YJzA==}
|
resolution: {integrity: sha512-oLAl5kBpV4w69UtFZ9xqcmTi+GENWOcPF7FCrczTiBbmC0ibXxCwyvZGbO39rCVEuLGAZM84DH0pUIyyv/YJzA==}
|
||||||
|
|
||||||
|
'@oxfmt/binding-android-arm-eabi@0.44.0':
|
||||||
|
resolution: {integrity: sha512-5UvghMd9SA/yvKTWCAxMAPXS1d2i054UeOf4iFjZjfayTwCINcC3oaSXjtbZfCaEpxgJod7XiOjTtby5yEv/BQ==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [android]
|
||||||
|
|
||||||
|
'@oxfmt/binding-android-arm64@0.44.0':
|
||||||
|
resolution: {integrity: sha512-IVudM1BWfvrYO++Khtzr8q9n5Rxu7msUvoFMqzGJVdX7HfUXUDHwaH2zHZNB58svx2J56pmCUzophyaPFkcG/A==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [android]
|
||||||
|
|
||||||
|
'@oxfmt/binding-darwin-arm64@0.44.0':
|
||||||
|
resolution: {integrity: sha512-eWCLAIKAHfx88EqEP1Ga2yz7qVcqDU5lemn4xck+07bH182hDdprOHjbogyk0In1Djys3T0/pO2JepFnRJ41Mg==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@oxfmt/binding-darwin-x64@0.44.0':
|
||||||
|
resolution: {integrity: sha512-eHTBznHLM49++dwz07MblQ2cOXyIgeedmE3Wgy4ptUESj38/qYZyRi1MPwC9olQJWssMeY6WI3UZ7YmU5ggvyQ==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@oxfmt/binding-freebsd-x64@0.44.0':
|
||||||
|
resolution: {integrity: sha512-jLMmbj0u0Ft43QpkUVr/0v1ZfQCGWAvU+WznEHcN3wZC/q6ox7XeSJtk9P36CCpiDSUf3sGnzbIuG1KdEMEDJQ==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [freebsd]
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-arm-gnueabihf@0.44.0':
|
||||||
|
resolution: {integrity: sha512-n+A/u/ByK1qV8FVGOwyaSpw5NPNl0qlZfgTBqHeGIqr8Qzq1tyWZ4lAaxPoe5mZqE3w88vn3+jZtMxriHPE7tg==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-arm-musleabihf@0.44.0':
|
||||||
|
resolution: {integrity: sha512-5eax+FkxyCqAi3Rw0mrZFr7+KTt/XweFsbALR+B5ljWBLBl8nHe4ADrUnb1gLEfQCJLl+Ca5FIVD4xEt95AwIw==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-arm64-gnu@0.44.0':
|
||||||
|
resolution: {integrity: sha512-58l8JaHxSGOmOMOG2CIrNsnkRJAj0YcHQCmvNACniOa/vd1iRHhlPajczegzS5jwMENlqgreyiTR9iNlke8qCw==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-arm64-musl@0.44.0':
|
||||||
|
resolution: {integrity: sha512-AlObQIXyVRZ96LbtVljtFq0JqH5B92NU+BQeDFrXWBUWlCKAM0wF5GLfIhCLT5kQ3Sl+U0YjRJ7Alqj5hGQaCg==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-ppc64-gnu@0.44.0':
|
||||||
|
resolution: {integrity: sha512-YcFE8/q/BbrCiIiM5piwbkA6GwJc5QqhMQp2yDrqQ2fuVkZ7CInb1aIijZ/k8EXc72qXMSwKpVlBv1w/MsGO/A==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [ppc64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-riscv64-gnu@0.44.0':
|
||||||
|
resolution: {integrity: sha512-eOdzs6RqkRzuqNHUX5C8ISN5xfGh4xDww8OEd9YAmc3OWN8oAe5bmlIqQ+rrHLpv58/0BuU48bxkhnIGjA/ATQ==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [riscv64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-riscv64-musl@0.44.0':
|
||||||
|
resolution: {integrity: sha512-YBgNTxntD/QvlFUfgvh8bEdwOhXiquX8gaofZJAwYa/Xp1S1DQrFVZEeck7GFktr24DztsSp8N8WtWCBwxs0Hw==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [riscv64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-s390x-gnu@0.44.0':
|
||||||
|
resolution: {integrity: sha512-GLIh1R6WHWshl/i4QQDNgj0WtT25aRO4HNUWEoitxiywyRdhTFmFEYT2rXlcl9U6/26vhmOqG5cRlMLG3ocaIA==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [s390x]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-x64-gnu@0.44.0':
|
||||||
|
resolution: {integrity: sha512-gZOpgTlOsLcLfAF9qgpTr7FIIFSKnQN3hDf/0JvQ4CIwMY7h+eilNjxq/CorqvYcEOu+LRt1W4ZS7KccEHLOdA==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-x64-musl@0.44.0':
|
||||||
|
resolution: {integrity: sha512-1CyS9JTB+pCUFYFI6pkQGGZaT/AY5gnhHVrQQLhFba6idP9AzVYm1xbdWfywoldTYvjxQJV6x4SuduCIfP3W+A==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
|
'@oxfmt/binding-openharmony-arm64@0.44.0':
|
||||||
|
resolution: {integrity: sha512-bmEv70Ak6jLr1xotCbF5TxIKjsmQaiX+jFRtnGtfA03tJPf6VG3cKh96S21boAt3JZc+Vjx8PYcDuLj39vM2Pw==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [openharmony]
|
||||||
|
|
||||||
|
'@oxfmt/binding-win32-arm64-msvc@0.44.0':
|
||||||
|
resolution: {integrity: sha512-yWzB+oCpSnP/dmw85eFLAT5o35Ve5pkGS2uF/UCISpIwDqf1xa7OpmtomiqY/Vzg8VyvMbuf6vroF2khF/+1Vg==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
'@oxfmt/binding-win32-ia32-msvc@0.44.0':
|
||||||
|
resolution: {integrity: sha512-TcWpo18xEIE3AmIG2kpr3kz5IEhQgnx0lazl2+8L+3eTopOAUevQcmlr4nhguImNWz0OMeOZrYZOhJNCf16nlQ==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [ia32]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
'@oxfmt/binding-win32-x64-msvc@0.44.0':
|
||||||
|
resolution: {integrity: sha512-oj8aLkPJZppIM4CMQNsyir9ybM1Xw/CfGPTSsTnzpVGyljgfbdP0EVUlURiGM0BDrmw5psQ6ArmGCcUY/yABaQ==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
'@oxlint/binding-android-arm-eabi@1.59.0':
|
||||||
|
resolution: {integrity: sha512-etYDw/UaEv936AQUd/CRMBVd+e+XuuU6wC+VzOv1STvsTyZenLChepLWqLtnyTTp4YMlM22ypzogDDwqYxv5cg==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [android]
|
||||||
|
|
||||||
|
'@oxlint/binding-android-arm64@1.59.0':
|
||||||
|
resolution: {integrity: sha512-TgLc7XVLKH2a4h8j3vn1MDjfK33i9MY60f/bKhRGWyVzbk5LCZ4X01VZG7iHrMmi5vYbAp8//Ponigx03CLsdw==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [android]
|
||||||
|
|
||||||
|
'@oxlint/binding-darwin-arm64@1.59.0':
|
||||||
|
resolution: {integrity: sha512-DXyFPf5ZKldMLloRHx/B9fsxsiTQomaw7cmEW3YIJko2HgCh+GUhp9gGYwHrqlLJPsEe3dYj9JebjX92D3j3AA==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@oxlint/binding-darwin-x64@1.59.0':
|
||||||
|
resolution: {integrity: sha512-LgvrsdgVLX1qWqIEmNsSmMXJhpAWdtUQ0M+oR0CySwi+9IHWyOGuIL8w8+u/kbZNMyZr4WUyYB5i0+D+AKgkLg==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [darwin]
|
||||||
|
|
||||||
|
'@oxlint/binding-freebsd-x64@1.59.0':
|
||||||
|
resolution: {integrity: sha512-bOJhqX/ny4hrFuTPlyk8foSRx/vLRpxJh0jOOKN2NWW6FScXHPAA5rQbrwdQPcgGB5V8Ua51RS03fke8ssBcug==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [freebsd]
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-arm-gnueabihf@1.59.0':
|
||||||
|
resolution: {integrity: sha512-vVUXxYMF9trXCsz4m9H6U0IjehosVHxBzVgJUxly1uz4W1PdDyicaBnpC0KRXsHYretLVe+uS9pJy8iM57Kujw==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-arm-musleabihf@1.59.0':
|
||||||
|
resolution: {integrity: sha512-TULQW8YBPGRWg5yZpFPL54HLOnJ3/HiX6VenDPi6YfxB/jlItwSMFh3/hCeSNbh+DAMaE1Py0j5MOaivHkI/9Q==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm]
|
||||||
|
os: [linux]
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-arm64-gnu@1.59.0':
|
||||||
|
resolution: {integrity: sha512-Gt54Y4eqSgYJ90xipm24xeyaPV854706o/kiT8oZvUt3VDY7qqxdqyGqchMaujd87ib+/MXvnl9WkK8Cc1BExg==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-arm64-musl@1.59.0':
|
||||||
|
resolution: {integrity: sha512-3CtsKp7NFB3OfqQzbuAecrY7GIZeiv7AD+xutU4tefVQzlfmTI7/ygWLrvkzsDEjTlMq41rYHxgsn6Yh8tybmA==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-ppc64-gnu@1.59.0':
|
||||||
|
resolution: {integrity: sha512-K0diOpT3ncDmOfl9I1HuvpEsAuTxkts0VYwIv/w6Xiy9CdwyPBVX88Ga9l8VlGgMrwBMnSY4xIvVlVY/fkQk7Q==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [ppc64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-riscv64-gnu@1.59.0':
|
||||||
|
resolution: {integrity: sha512-xAU7+QDU6kTJJ7mJLOGgo7oOjtAtkKyFZ0Yjdb5cEo3DiCCPFLvyr08rWiQh6evZ7RiUTf+o65NY/bqttzJiQQ==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [riscv64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-riscv64-musl@1.59.0':
|
||||||
|
resolution: {integrity: sha512-KUmZmKlTTyauOnvUNVxK7G40sSSx0+w5l1UhaGsC6KPpOYHenx2oqJTnabmpLJicok7IC+3Y6fXAUOMyexaeJQ==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [riscv64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-s390x-gnu@1.59.0':
|
||||||
|
resolution: {integrity: sha512-4usRxC8gS0PGdkHnRmwJt/4zrQNZyk6vL0trCxwZSsAKM+OxhB8nKiR+mhjdBbl8lbMh2gc3bZpNN/ik8c4c2A==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [s390x]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-x64-gnu@1.59.0':
|
||||||
|
resolution: {integrity: sha512-s/rNE2gDmbwAOOP493xk2X7M8LZfI1LJFSSW1+yanz3vuQCFPiHkx4GY+O1HuLUDtkzGlhtMrIcxxzyYLv308w==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-x64-musl@1.59.0':
|
||||||
|
resolution: {integrity: sha512-+yYj1udJa2UvvIUmEm0IcKgc0UlPMgz0nsSTvkPL2y6n0uU5LgIHSwVu4AHhrve6j9BpVSoRksnz8c9QcvITJA==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
|
'@oxlint/binding-openharmony-arm64@1.59.0':
|
||||||
|
resolution: {integrity: sha512-bUplUb48LYsB3hHlQXP2ZMOenpieWoOyppLAnnAhuPag3MGPnt+7caxE3w/Vl9wpQsTA3gzLntQi9rxWrs7Xqg==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [openharmony]
|
||||||
|
|
||||||
|
'@oxlint/binding-win32-arm64-msvc@1.59.0':
|
||||||
|
resolution: {integrity: sha512-/HLsLuz42rWl7h7ePdmMTpHm2HIDmPtcEMYgm5BBEHiEiuNOrzMaUpd2z7UnNni5LGN9obJy2YoAYBLXQwazrA==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [arm64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
'@oxlint/binding-win32-ia32-msvc@1.59.0':
|
||||||
|
resolution: {integrity: sha512-rUPy+JnanpPwV/aJCPnxAD1fW50+XPI0VkWr7f0vEbqcdsS8NpB24Rw6RsS7SdpFv8Dw+8ugCwao5nCFbqOUSg==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [ia32]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
|
'@oxlint/binding-win32-x64-msvc@1.59.0':
|
||||||
|
resolution: {integrity: sha512-xkE7puteDS/vUyRngLXW0t8WgdWoS/tfxXjhP/P7SMqPDx+hs44SpssO3h3qmTqECYEuXBUPzcAw5257Ka+ofA==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
cpu: [x64]
|
||||||
|
os: [win32]
|
||||||
|
|
||||||
'@pkgjs/parseargs@0.11.0':
|
'@pkgjs/parseargs@0.11.0':
|
||||||
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
|
resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==}
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
@@ -709,6 +959,21 @@ packages:
|
|||||||
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
|
resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
|
|
||||||
|
oxfmt@0.44.0:
|
||||||
|
resolution: {integrity: sha512-lnncqvHewyRvaqdrnntVIrZV2tEddz8lbvPsQzG/zlkfvgZkwy0HP1p/2u1aCDToeg1jb9zBpbJdfkV73Itw+w==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
hasBin: true
|
||||||
|
|
||||||
|
oxlint@1.59.0:
|
||||||
|
resolution: {integrity: sha512-0xBLeGGjP4vD9pygRo8iuOkOzEU1MqOnfiOl7KYezL/QvWL8NUg6n03zXc7ZVqltiOpUxBk2zgHI3PnRIEdAvw==}
|
||||||
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
|
hasBin: true
|
||||||
|
peerDependencies:
|
||||||
|
oxlint-tsgolint: '>=0.18.0'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
oxlint-tsgolint:
|
||||||
|
optional: true
|
||||||
|
|
||||||
package-json-from-dist@1.0.1:
|
package-json-from-dist@1.0.1:
|
||||||
resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==}
|
resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==}
|
||||||
|
|
||||||
@@ -830,6 +1095,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==}
|
resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==}
|
||||||
engines: {node: '>=12.0.0'}
|
engines: {node: '>=12.0.0'}
|
||||||
|
|
||||||
|
tinypool@2.1.0:
|
||||||
|
resolution: {integrity: sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==}
|
||||||
|
engines: {node: ^20.0.0 || >=22.0.0}
|
||||||
|
|
||||||
tslib@2.8.1:
|
tslib@2.8.1:
|
||||||
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==}
|
||||||
|
|
||||||
@@ -978,6 +1247,120 @@ snapshots:
|
|||||||
|
|
||||||
'@oxc-project/types@0.122.0': {}
|
'@oxc-project/types@0.122.0': {}
|
||||||
|
|
||||||
|
'@oxfmt/binding-android-arm-eabi@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-android-arm64@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-darwin-arm64@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-darwin-x64@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-freebsd-x64@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-arm-gnueabihf@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-arm-musleabihf@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-arm64-gnu@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-arm64-musl@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-ppc64-gnu@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-riscv64-gnu@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-riscv64-musl@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-s390x-gnu@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-x64-gnu@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-linux-x64-musl@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-openharmony-arm64@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-win32-arm64-msvc@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-win32-ia32-msvc@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxfmt/binding-win32-x64-msvc@0.44.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-android-arm-eabi@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-android-arm64@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-darwin-arm64@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-darwin-x64@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-freebsd-x64@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-arm-gnueabihf@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-arm-musleabihf@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-arm64-gnu@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-arm64-musl@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-ppc64-gnu@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-riscv64-gnu@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-riscv64-musl@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-s390x-gnu@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-x64-gnu@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-linux-x64-musl@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-openharmony-arm64@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-win32-arm64-msvc@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-win32-ia32-msvc@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
|
'@oxlint/binding-win32-x64-msvc@1.59.0':
|
||||||
|
optional: true
|
||||||
|
|
||||||
'@pkgjs/parseargs@0.11.0':
|
'@pkgjs/parseargs@0.11.0':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
@@ -1468,6 +1851,52 @@ snapshots:
|
|||||||
|
|
||||||
normalize-path@3.0.0: {}
|
normalize-path@3.0.0: {}
|
||||||
|
|
||||||
|
oxfmt@0.44.0:
|
||||||
|
dependencies:
|
||||||
|
tinypool: 2.1.0
|
||||||
|
optionalDependencies:
|
||||||
|
'@oxfmt/binding-android-arm-eabi': 0.44.0
|
||||||
|
'@oxfmt/binding-android-arm64': 0.44.0
|
||||||
|
'@oxfmt/binding-darwin-arm64': 0.44.0
|
||||||
|
'@oxfmt/binding-darwin-x64': 0.44.0
|
||||||
|
'@oxfmt/binding-freebsd-x64': 0.44.0
|
||||||
|
'@oxfmt/binding-linux-arm-gnueabihf': 0.44.0
|
||||||
|
'@oxfmt/binding-linux-arm-musleabihf': 0.44.0
|
||||||
|
'@oxfmt/binding-linux-arm64-gnu': 0.44.0
|
||||||
|
'@oxfmt/binding-linux-arm64-musl': 0.44.0
|
||||||
|
'@oxfmt/binding-linux-ppc64-gnu': 0.44.0
|
||||||
|
'@oxfmt/binding-linux-riscv64-gnu': 0.44.0
|
||||||
|
'@oxfmt/binding-linux-riscv64-musl': 0.44.0
|
||||||
|
'@oxfmt/binding-linux-s390x-gnu': 0.44.0
|
||||||
|
'@oxfmt/binding-linux-x64-gnu': 0.44.0
|
||||||
|
'@oxfmt/binding-linux-x64-musl': 0.44.0
|
||||||
|
'@oxfmt/binding-openharmony-arm64': 0.44.0
|
||||||
|
'@oxfmt/binding-win32-arm64-msvc': 0.44.0
|
||||||
|
'@oxfmt/binding-win32-ia32-msvc': 0.44.0
|
||||||
|
'@oxfmt/binding-win32-x64-msvc': 0.44.0
|
||||||
|
|
||||||
|
oxlint@1.59.0:
|
||||||
|
optionalDependencies:
|
||||||
|
'@oxlint/binding-android-arm-eabi': 1.59.0
|
||||||
|
'@oxlint/binding-android-arm64': 1.59.0
|
||||||
|
'@oxlint/binding-darwin-arm64': 1.59.0
|
||||||
|
'@oxlint/binding-darwin-x64': 1.59.0
|
||||||
|
'@oxlint/binding-freebsd-x64': 1.59.0
|
||||||
|
'@oxlint/binding-linux-arm-gnueabihf': 1.59.0
|
||||||
|
'@oxlint/binding-linux-arm-musleabihf': 1.59.0
|
||||||
|
'@oxlint/binding-linux-arm64-gnu': 1.59.0
|
||||||
|
'@oxlint/binding-linux-arm64-musl': 1.59.0
|
||||||
|
'@oxlint/binding-linux-ppc64-gnu': 1.59.0
|
||||||
|
'@oxlint/binding-linux-riscv64-gnu': 1.59.0
|
||||||
|
'@oxlint/binding-linux-riscv64-musl': 1.59.0
|
||||||
|
'@oxlint/binding-linux-s390x-gnu': 1.59.0
|
||||||
|
'@oxlint/binding-linux-x64-gnu': 1.59.0
|
||||||
|
'@oxlint/binding-linux-x64-musl': 1.59.0
|
||||||
|
'@oxlint/binding-openharmony-arm64': 1.59.0
|
||||||
|
'@oxlint/binding-win32-arm64-msvc': 1.59.0
|
||||||
|
'@oxlint/binding-win32-ia32-msvc': 1.59.0
|
||||||
|
'@oxlint/binding-win32-x64-msvc': 1.59.0
|
||||||
|
|
||||||
package-json-from-dist@1.0.1: {}
|
package-json-from-dist@1.0.1: {}
|
||||||
|
|
||||||
path-key@3.1.1: {}
|
path-key@3.1.1: {}
|
||||||
@@ -1627,6 +2056,8 @@ snapshots:
|
|||||||
fdir: 6.5.0(picomatch@4.0.4)
|
fdir: 6.5.0(picomatch@4.0.4)
|
||||||
picomatch: 4.0.4
|
picomatch: 4.0.4
|
||||||
|
|
||||||
|
tinypool@2.1.0: {}
|
||||||
|
|
||||||
tslib@2.8.1:
|
tslib@2.8.1:
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
|
|||||||
+11
-13
@@ -1,16 +1,14 @@
|
|||||||
<!DOCTYPE html>
|
<!doctype html>
|
||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
||||||
|
<title>LuminPro</title>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/internal/insets.css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
<head>
|
<body>
|
||||||
<meta charset="UTF-8" />
|
<div id="app"></div>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
|
<script type="module" src="/src/main.js"></script>
|
||||||
<title>LuminPro</title>
|
</body>
|
||||||
<link rel="stylesheet" type="text/css" href="/internal/insets.css" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
<script type="module" src="/src/main.js"></script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
+66
-59
@@ -1,98 +1,101 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, provide, onMounted, onUnmounted, watch } from 'vue';
|
import { ref, provide, onMounted, onUnmounted, watch } from 'vue'
|
||||||
import { moduleInfo } from 'kernelsu';
|
import { moduleInfo } from 'kernelsu'
|
||||||
import { runCmd, showToast } from './utils.js';
|
import { runCmd, showToast } from './utils.js'
|
||||||
import { useStatus } from './composables/useStatus.js';
|
import { useStatus } from './composables/useStatus.js'
|
||||||
import { useConfig } from './composables/useConfig.js';
|
import { useConfig } from './composables/useConfig.js'
|
||||||
import { useLog } from './composables/useLog.js';
|
import { useLog } from './composables/useLog.js'
|
||||||
import BottomNav from './components/BottomNav.vue';
|
import BottomNav from './components/BottomNav.vue'
|
||||||
import StatusView from './views/StatusView.vue';
|
import StatusView from './views/StatusView.vue'
|
||||||
import ConfigView from './views/ConfigView.vue';
|
import ConfigView from './views/ConfigView.vue'
|
||||||
import AppsView from './views/AppsView.vue';
|
import AppsView from './views/AppsView.vue'
|
||||||
import LogView from './views/LogView.vue';
|
import LogView from './views/LogView.vue'
|
||||||
import AboutView from './views/AboutView.vue';
|
import AboutView from './views/AboutView.vue'
|
||||||
|
|
||||||
const currentView = ref('status');
|
const currentView = ref('status')
|
||||||
const moduleVersion = ref('');
|
const moduleVersion = ref('')
|
||||||
const status = useStatus();
|
const status = useStatus()
|
||||||
const config = useConfig();
|
const config = useConfig()
|
||||||
const log = useLog();
|
const log = useLog()
|
||||||
|
|
||||||
// 供子组件使用
|
// 供子组件使用
|
||||||
provide('showToast', showToast);
|
provide('showToast', showToast)
|
||||||
provide('status', status);
|
provide('status', status)
|
||||||
provide('config', config);
|
provide('config', config)
|
||||||
provide('log', log);
|
provide('log', log)
|
||||||
|
|
||||||
let refreshTimer = null;
|
let refreshTimer = null
|
||||||
|
|
||||||
function startRefresh() {
|
function startRefresh() {
|
||||||
stopRefresh();
|
stopRefresh()
|
||||||
if (!config.autoRefresh.value) return;
|
if (!config.autoRefresh.value) return
|
||||||
const interval = config.statusRefreshInterval.value;
|
const interval = config.statusRefreshInterval.value
|
||||||
refreshTimer = setInterval(async () => {
|
refreshTimer = setInterval(async () => {
|
||||||
try {
|
try {
|
||||||
await Promise.all([status.load(), log.load()]);
|
await Promise.all([status.load(), log.load()])
|
||||||
} catch {}
|
} catch {}
|
||||||
}, interval);
|
}, interval)
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopRefresh() {
|
function stopRefresh() {
|
||||||
if (refreshTimer) { clearInterval(refreshTimer); refreshTimer = null; }
|
if (refreshTimer) {
|
||||||
|
clearInterval(refreshTimer)
|
||||||
|
refreshTimer = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function restartRefresh(enabled, interval) {
|
function restartRefresh(enabled, interval) {
|
||||||
config.autoRefresh.value = enabled;
|
config.autoRefresh.value = enabled
|
||||||
config.statusRefreshInterval.value = interval;
|
config.statusRefreshInterval.value = interval
|
||||||
startRefresh();
|
startRefresh()
|
||||||
}
|
}
|
||||||
provide('restartRefresh', restartRefresh);
|
provide('restartRefresh', restartRefresh)
|
||||||
|
|
||||||
// 跟随系统色彩偏好变化
|
// 跟随系统色彩偏好变化
|
||||||
let _mq = null;
|
let _mq = null
|
||||||
function _onSystemTheme() {
|
function _onSystemTheme() {
|
||||||
if (config.themeMode.value === 'system') config.applyTheme('system');
|
if (config.themeMode.value === 'system') config.applyTheme('system')
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
// 应用 UI 缩放 + 主题
|
// 应用 UI 缩放 + 主题
|
||||||
config.applyZoom();
|
config.applyZoom()
|
||||||
config.applyTheme(config.themeMode.value);
|
config.applyTheme(config.themeMode.value)
|
||||||
_mq = window.matchMedia('(prefers-color-scheme: light)');
|
_mq = window.matchMedia('(prefers-color-scheme: light)')
|
||||||
_mq.addEventListener('change', _onSystemTheme);
|
_mq.addEventListener('change', _onSystemTheme)
|
||||||
|
|
||||||
// 读取模块版本
|
// 读取模块版本
|
||||||
try {
|
try {
|
||||||
const info = JSON.parse(moduleInfo());
|
const info = JSON.parse(moduleInfo())
|
||||||
moduleVersion.value = info.version || '';
|
moduleVersion.value = info.version || ''
|
||||||
} catch {
|
} catch {
|
||||||
moduleVersion.value = '[debug]';
|
moduleVersion.value = '[debug]'
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面滚动监听
|
// 页面滚动监听
|
||||||
window.addEventListener('scroll', onScroll, { passive: true });
|
window.addEventListener('scroll', onScroll, { passive: true })
|
||||||
|
|
||||||
// 初始加载
|
// 初始加载
|
||||||
try {
|
try {
|
||||||
await Promise.all([status.load(true), config.load(), log.load()]);
|
await Promise.all([status.load(true), config.load(), log.load()])
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
startRefresh();
|
startRefresh()
|
||||||
});
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
stopRefresh();
|
stopRefresh()
|
||||||
window.removeEventListener('scroll', onScroll);
|
window.removeEventListener('scroll', onScroll)
|
||||||
_mq?.removeEventListener('change', _onSystemTheme);
|
_mq?.removeEventListener('change', _onSystemTheme)
|
||||||
});
|
})
|
||||||
|
|
||||||
function onScroll() {
|
function onScroll() {
|
||||||
const topBlur = document.querySelector('.top-blur');
|
const topBlur = document.querySelector('.top-blur')
|
||||||
if (topBlur) topBlur.classList.toggle('scrolled', window.scrollY > 10);
|
if (topBlur) topBlur.classList.toggle('scrolled', window.scrollY > 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleViewChange(view) {
|
function handleViewChange(view) {
|
||||||
currentView.value = view;
|
currentView.value = view
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -112,19 +115,23 @@ function handleViewChange(view) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-status-container">
|
<div class="header-status-container">
|
||||||
<div
|
<div class="header-status" id="module-status" :class="status.statusClass.value">
|
||||||
class="header-status"
|
|
||||||
id="module-status"
|
|
||||||
:class="status.statusClass.value"
|
|
||||||
>
|
|
||||||
<span class="status-dot"></span>
|
<span class="status-dot"></span>
|
||||||
<span class="status-text">{{ status.statusText.value }}</span>
|
<span class="status-text">{{ status.statusText.value }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-status-actions">
|
<div class="header-status-actions">
|
||||||
<button class="btn-status-action" id="btn-toggle-service" @click="status.toggleService(showToast)">
|
<button
|
||||||
|
class="btn-status-action"
|
||||||
|
id="btn-toggle-service"
|
||||||
|
@click="status.toggleService(showToast)"
|
||||||
|
>
|
||||||
{{ status.isPaused.value ? '启用' : '暂停' }}
|
{{ status.isPaused.value ? '启用' : '暂停' }}
|
||||||
</button>
|
</button>
|
||||||
<button class="btn-status-action" id="btn-restart-service" @click="status.restartService(showToast)">
|
<button
|
||||||
|
class="btn-status-action"
|
||||||
|
id="btn-restart-service"
|
||||||
|
@click="status.restartService(showToast)"
|
||||||
|
>
|
||||||
重启
|
重启
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+11
-9
@@ -12,7 +12,11 @@
|
|||||||
width: 72px;
|
width: 72px;
|
||||||
height: 72px;
|
height: 72px;
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
|
background: linear-gradient(
|
||||||
|
135deg,
|
||||||
|
var(--md-sys-color-primary-container),
|
||||||
|
var(--md-sys-color-secondary-container)
|
||||||
|
);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -73,7 +77,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
.about-list-item + .about-list-item {
|
.about-list-item + .about-list-item {
|
||||||
border-top: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.06);
|
border-top: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.06);
|
||||||
}
|
}
|
||||||
.about-list-item:active {
|
.about-list-item:active {
|
||||||
background-color: var(--md-sys-color-surface-container-high);
|
background-color: var(--md-sys-color-surface-container-high);
|
||||||
@@ -103,7 +107,7 @@
|
|||||||
.doc-sheet-backdrop {
|
.doc-sheet-backdrop {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
background: rgba(0,0,0,0.5);
|
background: rgba(0, 0, 0, 0.5);
|
||||||
backdrop-filter: blur(4px);
|
backdrop-filter: blur(4px);
|
||||||
z-index: 1999;
|
z-index: 1999;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@@ -127,7 +131,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
transform: translateY(100%);
|
transform: translateY(100%);
|
||||||
transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
|
transition: transform 0.35s cubic-bezier(0.19, 1, 0.22, 1);
|
||||||
box-shadow: 0 -8px 32px rgba(0,0,0,0.3);
|
box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.doc-sheet.show {
|
.doc-sheet.show {
|
||||||
@@ -137,7 +141,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 16px 16px 12px;
|
padding: 16px 16px 12px;
|
||||||
border-bottom: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.07);
|
border-bottom: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.07);
|
||||||
gap: 12px;
|
gap: 12px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
@@ -183,7 +187,8 @@
|
|||||||
color: var(--md-sys-color-on-surface);
|
color: var(--md-sys-color-on-surface);
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
.doc-sheet-content h1, .doc-sheet-content h2 {
|
.doc-sheet-content h1,
|
||||||
|
.doc-sheet-content h2 {
|
||||||
color: var(--md-sys-color-primary);
|
color: var(--md-sys-color-primary);
|
||||||
margin-top: 1.4em;
|
margin-top: 1.4em;
|
||||||
}
|
}
|
||||||
@@ -232,7 +237,6 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ==========================================
|
/* ==========================================
|
||||||
Theme Segmented Button
|
Theme Segmented Button
|
||||||
========================================== */
|
========================================== */
|
||||||
@@ -262,5 +266,3 @@
|
|||||||
color: var(--md-sys-color-on-primary-container);
|
color: var(--md-sys-color-on-primary-container);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
+28
-8
@@ -14,7 +14,9 @@
|
|||||||
border-radius: var(--border-radius-m);
|
border-radius: var(--border-radius-m);
|
||||||
padding: 8px 12px;
|
padding: 8px 12px;
|
||||||
margin-bottom: var(--spacing-m);
|
margin-bottom: var(--spacing-m);
|
||||||
transition: border-color 0.2s, box-shadow 0.2s;
|
transition:
|
||||||
|
border-color 0.2s,
|
||||||
|
box-shadow 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-search-container:focus-within {
|
.app-search-container:focus-within {
|
||||||
@@ -188,7 +190,11 @@
|
|||||||
width: 40px;
|
width: 40px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), rgba(168, 199, 250, 0.5));
|
background: linear-gradient(
|
||||||
|
135deg,
|
||||||
|
var(--md-sys-color-primary-container),
|
||||||
|
rgba(168, 199, 250, 0.5)
|
||||||
|
);
|
||||||
color: var(--md-sys-color-on-primary-container);
|
color: var(--md-sys-color-on-primary-container);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -239,7 +245,9 @@
|
|||||||
border-radius: var(--border-radius-s);
|
border-radius: var(--border-radius-s);
|
||||||
color: var(--md-sys-color-on-surface-variant);
|
color: var(--md-sys-color-on-surface-variant);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: transform 0.2s, background-color 0.2s;
|
transition:
|
||||||
|
transform 0.2s,
|
||||||
|
background-color 0.2s;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,7 +345,9 @@
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
padding: 3px 8px;
|
padding: 3px 8px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background-color 0.2s, border-color 0.2s;
|
transition:
|
||||||
|
background-color 0.2s,
|
||||||
|
border-color 0.2s;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
@@ -363,7 +373,9 @@
|
|||||||
font-size: 0.8125rem;
|
font-size: 0.8125rem;
|
||||||
color: var(--md-sys-color-on-surface);
|
color: var(--md-sys-color-on-surface);
|
||||||
outline: none;
|
outline: none;
|
||||||
transition: border-color 0.2s, box-shadow 0.2s;
|
transition:
|
||||||
|
border-color 0.2s,
|
||||||
|
box-shadow 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.activity-block-input:focus {
|
.activity-block-input:focus {
|
||||||
@@ -437,7 +449,10 @@
|
|||||||
height: 6px;
|
height: 6px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: var(--md-sys-color-outline-variant);
|
background-color: var(--md-sys-color-outline-variant);
|
||||||
transition: background-color 0.3s, transform 0.3s, width 0.3s;
|
transition:
|
||||||
|
background-color 0.3s,
|
||||||
|
transform 0.3s,
|
||||||
|
width 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.picker-step-dot.active {
|
.picker-step-dot.active {
|
||||||
@@ -504,8 +519,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes picker-pulse {
|
@keyframes picker-pulse {
|
||||||
0%, 100% { opacity: 1; }
|
0%,
|
||||||
50% { opacity: 0.35; }
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
50% {
|
||||||
|
opacity: 0.35;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.picker-result-box {
|
.picker-result-box {
|
||||||
|
|||||||
+472
-404
File diff suppressed because it is too large.
Load diff
+39
-19
@@ -3,7 +3,9 @@
|
|||||||
background-color: var(--md-sys-color-surface);
|
background-color: var(--md-sys-color-surface);
|
||||||
border-radius: var(--border-radius-m);
|
border-radius: var(--border-radius-m);
|
||||||
padding: var(--spacing-l);
|
padding: var(--spacing-l);
|
||||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
|
box-shadow:
|
||||||
|
0 1px 3px 0 rgba(0, 0, 0, 0.3),
|
||||||
|
0 4px 8px 3px rgba(0, 0, 0, 0.15);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
@@ -54,7 +56,7 @@
|
|||||||
padding: var(--spacing-m);
|
padding: var(--spacing-m);
|
||||||
background-color: var(--md-sys-color-surface-container);
|
background-color: var(--md-sys-color-surface-container);
|
||||||
border-radius: var(--border-radius-m);
|
border-radius: var(--border-radius-m);
|
||||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.05);
|
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-title {
|
.group-title {
|
||||||
@@ -67,7 +69,8 @@
|
|||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.group-title i, .group-title svg {
|
.group-title i,
|
||||||
|
.group-title svg {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
}
|
}
|
||||||
@@ -241,20 +244,20 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: var(--md-sys-color-surface-container-high);
|
background-color: var(--md-sys-color-surface-container-high);
|
||||||
transition: .4s;
|
transition: 0.4s;
|
||||||
border-radius: 34px;
|
border-radius: 34px;
|
||||||
border: 2px solid var(--md-sys-color-outline);
|
border: 2px solid var(--md-sys-color-outline);
|
||||||
}
|
}
|
||||||
|
|
||||||
.slider:before {
|
.slider:before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
content: "";
|
content: '';
|
||||||
height: 24px;
|
height: 24px;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
left: 2px;
|
left: 2px;
|
||||||
bottom: 2px;
|
bottom: 2px;
|
||||||
background-color: var(--md-sys-color-outline);
|
background-color: var(--md-sys-color-outline);
|
||||||
transition: .4s;
|
transition: 0.4s;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +285,7 @@ input:checked + .slider:before {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0,0,0), 0.04);
|
border: 1px solid rgba(var(--md-sys-color-on-surface-rgb, 0, 0, 0), 0.04);
|
||||||
transition: transform 0.2s ease;
|
transition: transform 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +322,11 @@ input:checked + .slider:before {
|
|||||||
.brightness-section {
|
.brightness-section {
|
||||||
margin-top: var(--spacing-l);
|
margin-top: var(--spacing-l);
|
||||||
padding: var(--spacing-m);
|
padding: var(--spacing-m);
|
||||||
background: linear-gradient(135deg, var(--md-sys-color-surface-container-high) 0%, var(--md-sys-color-surface-container) 100%);
|
background: linear-gradient(
|
||||||
|
135deg,
|
||||||
|
var(--md-sys-color-surface-container-high) 0%,
|
||||||
|
var(--md-sys-color-surface-container) 100%
|
||||||
|
);
|
||||||
border-radius: var(--border-radius-m);
|
border-radius: var(--border-radius-m);
|
||||||
border: 1px solid var(--md-sys-color-outline-variant);
|
border: 1px solid var(--md-sys-color-outline-variant);
|
||||||
}
|
}
|
||||||
@@ -370,14 +377,16 @@ input:checked + .slider:before {
|
|||||||
height: 24px;
|
height: 24px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
/* 背景将由 JS 通过 linear-gradient 动态更新实现进度条效果 */
|
/* 背景将由 JS 通过 linear-gradient 动态更新实现进度条效果 */
|
||||||
background: var(--md-sys-color-surface-container-high);
|
background: var(--md-sys-color-surface-container-high);
|
||||||
outline: none;
|
outline: none;
|
||||||
-webkit-appearance: none;
|
-webkit-appearance: none;
|
||||||
appearance: none;
|
appearance: none;
|
||||||
cursor: grab;
|
cursor: grab;
|
||||||
transition: height 0.2s, box-shadow 0.2s;
|
transition:
|
||||||
|
height 0.2s,
|
||||||
|
box-shadow 0.2s;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.03);
|
border: 1px solid rgba(255, 255, 255, 0.03);
|
||||||
box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
|
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
|
||||||
overflow: hidden; /* 确保进度条颜色不溢出圆角 */
|
overflow: hidden; /* 确保进度条颜色不溢出圆角 */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,12 +415,16 @@ input:checked + .slider:before {
|
|||||||
background: var(--md-sys-color-primary);
|
background: var(--md-sys-color-primary);
|
||||||
cursor: grab;
|
cursor: grab;
|
||||||
border: 2px solid var(--md-sys-color-surface);
|
border: 2px solid var(--md-sys-color-surface);
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
box-shadow:
|
||||||
|
0 2px 8px rgba(0, 0, 0, 0.4),
|
||||||
|
inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brightness-slider::-moz-range-thumb:hover {
|
.brightness-slider::-moz-range-thumb:hover {
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
box-shadow:
|
||||||
|
0 4px 12px rgba(0, 0, 0, 0.5),
|
||||||
|
inset 0 1px 2px rgba(255, 255, 255, 0.3);
|
||||||
transform: scale(1.1);
|
transform: scale(1.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,7 +477,9 @@ input:checked + .slider:before {
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background-color 0.2s, opacity 0.2s;
|
transition:
|
||||||
|
background-color 0.2s,
|
||||||
|
opacity 0.2s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn:active {
|
.btn:active {
|
||||||
@@ -482,7 +497,8 @@ input:checked + .slider:before {
|
|||||||
color: var(--md-sys-color-primary);
|
color: var(--md-sys-color-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-outline-s, .btn-text-s {
|
.btn-outline-s,
|
||||||
|
.btn-text-s {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
border: 1px solid var(--md-sys-color-outline-variant);
|
border: 1px solid var(--md-sys-color-outline-variant);
|
||||||
color: var(--md-sys-color-primary);
|
color: var(--md-sys-color-primary);
|
||||||
@@ -548,7 +564,8 @@ input:checked + .slider:before {
|
|||||||
transform: scale(0.9);
|
transform: scale(0.9);
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-icon-only-s i, .btn-icon-only-s svg {
|
.btn-icon-only-s i,
|
||||||
|
.btn-icon-only-s svg {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
}
|
}
|
||||||
@@ -557,8 +574,11 @@ input:checked + .slider:before {
|
|||||||
animation: spin 1s linear infinite;
|
animation: spin 1s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@keyframes spin {
|
@keyframes spin {
|
||||||
from { transform: rotate(0deg); }
|
from {
|
||||||
to { transform: rotate(360deg); }
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,111 +1,122 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted, onUnmounted, watch } from 'vue';
|
import { ref, onMounted, onUnmounted, watch } from 'vue'
|
||||||
import {
|
import {
|
||||||
Activity as IconActivity,
|
Activity as IconActivity,
|
||||||
Settings as IconSettings,
|
Settings as IconSettings,
|
||||||
AppWindow as IconApps,
|
AppWindow as IconApps,
|
||||||
ScrollText as IconLog,
|
ScrollText as IconLog,
|
||||||
Info as IconInfo,
|
Info as IconInfo,
|
||||||
} from 'lucide-vue-next';
|
} from 'lucide-vue-next'
|
||||||
|
|
||||||
const props = defineProps({ modelValue: { type: String, default: 'status' } });
|
const props = defineProps({ modelValue: { type: String, default: 'status' } })
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue'])
|
||||||
|
|
||||||
const navItems = [
|
const navItems = [
|
||||||
{ key: 'status', label: '状态', icon: IconActivity },
|
{ key: 'status', label: '状态', icon: IconActivity },
|
||||||
{ key: 'config', label: '配置', icon: IconSettings },
|
{ key: 'config', label: '配置', icon: IconSettings },
|
||||||
{ key: 'apps', label: '黑名单', icon: IconApps },
|
{ key: 'apps', label: '黑名单', icon: IconApps },
|
||||||
{ key: 'log', label: '日志', icon: IconLog },
|
{ key: 'log', label: '日志', icon: IconLog },
|
||||||
{ key: 'about', label: '关于', icon: IconInfo },
|
{ key: 'about', label: '关于', icon: IconInfo },
|
||||||
];
|
]
|
||||||
|
|
||||||
const navbarEl = ref(null);
|
const navbarEl = ref(null)
|
||||||
const sliderEl = ref(null);
|
const sliderEl = ref(null)
|
||||||
const btnRefs = ref([]);
|
const btnRefs = ref([])
|
||||||
|
|
||||||
function updateSlider(key, animate = true) {
|
function updateSlider(key, animate = true) {
|
||||||
const idx = navItems.findIndex(n => n.key === key);
|
const idx = navItems.findIndex((n) => n.key === key)
|
||||||
if (idx < 0) return;
|
if (idx < 0) return
|
||||||
const btn = btnRefs.value[idx];
|
const btn = btnRefs.value[idx]
|
||||||
if (!btn || !sliderEl.value) return;
|
if (!btn || !sliderEl.value) return
|
||||||
if (!animate) sliderEl.value.style.transition = 'none';
|
if (!animate) sliderEl.value.style.transition = 'none'
|
||||||
sliderEl.value.style.width = btn.offsetWidth + 'px';
|
sliderEl.value.style.width = btn.offsetWidth + 'px'
|
||||||
sliderEl.value.style.transform = `translateX(${btn.offsetLeft}px)`;
|
sliderEl.value.style.transform = `translateX(${btn.offsetLeft}px)`
|
||||||
if (!animate) requestAnimationFrame(() => { if (sliderEl.value) sliderEl.value.style.transition = ''; });
|
if (!animate)
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
if (sliderEl.value) sliderEl.value.style.transition = ''
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function select(key) {
|
function select(key) {
|
||||||
emit('update:modelValue', key);
|
emit('update:modelValue', key)
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(() => props.modelValue, v => updateSlider(v));
|
watch(
|
||||||
|
() => props.modelValue,
|
||||||
|
(v) => updateSlider(v),
|
||||||
|
)
|
||||||
|
|
||||||
// ---- 拖拽逻辑 ----
|
// ---- 拖拽逻辑 ----
|
||||||
let isDragging = false;
|
let isDragging = false
|
||||||
let isActuallyDragging = false;
|
let isActuallyDragging = false
|
||||||
let startX = 0;
|
let startX = 0
|
||||||
let startSliderX = 0;
|
let startSliderX = 0
|
||||||
|
|
||||||
function onPointerDown(e) {
|
function onPointerDown(e) {
|
||||||
isDragging = true;
|
isDragging = true
|
||||||
isActuallyDragging = false;
|
isActuallyDragging = false
|
||||||
startX = e.clientX;
|
startX = e.clientX
|
||||||
const idx = navItems.findIndex(n => n.key === props.modelValue);
|
const idx = navItems.findIndex((n) => n.key === props.modelValue)
|
||||||
startSliderX = idx >= 0 && btnRefs.value[idx] ? btnRefs.value[idx].offsetLeft : 0;
|
startSliderX = idx >= 0 && btnRefs.value[idx] ? btnRefs.value[idx].offsetLeft : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPointerMove(e) {
|
function onPointerMove(e) {
|
||||||
if (!isDragging) return;
|
if (!isDragging) return
|
||||||
const dx = e.clientX - startX;
|
const dx = e.clientX - startX
|
||||||
if (!isActuallyDragging && Math.abs(dx) > 10) {
|
if (!isActuallyDragging && Math.abs(dx) > 10) {
|
||||||
isActuallyDragging = true;
|
isActuallyDragging = true
|
||||||
navbarEl.value?.setPointerCapture(e.pointerId);
|
navbarEl.value?.setPointerCapture(e.pointerId)
|
||||||
}
|
}
|
||||||
if (!isActuallyDragging || !sliderEl.value) return;
|
if (!isActuallyDragging || !sliderEl.value) return
|
||||||
const first = btnRefs.value[0];
|
const first = btnRefs.value[0]
|
||||||
const last = btnRefs.value[btnRefs.value.length - 1];
|
const last = btnRefs.value[btnRefs.value.length - 1]
|
||||||
const minX = first ? first.offsetLeft : 0;
|
const minX = first ? first.offsetLeft : 0
|
||||||
const maxX = last ? last.offsetLeft : 0;
|
const maxX = last ? last.offsetLeft : 0
|
||||||
let tx = startSliderX + dx;
|
let tx = startSliderX + dx
|
||||||
if (tx < minX) tx = minX + (tx - minX) * 0.3;
|
if (tx < minX) tx = minX + (tx - minX) * 0.3
|
||||||
if (tx > maxX) tx = maxX + (tx - maxX) * 0.3;
|
if (tx > maxX) tx = maxX + (tx - maxX) * 0.3
|
||||||
sliderEl.value.style.transition = 'none';
|
sliderEl.value.style.transition = 'none'
|
||||||
sliderEl.value.style.transform = `translateX(${tx}px)`;
|
sliderEl.value.style.transform = `translateX(${tx}px)`
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPointerUp(e) {
|
function onPointerUp(e) {
|
||||||
if (!isDragging) return;
|
if (!isDragging) return
|
||||||
const wasDragging = isActuallyDragging;
|
const wasDragging = isActuallyDragging
|
||||||
isDragging = false;
|
isDragging = false
|
||||||
isActuallyDragging = false;
|
isActuallyDragging = false
|
||||||
navbarEl.value?.releasePointerCapture(e.pointerId);
|
navbarEl.value?.releasePointerCapture(e.pointerId)
|
||||||
|
|
||||||
if (wasDragging && sliderEl.value) {
|
if (wasDragging && sliderEl.value) {
|
||||||
const sliderRect = sliderEl.value.getBoundingClientRect();
|
const sliderRect = sliderEl.value.getBoundingClientRect()
|
||||||
const navRect = navbarEl.value?.getBoundingClientRect();
|
const navRect = navbarEl.value?.getBoundingClientRect()
|
||||||
const currentX = navRect ? sliderRect.left - navRect.left : 0;
|
const currentX = navRect ? sliderRect.left - navRect.left : 0
|
||||||
let closest = navItems[0].key;
|
let closest = navItems[0].key
|
||||||
let minDist = Infinity;
|
let minDist = Infinity
|
||||||
btnRefs.value.forEach((btn, i) => {
|
btnRefs.value.forEach((btn, i) => {
|
||||||
if (!btn) return;
|
if (!btn) return
|
||||||
const dist = Math.abs(btn.offsetLeft - currentX);
|
const dist = Math.abs(btn.offsetLeft - currentX)
|
||||||
if (dist < minDist) { minDist = dist; closest = navItems[i].key; }
|
if (dist < minDist) {
|
||||||
});
|
minDist = dist
|
||||||
select(closest);
|
closest = navItems[i].key
|
||||||
|
}
|
||||||
|
})
|
||||||
|
select(closest)
|
||||||
} else {
|
} else {
|
||||||
updateSlider(props.modelValue);
|
updateSlider(props.modelValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onResize() { updateSlider(props.modelValue, false); }
|
function onResize() {
|
||||||
|
updateSlider(props.modelValue, false)
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
updateSlider(props.modelValue, false);
|
updateSlider(props.modelValue, false)
|
||||||
window.addEventListener('resize', onResize);
|
window.addEventListener('resize', onResize)
|
||||||
});
|
})
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.removeEventListener('resize', onResize);
|
window.removeEventListener('resize', onResize)
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -121,7 +132,7 @@ onUnmounted(() => {
|
|||||||
<button
|
<button
|
||||||
v-for="(item, i) in navItems"
|
v-for="(item, i) in navItems"
|
||||||
:key="item.key"
|
:key="item.key"
|
||||||
:ref="el => btnRefs[i] = el"
|
:ref="(el) => (btnRefs[i] = el)"
|
||||||
class="navbar-btn"
|
class="navbar-btn"
|
||||||
:class="{ active: modelValue === item.key }"
|
:class="{ active: modelValue === item.key }"
|
||||||
:data-section="item.key"
|
:data-section="item.key"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils'
|
||||||
import { cva } from 'class-variance-authority';
|
import { cva } from 'class-variance-authority'
|
||||||
|
|
||||||
const badgeVariants = cva(
|
const badgeVariants = cva(
|
||||||
'inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium transition-colors',
|
'inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium transition-colors',
|
||||||
@@ -16,13 +16,13 @@ const badgeVariants = cva(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
defaultVariants: { variant: 'default' },
|
defaultVariants: { variant: 'default' },
|
||||||
}
|
},
|
||||||
);
|
)
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
variant: { type: String, default: 'default' },
|
variant: { type: String, default: 'default' },
|
||||||
class: { type: String, default: '' },
|
class: { type: String, default: '' },
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils'
|
||||||
import { cva } from 'class-variance-authority';
|
import { cva } from 'class-variance-authority'
|
||||||
|
|
||||||
const buttonVariants = cva(
|
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',
|
'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0',
|
||||||
@@ -8,8 +8,10 @@ const buttonVariants = cva(
|
|||||||
variants: {
|
variants: {
|
||||||
variant: {
|
variant: {
|
||||||
default: 'bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80',
|
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',
|
destructive:
|
||||||
outline: 'border border-border bg-transparent hover:bg-secondary hover:text-secondary-foreground',
|
'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',
|
secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
||||||
ghost: 'hover:bg-secondary hover:text-secondary-foreground',
|
ghost: 'hover:bg-secondary hover:text-secondary-foreground',
|
||||||
link: 'text-primary underline-offset-4 hover:underline',
|
link: 'text-primary underline-offset-4 hover:underline',
|
||||||
@@ -26,8 +28,8 @@ const buttonVariants = cva(
|
|||||||
variant: 'default',
|
variant: 'default',
|
||||||
size: 'default',
|
size: 'default',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
);
|
)
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
variant: { type: String, default: 'default' },
|
variant: { type: String, default: 'default' },
|
||||||
@@ -36,7 +38,7 @@ const props = defineProps({
|
|||||||
disabled: { type: Boolean, default: false },
|
disabled: { type: Boolean, default: false },
|
||||||
type: { type: String, default: 'button' },
|
type: { type: String, default: 'button' },
|
||||||
as: { type: String, default: 'button' },
|
as: { type: String, default: 'button' },
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
class: { type: String, default: '' },
|
class: { type: String, default: '' },
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div :class="cn('rounded-xl border border-border/40 bg-card text-card-foreground shadow-md', props.class)">
|
<div
|
||||||
|
:class="
|
||||||
|
cn('rounded-xl border border-border/40 bg-card text-card-foreground shadow-md', props.class)
|
||||||
|
"
|
||||||
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
class: { type: String, default: '' },
|
class: { type: String, default: '' },
|
||||||
@@ -11,9 +11,9 @@ const props = defineProps({
|
|||||||
max: { type: [String, Number], default: undefined },
|
max: { type: [String, Number], default: undefined },
|
||||||
autocomplete: { type: String, default: 'off' },
|
autocomplete: { type: String, default: 'off' },
|
||||||
spellcheck: { type: Boolean, default: false },
|
spellcheck: { type: Boolean, default: false },
|
||||||
});
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue'])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -27,10 +27,12 @@ const emit = defineEmits(['update:modelValue']);
|
|||||||
:max="max"
|
:max="max"
|
||||||
:autocomplete="autocomplete"
|
:autocomplete="autocomplete"
|
||||||
:spellcheck="spellcheck"
|
:spellcheck="spellcheck"
|
||||||
:class="cn(
|
:class="
|
||||||
'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',
|
cn(
|
||||||
props.class
|
'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)"
|
@input="emit('update:modelValue', $event.target.value)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,14 +1,22 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
class: { type: String, default: '' },
|
class: { type: String, default: '' },
|
||||||
for: { type: String, default: undefined },
|
for: { type: String, default: undefined },
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<label :for="props.for" :class="cn('text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70', props.class)">
|
<label
|
||||||
|
:for="props.for"
|
||||||
|
:class="
|
||||||
|
cn(
|
||||||
|
'text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
|
||||||
|
props.class,
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</label>
|
</label>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,19 +1,21 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
class: { type: String, default: '' },
|
class: { type: String, default: '' },
|
||||||
vertical: { type: Boolean, default: false },
|
vertical: { type: Boolean, default: false },
|
||||||
});
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
:role="'separator'"
|
:role="'separator'"
|
||||||
:class="cn(
|
:class="
|
||||||
vertical ? 'inline-flex h-full w-px' : 'flex h-px w-full',
|
cn(
|
||||||
'bg-border shrink-0',
|
vertical ? 'inline-flex h-full w-px' : 'flex h-px w-full',
|
||||||
props.class
|
'bg-border shrink-0',
|
||||||
)"
|
props.class,
|
||||||
|
)
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
class: { type: String, default: '' },
|
class: { type: String, default: '' },
|
||||||
modelValue: { type: Boolean, default: false },
|
modelValue: { type: Boolean, default: false },
|
||||||
disabled: { type: Boolean, default: false },
|
disabled: { type: Boolean, default: false },
|
||||||
id: { type: String, default: undefined },
|
id: { type: String, default: undefined },
|
||||||
});
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue'])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -18,22 +18,26 @@ const emit = defineEmits(['update:modelValue']);
|
|||||||
:aria-checked="modelValue"
|
:aria-checked="modelValue"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:id="id"
|
:id="id"
|
||||||
:class="cn(
|
:class="
|
||||||
'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',
|
cn(
|
||||||
modelValue
|
'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',
|
||||||
? 'bg-primary border-2 border-transparent'
|
modelValue
|
||||||
: 'bg-transparent border-2 border-muted-foreground/40',
|
? 'bg-primary border-2 border-transparent'
|
||||||
props.class
|
: 'bg-transparent border-2 border-muted-foreground/40',
|
||||||
)"
|
props.class,
|
||||||
|
)
|
||||||
|
"
|
||||||
@click="emit('update:modelValue', !modelValue)"
|
@click="emit('update:modelValue', !modelValue)"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
:class="cn(
|
:class="
|
||||||
'pointer-events-none block rounded-full shadow-sm ring-0 transition-all duration-200',
|
cn(
|
||||||
modelValue
|
'pointer-events-none block rounded-full shadow-sm ring-0 transition-all duration-200',
|
||||||
? 'h-5 w-5 translate-x-5 bg-white'
|
modelValue
|
||||||
: 'h-4 w-4 translate-x-0.5 bg-muted-foreground/60'
|
? 'h-5 w-5 translate-x-5 bg-white'
|
||||||
)"
|
: 'h-4 w-4 translate-x-0.5 bg-muted-foreground/60',
|
||||||
|
)
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
class: { type: String, default: '' },
|
class: { type: String, default: '' },
|
||||||
@@ -7,9 +7,9 @@ const props = defineProps({
|
|||||||
placeholder: { type: String, default: '' },
|
placeholder: { type: String, default: '' },
|
||||||
disabled: { type: Boolean, default: false },
|
disabled: { type: Boolean, default: false },
|
||||||
rows: { type: Number, default: 2 },
|
rows: { type: Number, default: 2 },
|
||||||
});
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue'])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -19,10 +19,12 @@ const emit = defineEmits(['update:modelValue']);
|
|||||||
:placeholder="placeholder"
|
:placeholder="placeholder"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:rows="rows"
|
:rows="rows"
|
||||||
:class="cn(
|
:class="
|
||||||
'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',
|
cn(
|
||||||
props.class
|
'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)"
|
@input="emit('update:modelValue', $event.target.value)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,159 +1,220 @@
|
|||||||
import { ref, reactive } from 'vue';
|
import { ref, reactive } from 'vue'
|
||||||
import { listPackages, getPackagesInfo } from 'kernelsu';
|
import { listPackages, getPackagesInfo } from 'kernelsu'
|
||||||
import PinyinMatch from 'pinyin-match';
|
import PinyinMatch from 'pinyin-match'
|
||||||
import { runCmd, readConfig, updateConfig } from '../utils.js';
|
import { runCmd, readConfig, updateConfig } from '../utils.js'
|
||||||
|
|
||||||
export function useApps() {
|
export function useApps() {
|
||||||
const apps = ref([]);
|
const apps = ref([])
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false)
|
||||||
const loadError = ref('');
|
const loadError = ref('')
|
||||||
const searchKeyword = ref('');
|
const searchKeyword = ref('')
|
||||||
const showingSystemApps = ref(true);
|
const showingSystemApps = ref(true)
|
||||||
const savedBlacklist = ref(new Set());
|
const savedBlacklist = ref(new Set())
|
||||||
const activityEntries = ref(new Set());
|
const activityEntries = ref(new Set())
|
||||||
|
|
||||||
/** 每个 app 条目结构: { packageName, appLabel, isSystem, uid, checked, hasActivities } */
|
/** 每个 app 条目结构: { packageName, appLabel, isSystem, uid, checked, hasActivities } */
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
isLoading.value = true;
|
isLoading.value = true
|
||||||
loadError.value = '';
|
loadError.value = ''
|
||||||
try {
|
try {
|
||||||
const cfg = await readConfig();
|
const cfg = await readConfig()
|
||||||
const allSaved = Array.isArray(cfg.blacklist_apps) ? cfg.blacklist_apps : [];
|
const allSaved = Array.isArray(cfg.blacklist_apps) ? cfg.blacklist_apps : []
|
||||||
savedBlacklist.value = new Set(allSaved);
|
savedBlacklist.value = new Set(allSaved)
|
||||||
const savedPkgSet = new Set(allSaved.filter(e => !e.includes('/')));
|
const savedPkgSet = new Set(allSaved.filter((e) => !e.includes('/')))
|
||||||
activityEntries.value = new Set(allSaved.filter(e => e.includes('/')));
|
activityEntries.value = new Set(allSaved.filter((e) => e.includes('/')))
|
||||||
|
|
||||||
let infoList = [];
|
let infoList = []
|
||||||
try {
|
try {
|
||||||
const pkgs = await listPackages();
|
const pkgs = await listPackages()
|
||||||
if (pkgs && pkgs.length > 0) infoList = await getPackagesInfo(pkgs);
|
if (pkgs && pkgs.length > 0) infoList = await getPackagesInfo(pkgs)
|
||||||
else throw new Error('no pkgs');
|
else throw new Error('no pkgs')
|
||||||
} catch {
|
} catch {
|
||||||
console.log('[DEBUG] 使用模拟数据');
|
console.log('[DEBUG] 使用模拟数据')
|
||||||
infoList = Array.from({ length: 150 }, (_, i) => ({
|
infoList = Array.from({ length: 150 }, (_, i) => ({
|
||||||
packageName: `com.mock.app${i}`,
|
packageName: `com.mock.app${i}`,
|
||||||
appLabel: i % 10 === 0 ? `测试应用 ${i} (含抖音关键字)` : `模拟应用 ${i}`,
|
appLabel: i % 10 === 0 ? `测试应用 ${i} (含抖音关键字)` : `模拟应用 ${i}`,
|
||||||
isSystem: i % 5 === 0,
|
isSystem: i % 5 === 0,
|
||||||
uid: 10000 + i,
|
uid: 10000 + i,
|
||||||
}));
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!showingSystemApps.value) infoList = infoList.filter(a => !a.isSystem);
|
if (!showingSystemApps.value) infoList = infoList.filter((a) => !a.isSystem)
|
||||||
|
|
||||||
infoList.sort((a, b) => {
|
infoList.sort((a, b) => {
|
||||||
if (a.isSystem !== b.isSystem) return a.isSystem ? 1 : -1;
|
if (a.isSystem !== b.isSystem) return a.isSystem ? 1 : -1
|
||||||
return (a.appLabel || '').localeCompare(b.appLabel || '');
|
return (a.appLabel || '').localeCompare(b.appLabel || '')
|
||||||
});
|
})
|
||||||
|
|
||||||
const seenUids = new Set();
|
const seenUids = new Set()
|
||||||
infoList = infoList.filter(a => {
|
infoList = infoList.filter((a) => {
|
||||||
if (a.uid == null) return true;
|
if (a.uid == null) return true
|
||||||
if (seenUids.has(a.uid)) return false;
|
if (seenUids.has(a.uid)) return false
|
||||||
seenUids.add(a.uid); return true;
|
seenUids.add(a.uid)
|
||||||
});
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
apps.value = infoList.map(a => reactive({
|
apps.value = infoList.map((a) =>
|
||||||
packageName: a.packageName,
|
reactive({
|
||||||
appLabel: a.appLabel || 'Unknown',
|
packageName: a.packageName,
|
||||||
isSystem: a.isSystem,
|
appLabel: a.appLabel || 'Unknown',
|
||||||
uid: a.uid,
|
isSystem: a.isSystem,
|
||||||
checked: savedPkgSet.has(a.packageName),
|
uid: a.uid,
|
||||||
expanded: false,
|
checked: savedPkgSet.has(a.packageName),
|
||||||
}));
|
expanded: false,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
_reorder();
|
_reorder()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
loadError.value = e.message || String(e);
|
loadError.value = e.message || String(e)
|
||||||
} finally {
|
} finally {
|
||||||
isLoading.value = false;
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function _reorder() {
|
function _reorder() {
|
||||||
apps.value.sort((a, b) => {
|
apps.value.sort((a, b) => {
|
||||||
const stateA = a.checked ? 2 : (hasActivity(a.packageName) ? 1 : 0);
|
const stateA = a.checked ? 2 : hasActivity(a.packageName) ? 1 : 0
|
||||||
const stateB = b.checked ? 2 : (hasActivity(b.packageName) ? 1 : 0);
|
const stateB = b.checked ? 2 : hasActivity(b.packageName) ? 1 : 0
|
||||||
return stateB - stateA;
|
return stateB - stateA
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasActivity(pkg) {
|
function hasActivity(pkg) {
|
||||||
return [...activityEntries.value].some(e => e.startsWith(pkg + '/'));
|
return [...activityEntries.value].some((e) => e.startsWith(pkg + '/'))
|
||||||
}
|
}
|
||||||
|
|
||||||
function getActivities(pkg) {
|
function getActivities(pkg) {
|
||||||
return [...activityEntries.value].filter(e => e.startsWith(pkg + '/'));
|
return [...activityEntries.value].filter((e) => e.startsWith(pkg + '/'))
|
||||||
}
|
}
|
||||||
|
|
||||||
function addActivity(entry) {
|
function addActivity(entry) {
|
||||||
activityEntries.value.add(entry);
|
activityEntries.value.add(entry)
|
||||||
_reorder();
|
_reorder()
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeActivity(entry) {
|
function removeActivity(entry) {
|
||||||
activityEntries.value.delete(entry);
|
activityEntries.value.delete(entry)
|
||||||
_reorder();
|
_reorder()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function save(toast) {
|
async function save(toast) {
|
||||||
toast('保存中...');
|
toast('保存中...')
|
||||||
const selectedPkgs = apps.value.filter(a => a.checked).map(a => a.packageName);
|
const selectedPkgs = apps.value.filter((a) => a.checked).map((a) => a.packageName)
|
||||||
const allEntries = [...selectedPkgs, ...activityEntries.value];
|
const allEntries = [...selectedPkgs, ...activityEntries.value]
|
||||||
const res = await updateConfig({ blacklist_apps: allEntries });
|
const res = await updateConfig({ blacklist_apps: allEntries })
|
||||||
if (res.errno === 0) {
|
if (res.errno === 0) {
|
||||||
savedBlacklist.value = new Set(allEntries);
|
savedBlacklist.value = new Set(allEntries)
|
||||||
toast('黑名单保存成功');
|
toast('黑名单保存成功')
|
||||||
} else {
|
} else {
|
||||||
toast('保存失败: ' + res.stderr);
|
toast('保存失败: ' + res.stderr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onCheckboxChange() { _reorder(); }
|
function onCheckboxChange() {
|
||||||
|
_reorder()
|
||||||
function toggleSystemApps() {
|
|
||||||
showingSystemApps.value = !showingSystemApps.value;
|
|
||||||
load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectAll() { apps.value.forEach(a => { a.checked = true; }); _reorder(); }
|
function toggleSystemApps() {
|
||||||
function selectNone() { apps.value.forEach(a => { a.checked = false; }); _reorder(); }
|
showingSystemApps.value = !showingSystemApps.value
|
||||||
function invertSelection() { apps.value.forEach(a => { a.checked = !a.checked; }); _reorder(); }
|
load()
|
||||||
|
}
|
||||||
|
|
||||||
const smartKeywords = ['抖音', 'tiktok', '爱奇艺', '优酷', '腾讯视频', '哔哩', 'bilibili',
|
function selectAll() {
|
||||||
'youku', 'iqiyi', '芒果', '西瓜', '快手', 'kuaishou', '小红书',
|
apps.value.forEach((a) => {
|
||||||
'netflix', 'youtube', 'hulu', 'disney', 'prime', '相册', 'gallery', 'photos', 'x'];
|
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() {
|
function smartSelect() {
|
||||||
apps.value.forEach(a => {
|
apps.value.forEach((a) => {
|
||||||
const name = (a.appLabel || '').toLowerCase();
|
const name = (a.appLabel || '').toLowerCase()
|
||||||
const pkg = (a.packageName || '').toLowerCase();
|
const pkg = (a.packageName || '').toLowerCase()
|
||||||
for (const kw of smartKeywords) {
|
for (const kw of smartKeywords) {
|
||||||
if (kw === 'x') {
|
if (kw === 'x') {
|
||||||
if (name === 'x' || name === 'x (twitter)') { a.checked = true; break; }
|
if (name === 'x' || name === 'x (twitter)') {
|
||||||
} else if (name.includes(kw) || pkg.includes(kw)) { a.checked = true; break; }
|
a.checked = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else if (name.includes(kw) || pkg.includes(kw)) {
|
||||||
|
a.checked = true
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
_reorder();
|
_reorder()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 过滤后的列表
|
// 过滤后的列表
|
||||||
function getFilteredApps() {
|
function getFilteredApps() {
|
||||||
const kw = searchKeyword.value.trim().toLowerCase();
|
const kw = searchKeyword.value.trim().toLowerCase()
|
||||||
if (!kw) return apps.value;
|
if (!kw) return apps.value
|
||||||
return apps.value.filter(a => {
|
return apps.value.filter((a) => {
|
||||||
const pkg = a.packageName.toLowerCase();
|
const pkg = a.packageName.toLowerCase()
|
||||||
return pkg.includes(kw) || PinyinMatch.match(a.appLabel, kw);
|
return pkg.includes(kw) || PinyinMatch.match(a.appLabel, kw)
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
apps, isLoading, loadError, searchKeyword, showingSystemApps,
|
apps,
|
||||||
savedBlacklist, activityEntries,
|
isLoading,
|
||||||
load, save,
|
loadError,
|
||||||
hasActivity, getActivities, addActivity, removeActivity,
|
searchKeyword,
|
||||||
|
showingSystemApps,
|
||||||
|
savedBlacklist,
|
||||||
|
activityEntries,
|
||||||
|
load,
|
||||||
|
save,
|
||||||
|
hasActivity,
|
||||||
|
getActivities,
|
||||||
|
addActivity,
|
||||||
|
removeActivity,
|
||||||
onCheckboxChange,
|
onCheckboxChange,
|
||||||
toggleSystemApps, selectAll, selectNone, invertSelection, smartSelect,
|
toggleSystemApps,
|
||||||
|
selectAll,
|
||||||
|
selectNone,
|
||||||
|
invertSelection,
|
||||||
|
smartSelect,
|
||||||
getFilteredApps,
|
getFilteredApps,
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
+166
-117
@@ -1,174 +1,223 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue'
|
||||||
import {
|
import {
|
||||||
runCmd, readConfig, writeConfig, updateConfig,
|
runCmd,
|
||||||
CONFIG_FILE, BACKUP_CONFIG_FILE, PID_FILE, FLAG_FILE,
|
readConfig,
|
||||||
DEFAULT_NOW_BRI_FILE, DEFAULT_SYS_MAX_BRI_FILE,
|
writeConfig,
|
||||||
} from '../utils.js';
|
updateConfig,
|
||||||
|
CONFIG_FILE,
|
||||||
|
BACKUP_CONFIG_FILE,
|
||||||
|
PID_FILE,
|
||||||
|
FLAG_FILE,
|
||||||
|
DEFAULT_NOW_BRI_FILE,
|
||||||
|
DEFAULT_SYS_MAX_BRI_FILE,
|
||||||
|
} from '../utils.js'
|
||||||
|
|
||||||
export function useConfig() {
|
export function useConfig() {
|
||||||
// 亮度配置
|
// 亮度配置
|
||||||
const uiMaxBri = ref('');
|
const uiMaxBri = ref('')
|
||||||
const maxBri = ref('');
|
const maxBri = ref('')
|
||||||
const stepsNum = ref('50');
|
const stepsNum = ref('50')
|
||||||
const logMaxSize = ref('500');
|
const logMaxSize = ref('500')
|
||||||
|
|
||||||
// 执行策略
|
// 执行策略
|
||||||
const autoBriSleep = ref(false);
|
const autoBriSleep = ref(false)
|
||||||
const displayHdrSleep = ref(false);
|
const displayHdrSleep = ref(false)
|
||||||
const sleepMode = ref(false);
|
const sleepMode = ref(false)
|
||||||
const sleepStartH = ref('19');
|
const sleepStartH = ref('19')
|
||||||
const sleepStartM = ref('00');
|
const sleepStartM = ref('00')
|
||||||
const sleepEndH = ref('06');
|
const sleepEndH = ref('06')
|
||||||
const sleepEndM = ref('00');
|
const sleepEndM = ref('00')
|
||||||
|
|
||||||
// 高级设置
|
// 高级设置
|
||||||
const nowBriFile = ref(DEFAULT_NOW_BRI_FILE);
|
const nowBriFile = ref(DEFAULT_NOW_BRI_FILE)
|
||||||
const sysMaxBriFile = ref(DEFAULT_SYS_MAX_BRI_FILE);
|
const sysMaxBriFile = ref(DEFAULT_SYS_MAX_BRI_FILE)
|
||||||
const inotifyEvents = ref('c');
|
const inotifyEvents = ref('c')
|
||||||
|
|
||||||
// Web UI 配置 (localStorage 持久化)
|
// Web UI 配置 (localStorage 持久化)
|
||||||
const autoRefresh = ref(localStorage.getItem('autoRefresh') !== 'false');
|
const autoRefresh = ref(localStorage.getItem('autoRefresh') !== 'false')
|
||||||
const statusRefreshInterval = ref(
|
const statusRefreshInterval = ref(
|
||||||
Math.max(100, parseInt(localStorage.getItem('statusLogRefreshInterval') || '1000', 10))
|
Math.max(100, parseInt(localStorage.getItem('statusLogRefreshInterval') || '1000', 10)),
|
||||||
);
|
)
|
||||||
const uiZoom = ref(
|
const uiZoom = ref(
|
||||||
Math.min(150, Math.max(50, parseInt(localStorage.getItem('uiZoom') || '100', 10)))
|
Math.min(150, Math.max(50, parseInt(localStorage.getItem('uiZoom') || '100', 10))),
|
||||||
);
|
)
|
||||||
const themeMode = ref(localStorage.getItem('themeMode') || 'system');
|
const themeMode = ref(localStorage.getItem('themeMode') || 'system')
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
const cfg = await readConfig();
|
const cfg = await readConfig()
|
||||||
if (!cfg || Object.keys(cfg).length === 0) return;
|
if (!cfg || Object.keys(cfg).length === 0) return
|
||||||
|
|
||||||
uiMaxBri.value = cfg.ui_max_bri != null ? String(cfg.ui_max_bri) : '';
|
uiMaxBri.value = cfg.ui_max_bri != null ? String(cfg.ui_max_bri) : ''
|
||||||
maxBri.value = cfg.max_bri != null ? String(cfg.max_bri) : '';
|
maxBri.value = cfg.max_bri != null ? String(cfg.max_bri) : ''
|
||||||
stepsNum.value = cfg.steps_num != null ? String(cfg.steps_num) : '50';
|
stepsNum.value = cfg.steps_num != null ? String(cfg.steps_num) : '50'
|
||||||
logMaxSize.value = cfg.log_max_size != null ? String(cfg.log_max_size) : '500';
|
logMaxSize.value = cfg.log_max_size != null ? String(cfg.log_max_size) : '500'
|
||||||
autoBriSleep.value = cfg.auto_bri_sleep === 1;
|
autoBriSleep.value = cfg.auto_bri_sleep === 1
|
||||||
displayHdrSleep.value = cfg.display_hdr_sleep === 1;
|
displayHdrSleep.value = cfg.display_hdr_sleep === 1
|
||||||
nowBriFile.value = cfg.now_bri_file || DEFAULT_NOW_BRI_FILE;
|
nowBriFile.value = cfg.now_bri_file || DEFAULT_NOW_BRI_FILE
|
||||||
sysMaxBriFile.value = cfg.max_bri_file || DEFAULT_SYS_MAX_BRI_FILE;
|
sysMaxBriFile.value = cfg.max_bri_file || DEFAULT_SYS_MAX_BRI_FILE
|
||||||
inotifyEvents.value = cfg.inotify_events || 'c';
|
inotifyEvents.value = cfg.inotify_events || 'c'
|
||||||
|
|
||||||
const st = cfg.sleep_time || '';
|
const st = cfg.sleep_time || ''
|
||||||
if (st && st.includes('-')) {
|
if (st && st.includes('-')) {
|
||||||
sleepMode.value = true;
|
sleepMode.value = true
|
||||||
const [s, e] = st.split('-');
|
const [s, e] = st.split('-')
|
||||||
if (s.length === 4) { sleepStartH.value = s.slice(0, 2); sleepStartM.value = s.slice(2); }
|
if (s.length === 4) {
|
||||||
if (e.length === 4) { sleepEndH.value = e.slice(0, 2); sleepEndM.value = e.slice(2); }
|
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 {
|
} else {
|
||||||
sleepMode.value = false;
|
sleepMode.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSleepTimeStr() {
|
function getSleepTimeStr() {
|
||||||
if (!sleepMode.value) return '';
|
if (!sleepMode.value) return ''
|
||||||
const pad = v => String(v).padStart(2, '0');
|
const pad = (v) => String(v).padStart(2, '0')
|
||||||
return `${pad(sleepStartH.value)}${pad(sleepStartM.value)}-${pad(sleepEndH.value)}${pad(sleepEndM.value)}`;
|
return `${pad(sleepStartH.value)}${pad(sleepStartM.value)}-${pad(sleepEndH.value)}${pad(sleepEndM.value)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
async function save(toast) {
|
async function save(toast) {
|
||||||
if (!uiMaxBri.value || !maxBri.value) { toast('亮度値不能为空'); return; }
|
if (!uiMaxBri.value || !maxBri.value) {
|
||||||
toast('保存中...');
|
toast('亮度値不能为空')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
toast('保存中...')
|
||||||
// 读取当前配置(保留 blacklist_apps 等其他字段)
|
// 读取当前配置(保留 blacklist_apps 等其他字段)
|
||||||
const current = await readConfig();
|
const current = await readConfig()
|
||||||
await writeConfig({
|
await writeConfig({
|
||||||
...current,
|
...current,
|
||||||
ui_max_bri: parseInt(uiMaxBri.value) || 0,
|
ui_max_bri: parseInt(uiMaxBri.value) || 0,
|
||||||
max_bri: parseInt(maxBri.value) || 0,
|
max_bri: parseInt(maxBri.value) || 0,
|
||||||
steps_num: parseInt(stepsNum.value) || 50,
|
steps_num: parseInt(stepsNum.value) || 50,
|
||||||
log_max_size: parseInt(logMaxSize.value) || 500,
|
log_max_size: parseInt(logMaxSize.value) || 500,
|
||||||
auto_bri_sleep: autoBriSleep.value ? 1 : 0,
|
auto_bri_sleep: autoBriSleep.value ? 1 : 0,
|
||||||
display_hdr_sleep: displayHdrSleep.value ? 1 : 0,
|
display_hdr_sleep: displayHdrSleep.value ? 1 : 0,
|
||||||
sleep_time: getSleepTimeStr(),
|
sleep_time: getSleepTimeStr(),
|
||||||
});
|
})
|
||||||
await runCmd(`rm -f "${FLAG_FILE}"`);
|
await runCmd(`rm -f "${FLAG_FILE}"`)
|
||||||
const pidRes = await runCmd(`cat "${PID_FILE}"`);
|
const pidRes = await runCmd(`cat "${PID_FILE}"`)
|
||||||
toast(pidRes.errno === 0 && pidRes.stdout.trim() ? '配置已保存 (下次调整时生效)' : '配置已保存 (服务未运行)');
|
toast(
|
||||||
|
pidRes.errno === 0 && pidRes.stdout.trim()
|
||||||
|
? '配置已保存 (下次调整时生效)'
|
||||||
|
: '配置已保存 (服务未运行)',
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveAdvanced(toast, onPathsChanged) {
|
async function saveAdvanced(toast, onPathsChanged) {
|
||||||
toast('保存中...');
|
toast('保存中...')
|
||||||
await updateConfig({
|
await updateConfig({
|
||||||
now_bri_file: nowBriFile.value || DEFAULT_NOW_BRI_FILE,
|
now_bri_file: nowBriFile.value || DEFAULT_NOW_BRI_FILE,
|
||||||
max_bri_file: sysMaxBriFile.value || DEFAULT_SYS_MAX_BRI_FILE,
|
max_bri_file: sysMaxBriFile.value || DEFAULT_SYS_MAX_BRI_FILE,
|
||||||
inotify_events: inotifyEvents.value || 'c',
|
inotify_events: inotifyEvents.value || 'c',
|
||||||
});
|
})
|
||||||
onPathsChanged?.();
|
onPathsChanged?.()
|
||||||
toast('高级设置已保存,需重启服务生效');
|
toast('高级设置已保存,需重启服务生效')
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resetToDefaults(toast) {
|
async function resetToDefaults(toast) {
|
||||||
toast('正在恢复默认配置...');
|
toast('正在恢复默认配置...')
|
||||||
const backupRes = await runCmd(`cat "${BACKUP_CONFIG_FILE}"`);
|
const backupRes = await runCmd(`cat "${BACKUP_CONFIG_FILE}"`)
|
||||||
if (backupRes.errno !== 0 || !backupRes.stdout.trim()) {
|
if (backupRes.errno !== 0 || !backupRes.stdout.trim()) {
|
||||||
toast('备份文件不存在,无法恢复');
|
toast('备份文件不存在,无法恢复')
|
||||||
return;
|
return
|
||||||
|
}
|
||||||
|
let backup
|
||||||
|
try {
|
||||||
|
backup = JSON.parse(backupRes.stdout)
|
||||||
|
} catch {
|
||||||
|
toast('备份文件损坏')
|
||||||
|
return
|
||||||
}
|
}
|
||||||
let backup;
|
|
||||||
try { backup = JSON.parse(backupRes.stdout); } catch { toast('备份文件损坏'); return; }
|
|
||||||
|
|
||||||
uiMaxBri.value = backup.ui_max_bri != null ? String(backup.ui_max_bri) : '';
|
uiMaxBri.value = backup.ui_max_bri != null ? String(backup.ui_max_bri) : ''
|
||||||
maxBri.value = backup.max_bri != null ? String(backup.max_bri) : '';
|
maxBri.value = backup.max_bri != null ? String(backup.max_bri) : ''
|
||||||
autoBriSleep.value = backup.auto_bri_sleep === 1;
|
autoBriSleep.value = backup.auto_bri_sleep === 1
|
||||||
displayHdrSleep.value = backup.display_hdr_sleep === 1;
|
displayHdrSleep.value = backup.display_hdr_sleep === 1
|
||||||
stepsNum.value = backup.steps_num != null ? String(backup.steps_num) : '50';
|
stepsNum.value = backup.steps_num != null ? String(backup.steps_num) : '50'
|
||||||
logMaxSize.value = backup.log_max_size != null ? String(backup.log_max_size) : '500';
|
logMaxSize.value = backup.log_max_size != null ? String(backup.log_max_size) : '500'
|
||||||
nowBriFile.value = backup.now_bri_file || DEFAULT_NOW_BRI_FILE;
|
nowBriFile.value = backup.now_bri_file || DEFAULT_NOW_BRI_FILE
|
||||||
sysMaxBriFile.value = backup.max_bri_file || DEFAULT_SYS_MAX_BRI_FILE;
|
sysMaxBriFile.value = backup.max_bri_file || DEFAULT_SYS_MAX_BRI_FILE
|
||||||
inotifyEvents.value = backup.inotify_events || 'c';
|
inotifyEvents.value = backup.inotify_events || 'c'
|
||||||
|
|
||||||
const st = backup.sleep_time || '';
|
const st = backup.sleep_time || ''
|
||||||
if (st && st.includes('-')) {
|
if (st && st.includes('-')) {
|
||||||
sleepMode.value = true;
|
sleepMode.value = true
|
||||||
const [s, e] = st.split('-');
|
const [s, e] = st.split('-')
|
||||||
if (s.length === 4) { sleepStartH.value = s.slice(0, 2); sleepStartM.value = s.slice(2); }
|
if (s.length === 4) {
|
||||||
if (e.length === 4) { sleepEndH.value = e.slice(0, 2); sleepEndM.value = e.slice(2); }
|
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 {
|
} else {
|
||||||
sleepMode.value = true;
|
sleepMode.value = true
|
||||||
sleepStartH.value = '19'; sleepStartM.value = '00';
|
sleepStartH.value = '19'
|
||||||
sleepEndH.value = '06'; sleepEndM.value = '00';
|
sleepStartM.value = '00'
|
||||||
|
sleepEndH.value = '06'
|
||||||
|
sleepEndM.value = '00'
|
||||||
}
|
}
|
||||||
await save(toast);
|
await save(toast)
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveWebUIConfig(toast, newAutoRefresh, newInterval, newZoom, newTheme, onRestart) {
|
function saveWebUIConfig(toast, newAutoRefresh, newInterval, newZoom, newTheme, onRestart) {
|
||||||
const interval = Math.max(100, parseInt(newInterval, 10) || 1000);
|
const interval = Math.max(100, parseInt(newInterval, 10) || 1000)
|
||||||
const zoom = Math.min(150, Math.max(50, parseInt(newZoom, 10) || 100));
|
const zoom = Math.min(150, Math.max(50, parseInt(newZoom, 10) || 100))
|
||||||
localStorage.setItem('autoRefresh', newAutoRefresh);
|
localStorage.setItem('autoRefresh', newAutoRefresh)
|
||||||
localStorage.setItem('statusLogRefreshInterval', interval);
|
localStorage.setItem('statusLogRefreshInterval', interval)
|
||||||
localStorage.setItem('uiZoom', zoom);
|
localStorage.setItem('uiZoom', zoom)
|
||||||
localStorage.setItem('themeMode', newTheme);
|
localStorage.setItem('themeMode', newTheme)
|
||||||
autoRefresh.value = newAutoRefresh;
|
autoRefresh.value = newAutoRefresh
|
||||||
statusRefreshInterval.value = interval;
|
statusRefreshInterval.value = interval
|
||||||
uiZoom.value = zoom;
|
uiZoom.value = zoom
|
||||||
themeMode.value = newTheme;
|
themeMode.value = newTheme
|
||||||
document.documentElement.style.zoom = zoom / 100;
|
document.documentElement.style.zoom = zoom / 100
|
||||||
applyTheme(newTheme);
|
applyTheme(newTheme)
|
||||||
onRestart?.(newAutoRefresh, interval);
|
onRestart?.(newAutoRefresh, interval)
|
||||||
toast('Web UI 配置已保存');
|
toast('Web UI 配置已保存')
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyZoom() {
|
function applyZoom() {
|
||||||
document.documentElement.style.zoom = uiZoom.value / 100;
|
document.documentElement.style.zoom = uiZoom.value / 100
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyTheme(mode) {
|
function applyTheme(mode) {
|
||||||
const html = document.documentElement;
|
const html = document.documentElement
|
||||||
html.classList.remove('light', 'dark');
|
html.classList.remove('light', 'dark')
|
||||||
if (mode === 'light') html.classList.add('light');
|
if (mode === 'light') html.classList.add('light')
|
||||||
else if (mode === 'dark') html.classList.add('dark');
|
else if (mode === 'dark') html.classList.add('dark')
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
uiMaxBri, maxBri, stepsNum, logMaxSize,
|
uiMaxBri,
|
||||||
autoBriSleep, displayHdrSleep,
|
maxBri,
|
||||||
sleepMode, sleepStartH, sleepStartM, sleepEndH, sleepEndM,
|
stepsNum,
|
||||||
nowBriFile, sysMaxBriFile, inotifyEvents,
|
logMaxSize,
|
||||||
autoRefresh, statusRefreshInterval, uiZoom, themeMode,
|
autoBriSleep,
|
||||||
load, save, saveAdvanced, resetToDefaults,
|
displayHdrSleep,
|
||||||
saveWebUIConfig, applyZoom, applyTheme,
|
sleepMode,
|
||||||
};
|
sleepStartH,
|
||||||
|
sleepStartM,
|
||||||
|
sleepEndH,
|
||||||
|
sleepEndM,
|
||||||
|
nowBriFile,
|
||||||
|
sysMaxBriFile,
|
||||||
|
inotifyEvents,
|
||||||
|
autoRefresh,
|
||||||
|
statusRefreshInterval,
|
||||||
|
uiZoom,
|
||||||
|
themeMode,
|
||||||
|
load,
|
||||||
|
save,
|
||||||
|
saveAdvanced,
|
||||||
|
resetToDefaults,
|
||||||
|
saveWebUIConfig,
|
||||||
|
applyZoom,
|
||||||
|
applyTheme,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,49 +1,58 @@
|
|||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue'
|
||||||
import { runCmd, LOG_FILE } from '../utils.js';
|
import { runCmd, LOG_FILE } from '../utils.js'
|
||||||
|
|
||||||
export function useLog() {
|
export function useLog() {
|
||||||
const fullLog = ref('');
|
const fullLog = ref('')
|
||||||
const filterLevel = ref('');
|
const filterLevel = ref('')
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false)
|
||||||
|
|
||||||
const filteredLog = computed(() => {
|
const filteredLog = computed(() => {
|
||||||
if (!fullLog.value) return '暂无日志';
|
if (!fullLog.value) return '暂无日志'
|
||||||
if (!filterLevel.value) return fullLog.value;
|
if (!filterLevel.value) return fullLog.value
|
||||||
const lines = fullLog.value.split('\n').filter(l => l.includes(`[${filterLevel.value}]`));
|
const lines = fullLog.value.split('\n').filter((l) => l.includes(`[${filterLevel.value}]`))
|
||||||
return lines.length > 0 ? lines.join('\n') : `暂无 [${filterLevel.value}] 等级的日志`;
|
return lines.length > 0 ? lines.join('\n') : `暂无 [${filterLevel.value}] 等级的日志`
|
||||||
});
|
})
|
||||||
|
|
||||||
async function load() {
|
async function load() {
|
||||||
const res = await runCmd(`tail -n 100 "${LOG_FILE}"`);
|
const res = await runCmd(`tail -n 100 "${LOG_FILE}"`)
|
||||||
fullLog.value = res.errno === 0 ? (res.stdout.trim() || '暂无日志') : '无法读取日志 (可能模块尚未产生日志文件)';
|
fullLog.value =
|
||||||
|
res.errno === 0 ? res.stdout.trim() || '暂无日志' : '无法读取日志 (可能模块尚未产生日志文件)'
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clear(toast) {
|
async function clear(toast) {
|
||||||
toast('正在清空日志...');
|
toast('正在清空日志...')
|
||||||
const res = await runCmd(`> "${LOG_FILE}"`);
|
const res = await runCmd(`> "${LOG_FILE}"`)
|
||||||
if (res.errno === 0) { fullLog.value = ''; toast('日志已清空'); }
|
if (res.errno === 0) {
|
||||||
else toast('清空失败: ' + (res.stderr || '未知错误'));
|
fullLog.value = ''
|
||||||
|
toast('日志已清空')
|
||||||
|
} else toast('清空失败: ' + (res.stderr || '未知错误'))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function copy(toast) {
|
async function copy(toast) {
|
||||||
const res = await runCmd(`tail -n 50 "${LOG_FILE}"`);
|
const res = await runCmd(`tail -n 50 "${LOG_FILE}"`)
|
||||||
if (res.errno !== 0 || !res.stdout.trim()) { toast('暂无日志内容'); return; }
|
if (res.errno !== 0 || !res.stdout.trim()) {
|
||||||
try {
|
toast('暂无日志内容')
|
||||||
await navigator.clipboard.writeText(res.stdout.trim());
|
return
|
||||||
} 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 条日志');
|
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) {
|
async function exportLog(toast) {
|
||||||
toast('正在导出...');
|
toast('正在导出...')
|
||||||
const res = await runCmd(`cp "${LOG_FILE}" "/sdcard/LuminPro_$(date '+%Y%m%d_%H%M%S').log"`);
|
const res = await runCmd(`cp "${LOG_FILE}" "/sdcard/LuminPro_$(date '+%Y%m%d_%H%M%S').log"`)
|
||||||
toast(res.errno === 0 ? '日志已导出到 /sdcard' : '导出失败: ' + (res.stderr || '未知错误'));
|
toast(res.errno === 0 ? '日志已导出到 /sdcard' : '导出失败: ' + (res.stderr || '未知错误'))
|
||||||
}
|
}
|
||||||
|
|
||||||
return { fullLog, filterLevel, filteredLog, isLoading, load, clear, copy, exportLog };
|
return { fullLog, filterLevel, filteredLog, isLoading, load, clear, copy, exportLog }
|
||||||
}
|
}
|
||||||
@@ -1,152 +1,169 @@
|
|||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue'
|
||||||
import {
|
import {
|
||||||
runCmd, readConfig,
|
runCmd,
|
||||||
PID_FILE, STOP_FLAG_FILE,
|
readConfig,
|
||||||
DEFAULT_NOW_BRI_FILE, DEFAULT_SYS_MAX_BRI_FILE,
|
PID_FILE,
|
||||||
} from '../utils.js';
|
STOP_FLAG_FILE,
|
||||||
|
DEFAULT_NOW_BRI_FILE,
|
||||||
|
DEFAULT_SYS_MAX_BRI_FILE,
|
||||||
|
} from '../utils.js'
|
||||||
|
|
||||||
export function useStatus() {
|
export function useStatus() {
|
||||||
// 亮度
|
// 亮度
|
||||||
const currentBri = ref(null);
|
const currentBri = ref(null)
|
||||||
const sysMaxBri = ref(null);
|
const sysMaxBri = ref(null)
|
||||||
|
|
||||||
// 服务状态
|
// 服务状态
|
||||||
const inotifydPid = ref('—');
|
const inotifydPid = ref('—')
|
||||||
const inotifydState = ref('—');
|
const inotifydState = ref('—')
|
||||||
const isRunning = ref(false);
|
const isRunning = ref(false)
|
||||||
const isPaused = ref(false);
|
const isPaused = ref(false)
|
||||||
const statusClass = computed(() => {
|
const statusClass = computed(() => {
|
||||||
if (isPaused.value) return 'status-paused';
|
if (isPaused.value) return 'status-paused'
|
||||||
if (isRunning.value) return 'status-running';
|
if (isRunning.value) return 'status-running'
|
||||||
return 'status-loading';
|
return 'status-loading'
|
||||||
});
|
})
|
||||||
const statusText = computed(() => {
|
const statusText = computed(() => {
|
||||||
if (isPaused.value) return '已暂停';
|
if (isPaused.value) return '已暂停'
|
||||||
if (isRunning.value) return '运行中';
|
if (isRunning.value) return '运行中'
|
||||||
return '未运行';
|
return '未运行'
|
||||||
});
|
})
|
||||||
|
|
||||||
// HDR / 睡眠状态
|
// HDR / 睡眠状态
|
||||||
const hdrRatio = ref('—');
|
const hdrRatio = ref('—')
|
||||||
const sleepStatus = ref('—');
|
const sleepStatus = ref('—')
|
||||||
|
|
||||||
// 自动亮度
|
// 自动亮度
|
||||||
const autoBriMode = ref(false);
|
const autoBriMode = ref(false)
|
||||||
|
|
||||||
// 缓存配置字段(避免每次刷新都 readConfig)
|
// 缓存配置字段(避免每次刷新都 readConfig)
|
||||||
let _nowBriFile = null;
|
let _nowBriFile = null
|
||||||
let _sysMaxBriFile = null;
|
let _sysMaxBriFile = null
|
||||||
let _sleepTime = null;
|
let _sleepTime = null
|
||||||
|
|
||||||
async function _ensurePaths() {
|
async function _ensurePaths() {
|
||||||
if (_nowBriFile && _sysMaxBriFile) return;
|
if (_nowBriFile && _sysMaxBriFile) return
|
||||||
const cfg = await readConfig();
|
const cfg = await readConfig()
|
||||||
_nowBriFile = cfg.now_bri_file || DEFAULT_NOW_BRI_FILE;
|
_nowBriFile = cfg.now_bri_file || DEFAULT_NOW_BRI_FILE
|
||||||
_sysMaxBriFile = cfg.max_bri_file || DEFAULT_SYS_MAX_BRI_FILE;
|
_sysMaxBriFile = cfg.max_bri_file || DEFAULT_SYS_MAX_BRI_FILE
|
||||||
_sleepTime = cfg.sleep_time || '';
|
_sleepTime = cfg.sleep_time || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
function invalidatePaths() {
|
function invalidatePaths() {
|
||||||
_nowBriFile = null;
|
_nowBriFile = null
|
||||||
_sysMaxBriFile = null;
|
_sysMaxBriFile = null
|
||||||
_sleepTime = null;
|
_sleepTime = null
|
||||||
}
|
}
|
||||||
|
|
||||||
async function load(forceFull = false) {
|
async function load(forceFull = false) {
|
||||||
await _ensurePaths();
|
await _ensurePaths()
|
||||||
|
|
||||||
const needBri = forceFull || currentBri.value === null || sysMaxBri.value === null;
|
const needBri = forceFull || currentBri.value === null || sysMaxBri.value === null
|
||||||
|
|
||||||
// 所有 Shell 命令一次并发,消除多轮顺序等待
|
// 所有 Shell 命令一次并发,消除多轮顺序等待
|
||||||
// PID + 进程状态合并为一条命令以减少 exec 次数
|
// PID + 进程状态合并为一条命令以减少 exec 次数
|
||||||
const [pidStateRes, stopRes, autoBriRes, hdrRes, cBriRes, sBriRes] = await Promise.all([
|
const [pidStateRes, stopRes, autoBriRes, hdrRes, cBriRes, sBriRes] = await Promise.all([
|
||||||
runCmd(`PID=$(cat "${PID_FILE}" 2>/dev/null || true); printf '%s\\n' "$PID"; [ -n "$PID" ] && grep '^State:' "/proc/$PID/status" 2>/dev/null | awk '{print $2}' || true`),
|
runCmd(
|
||||||
|
`PID=$(cat "${PID_FILE}" 2>/dev/null || true); printf '%s\\n' "$PID"; [ -n "$PID" ] && grep '^State:' "/proc/$PID/status" 2>/dev/null | awk '{print $2}' || true`,
|
||||||
|
),
|
||||||
runCmd(`[ -f "${STOP_FLAG_FILE}" ] && echo "1" || echo "0"`),
|
runCmd(`[ -f "${STOP_FLAG_FILE}" ] && echo "1" || echo "0"`),
|
||||||
runCmd(`settings get system screen_brightness_mode`),
|
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(
|
||||||
needBri ? runCmd(`cat "${_nowBriFile}"`) : Promise.resolve({ errno: -1, stdout: '' }),
|
`dumpsys display 2>/dev/null | sed -n 's/.*hdrSdrRatio \\([0-9.]*\\).*/\\1/p' | head -n 1`,
|
||||||
|
),
|
||||||
|
needBri ? runCmd(`cat "${_nowBriFile}"`) : Promise.resolve({ errno: -1, stdout: '' }),
|
||||||
needBri ? runCmd(`cat "${_sysMaxBriFile}"`) : Promise.resolve({ errno: -1, stdout: '' }),
|
needBri ? runCmd(`cat "${_sysMaxBriFile}"`) : Promise.resolve({ errno: -1, stdout: '' }),
|
||||||
]);
|
])
|
||||||
|
|
||||||
if (needBri) {
|
if (needBri) {
|
||||||
currentBri.value = cBriRes.errno === 0 ? cBriRes.stdout.trim() : '0';
|
currentBri.value = cBriRes.errno === 0 ? cBriRes.stdout.trim() : '0'
|
||||||
sysMaxBri.value = sBriRes.errno === 0 ? sBriRes.stdout.trim() : '255';
|
sysMaxBri.value = sBriRes.errno === 0 ? sBriRes.stdout.trim() : '255'
|
||||||
}
|
}
|
||||||
|
|
||||||
const psLines = (pidStateRes.errno === 0 ? pidStateRes.stdout : '').split('\n');
|
const psLines = (pidStateRes.errno === 0 ? pidStateRes.stdout : '').split('\n')
|
||||||
const pidStr = psLines[0]?.trim() || '';
|
const pidStr = psLines[0]?.trim() || ''
|
||||||
const stateChar = psLines[1]?.trim() || '';
|
const stateChar = psLines[1]?.trim() || ''
|
||||||
|
|
||||||
isPaused.value = stopRes.errno === 0 && stopRes.stdout.trim() === '1';
|
isPaused.value = stopRes.errno === 0 && stopRes.stdout.trim() === '1'
|
||||||
isRunning.value = !isPaused.value && !!pidStr;
|
isRunning.value = !isPaused.value && !!pidStr
|
||||||
inotifydPid.value = pidStr || '离线';
|
inotifydPid.value = pidStr || '离线'
|
||||||
inotifydState.value = isRunning.value ? (stateChar || '已退出') : '离线';
|
inotifydState.value = isRunning.value ? stateChar || '已退出' : '离线'
|
||||||
|
|
||||||
autoBriMode.value = autoBriRes.errno === 0 && parseInt(autoBriRes.stdout.trim(), 10) === 1;
|
autoBriMode.value = autoBriRes.errno === 0 && parseInt(autoBriRes.stdout.trim(), 10) === 1
|
||||||
|
|
||||||
const hdrRaw = hdrRes.errno === 0 ? hdrRes.stdout.trim() : '';
|
const hdrRaw = hdrRes.errno === 0 ? hdrRes.stdout.trim() : ''
|
||||||
hdrRatio.value = (hdrRaw && /^\d+(\.\d+)?$/.test(hdrRaw)) ? parseFloat(hdrRaw).toFixed(2) : '-';
|
hdrRatio.value = hdrRaw && /^\d+(\.\d+)?$/.test(hdrRaw) ? parseFloat(hdrRaw).toFixed(2) : '-'
|
||||||
|
|
||||||
sleepStatus.value = _calcSleep(_sleepTime);
|
sleepStatus.value = _calcSleep(_sleepTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
function _calcSleep(sleepTime) {
|
function _calcSleep(sleepTime) {
|
||||||
if (!sleepTime || !sleepTime.includes('-')) return '非休眠';
|
if (!sleepTime || !sleepTime.includes('-')) return '非休眠'
|
||||||
const [s, e] = sleepTime.split('-');
|
const [s, e] = sleepTime.split('-')
|
||||||
if (s.length !== 4 || e.length !== 4) return '非休眠';
|
if (s.length !== 4 || e.length !== 4) return '非休眠'
|
||||||
const now = new Date();
|
const now = new Date()
|
||||||
const nV = now.getHours() * 100 + now.getMinutes();
|
const nV = now.getHours() * 100 + now.getMinutes()
|
||||||
const sNum = parseInt(s.slice(0, 2), 10) * 100 + parseInt(s.slice(2), 10);
|
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);
|
const eNum = parseInt(e.slice(0, 2), 10) * 100 + parseInt(e.slice(2), 10)
|
||||||
if (sNum > eNum) {
|
if (sNum > eNum) {
|
||||||
return (nV >= sNum || nV < eNum) ? '休眠中' : '非休眠';
|
return nV >= sNum || nV < eNum ? '休眠中' : '非休眠'
|
||||||
}
|
}
|
||||||
return (nV >= sNum && nV < eNum) ? '休眠中' : '非休眠';
|
return nV >= sNum && nV < eNum ? '休眠中' : '非休眠'
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleService(toast) {
|
async function toggleService(toast) {
|
||||||
const res = await runCmd(`sh /data/adb/modules/LuminPro/action.sh`);
|
const res = await runCmd(`sh /data/adb/modules/LuminPro/action.sh`)
|
||||||
toast(res.errno === 0 ? (res.stdout.trim() || '状态已切换') : ('操作失败: ' + res.stderr));
|
toast(res.errno === 0 ? res.stdout.trim() || '状态已切换' : '操作失败: ' + res.stderr)
|
||||||
await load(true);
|
await load(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function restartService(toast) {
|
async function restartService(toast) {
|
||||||
toast('正在重启服务...');
|
toast('正在重启服务...')
|
||||||
const res = await runCmd(`sh /data/adb/modules/LuminPro/script/restart.sh`);
|
const res = await runCmd(`sh /data/adb/modules/LuminPro/script/restart.sh`)
|
||||||
setTimeout(async () => { await load(true); }, 1000);
|
setTimeout(async () => {
|
||||||
toast(res.errno === 0 ? '服务已成功重启' : ('重启失败: ' + res.stderr));
|
await load(true)
|
||||||
|
}, 1000)
|
||||||
|
toast(res.errno === 0 ? '服务已成功重启' : '重启失败: ' + res.stderr)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setBrightness(newBri, toast) {
|
async function setBrightness(newBri, toast) {
|
||||||
currentBri.value = String(newBri);
|
currentBri.value = String(newBri)
|
||||||
const cmd = `echo -n '${newBri}' > '${_nowBriFile}' 2>/dev/null && echo 'OK'`;
|
const cmd = `echo -n '${newBri}' > '${_nowBriFile}' 2>/dev/null && echo 'OK'`
|
||||||
const res = await runCmd(cmd);
|
const res = await runCmd(cmd)
|
||||||
if (!(res.errno === 0 && res.stdout.includes('OK'))) {
|
if (!(res.errno === 0 && res.stdout.includes('OK'))) {
|
||||||
toast('亮度设置失败,已恢复');
|
toast('亮度设置失败,已恢复')
|
||||||
await load(true);
|
await load(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setAutoBrightness(enabled, toast) {
|
async function setAutoBrightness(enabled, toast) {
|
||||||
const mode = enabled ? 1 : 0;
|
const mode = enabled ? 1 : 0
|
||||||
const res = await runCmd(`settings put system screen_brightness_mode ${mode}`);
|
const res = await runCmd(`settings put system screen_brightness_mode ${mode}`)
|
||||||
if (res.errno === 0) {
|
if (res.errno === 0) {
|
||||||
autoBriMode.value = enabled;
|
autoBriMode.value = enabled
|
||||||
toast(enabled ? '自动亮度已启用' : '手动亮度已启用');
|
toast(enabled ? '自动亮度已启用' : '手动亮度已启用')
|
||||||
} else {
|
} else {
|
||||||
toast('设置失败: ' + (res.stderr || '未知错误'));
|
toast('设置失败: ' + (res.stderr || '未知错误'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentBri, sysMaxBri,
|
currentBri,
|
||||||
inotifydPid, inotifydState,
|
sysMaxBri,
|
||||||
isRunning, isPaused,
|
inotifydPid,
|
||||||
statusClass, statusText,
|
inotifydState,
|
||||||
hdrRatio, sleepStatus,
|
isRunning,
|
||||||
|
isPaused,
|
||||||
|
statusClass,
|
||||||
|
statusText,
|
||||||
|
hdrRatio,
|
||||||
|
sleepStatus,
|
||||||
autoBriMode,
|
autoBriMode,
|
||||||
load, invalidatePaths,
|
load,
|
||||||
toggleService, restartService,
|
invalidatePaths,
|
||||||
setBrightness, setAutoBrightness,
|
toggleService,
|
||||||
};
|
restartService,
|
||||||
|
setBrightness,
|
||||||
|
setAutoBrightness,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,11 @@
|
|||||||
|
|
||||||
.header-icon {
|
.header-icon {
|
||||||
font-size: 2.5rem;
|
font-size: 2.5rem;
|
||||||
background: linear-gradient(135deg, var(--md-sys-color-primary-container), var(--md-sys-color-secondary-container));
|
background: linear-gradient(
|
||||||
|
135deg,
|
||||||
|
var(--md-sys-color-primary-container),
|
||||||
|
var(--md-sys-color-secondary-container)
|
||||||
|
);
|
||||||
width: 56px;
|
width: 56px;
|
||||||
height: 56px;
|
height: 56px;
|
||||||
border-radius: 12px;
|
border-radius: 12px;
|
||||||
@@ -110,7 +114,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes status-pulse {
|
@keyframes status-pulse {
|
||||||
0%, 100% {
|
0%,
|
||||||
|
100% {
|
||||||
box-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
|
box-shadow: 0 0 8px rgba(244, 67, 54, 0.5);
|
||||||
}
|
}
|
||||||
50% {
|
50% {
|
||||||
@@ -119,7 +124,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@keyframes status-pulse-green {
|
@keyframes status-pulse-green {
|
||||||
0%, 100% {
|
0%,
|
||||||
|
100% {
|
||||||
box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
|
box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
|
||||||
}
|
}
|
||||||
50% {
|
50% {
|
||||||
@@ -137,4 +143,3 @@
|
|||||||
.header-status.status-loading .status-dot {
|
.header-status.status-loading .status-dot {
|
||||||
animation: status-pulse 2s infinite;
|
animation: status-pulse 2s infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
+4
-3
@@ -1,5 +1,5 @@
|
|||||||
@import "tailwindcss";
|
@import 'tailwindcss';
|
||||||
@import "tw-animate-css";
|
@import 'tw-animate-css';
|
||||||
|
|
||||||
@custom-variant dark (&:is(.dark *));
|
@custom-variant dark (&:is(.dark *));
|
||||||
|
|
||||||
@@ -33,7 +33,8 @@
|
|||||||
/* ===============================
|
/* ===============================
|
||||||
Shadcn 主题 Token (暗色, MD3 调色板)
|
Shadcn 主题 Token (暗色, MD3 调色板)
|
||||||
=============================== */
|
=============================== */
|
||||||
:root, :root.dark {
|
:root,
|
||||||
|
:root.dark {
|
||||||
--radius: 0.75rem;
|
--radius: 0.75rem;
|
||||||
|
|
||||||
/* Shadcn tokens */
|
/* Shadcn tokens */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { clsx } from 'clsx';
|
import { clsx } from 'clsx'
|
||||||
import { twMerge } from 'tailwind-merge';
|
import { twMerge } from 'tailwind-merge'
|
||||||
|
|
||||||
export function cn(...inputs) {
|
export function cn(...inputs) {
|
||||||
return twMerge(clsx(inputs));
|
return twMerge(clsx(inputs))
|
||||||
}
|
}
|
||||||
+23
-15
@@ -60,8 +60,9 @@
|
|||||||
z-index: 998;
|
z-index: 998;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
/* 基础暗色背景,增强状态栏文字可读性 */
|
/* 基础暗色背景,增强状态栏文字可读性 */
|
||||||
background: linear-gradient(to bottom,
|
background: linear-gradient(
|
||||||
rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0.85) 0%,
|
to bottom,
|
||||||
|
rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0.85) 0%,
|
||||||
rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0.4) 40%,
|
rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0.4) 40%,
|
||||||
rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0) 100%
|
rgba(var(--md-sys-color-background-rgb, 17, 19, 24), 0) 100%
|
||||||
);
|
);
|
||||||
@@ -69,17 +70,19 @@
|
|||||||
-webkit-backdrop-filter: blur(16px);
|
-webkit-backdrop-filter: blur(16px);
|
||||||
backdrop-filter: blur(16px);
|
backdrop-filter: blur(16px);
|
||||||
/* 梯度蒙版:越往上越模糊的核心逻辑 */
|
/* 梯度蒙版:越往上越模糊的核心逻辑 */
|
||||||
-webkit-mask-image: linear-gradient(to bottom,
|
-webkit-mask-image: linear-gradient(
|
||||||
rgba(0,0,0,1) 0%,
|
to bottom,
|
||||||
rgba(0,0,0,1) 30%,
|
rgba(0, 0, 0, 1) 0%,
|
||||||
rgba(0,0,0,0.7) 60%,
|
rgba(0, 0, 0, 1) 30%,
|
||||||
rgba(0,0,0,0) 100%
|
rgba(0, 0, 0, 0.7) 60%,
|
||||||
|
rgba(0, 0, 0, 0) 100%
|
||||||
);
|
);
|
||||||
mask-image: linear-gradient(to bottom,
|
mask-image: linear-gradient(
|
||||||
rgba(0,0,0,1) 0%,
|
to bottom,
|
||||||
rgba(0,0,0,1) 30%,
|
rgba(0, 0, 0, 1) 0%,
|
||||||
rgba(0,0,0,0.7) 60%,
|
rgba(0, 0, 0, 1) 30%,
|
||||||
rgba(0,0,0,0) 100%
|
rgba(0, 0, 0, 0.7) 60%,
|
||||||
|
rgba(0, 0, 0, 0) 100%
|
||||||
);
|
);
|
||||||
transform: translateZ(0); /* 开启 GPU 加速 */
|
transform: translateZ(0); /* 开启 GPU 加速 */
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@@ -129,7 +132,9 @@
|
|||||||
padding: 8px 16px;
|
padding: 8px 16px;
|
||||||
border-radius: 28px;
|
border-radius: 28px;
|
||||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 8px 32px rgba(0, 0, 0, 0.3);
|
box-shadow:
|
||||||
|
0 4px 12px rgba(0, 0, 0, 0.15),
|
||||||
|
0 8px 32px rgba(0, 0, 0, 0.3);
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
max-width: calc(100% - 32px);
|
max-width: calc(100% - 32px);
|
||||||
@@ -147,7 +152,9 @@
|
|||||||
height: auto;
|
height: auto;
|
||||||
background: var(--md-sys-color-primary-container);
|
background: var(--md-sys-color-primary-container);
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), width 0.3s ease;
|
transition:
|
||||||
|
transform 0.3s cubic-bezier(0.25, 1, 0.5, 1),
|
||||||
|
width 0.3s ease;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
@@ -173,7 +180,8 @@
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-btn i, .navbar-btn svg {
|
.navbar-btn i,
|
||||||
|
.navbar-btn svg {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
+10
-10
@@ -1,11 +1,11 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue'
|
||||||
import App from './App.vue';
|
import App from './App.vue'
|
||||||
import './index.css';
|
import './index.css'
|
||||||
import './style.css';
|
import './style.css'
|
||||||
import './header.css';
|
import './header.css'
|
||||||
import './components.css';
|
import './components.css'
|
||||||
import './about.css';
|
import './about.css'
|
||||||
import './apps.css';
|
import './apps.css'
|
||||||
import './log.css';
|
import './log.css'
|
||||||
|
|
||||||
createApp(App).mount('#app');
|
createApp(App).mount('#app')
|
||||||
+7
-3
@@ -1,4 +1,5 @@
|
|||||||
:root, :root.dark {
|
:root,
|
||||||
|
:root.dark {
|
||||||
--md-sys-color-background: #111318;
|
--md-sys-color-background: #111318;
|
||||||
--md-sys-color-background-rgb: 17, 19, 24;
|
--md-sys-color-background-rgb: 17, 19, 24;
|
||||||
--md-sys-color-on-background: #e2e2e9;
|
--md-sys-color-on-background: #e2e2e9;
|
||||||
@@ -62,7 +63,11 @@ body {
|
|||||||
padding-bottom: var(--safe-area-inset-bottom, 0);
|
padding-bottom: var(--safe-area-inset-bottom, 0);
|
||||||
background-color: var(--md-sys-color-background);
|
background-color: var(--md-sys-color-background);
|
||||||
color: var(--md-sys-color-on-background);
|
color: var(--md-sys-color-on-background);
|
||||||
font-family: 'Geist', system-ui, -apple-system, sans-serif;
|
font-family:
|
||||||
|
'Geist',
|
||||||
|
system-ui,
|
||||||
|
-apple-system,
|
||||||
|
sans-serif;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
scrollbar-width: none; /* Firefox */
|
scrollbar-width: none; /* Firefox */
|
||||||
-ms-overflow-style: none; /* IE/Edge */
|
-ms-overflow-style: none; /* IE/Edge */
|
||||||
@@ -81,4 +86,3 @@ body::-webkit-scrollbar {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: var(--spacing-m);
|
gap: var(--spacing-m);
|
||||||
}
|
}
|
||||||
|
|
||||||
+73
-44
@@ -1,83 +1,112 @@
|
|||||||
import { exec } from 'kernelsu';
|
import { exec } from 'kernelsu'
|
||||||
|
|
||||||
export const MODULE_DIR = '/data/adb/modules/LuminPro';
|
export const MODULE_DIR = '/data/adb/modules/LuminPro'
|
||||||
export const CONFIG_DIR = `${MODULE_DIR}/config`;
|
export const CONFIG_DIR = `${MODULE_DIR}/config`
|
||||||
export const CONFIG_FILE = `${MODULE_DIR}/config/config.json`;
|
export const CONFIG_FILE = `${MODULE_DIR}/config/config.json`
|
||||||
export const BACKUP_CONFIG_FILE = `${MODULE_DIR}/config/.backup/config.json`;
|
export const BACKUP_CONFIG_FILE = `${MODULE_DIR}/config/.backup/config.json`
|
||||||
export const PID_FILE = `${MODULE_DIR}/pid/inotifyd.pid`;
|
export const PID_FILE = `${MODULE_DIR}/pid/inotifyd.pid`
|
||||||
export const FLAG_FILE = `${MODULE_DIR}/pid/up.flag`;
|
export const FLAG_FILE = `${MODULE_DIR}/pid/up.flag`
|
||||||
export const STOP_FLAG_FILE = `${MODULE_DIR}/pid/stop.flag`;
|
export const STOP_FLAG_FILE = `${MODULE_DIR}/pid/stop.flag`
|
||||||
export const LOG_FILE = `${MODULE_DIR}/service.log`;
|
export const LOG_FILE = `${MODULE_DIR}/service.log`
|
||||||
export const DEFAULT_NOW_BRI_FILE = '/sys/class/backlight/panel0-backlight/brightness';
|
export const DEFAULT_NOW_BRI_FILE = '/sys/class/backlight/panel0-backlight/brightness'
|
||||||
export const DEFAULT_SYS_MAX_BRI_FILE = '/sys/class/backlight/panel0-backlight/max_brightness';
|
export const DEFAULT_SYS_MAX_BRI_FILE = '/sys/class/backlight/panel0-backlight/max_brightness'
|
||||||
|
|
||||||
export function showToast(msg) {
|
export function showToast(msg) {
|
||||||
const toast = document.getElementById('toast');
|
const toast = document.getElementById('toast')
|
||||||
toast.textContent = msg;
|
toast.textContent = msg
|
||||||
toast.classList.add('show');
|
toast.classList.add('show')
|
||||||
setTimeout(() => toast.classList.remove('show'), 3000);
|
setTimeout(() => toast.classList.remove('show'), 3000)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function runCmd(cmd) {
|
export async function runCmd(cmd) {
|
||||||
try {
|
try {
|
||||||
const res = await exec(cmd);
|
const res = await exec(cmd)
|
||||||
return res;
|
return res
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(`[DEBUG] 执行命令失败 (可能是非 KSU 环境): ${cmd}`);
|
console.warn(`[DEBUG] 执行命令失败 (可能是非 KSU 环境): ${cmd}`)
|
||||||
|
|
||||||
// JSON 配置模拟
|
// JSON 配置模拟
|
||||||
if (cmd.includes('cat') && cmd.includes('config.json')) {
|
if (cmd.includes('cat') && cmd.includes('config.json')) {
|
||||||
return { errno: 0, stdout: JSON.stringify({
|
return {
|
||||||
ui_max_bri: 4095, max_bri: 3500, steps_num: 100, log_max_size: 1024,
|
errno: 0,
|
||||||
auto_bri_sleep: 1, display_hdr_sleep: 0, sleep_time: '1900-0600',
|
stdout: JSON.stringify({
|
||||||
inotify_events: 'c',
|
ui_max_bri: 4095,
|
||||||
now_bri_file: '/sys/mock/brightness',
|
max_bri: 3500,
|
||||||
max_bri_file: '/sys/mock/max_brightness',
|
steps_num: 100,
|
||||||
blacklist_apps: ['com.example.app'],
|
log_max_size: 1024,
|
||||||
}), stderr: '' };
|
auto_bri_sleep: 1,
|
||||||
|
display_hdr_sleep: 0,
|
||||||
|
sleep_time: '1900-0600',
|
||||||
|
inotify_events: 'c',
|
||||||
|
now_bri_file: '/sys/mock/brightness',
|
||||||
|
max_bri_file: '/sys/mock/max_brightness',
|
||||||
|
blacklist_apps: ['com.example.app'],
|
||||||
|
}),
|
||||||
|
stderr: '',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 状态模拟
|
// 状态模拟
|
||||||
if (cmd.includes('cat') && cmd.includes('inotifyd.pid')) return { errno: 0, stdout: '12345', stderr: '' };
|
if (cmd.includes('cat') && cmd.includes('inotifyd.pid'))
|
||||||
if (cmd.includes('settings get system screen_brightness_mode')) return { errno: 0, stdout: '1', stderr: '' };
|
return { errno: 0, stdout: '12345', stderr: '' }
|
||||||
if (cmd.includes('[ -f') && cmd.includes('stop.flag')) return { errno: 0, stdout: '0', stderr: '' };
|
if (cmd.includes('settings get system screen_brightness_mode'))
|
||||||
if (cmd.includes('cat') && (cmd.includes('brightness') || cmd.includes('now_bri'))) return { errno: 0, stdout: '1200', stderr: '' };
|
return { errno: 0, stdout: '1', stderr: '' }
|
||||||
if (cmd.includes('cat') && (cmd.includes('max_brightness') || cmd.includes('max_bri'))) return { errno: 0, stdout: '4095', stderr: '' };
|
if (cmd.includes('[ -f') && cmd.includes('stop.flag'))
|
||||||
|
return { errno: 0, stdout: '0', stderr: '' }
|
||||||
|
if (cmd.includes('cat') && (cmd.includes('brightness') || cmd.includes('now_bri')))
|
||||||
|
return { errno: 0, stdout: '1200', stderr: '' }
|
||||||
|
if (cmd.includes('cat') && (cmd.includes('max_brightness') || cmd.includes('max_bri')))
|
||||||
|
return { errno: 0, stdout: '4095', stderr: '' }
|
||||||
|
|
||||||
// 日志模拟
|
// 日志模拟
|
||||||
if (cmd.includes('tail') && cmd.includes('service.log')) {
|
if (cmd.includes('tail') && cmd.includes('service.log')) {
|
||||||
return { errno: 0, stdout: '[04-07 15:40:01] [service] [INFO ] LuminPro 服务启动\n[04-07 15:41:05] [up] [INFO ] 触发提升: 当前亮度 1200 ≥ 阈値 1000\n[04-07 15:42:10] [up] [SUCCESS ] 亮度提升完成 (3500)', stderr: '' };
|
return {
|
||||||
|
errno: 0,
|
||||||
|
stdout:
|
||||||
|
'[04-07 15:40:01] [service] [INFO ] LuminPro 服务启动\n[04-07 15:41:05] [up] [INFO ] 触发提升: 当前亮度 1200 ≥ 阈値 1000\n[04-07 15:42:10] [up] [SUCCESS ] 亮度提升完成 (3500)',
|
||||||
|
stderr: '',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文档模拟
|
// 文档模拟
|
||||||
if (cmd.includes('cat') && cmd.includes('.md')) return { errno: 0, stdout: '# 调试模式\n\n当前处于 **Web 调试模式**,显示的是模拟测试数据。', stderr: '' };
|
if (cmd.includes('cat') && cmd.includes('.md'))
|
||||||
if (cmd.includes('cat') && cmd.includes('.txt')) return { errno: 0, stdout: '这是 NOTE.txt 的模拟内容。', stderr: '' };
|
return {
|
||||||
|
errno: 0,
|
||||||
|
stdout: '# 调试模式\n\n当前处于 **Web 调试模式**,显示的是模拟测试数据。',
|
||||||
|
stderr: '',
|
||||||
|
}
|
||||||
|
if (cmd.includes('cat') && cmd.includes('.txt'))
|
||||||
|
return { errno: 0, stdout: '这是 NOTE.txt 的模拟内容。', stderr: '' }
|
||||||
|
|
||||||
return { errno: -1, stdout: '', stderr: String(e) };
|
return { errno: -1, stdout: '', stderr: String(e) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 读取完整 JSON 配置
|
// 读取完整 JSON 配置
|
||||||
export async function readConfig() {
|
export async function readConfig() {
|
||||||
const res = await runCmd(`cat "${CONFIG_FILE}"`);
|
const res = await runCmd(`cat "${CONFIG_FILE}"`)
|
||||||
if (res.errno !== 0 || !res.stdout.trim()) return {};
|
if (res.errno !== 0 || !res.stdout.trim()) return {}
|
||||||
try { return JSON.parse(res.stdout); } catch { return {}; }
|
try {
|
||||||
|
return JSON.parse(res.stdout)
|
||||||
|
} catch {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 写入完整 JSON 配置
|
// 写入完整 JSON 配置
|
||||||
export async function writeConfig(obj) {
|
export async function writeConfig(obj) {
|
||||||
const content = JSON.stringify(obj).replace(/'/g, "'\\''" );
|
const content = JSON.stringify(obj).replace(/'/g, "'\\''")
|
||||||
return runCmd(`printf '%s' '${content}' > "${CONFIG_FILE}"`);
|
return runCmd(`printf '%s' '${content}' > "${CONFIG_FILE}"`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 合并更新 JSON 配置(保留其他字段)
|
// 合并更新 JSON 配置(保留其他字段)
|
||||||
export async function updateConfig(updates) {
|
export async function updateConfig(updates) {
|
||||||
const current = await readConfig();
|
const current = await readConfig()
|
||||||
return writeConfig({ ...current, ...updates });
|
return writeConfig({ ...current, ...updates })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 将文件内容写入指定路径
|
// 将文件内容写入指定路径
|
||||||
export async function writeFile(path, content) {
|
export async function writeFile(path, content) {
|
||||||
const safeContent = String(content).replace(/'/g, "'\\''" );
|
const safeContent = String(content).replace(/'/g, "'\\''")
|
||||||
return runCmd(`printf '%s' '${safeContent}' > "${path}"`);
|
return runCmd(`printf '%s' '${safeContent}' > "${path}"`)
|
||||||
}
|
}
|
||||||
@@ -1,103 +1,115 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref } from 'vue'
|
||||||
import Button from "@/components/ui/Button.vue";
|
import Button from '@/components/ui/Button.vue'
|
||||||
import { BookOpen, ScrollText, StickyNote, X, Github } from "lucide-vue-next";
|
import { BookOpen, ScrollText, StickyNote, X, Github } from 'lucide-vue-next'
|
||||||
import { runCmd } from "../utils.js";
|
import { runCmd } from '../utils.js'
|
||||||
|
|
||||||
const MODULE_DIR = '/data/adb/modules/LuminPro';
|
const MODULE_DIR = '/data/adb/modules/LuminPro'
|
||||||
|
|
||||||
const sheetOpen = ref(false);
|
const sheetOpen = ref(false)
|
||||||
const sheetTitle = ref("");
|
const sheetTitle = ref('')
|
||||||
const sheetContent = ref("");
|
const sheetContent = ref('')
|
||||||
const sheetLoading = ref(false);
|
const sheetLoading = ref(false)
|
||||||
|
|
||||||
const moduleDocs = [
|
const moduleDocs = [
|
||||||
{ title: "README", file: `${MODULE_DIR}/README.md`, icon: BookOpen, md: true },
|
{ 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: 'README (EN)', file: `${MODULE_DIR}/README_en.md`, icon: BookOpen, md: true },
|
||||||
{ title: "更新日志", file: `${MODULE_DIR}/changelog.md`, icon: ScrollText, md: true },
|
{ title: '更新日志', file: `${MODULE_DIR}/changelog.md`, icon: ScrollText, md: true },
|
||||||
{ title: "NOTE", file: `${MODULE_DIR}/NOTE.txt`, icon: StickyNote, md: false },
|
{ title: 'NOTE', file: `${MODULE_DIR}/NOTE.txt`, icon: StickyNote, md: false },
|
||||||
];
|
]
|
||||||
|
|
||||||
function mdToHtml(text) {
|
function mdToHtml(text) {
|
||||||
return text
|
return text
|
||||||
.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")
|
.replace(/&/g, '&')
|
||||||
.replace(/^### (.+)$/gm, "<h3>$1</h3>")
|
.replace(/</g, '<')
|
||||||
.replace(/^## (.+)$/gm, "<h2>$1</h2>")
|
.replace(/>/g, '>')
|
||||||
.replace(/^# (.+)$/gm, "<h1>$1</h1>")
|
.replace(/^### (.+)$/gm, '<h3>$1</h3>')
|
||||||
.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>")
|
.replace(/^## (.+)$/gm, '<h2>$1</h2>')
|
||||||
.replace(/`([^`]+)`/g, "<code>$1</code>")
|
.replace(/^# (.+)$/gm, '<h1>$1</h1>')
|
||||||
.replace(/\n/g, "<br>");
|
.replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
|
||||||
|
.replace(/`([^`]+)`/g, '<code>$1</code>')
|
||||||
|
.replace(/\n/g, '<br>')
|
||||||
}
|
}
|
||||||
|
|
||||||
async function openModuleDoc(doc) {
|
async function openModuleDoc(doc) {
|
||||||
sheetTitle.value = doc.title;
|
sheetTitle.value = doc.title
|
||||||
sheetContent.value = "";
|
sheetContent.value = ''
|
||||||
sheetLoading.value = true;
|
sheetLoading.value = true
|
||||||
sheetOpen.value = true;
|
sheetOpen.value = true
|
||||||
try {
|
try {
|
||||||
const res = await runCmd(`cat "${doc.file}" 2>/dev/null`);
|
const res = await runCmd(`cat "${doc.file}" 2>/dev/null`)
|
||||||
if (res.errno !== 0 || !res.stdout.trim()) throw new Error('文件不存在或为空');
|
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>');
|
sheetContent.value = doc.md
|
||||||
|
? mdToHtml(res.stdout)
|
||||||
|
: res.stdout
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>')
|
||||||
|
.replace(/\n/g, '<br>')
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
sheetContent.value = `加载失败: ${e.message}`;
|
sheetContent.value = `加载失败: ${e.message}`
|
||||||
} finally {
|
} finally {
|
||||||
sheetLoading.value = false;
|
sheetLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeSheet() {
|
function closeSheet() {
|
||||||
sheetOpen.value = false;
|
sheetOpen.value = false
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div style="display:contents">
|
<div style="display: contents">
|
||||||
<section class="card" id="about-section">
|
<section class="card" id="about-section">
|
||||||
<!-- 模块文档 -->
|
<!-- 模块文档 -->
|
||||||
<div class="about-section-title">模块文档</div>
|
<div class="about-section-title">模块文档</div>
|
||||||
<div class="about-list">
|
<div class="about-list">
|
||||||
<button
|
<button
|
||||||
v-for="doc in moduleDocs"
|
v-for="doc in moduleDocs"
|
||||||
:key="doc.file"
|
:key="doc.file"
|
||||||
class="about-list-item"
|
class="about-list-item"
|
||||||
@click="openModuleDoc(doc)"
|
@click="openModuleDoc(doc)"
|
||||||
>
|
>
|
||||||
<component :is="doc.icon" :size="18" class="about-list-icon" />
|
<component :is="doc.icon" :size="18" class="about-list-icon" />
|
||||||
<span>{{ doc.title }}</span>
|
<span>{{ doc.title }}</span>
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- 链接列表 -->
|
|
||||||
<div class="about-section-title">链接</div>
|
|
||||||
<div class="about-list">
|
|
||||||
<button
|
|
||||||
class="about-list-item"
|
|
||||||
@click="runCmd('am start -a android.intent.action.VIEW -d \'https://github.com/YuleBest/LuminPro\'')"
|
|
||||||
>
|
|
||||||
<Github :size="18" class="about-list-icon" />
|
|
||||||
<span>GitHub 项目主页</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="about-footer">Made with ❤ by Yule</p>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<!-- 文档底部弹出抽屉 -->
|
|
||||||
<Teleport to="body">
|
|
||||||
<div class="doc-sheet-backdrop" :class="{ show: sheetOpen }" @click="closeSheet"></div>
|
|
||||||
<div class="doc-sheet" :class="{ show: sheetOpen }">
|
|
||||||
<div class="doc-sheet-header">
|
|
||||||
<span class="doc-sheet-title">{{ sheetTitle }}</span>
|
|
||||||
<button class="doc-sheet-close" @click="closeSheet">
|
|
||||||
<X :size="20" />
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="doc-sheet-body">
|
|
||||||
<div v-if="sheetLoading" class="doc-sheet-loading">加载中...</div>
|
<!-- 链接列表 -->
|
||||||
<!-- eslint-disable-next-line vue/no-v-html -->
|
<div class="about-section-title">链接</div>
|
||||||
<div v-else class="doc-sheet-content" v-html="sheetContent"></div>
|
<div class="about-list">
|
||||||
|
<button
|
||||||
|
class="about-list-item"
|
||||||
|
@click="
|
||||||
|
runCmd(
|
||||||
|
'am start -a android.intent.action.VIEW -d \'https://github.com/YuleBest/LuminPro\'',
|
||||||
|
)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<Github :size="18" class="about-list-icon" />
|
||||||
|
<span>GitHub 项目主页</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</Teleport>
|
<p class="about-footer">Made with ❤ by Yule</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- 文档底部弹出抽屉 -->
|
||||||
|
<Teleport to="body">
|
||||||
|
<div class="doc-sheet-backdrop" :class="{ show: sheetOpen }" @click="closeSheet"></div>
|
||||||
|
<div class="doc-sheet" :class="{ show: sheetOpen }">
|
||||||
|
<div class="doc-sheet-header">
|
||||||
|
<span class="doc-sheet-title">{{ sheetTitle }}</span>
|
||||||
|
<button class="doc-sheet-close" @click="closeSheet">
|
||||||
|
<X :size="20" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="doc-sheet-body">
|
||||||
|
<div v-if="sheetLoading" class="doc-sheet-loading">加载中...</div>
|
||||||
|
<!-- eslint-disable-next-line vue/no-v-html -->
|
||||||
|
<div v-else class="doc-sheet-content" v-html="sheetContent"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</Teleport>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
+379
-294
@@ -1,361 +1,446 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { inject, ref, computed, onMounted, reactive } from "vue";
|
import { inject, ref, computed, onMounted, reactive } from 'vue'
|
||||||
import { getPackagesInfo } from "kernelsu";
|
import { getPackagesInfo } from 'kernelsu'
|
||||||
import { useApps } from "@/composables/useApps.js";
|
import { useApps } from '@/composables/useApps.js'
|
||||||
import { runCmd } from "../utils.js";
|
import { runCmd } from '../utils.js'
|
||||||
import Button from "@/components/ui/Button.vue";
|
import Button from '@/components/ui/Button.vue'
|
||||||
import {
|
import {
|
||||||
RefreshCw, Eye, EyeOff, Sparkles, Plus, CheckCheck, Square,
|
RefreshCw,
|
||||||
CheckSquare, Search, X, Check, ChevronDown, ScanSearch,
|
Eye,
|
||||||
ChevronLeft, Monitor, Clock, CircleCheck,
|
EyeOff,
|
||||||
} from "lucide-vue-next";
|
Sparkles,
|
||||||
|
Plus,
|
||||||
|
CheckCheck,
|
||||||
|
Square,
|
||||||
|
CheckSquare,
|
||||||
|
Search,
|
||||||
|
X,
|
||||||
|
Check,
|
||||||
|
ChevronDown,
|
||||||
|
ScanSearch,
|
||||||
|
ChevronLeft,
|
||||||
|
Monitor,
|
||||||
|
Clock,
|
||||||
|
CircleCheck,
|
||||||
|
} from 'lucide-vue-next'
|
||||||
|
|
||||||
const showToast = inject("showToast");
|
const showToast = inject('showToast')
|
||||||
const appsMenuOpen = ref(false);
|
const appsMenuOpen = ref(false)
|
||||||
|
|
||||||
const {
|
const {
|
||||||
apps, isLoading, loadError, searchKeyword, showingSystemApps,
|
apps,
|
||||||
savedBlacklist, activityEntries,
|
isLoading,
|
||||||
load, save,
|
loadError,
|
||||||
hasActivity, getActivities, addActivity, removeActivity,
|
searchKeyword,
|
||||||
|
showingSystemApps,
|
||||||
|
savedBlacklist,
|
||||||
|
activityEntries,
|
||||||
|
load,
|
||||||
|
save,
|
||||||
|
hasActivity,
|
||||||
|
getActivities,
|
||||||
|
addActivity,
|
||||||
|
removeActivity,
|
||||||
onCheckboxChange,
|
onCheckboxChange,
|
||||||
toggleSystemApps, selectAll, selectNone, invertSelection, smartSelect,
|
toggleSystemApps,
|
||||||
|
selectAll,
|
||||||
|
selectNone,
|
||||||
|
invertSelection,
|
||||||
|
smartSelect,
|
||||||
getFilteredApps,
|
getFilteredApps,
|
||||||
} = useApps();
|
} = useApps()
|
||||||
|
|
||||||
const filteredApps = computed(() => getFilteredApps());
|
const filteredApps = computed(() => getFilteredApps())
|
||||||
const appCount = computed(() => filteredApps.value.length);
|
const appCount = computed(() => filteredApps.value.length)
|
||||||
|
|
||||||
onMounted(() => load());
|
onMounted(() => load())
|
||||||
|
|
||||||
// 关闭下拉菜单 (点击外部)
|
// 关闭下拉菜单 (点击外部)
|
||||||
function handleBodyClick() { appsMenuOpen.value = false; }
|
function handleBodyClick() {
|
||||||
|
appsMenuOpen.value = false
|
||||||
|
}
|
||||||
|
|
||||||
// 按活动屏蔽
|
// 按活动屏蔽
|
||||||
const activityInput = ref("");
|
const activityInput = ref('')
|
||||||
function doAddActivity() {
|
function doAddActivity() {
|
||||||
const val = activityInput.value.trim();
|
const val = activityInput.value.trim()
|
||||||
if (!val) return;
|
if (!val) return
|
||||||
const parts = val.split("/");
|
const parts = val.split('/')
|
||||||
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
||||||
showToast("格式错误,请输入 包名/完整活动类名");
|
showToast('格式错误,请输入 包名/完整活动类名')
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
addActivity(val);
|
addActivity(val)
|
||||||
activityInput.value = "";
|
activityInput.value = ''
|
||||||
showToast(`已添加: ${val}`);
|
showToast(`已添加: ${val}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 手动添加包名
|
// 手动添加包名
|
||||||
async function handleManualAdd() {
|
async function handleManualAdd() {
|
||||||
appsMenuOpen.value = false;
|
appsMenuOpen.value = false
|
||||||
const pkg = prompt("请输入完整应用包名(例如: com.example.app):");
|
const pkg = prompt('请输入完整应用包名(例如: com.example.app):')
|
||||||
if (!pkg?.trim()) return;
|
if (!pkg?.trim()) return
|
||||||
const realPkg = pkg.trim();
|
const realPkg = pkg.trim()
|
||||||
const existing = apps.value.find((a) => a.packageName === realPkg);
|
const existing = apps.value.find((a) => a.packageName === realPkg)
|
||||||
if (existing) {
|
if (existing) {
|
||||||
existing.checked = true;
|
existing.checked = true
|
||||||
onCheckboxChange();
|
onCheckboxChange()
|
||||||
showToast("已为你自动勾选并置顶");
|
showToast('已为你自动勾选并置顶')
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
showToast("正在获取应用信息...");
|
showToast('正在获取应用信息...')
|
||||||
let appData = {
|
let appData = {
|
||||||
packageName: realPkg,
|
packageName: realPkg,
|
||||||
appLabel: "未知 (手动添加)",
|
appLabel: '未知 (手动添加)',
|
||||||
isSystem: false,
|
isSystem: false,
|
||||||
uid: "自定义",
|
uid: '自定义',
|
||||||
};
|
}
|
||||||
try {
|
try {
|
||||||
const info = await getPackagesInfo([realPkg]);
|
const info = await getPackagesInfo([realPkg])
|
||||||
if (info?.length > 0) appData = info[0];
|
if (info?.length > 0) appData = info[0]
|
||||||
} catch {}
|
} catch {}
|
||||||
apps.value.unshift(reactive({ ...appData, checked: true, expanded: false }));
|
apps.value.unshift(reactive({ ...appData, checked: true, expanded: false }))
|
||||||
onCheckboxChange();
|
onCheckboxChange()
|
||||||
showToast("已添加到列表顶部");
|
showToast('已添加到列表顶部')
|
||||||
}
|
}
|
||||||
|
|
||||||
// Activity Picker
|
// Activity Picker
|
||||||
const pickerVisible = ref(false);
|
const pickerVisible = ref(false)
|
||||||
const pickerStep = ref(1);
|
const pickerStep = ref(1)
|
||||||
const pickerStatusText = ref("等待中...");
|
const pickerStatusText = ref('等待中...')
|
||||||
const pickerPolling = ref(false);
|
const pickerPolling = ref(false)
|
||||||
const pickerResult = ref("");
|
const pickerResult = ref('')
|
||||||
let pollingTimer = null;
|
let pollingTimer = null
|
||||||
|
|
||||||
function openPicker() {
|
function openPicker() {
|
||||||
stopPolling();
|
stopPolling()
|
||||||
pickerStep.value = 1;
|
pickerStep.value = 1
|
||||||
pickerStatusText.value = "等待中...";
|
pickerStatusText.value = '等待中...'
|
||||||
pickerResult.value = "";
|
pickerResult.value = ''
|
||||||
pickerPolling.value = false;
|
pickerPolling.value = false
|
||||||
pickerVisible.value = true;
|
pickerVisible.value = true
|
||||||
}
|
}
|
||||||
function closePicker() {
|
function closePicker() {
|
||||||
stopPolling();
|
stopPolling()
|
||||||
pickerVisible.value = false;
|
pickerVisible.value = false
|
||||||
}
|
}
|
||||||
function stopPolling() {
|
function stopPolling() {
|
||||||
if (pollingTimer) {
|
if (pollingTimer) {
|
||||||
clearInterval(pollingTimer);
|
clearInterval(pollingTimer)
|
||||||
pollingTimer = null;
|
pollingTimer = null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function startPolling() {
|
function startPolling() {
|
||||||
pickerPolling.value = true;
|
pickerPolling.value = true
|
||||||
pickerStatusText.value = "检测中,请切换到目标界面...";
|
pickerStatusText.value = '检测中,请切换到目标界面...'
|
||||||
stopPolling();
|
stopPolling()
|
||||||
pollingTimer = setInterval(async () => {
|
pollingTimer = setInterval(async () => {
|
||||||
try {
|
try {
|
||||||
const res = await runCmd(
|
const res = await runCmd(
|
||||||
`dumpsys window 2>/dev/null | grep mCurrentFocus | sed 's/.*u[0-9][0-9]* //' | sed 's/}.*//'`
|
`dumpsys window 2>/dev/null | grep mCurrentFocus | sed 's/.*u[0-9][0-9]* //' | sed 's/}.*//'`,
|
||||||
);
|
)
|
||||||
if (res.errno !== 0) return;
|
if (res.errno !== 0) return
|
||||||
const activity = res.stdout.trim();
|
const activity = res.stdout.trim()
|
||||||
if (!activity || activity.toLowerCase().includes("webui")) return;
|
if (!activity || activity.toLowerCase().includes('webui')) return
|
||||||
stopPolling();
|
stopPolling()
|
||||||
pickerPolling.value = false;
|
pickerPolling.value = false
|
||||||
pickerResult.value = activity;
|
pickerResult.value = activity
|
||||||
pickerStep.value = 3;
|
pickerStep.value = 3
|
||||||
} catch {}
|
} catch {}
|
||||||
}, 600);
|
}, 600)
|
||||||
}
|
}
|
||||||
function confirmPicker() {
|
function confirmPicker() {
|
||||||
if (!pickerResult.value) return;
|
if (!pickerResult.value) return
|
||||||
addActivity(pickerResult.value);
|
addActivity(pickerResult.value)
|
||||||
showToast(`已添加: ${pickerResult.value}`);
|
showToast(`已添加: ${pickerResult.value}`)
|
||||||
closePicker();
|
closePicker()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div style="display:contents">
|
<div style="display: contents">
|
||||||
<section class="card" id="apps-section">
|
<section class="card" id="apps-section">
|
||||||
<div class="card-header" style="margin-bottom: 8px">
|
<div class="card-header" style="margin-bottom: 8px">
|
||||||
<h2>黑名单</h2>
|
<h2>黑名单</h2>
|
||||||
<div class="header-actions dropdown-container">
|
<div class="header-actions dropdown-container">
|
||||||
<Button variant="ghost" size="icon" @click="load">
|
<Button variant="ghost" size="icon" @click="load">
|
||||||
<RefreshCw :size="18" />
|
<RefreshCw :size="18" />
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" size="icon" @click="appsMenuOpen = !appsMenuOpen">
|
<Button variant="ghost" size="icon" @click="appsMenuOpen = !appsMenuOpen">
|
||||||
<span class="sr-only">更多</span>
|
<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">
|
<svg
|
||||||
<circle cx="12" cy="12" r="1" /><circle cx="12" cy="5" r="1" /><circle cx="12" cy="19" r="1" />
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
</svg>
|
width="18"
|
||||||
</Button>
|
height="18"
|
||||||
<div class="dropdown-menu" :class="{ show: appsMenuOpen }" @click.stop>
|
viewBox="0 0 24 24"
|
||||||
<div class="dropdown-item" @click="toggleSystemApps(); appsMenuOpen = false">
|
fill="none"
|
||||||
<component :is="showingSystemApps ? EyeOff : Eye" :size="18" />
|
stroke="currentColor"
|
||||||
<span>{{ showingSystemApps ? "隐藏系统应用" : "显示系统应用" }}</span>
|
stroke-width="2"
|
||||||
</div>
|
stroke-linecap="round"
|
||||||
<div class="dropdown-item" @click="smartSelect(); appsMenuOpen = false">
|
stroke-linejoin="round"
|
||||||
<Sparkles :size="18" /><span>智能选择</span>
|
>
|
||||||
</div>
|
<circle cx="12" cy="12" r="1" />
|
||||||
<div class="dropdown-item" @click="handleManualAdd">
|
<circle cx="12" cy="5" r="1" />
|
||||||
<Plus :size="18" /><span>手动添加包名</span>
|
<circle cx="12" cy="19" r="1" />
|
||||||
</div>
|
</svg>
|
||||||
<div class="dropdown-item" @click="selectAll(); appsMenuOpen = false">
|
</Button>
|
||||||
<CheckCheck :size="18" /><span>全选</span>
|
<div class="dropdown-menu" :class="{ show: appsMenuOpen }" @click.stop>
|
||||||
</div>
|
<div
|
||||||
<div class="dropdown-item" @click="selectNone(); appsMenuOpen = false">
|
class="dropdown-item"
|
||||||
<Square :size="18" /><span>全不选</span>
|
@click="
|
||||||
</div>
|
toggleSystemApps()
|
||||||
<div class="dropdown-item" @click="invertSelection(); appsMenuOpen = false">
|
appsMenuOpen = false
|
||||||
<CheckSquare :size="18" /><span>反选</span>
|
"
|
||||||
|
>
|
||||||
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<p class="app-list-hint">
|
<p class="app-list-hint">
|
||||||
被选中的应用将不生效本模块<br />推荐选择视频类、相册等需展示 HDR 内容的应用
|
被选中的应用将不生效本模块<br />推荐选择视频类、相册等需展示 HDR 内容的应用
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- 按活动屏蔽 -->
|
<!-- 按活动屏蔽 -->
|
||||||
<div class="activity-block-card">
|
<div class="activity-block-card">
|
||||||
<div class="activity-block-header">
|
<div class="activity-block-header">
|
||||||
<span class="activity-block-label">按活动屏蔽</span>
|
<span class="activity-block-label">按活动屏蔽</span>
|
||||||
<button class="btn-picker-trigger" @click="openPicker">
|
<button class="btn-picker-trigger" @click="openPicker">
|
||||||
<ScanSearch :size="12" /> 扫描获取
|
<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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<!-- 活动列表 -->
|
<div class="activity-block-row">
|
||||||
<div
|
<input
|
||||||
v-if="hasActivity(app.packageName)"
|
v-model="activityInput"
|
||||||
class="app-activities-list"
|
type="text"
|
||||||
:class="{ show: app.expanded }"
|
class="activity-block-input"
|
||||||
>
|
placeholder="com.pkg/com.pkg.ActivityClass"
|
||||||
<div
|
autocomplete="off"
|
||||||
v-for="entry in getActivities(app.packageName)"
|
spellcheck="false"
|
||||||
:key="entry"
|
@keydown.enter="doAddActivity"
|
||||||
class="activity-entry-item"
|
/>
|
||||||
|
<Button
|
||||||
|
style="
|
||||||
|
padding: 0 14px;
|
||||||
|
border-radius: var(--border-radius-s);
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
flex-shrink: 0;
|
||||||
|
"
|
||||||
|
@click="doAddActivity"
|
||||||
|
>确认</Button
|
||||||
>
|
>
|
||||||
<span class="activity-entry-path">{{
|
</div>
|
||||||
entry.slice(app.packageName.length + 1)
|
</div>
|
||||||
}}</span>
|
|
||||||
<button class="activity-entry-delete" @click="removeActivity(entry)">
|
<!-- 搜索栏 + 保存 -->
|
||||||
<X :size="14" />
|
<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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<!-- 活动列表 -->
|
||||||
</div>
|
<div
|
||||||
</div>
|
v-if="hasActivity(app.packageName)"
|
||||||
</section>
|
class="app-activities-list"
|
||||||
|
:class="{ show: app.expanded }"
|
||||||
<!-- 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>
|
<div
|
||||||
<!-- 步骤 3 -->
|
v-for="entry in getActivities(app.packageName)"
|
||||||
<div class="picker-step" v-show="pickerStep === 3">
|
:key="entry"
|
||||||
<div class="picker-step-icon">
|
class="activity-entry-item"
|
||||||
<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>
|
<span class="activity-entry-path">{{ entry.slice(app.packageName.length + 1) }}</span>
|
||||||
|
<button class="activity-entry-delete" @click="removeActivity(entry)">
|
||||||
|
<X :size="14" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</section>
|
||||||
</Teleport>
|
|
||||||
|
<!-- 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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
+291
-208
@@ -1,36 +1,46 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { inject, ref } from 'vue';
|
import { inject, ref } from 'vue'
|
||||||
import Button from '@/components/ui/Button.vue';
|
import Button from '@/components/ui/Button.vue'
|
||||||
import Input from '@/components/ui/Input.vue';
|
import Input from '@/components/ui/Input.vue'
|
||||||
import Textarea from '@/components/ui/Textarea.vue';
|
import Textarea from '@/components/ui/Textarea.vue'
|
||||||
import Switch from '@/components/ui/Switch.vue';
|
import Switch from '@/components/ui/Switch.vue'
|
||||||
import Label from '@/components/ui/Label.vue';
|
import Label from '@/components/ui/Label.vue'
|
||||||
import { Save, Settings2, ShieldCheck, FileText, Settings, Monitor, HelpCircle } from 'lucide-vue-next';
|
import {
|
||||||
import { runCmd } from '../utils.js';
|
Save,
|
||||||
|
Settings2,
|
||||||
|
ShieldCheck,
|
||||||
|
FileText,
|
||||||
|
Settings,
|
||||||
|
Monitor,
|
||||||
|
HelpCircle,
|
||||||
|
} from 'lucide-vue-next'
|
||||||
|
import { runCmd } from '../utils.js'
|
||||||
|
|
||||||
const config = inject('config');
|
const config = inject('config')
|
||||||
const showToast = inject('showToast');
|
const showToast = inject('showToast')
|
||||||
const restartRefresh = inject('restartRefresh');
|
const restartRefresh = inject('restartRefresh')
|
||||||
|
|
||||||
// 恢复默认二次确认
|
// 恢复默认二次确认
|
||||||
const resetConfirming = ref(false);
|
const resetConfirming = ref(false)
|
||||||
let resetTimer = null;
|
let resetTimer = null
|
||||||
function handleReset() {
|
function handleReset() {
|
||||||
if (!resetConfirming.value) {
|
if (!resetConfirming.value) {
|
||||||
resetConfirming.value = true;
|
resetConfirming.value = true
|
||||||
resetTimer = setTimeout(() => { resetConfirming.value = false; }, 5000);
|
resetTimer = setTimeout(() => {
|
||||||
return;
|
resetConfirming.value = false
|
||||||
|
}, 5000)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
clearTimeout(resetTimer);
|
clearTimeout(resetTimer)
|
||||||
resetConfirming.value = false;
|
resetConfirming.value = false
|
||||||
config.resetToDefaults(showToast);
|
config.resetToDefaults(showToast)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function viewInotifyHelp() {
|
async function viewInotifyHelp() {
|
||||||
showToast('获取中...');
|
showToast('获取中...')
|
||||||
const res = await runCmd('inotifyd --help');
|
const res = await runCmd('inotifyd --help')
|
||||||
const out = (res.stderr || '') + (res.stdout || '');
|
const out = (res.stderr || '') + (res.stdout || '')
|
||||||
alert(out.trim() || '无法获取帮助信息');
|
alert(out.trim() || '无法获取帮助信息')
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSaveWebUI() {
|
function handleSaveWebUI() {
|
||||||
@@ -41,206 +51,279 @@ function handleSaveWebUI() {
|
|||||||
config.uiZoom.value,
|
config.uiZoom.value,
|
||||||
config.themeMode.value,
|
config.themeMode.value,
|
||||||
restartRefresh,
|
restartRefresh,
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div style="display:contents">
|
<div style="display: contents">
|
||||||
<!-- === 亮度配置 === -->
|
<!-- === 亮度配置 === -->
|
||||||
<section class="card" id="config-section" data-nav-group="config">
|
<section class="card" id="config-section" data-nav-group="config">
|
||||||
<div class="card-header"><h2>亮度配置</h2></div>
|
<div class="card-header"><h2>亮度配置</h2></div>
|
||||||
|
|
||||||
<div class="config-group">
|
<div class="config-group">
|
||||||
<h3 class="group-title"><Settings2 :size="16" /> 亮度调节</h3>
|
<h3 class="group-title"><Settings2 :size="16" /> 亮度调节</h3>
|
||||||
|
|
||||||
<div class="config-item">
|
<div class="config-item">
|
||||||
<div class="config-label">
|
<div class="config-label">
|
||||||
<span class="config-name">前台最大亮度</span>
|
<span class="config-name">前台最大亮度</span>
|
||||||
<span class="config-desc">触发亮度提升的阈值</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>
|
</div>
|
||||||
<span class="time-sep">至</span>
|
<Input v-model="config.uiMaxBri.value" type="number" min="0" class="config-input" />
|
||||||
<div class="time-unit">
|
</div>
|
||||||
<input type="number" v-model="config.sleepEndH.value" class="time-input" min="0" max="23" placeholder="00" />
|
|
||||||
<span>:</span>
|
<div class="config-item">
|
||||||
<input type="number" v-model="config.sleepEndM.value" class="time-input" min="0" max="59" placeholder="00" />
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="config-group">
|
<div class="config-group">
|
||||||
<h3 class="group-title"><FileText :size="16" /> 系统管理</h3>
|
<h3 class="group-title"><FileText :size="16" /> 系统管理</h3>
|
||||||
<div class="config-item">
|
<div class="config-item">
|
||||||
<div class="config-label">
|
<div class="config-label">
|
||||||
<span class="config-name">日志大小限制</span>
|
<span class="config-name">日志大小限制</span>
|
||||||
<span class="config-desc">单位: KB</span>
|
<span class="config-desc">单位: KB</span>
|
||||||
</div>
|
</div>
|
||||||
<Input v-model="config.logMaxSize.value" type="number" min="1" max="10240" class="config-input" />
|
<Input
|
||||||
</div>
|
v-model="config.logMaxSize.value"
|
||||||
</div>
|
type="number"
|
||||||
|
min="1"
|
||||||
<div class="card-actions">
|
max="10240"
|
||||||
<Button variant="outline" @click="handleReset" :class="resetConfirming ? 'border-destructive text-destructive' : ''">
|
class="config-input"
|
||||||
{{ 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>
|
</div>
|
||||||
|
|
||||||
<div class="config-item">
|
<div class="card-actions">
|
||||||
<div class="config-label">
|
<Button
|
||||||
<span class="config-name">界面缩放</span>
|
variant="outline"
|
||||||
<span class="config-desc">50% - 150%(立即生效)</span>
|
@click="handleReset"
|
||||||
</div>
|
:class="resetConfirming ? 'border-destructive text-destructive' : ''"
|
||||||
<Input v-model="config.uiZoom.value" type="number" min="50" max="150" class="config-input" />
|
>
|
||||||
|
{{ resetConfirming ? '确认恢复?' : '恢复默认' }}
|
||||||
|
</Button>
|
||||||
|
<Button @click="config.save(showToast)"> <Save :size="15" /> 保存配置 </Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</section>
|
||||||
|
|
||||||
<div class="card-actions">
|
<!-- === 高级设置 === -->
|
||||||
<Button @click="handleSaveWebUI">
|
<section class="card" id="advanced-section" data-nav-group="config">
|
||||||
<Save :size="15" /> 保存配置
|
<div class="card-header"><h2>高级设置</h2></div>
|
||||||
</Button>
|
|
||||||
</div>
|
<div class="config-group">
|
||||||
</section>
|
<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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
+61
-27
@@ -1,41 +1,43 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { inject, ref, onMounted } from 'vue';
|
import { inject, ref, onMounted } from 'vue'
|
||||||
import Button from '@/components/ui/Button.vue';
|
import Button from '@/components/ui/Button.vue'
|
||||||
import { RefreshCw, Copy, Download, Trash2 } from 'lucide-vue-next';
|
import { RefreshCw, Copy, Download, Trash2 } from 'lucide-vue-next'
|
||||||
|
|
||||||
const showToast = inject('showToast');
|
const showToast = inject('showToast')
|
||||||
const log = inject('log');
|
const log = inject('log')
|
||||||
|
|
||||||
const logMenuOpen = ref(false);
|
const logMenuOpen = ref(false)
|
||||||
const clearConfirming = ref(false);
|
const clearConfirming = ref(false)
|
||||||
|
|
||||||
let clearConfirmTimer = null;
|
let clearConfirmTimer = null
|
||||||
function handleClear() {
|
function handleClear() {
|
||||||
if (!clearConfirming.value) {
|
if (!clearConfirming.value) {
|
||||||
clearConfirming.value = true;
|
clearConfirming.value = true
|
||||||
clearConfirmTimer = setTimeout(() => { clearConfirming.value = false; }, 3000);
|
clearConfirmTimer = setTimeout(() => {
|
||||||
return;
|
clearConfirming.value = false
|
||||||
|
}, 3000)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
clearTimeout(clearConfirmTimer);
|
clearTimeout(clearConfirmTimer)
|
||||||
clearConfirming.value = false;
|
clearConfirming.value = false
|
||||||
logMenuOpen.value = false;
|
logMenuOpen.value = false
|
||||||
log.clear(showToast);
|
log.clear(showToast)
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter options
|
// filter options
|
||||||
const filterOptions = [
|
const filterOptions = [
|
||||||
{ key: '', label: '全部' },
|
{ key: '', label: '全部' },
|
||||||
{ key: 'INFO', label: 'INFO' },
|
{ key: 'INFO', label: 'INFO' },
|
||||||
{ key: 'WARN', label: 'WARN' },
|
{ key: 'WARN', label: 'WARN' },
|
||||||
{ key: 'ERROR', label: 'ERROR' },
|
{ key: 'ERROR', label: 'ERROR' },
|
||||||
];
|
]
|
||||||
|
|
||||||
onMounted(() => log.load());
|
onMounted(() => log.load())
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section class="card" id="log-section">
|
<section class="card" id="log-section">
|
||||||
<div class="card-header" style="margin-bottom:8px">
|
<div class="card-header" style="margin-bottom: 8px">
|
||||||
<h2>运行日志</h2>
|
<h2>运行日志</h2>
|
||||||
<div class="header-actions dropdown-container">
|
<div class="header-actions dropdown-container">
|
||||||
<Button variant="ghost" size="icon" @click="log.load">
|
<Button variant="ghost" size="icon" @click="log.load">
|
||||||
@@ -43,16 +45,46 @@ onMounted(() => log.load());
|
|||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" size="icon" @click="logMenuOpen = !logMenuOpen">
|
<Button variant="ghost" size="icon" @click="logMenuOpen = !logMenuOpen">
|
||||||
<span class="sr-only">更多操作</span>
|
<span class="sr-only">更多操作</span>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="18"
|
||||||
|
height="18"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="2"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
>
|
||||||
|
<circle cx="12" cy="12" r="1" />
|
||||||
|
<circle cx="12" cy="5" r="1" />
|
||||||
|
<circle cx="12" cy="19" r="1" />
|
||||||
|
</svg>
|
||||||
</Button>
|
</Button>
|
||||||
<div class="dropdown-menu" :class="{ show: logMenuOpen }" @click.stop>
|
<div class="dropdown-menu" :class="{ show: logMenuOpen }" @click.stop>
|
||||||
<div class="dropdown-item" @click="log.copy(showToast); logMenuOpen=false">
|
<div
|
||||||
|
class="dropdown-item"
|
||||||
|
@click="
|
||||||
|
log.copy(showToast)
|
||||||
|
logMenuOpen = false
|
||||||
|
"
|
||||||
|
>
|
||||||
<Copy :size="18" /><span>复制日志</span>
|
<Copy :size="18" /><span>复制日志</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="dropdown-item" @click="log.exportLog(showToast); logMenuOpen=false">
|
<div
|
||||||
|
class="dropdown-item"
|
||||||
|
@click="
|
||||||
|
log.exportLog(showToast)
|
||||||
|
logMenuOpen = false
|
||||||
|
"
|
||||||
|
>
|
||||||
<Download :size="18" /><span>导出日志文件</span>
|
<Download :size="18" /><span>导出日志文件</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="dropdown-item" :class="{ 'dropdown-item-danger': clearConfirming }" @click="handleClear">
|
<div
|
||||||
|
class="dropdown-item"
|
||||||
|
:class="{ 'dropdown-item-danger': clearConfirming }"
|
||||||
|
@click="handleClear"
|
||||||
|
>
|
||||||
<Trash2 :size="18" />
|
<Trash2 :size="18" />
|
||||||
<span>{{ clearConfirming ? '再次点击确认清除' : '清除日志' }}</span>
|
<span>{{ clearConfirming ? '再次点击确认清除' : '清除日志' }}</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -61,7 +93,7 @@ onMounted(() => log.load());
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 过滤器 -->
|
<!-- 过滤器 -->
|
||||||
<div class="log-filter-container" style="margin-bottom:var(--spacing-s)">
|
<div class="log-filter-container" style="margin-bottom: var(--spacing-s)">
|
||||||
<div class="log-filter-tabs">
|
<div class="log-filter-tabs">
|
||||||
<button
|
<button
|
||||||
v-for="opt in filterOptions"
|
v-for="opt in filterOptions"
|
||||||
@@ -69,7 +101,9 @@ onMounted(() => log.load());
|
|||||||
class="log-filter-tab"
|
class="log-filter-tab"
|
||||||
:class="{ active: log.filterLevel.value === opt.key }"
|
:class="{ active: log.filterLevel.value === opt.key }"
|
||||||
@click="log.filterLevel.value = opt.key"
|
@click="log.filterLevel.value = opt.key"
|
||||||
>{{ opt.label }}</button>
|
>
|
||||||
|
{{ opt.label }}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,53 +1,64 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { inject, computed, ref } from 'vue';
|
import { inject, computed, ref } from 'vue'
|
||||||
import Button from '@/components/ui/Button.vue';
|
import Button from '@/components/ui/Button.vue'
|
||||||
import Switch from '@/components/ui/Switch.vue';
|
import Switch from '@/components/ui/Switch.vue'
|
||||||
import Badge from '@/components/ui/Badge.vue';
|
import Badge from '@/components/ui/Badge.vue'
|
||||||
import {
|
import {
|
||||||
RefreshCw, Play, RotateCcw,
|
RefreshCw,
|
||||||
SunMedium, Smartphone, Activity, Clock, Moon, Layers,
|
Play,
|
||||||
} from 'lucide-vue-next';
|
RotateCcw,
|
||||||
|
SunMedium,
|
||||||
|
Smartphone,
|
||||||
|
Activity,
|
||||||
|
Clock,
|
||||||
|
Moon,
|
||||||
|
Layers,
|
||||||
|
} from 'lucide-vue-next'
|
||||||
|
|
||||||
const status = inject('status');
|
const status = inject('status')
|
||||||
const showToast = inject('showToast');
|
const showToast = inject('showToast')
|
||||||
const config = inject('config');
|
const config = inject('config')
|
||||||
|
|
||||||
const confirmedLowBri = ref(false);
|
const confirmedLowBri = ref(false)
|
||||||
|
|
||||||
// --------- 亮度滑条渐变 ----------
|
// --------- 亮度滑条渐变 ----------
|
||||||
const sliderStyle = computed(() => {
|
const sliderStyle = computed(() => {
|
||||||
const sysMax = parseInt(status.sysMaxBri.value) || 255;
|
const sysMax = parseInt(status.sysMaxBri.value) || 255
|
||||||
const curr = parseInt(status.currentBri.value) || 0;
|
const curr = parseInt(status.currentBri.value) || 0
|
||||||
const uiMax = parseInt(config.uiMaxBri.value) || sysMax;
|
const uiMax = parseInt(config.uiMaxBri.value) || sysMax
|
||||||
const c = (curr / sysMax) * 100;
|
const c = (curr / sysMax) * 100
|
||||||
const u = (uiMax / sysMax) * 100;
|
const u = (uiMax / sysMax) * 100
|
||||||
const pri = '#a8c7fa';
|
const pri = '#a8c7fa'
|
||||||
const bst = '#fb8c00';
|
const bst = '#fb8c00'
|
||||||
const trk = 'var(--md-sys-color-surface-container-high)';
|
const trk = 'var(--md-sys-color-surface-container-high)'
|
||||||
const btrk = 'rgba(251,140,0,0.15)';
|
const btrk = 'rgba(251,140,0,0.15)'
|
||||||
if (c <= u) {
|
if (c <= u) {
|
||||||
return `background: linear-gradient(to right, ${pri} 0%, ${pri} ${c}%, ${trk} ${c}%, ${trk} ${u}%, ${btrk} ${u}%, ${btrk} 100%)`;
|
return `background: linear-gradient(to right, ${pri} 0%, ${pri} ${c}%, ${trk} ${c}%, ${trk} ${u}%, ${btrk} ${u}%, ${btrk} 100%)`
|
||||||
}
|
}
|
||||||
return `background: linear-gradient(to right, ${pri} 0%, ${pri} ${u}%, ${bst} ${u}%, ${bst} ${c}%, ${btrk} ${c}%, ${btrk} 100%)`;
|
return `background: linear-gradient(to right, ${pri} 0%, ${pri} ${u}%, ${bst} ${u}%, ${bst} ${c}%, ${btrk} ${c}%, ${btrk} 100%)`
|
||||||
});
|
})
|
||||||
|
|
||||||
const brightnessPercent = computed(() => {
|
const brightnessPercent = computed(() => {
|
||||||
const sysMax = parseInt(status.sysMaxBri.value) || 255;
|
const sysMax = parseInt(status.sysMaxBri.value) || 255
|
||||||
const curr = parseInt(status.currentBri.value) || 0;
|
const curr = parseInt(status.currentBri.value) || 0
|
||||||
return Math.round((curr / sysMax) * 100) + '%';
|
return Math.round((curr / sysMax) * 100) + '%'
|
||||||
});
|
})
|
||||||
|
|
||||||
async function onSliderChange(e) {
|
async function onSliderChange(e) {
|
||||||
const newBri = parseInt(e.target.value, 10);
|
const newBri = parseInt(e.target.value, 10)
|
||||||
const sysMax = parseInt(status.sysMaxBri.value) || 255;
|
const sysMax = parseInt(status.sysMaxBri.value) || 255
|
||||||
const pct = Math.round((newBri / sysMax) * 100);
|
const pct = Math.round((newBri / sysMax) * 100)
|
||||||
if (pct < 5 && !confirmedLowBri.value) {
|
if (pct < 5 && !confirmedLowBri.value) {
|
||||||
const ok = confirm('⚠️ 警告:亮度低于 5% 可能导致屏幕近似黑屏。\n\n确定要继续吗?');
|
const ok = confirm('⚠️ 警告:亮度低于 5% 可能导致屏幕近似黑屏。\n\n确定要继续吗?')
|
||||||
if (!ok) { const safe = Math.ceil(sysMax * 0.05); e.target.value = safe; return; }
|
if (!ok) {
|
||||||
confirmedLowBri.value = true;
|
const safe = Math.ceil(sysMax * 0.05)
|
||||||
|
e.target.value = safe
|
||||||
|
return
|
||||||
|
}
|
||||||
|
confirmedLowBri.value = true
|
||||||
}
|
}
|
||||||
if (pct >= 5) confirmedLowBri.value = false;
|
if (pct >= 5) confirmedLowBri.value = false
|
||||||
await status.setBrightness(newBri, showToast);
|
await status.setBrightness(newBri, showToast)
|
||||||
}
|
}
|
||||||
|
|
||||||
const statusItems = computed(() => [
|
const statusItems = computed(() => [
|
||||||
@@ -57,7 +68,7 @@ const statusItems = computed(() => [
|
|||||||
{ label: 'inotifyd 状态', value: status.inotifydState.value, icon: Clock },
|
{ label: 'inotifyd 状态', value: status.inotifydState.value, icon: Clock },
|
||||||
{ label: '休眠状态', value: status.sleepStatus.value, icon: Moon },
|
{ label: '休眠状态', value: status.sleepStatus.value, icon: Moon },
|
||||||
{ label: 'HDR/SDR 比率', value: status.hdrRatio.value, icon: Layers },
|
{ label: 'HDR/SDR 比率', value: status.hdrRatio.value, icon: Layers },
|
||||||
]);
|
])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue';
|
import vue from '@vitejs/plugin-vue'
|
||||||
import tailwindcss from '@tailwindcss/vite';
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
import { fileURLToPath, URL } from 'node:url';
|
import { fileURLToPath, URL } from 'node:url'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [vue(), tailwindcss()],
|
plugins: [vue(), tailwindcss()],
|
||||||
@@ -14,4 +14,4 @@ export default defineConfig({
|
|||||||
outDir: '../webroot',
|
outDir: '../webroot',
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
Reference in new issue
Block a user