[Feat] Screen Lock overrides & Move Aura Settings to pref page

This commit is contained in:
Minoricew
2025-06-03 02:11:39 +08:00
parent a86d13431b
commit fbc5cf1f57
20 changed files with 1807 additions and 67 deletions

View File

@@ -6,20 +6,6 @@
<li class="nav-item" role="presentation">
<button
class="nav-link active"
id="aura-subpage-tab"
data-bs-toggle="pill"
data-bs-target="#aura-subpage"
type="button"
role="tab"
aria-controls="aura-subpage"
aria-selected="true"
>
Aura 设置
</button>
</li>
<li class="nav-item" role="presentation">
<button
class="nav-link"
id="auth-subpage-tab"
data-bs-toggle="pill"
data-bs-target="#auth-subpage"
@@ -49,12 +35,6 @@
<div class="tab-content">
<div
class="tab-pane fade show active"
id="aura-subpage"
role="tabpanel"
aria-labelledby="aura-subpage-tab"
></div>
<div
class="tab-pane fade show"
id="auth-subpage"
role="tabpanel"
aria-labelledby="auth-subpage-tab"

View File

@@ -5,15 +5,9 @@
const {
settingsRenderer,
} = require("../../aura/ui/composables/settingsRenderer");
const { auraSettings } = require(`${pathBase}/aura`);
const { authSettings } = require(`${pathBase}/auth`);
const { banAuditSettings } = require(`${pathBase}/audit`);
const initAuraSubPage = () => {
const auraSettingsSubPageEl = document.getElementById("aura-subpage");
settingsRenderer(auraSettingsSubPageEl, auraSettings);
};
const initAuthSubPage = () => {
const authSubPageEl = document.getElementById("auth-subpage");
settingsRenderer(authSubPageEl, authSettings);
@@ -25,7 +19,6 @@
};
const onMounted = () => {
initAuraSubPage();
initAuthSubPage();
initBanAuditSubPage();

View File

@@ -131,6 +131,131 @@ const authSettings = [
},
{
id: 1,
categoryName: "屏幕锁",
child: [
{
index: 0,
id: "enableScreenLockOverride",
type: "switch",
name: "启用屏幕锁覆写功能",
description: "覆写希沃管家的屏幕锁组件, 绕过限制",
restart: false,
reload: false,
associateVal: null,
auraIf: () => true,
defaultValue: true,
valueGetter: () => {
return global.__HUGO_AURA_CONFIG__.rewrite["vendor/screenLock"]
.enabled;
},
callbackFn: (newVal) => {
if (typeof newVal !== "boolean") return;
global.__HUGO_AURA_CONFIG__.rewrite["vendor/screenLock"].enabled =
newVal;
},
},
{
index: 1,
id: "disableKeyboardHook",
type: "switch",
name: "允许快捷键操作",
description: "屏蔽键盘 DLL Hook, 允许在屏幕锁中操作快捷键",
restart: false,
reload: false,
tip: true,
tipTitle: "此功能正在测试中, 可能并不稳定",
associateVal: ["rewrite.vendor/screenLock.enabled"],
auraIf: () => {
return global.__HUGO_AURA_CONFIG__.rewrite["vendor/screenLock"]
.enabled;
},
defaultValue: false,
valueGetter: () => {
return global.__HUGO_AURA_CONFIG__.rewrite["vendor/screenLock"]
.disableKeyboardHook;
},
callbackFn: (newVal) => {
if (typeof newVal !== "boolean") return;
global.__HUGO_AURA_CONFIG__.rewrite[
"vendor/screenLock"
].disableKeyboardHook = newVal;
},
},
{
index: 2,
id: "screenLockAuthOverrideType",
type: "radio",
name: "覆写模式",
description: "选择一个认证覆写模式",
restart: false,
reload: false,
associateVal: ["rewrite.vendor/screenLock.enabled"],
auraIf: () => {
return global.__HUGO_AURA_CONFIG__.rewrite["vendor/screenLock"]
.enabled;
},
defaultValue: "none",
templates: ["customActivationCode", "none"],
templateLabels: ["自定义激活码", "不修改"],
valueGetter: () => {
return global.__HUGO_AURA_CONFIG__.rewrite["vendor/screenLock"]
.authRewriteType;
},
callbackFn: (newVal) => {
global.__HUGO_AURA_CONFIG__.rewrite[
"vendor/screenLock"
].authRewriteType = newVal;
},
},
{
index: 3,
id: "customActivationCode",
type: "input",
subType: "password",
name: "自定义激活码",
description: '请在屏幕锁页面下方选择 "激活码解锁" 以使用',
restart: false,
reload: false,
warning: true,
warningContent: "密码为 6 位纯数字",
associateVal: [
"rewrite.vendor/screenLock.enabled",
"rewrite.vendor/screenLock.authRewriteType",
],
auraIf: () => {
return (
global.__HUGO_AURA_CONFIG__.rewrite["vendor/screenLock"].enabled &&
global.__HUGO_AURA_CONFIG__.rewrite["vendor/screenLock"].authRewriteType ===
"customActivationCode"
);
},
defaultValue: "",
placeHolder: "留空表示不修改, 保留已设置值",
valueGetter: () => {
return "";
},
callbackFn: (newVal) => {
if (newVal === "" || !newVal) return { valid: true };
if (newVal.length !== 6)
return { valid: false, hint: "仅可输入 6 位密码" };
if (!/^\d+$/.test(newVal)) {
return { valid: false, hint: "仅允许纯数字密码" };
}
const __config =
global.__HUGO_AURA_CONFIG__.rewrite["vendor/screenLock"];
const crypto = require("crypto");
const result = crypto
.createHash("md5")
.update(newVal + "auraScreenLockCrack")
.digest("hex");
__config.customActivationCode.activationCodeWithSalt = result;
return { valid: true };
},
},
],
},
{
id: 2,
categoryName: "基础设施",
child: [
{
@@ -143,6 +268,9 @@ const authSettings = [
reload: false,
tip: true,
tipTitle: "启用后, 按下 Ctrl + Shift + I 即可打开 DevTools",
warning: true,
warningContent:
"在操作不当的情况下, 有可能造成 DevTools 永久无法激活 (Electron 的 Bug), 此时请使用 Chrome 远程调试",
associateVal: null,
auraIf: () => true,
defaultValue: false,

View File

@@ -0,0 +1,8 @@
.aura-config-subpage-preferences-root {
opacity: 1;
transition: opacity 0.5s;
}
.aura-config-subpage-preferences-root.acs-preferences-root-hidden {
opacity: 0;
}

View File

@@ -0,0 +1,49 @@
<div
id="acs-preferences-root-el"
class="aura-config-subpage-preferences-root acs-preferences-root-hidden"
>
<ul class="nav nav-underline mb-3" role="tablist">
<li class="nav-item" role="presentation">
<button
class="nav-link active"
id="aura-subpage-tab"
data-bs-toggle="pill"
data-bs-target="#aura-subpage"
type="button"
role="tab"
aria-controls="aura-subpage"
aria-selected="true"
>
Aura 设置
</button>
</li>
<li class="nav-item" role="presentation">
<button
class="nav-link"
id="about-subpage-tab"
data-bs-toggle="pill"
data-bs-target="#about-subpage"
type="button"
role="tab"
aria-controls="about-subpage"
aria-selected="true"
>
关于项目
</button>
</li>
</ul>
<div class="tab-content">
<div
class="tab-pane fade show active"
id="aura-subpage"
role="tabpanel"
aria-labelledby="aura-subpage-tab"
></div>
<div
class="tab-pane fade"
id="about-subpage"
role="tabpanel"
aria-labelledby="about-subpage-tab"
></div>
</div>
</div>

View File

@@ -0,0 +1,23 @@
(() => {
const pathBase = "../../aura/ui/pages/configSubPages/preferences/settings";
const {
settingsRenderer,
} = require("../../aura/ui/composables/settingsRenderer");
const { auraSettings } = require(`${pathBase}/aura`);
const initAuraSubPage = () => {
const auraSettingsSubPageEl = document.getElementById("aura-subpage");
settingsRenderer(auraSettingsSubPageEl, auraSettings);
};
const onMounted = () => {
initAuraSubPage();
const rootEl = document.getElementById("acs-preferences-root-el");
setTimeout(() => {
rootEl.classList.remove("acs-preferences-root-hidden");
}, 500);
};
onMounted();
})();

View File

@@ -36,6 +36,8 @@ const auraSettings = [
description: "此密码将用于访问 Aura 设置 UI",
restart: false,
reload: false,
tip: true,
tipTitle: "密码将在本地使用 SHA512 加盐存储",
associateVal: ["auraSettings.settingsPasswordEnabled"],
auraIf: () => {
return global.__HUGO_AURA_CONFIG__.auraSettings
@@ -91,8 +93,8 @@ const auraSettings = [
description: "启用后, 密码验证时, 背景将具有毛玻璃效果",
restart: false,
reload: false,
tip: true,
tipTitle: "不建议在较旧 (如 i5 8 代) 机型上开启, 可能导致性能问题",
warning: true,
warningContent: "不建议在较旧 (如 i5 8 代) 机型上开启, 可能导致性能问题",
associateVal: null,
auraIf: () => true,
defaultValue: true,