mirror of
https://github.com/HugoAura/Seewo-HugoAura.git
synced 2026-06-21 23:54:26 +08:00
Compare commits
5 Commits
v0.1.1-pre
...
vAutoBuild
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef0e39dd8c | ||
|
|
9a2a335742 | ||
|
|
e63c989d88 | ||
|
|
70ffa3f581 | ||
|
|
c0249693a8 |
39
.github/workflows/pack.yml
vendored
39
.github/workflows/pack.yml
vendored
@@ -7,6 +7,8 @@ on:
|
|||||||
branches: [dev, stable, main, master]
|
branches: [dev, stable, main, master]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions: write-all
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pack:
|
pack:
|
||||||
name: Patch & Pack
|
name: Patch & Pack
|
||||||
@@ -123,6 +125,30 @@ jobs:
|
|||||||
echo "[DEBUG] Files in <Working DIR>/Artifacts directory:"
|
echo "[DEBUG] Files in <Working DIR>/Artifacts directory:"
|
||||||
ls -la Artifacts/
|
ls -la Artifacts/
|
||||||
|
|
||||||
|
- name: Get short commit hash
|
||||||
|
run: |
|
||||||
|
cd ./HugoAura-Code
|
||||||
|
SHORT_HASH=$(git rev-parse --short=7 HEAD)
|
||||||
|
echo "SHORT_HASH=$SHORT_HASH" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Create release content
|
||||||
|
run: |
|
||||||
|
cat > rel_msg.txt << EOF
|
||||||
|
## 这是 HugoAura 的 CI 自动构建版本
|
||||||
|
|
||||||
|
### 版本类型: 🔁 自动构建版
|
||||||
|
|
||||||
|
### 版本号: `vAutoBuild-${{ env.SHORT_HASH }}`
|
||||||
|
|
||||||
|
### 对应 Commit: [`${{ env.SHORT_HASH }}`](https://github.com/HugoAura/Seewo-HugoAura/commit/${{ env.GITHUB_SHA }})
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ⚠ 注意: CI 自动构建版本可能不稳定 / 存在较多 Bug, 更新时请留意
|
||||||
|
|
||||||
|
**🕘 构建时间: ${{ env.BUILDTIME }}**
|
||||||
|
EOF
|
||||||
|
|
||||||
- name: Upload patched ASAR
|
- name: Upload patched ASAR
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -134,3 +160,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: aura-code
|
name: aura-code
|
||||||
path: Artifacts/aura.zip
|
path: Artifacts/aura.zip
|
||||||
|
|
||||||
|
- name: Upload release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: vAutoBuild
|
||||||
|
name: "[CI] HugoAura Auto Build Release"
|
||||||
|
body_path: rel_msg.txt
|
||||||
|
prerelease: true
|
||||||
|
generate_release_notes: false
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
file: |
|
||||||
|
Artifacts/app-patched.asar
|
||||||
|
Artifacts/aura.zip
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ const buildIpcMain = (electron) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { applyBaseIpcHandler } = require("./ipcModules/baseIpcHandler");
|
||||||
const { applyConfigIpcHandler } = require("./ipcModules/configIpcHandler");
|
const { applyConfigIpcHandler } = require("./ipcModules/configIpcHandler");
|
||||||
const { applyFsIpcHandler } = require("./ipcModules/fsIpcHandler");
|
const { applyFsIpcHandler } = require("./ipcModules/fsIpcHandler");
|
||||||
const { applyPlsIpcHandler } = require("./ipcModules/plsIpcHandler");
|
const { applyPlsIpcHandler } = require("./ipcModules/plsIpcHandler");
|
||||||
@@ -85,6 +86,7 @@ const buildIpcMain = (electron) => {
|
|||||||
app.exit(0);
|
app.exit(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
applyBaseIpcHandler(ipcMain);
|
||||||
applyConfigIpcHandler(ipcMain);
|
applyConfigIpcHandler(ipcMain);
|
||||||
applyFsIpcHandler(ipcMain);
|
applyFsIpcHandler(ipcMain);
|
||||||
applyPlsIpcHandler(ipcMain);
|
applyPlsIpcHandler(ipcMain);
|
||||||
|
|||||||
59
src/aura/init/main/ipcModules/baseIpcHandler.js
Normal file
59
src/aura/init/main/ipcModules/baseIpcHandler.js
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
// @ts-check
|
||||||
|
|
||||||
|
const { BrowserWindow } = require("electron");
|
||||||
|
|
||||||
|
const composables = {
|
||||||
|
getBrowserWindowInstance: (windowKey) => {
|
||||||
|
if (!global.__HUGO_AURA__.hookedWindows) return null;
|
||||||
|
const hookedWindowIns = global.__HUGO_AURA__.hookedWindows.get(windowKey);
|
||||||
|
if (!hookedWindowIns) return undefined;
|
||||||
|
const browserWindowIns = BrowserWindow.fromWebContents(
|
||||||
|
hookedWindowIns.webContents
|
||||||
|
);
|
||||||
|
return browserWindowIns;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("electron").IpcMain} ipcMain
|
||||||
|
*/
|
||||||
|
const applyBaseIpcHandler = (ipcMain) => {
|
||||||
|
const methodBase = "$aura.base";
|
||||||
|
|
||||||
|
ipcMain.on(
|
||||||
|
`${methodBase}.minimizeWindow`,
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("electron").IpcMainEvent} _event
|
||||||
|
* @param {{ targetWindowKey: string }} arg
|
||||||
|
*/
|
||||||
|
(_event, arg) => {
|
||||||
|
const browserWindowIns = composables.getBrowserWindowInstance(
|
||||||
|
arg.targetWindowKey
|
||||||
|
);
|
||||||
|
if (!browserWindowIns) return;
|
||||||
|
|
||||||
|
browserWindowIns.minimize();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
ipcMain.on(
|
||||||
|
`${methodBase}.closeWindow`,
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("electron").IpcMainEvent} _event
|
||||||
|
* @param {{ targetWindowKey: string }} arg
|
||||||
|
*/
|
||||||
|
(_event, arg) => {
|
||||||
|
const browserWindowIns = composables.getBrowserWindowInstance(
|
||||||
|
arg.targetWindowKey
|
||||||
|
);
|
||||||
|
if (!browserWindowIns) return;
|
||||||
|
|
||||||
|
browserWindowIns.close();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { applyBaseIpcHandler };
|
||||||
@@ -42,7 +42,7 @@ const composableFunctions = {
|
|||||||
const dirName = path.dirname(targetPath);
|
const dirName = path.dirname(targetPath);
|
||||||
|
|
||||||
if (!fs.existsSync(dirName)) {
|
if (!fs.existsSync(dirName)) {
|
||||||
fs.mkdirSync(dirName);
|
fs.mkdirSync(dirName, { recursive: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
const httpModuleIns = url.startsWith("https") ? nodeHttps : nodeHttp;
|
const httpModuleIns = url.startsWith("https") ? nodeHttps : nodeHttp;
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ const applyPlsIpcHandler = (ipcMain) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fs.mkdirSync(PLS_INSTALL_DIR);
|
fs.mkdirSync(PLS_INSTALL_DIR, { recursive: true });
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
data: {
|
data: {
|
||||||
|
|||||||
@@ -30,7 +30,14 @@
|
|||||||
"settingsPasswordEnabled": false,
|
"settingsPasswordEnabled": false,
|
||||||
"settingsPasswordWithSalt": "32703D292460CC9A3B867494D6AD9A8E4A3ADF0FAA4D6867BC4D412CC3927D02E47C6D0B1763BB53E57B2241C6193433561CDA09D7C48CA03983072B876F0965",
|
"settingsPasswordWithSalt": "32703D292460CC9A3B867494D6AD9A8E4A3ADF0FAA4D6867BC4D412CC3927D02E47C6D0B1763BB53E57B2241C6193433561CDA09D7C48CA03983072B876F0965",
|
||||||
"encryptConfig": false,
|
"encryptConfig": false,
|
||||||
"appearance": {}
|
"appearance": {},
|
||||||
|
"uiAccessMethod": {
|
||||||
|
"showEntryIcon": true,
|
||||||
|
"fallbackAccessMethods": {
|
||||||
|
"hotkey": false,
|
||||||
|
"touch": false
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"devTools": false
|
"devTools": false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,28 @@ const showToast = (entry) => {
|
|||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const setDisableStatus = (el, isDisable, hint = null) => {
|
||||||
|
if (isDisable) {
|
||||||
|
el.classList.add("ase-operation-area-disabled");
|
||||||
|
if (hint) {
|
||||||
|
el.setAttribute("data-bs-toggle", "tooltip");
|
||||||
|
el.setAttribute("data-bs-placement", "top");
|
||||||
|
el.setAttribute("data-bs-title", hint);
|
||||||
|
const tooltipIns = bootstrap.Tooltip.getOrCreateInstance(el);
|
||||||
|
tooltipIns.enable();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
el.setAttribute("data-bs-toggle", "tooltip");
|
||||||
|
el.setAttribute("data-bs-placement", "top");
|
||||||
|
el.setAttribute("data-bs-title", "None");
|
||||||
|
el.classList.remove("ase-operation-area-disabled");
|
||||||
|
const tooltipIns = bootstrap.Tooltip.getInstance(el);
|
||||||
|
if (tooltipIns) {
|
||||||
|
tooltipIns.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const insertOrRemoveEl = (parent, child, isInsert = true) => {
|
const insertOrRemoveEl = (parent, child, isInsert = true) => {
|
||||||
if (Array.isArray(child)) {
|
if (Array.isArray(child)) {
|
||||||
for (const perEl of child) {
|
for (const perEl of child) {
|
||||||
@@ -71,7 +93,12 @@ const renderInputArea = (entry, operationArea, descriptionArea) => {
|
|||||||
switchEl.checked = elValue;
|
switchEl.checked = elValue;
|
||||||
switchEl.addEventListener("change", async (event) => {
|
switchEl.addEventListener("change", async (event) => {
|
||||||
showToast(entry);
|
showToast(entry);
|
||||||
await entry.callbackFn(event.target.checked);
|
await entry.callbackFn(
|
||||||
|
event.target.checked,
|
||||||
|
switchEl,
|
||||||
|
operationArea,
|
||||||
|
descriptionArea
|
||||||
|
);
|
||||||
});
|
});
|
||||||
operationArea.classList.add("form-check", "form-switch");
|
operationArea.classList.add("form-check", "form-switch");
|
||||||
return switchEl;
|
return switchEl;
|
||||||
@@ -92,7 +119,12 @@ const renderInputArea = (entry, operationArea, descriptionArea) => {
|
|||||||
radioEl.addEventListener("change", async (event) => {
|
radioEl.addEventListener("change", async (event) => {
|
||||||
if (event.target.checked) {
|
if (event.target.checked) {
|
||||||
showToast(entry);
|
showToast(entry);
|
||||||
await entry.callbackFn(event.target.value);
|
await entry.callbackFn(
|
||||||
|
event.target.value,
|
||||||
|
radioEl,
|
||||||
|
operationArea,
|
||||||
|
descriptionArea
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
inlineContainerEl.appendChild(radioEl);
|
inlineContainerEl.appendChild(radioEl);
|
||||||
@@ -114,7 +146,12 @@ const renderInputArea = (entry, operationArea, descriptionArea) => {
|
|||||||
inputEl.placeholder = entry.placeHolder;
|
inputEl.placeholder = entry.placeHolder;
|
||||||
inputEl.id = entry.id;
|
inputEl.id = entry.id;
|
||||||
inputEl.addEventListener("change", async (event) => {
|
inputEl.addEventListener("change", async (event) => {
|
||||||
const result = await entry.callbackFn(event.target.value);
|
const result = await entry.callbackFn(
|
||||||
|
event.target.value,
|
||||||
|
inputEl,
|
||||||
|
operationArea,
|
||||||
|
descriptionArea
|
||||||
|
);
|
||||||
const success = result.valid;
|
const success = result.valid;
|
||||||
if (success) {
|
if (success) {
|
||||||
showToast(entry);
|
showToast(entry);
|
||||||
@@ -250,22 +287,6 @@ const renderNormalSettingsItem = (entry, formEl) => {
|
|||||||
// createOnLeaveEvtListener(channel, evtListener);
|
// createOnLeaveEvtListener(channel, evtListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
const setDisableStatus = (el, isDisable, hint = null) => {
|
|
||||||
if (isDisable) {
|
|
||||||
el.classList.add("ase-operation-area-disabled");
|
|
||||||
if (hint) {
|
|
||||||
el.setAttribute("data-bs-toggle", "tooltip");
|
|
||||||
el.setAttribute("data-bs-placement", "top");
|
|
||||||
el.setAttribute("data-bs-title", hint);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
el.setAttribute("data-bs-toggle", "");
|
|
||||||
el.setAttribute("data-bs-placement", "");
|
|
||||||
el.setAttribute("data-bs-title", "");
|
|
||||||
el.classList.remove("ase-operation-area-disabled");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (entry.PLSRequired) {
|
if (entry.PLSRequired) {
|
||||||
if (!global.__HUGO_AURA__.plsStats.connected) {
|
if (!global.__HUGO_AURA__.plsStats.connected) {
|
||||||
setDisableStatus(entryOperationArea, true, "连接至 PLS 以继续");
|
setDisableStatus(entryOperationArea, true, "连接至 PLS 以继续");
|
||||||
@@ -285,6 +306,19 @@ const renderNormalSettingsItem = (entry, formEl) => {
|
|||||||
const isShow = entry.auraIf();
|
const isShow = entry.auraIf();
|
||||||
if (!isShow) entryContainerEl.classList.add("aura-settings-entry-hidden");
|
if (!isShow) entryContainerEl.classList.add("aura-settings-entry-hidden");
|
||||||
|
|
||||||
|
const updateDisableStatus = () => {
|
||||||
|
const isDisabledRet = entry.auraDisable();
|
||||||
|
setDisableStatus(
|
||||||
|
entryOperationArea,
|
||||||
|
isDisabledRet.value,
|
||||||
|
isDisabledRet.tooltip
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (entry.auraDisable) {
|
||||||
|
updateDisableStatus();
|
||||||
|
}
|
||||||
|
|
||||||
if (entry.associateVal) {
|
if (entry.associateVal) {
|
||||||
const evtListener = (event) => {
|
const evtListener = (event) => {
|
||||||
if (!entry.associateVal.includes(event.detail.path.join("."))) return;
|
if (!entry.associateVal.includes(event.detail.path.join("."))) return;
|
||||||
@@ -293,6 +327,10 @@ const renderNormalSettingsItem = (entry, formEl) => {
|
|||||||
isShow
|
isShow
|
||||||
? cls.remove("aura-settings-entry-hidden")
|
? cls.remove("aura-settings-entry-hidden")
|
||||||
: cls.add("aura-settings-entry-hidden");
|
: cls.add("aura-settings-entry-hidden");
|
||||||
|
|
||||||
|
if (entry.auraDisable) {
|
||||||
|
updateDisableStatus();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const channel = entry.PLSRequired
|
const channel = entry.PLSRequired
|
||||||
? "onPLSConfigUpdate"
|
? "onPLSConfigUpdate"
|
||||||
@@ -378,7 +416,9 @@ const settingsRenderer = (pendingEl, settingsObj) => {
|
|||||||
}
|
}
|
||||||
pendingEl.appendChild(formEl);
|
pendingEl.appendChild(formEl);
|
||||||
|
|
||||||
global.__HUGO_AURA_GLOBAL__.utils.refreshBsTooltip();
|
global.__HUGO_AURA_GLOBAL__.utils.refreshBsTooltip(
|
||||||
|
".aura-settings-entry-property-icon"
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { settingsRenderer };
|
module.exports = { settingsRenderer };
|
||||||
|
|||||||
@@ -4,16 +4,14 @@
|
|||||||
|
|
||||||
/* Util: BootStrap Tooltip Ctrl */
|
/* Util: BootStrap Tooltip Ctrl */
|
||||||
let tooltipTriggerCache = null;
|
let tooltipTriggerCache = null;
|
||||||
const refreshBsTooltip = () => {
|
const refreshBsTooltip = (selector = '[data-bs-toggle="tooltip"]') => {
|
||||||
if (tooltipTriggerCache) {
|
if (tooltipTriggerCache) {
|
||||||
[...tooltipTriggerCache].map((el) =>
|
[...tooltipTriggerCache].map((el) =>
|
||||||
bootstrap.Tooltip.getInstance(el).disable()
|
bootstrap.Tooltip.getInstance(el).disable()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const tooltipTriggerList = document.querySelectorAll(
|
const tooltipTriggerList = document.querySelectorAll(selector);
|
||||||
'[data-bs-toggle="tooltip"]'
|
|
||||||
);
|
|
||||||
tooltipTriggerCache = tooltipTriggerList;
|
tooltipTriggerCache = tooltipTriggerList;
|
||||||
[...tooltipTriggerList].map(
|
[...tooltipTriggerList].map(
|
||||||
(tooltipTriggerEl) => new bootstrap.Tooltip(tooltipTriggerEl)
|
(tooltipTriggerEl) => new bootstrap.Tooltip(tooltipTriggerEl)
|
||||||
|
|||||||
@@ -272,14 +272,14 @@
|
|||||||
status: "dead",
|
status: "dead",
|
||||||
authToken: "66ccff0d000721114514191981023333",
|
authToken: "66ccff0d000721114514191981023333",
|
||||||
};
|
};
|
||||||
const isPlsFolderExists = (
|
|
||||||
await global.ipcRenderer.invoke(`${IPC_METHOD_BASE}.getPlsBinExists`)
|
|
||||||
).data.isExists;
|
|
||||||
updatedPlsStats.installed = isPlsFolderExists;
|
|
||||||
} else {
|
} else {
|
||||||
updatedPlsStats = curPlsStats.data;
|
updatedPlsStats = curPlsStats.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isPlsFolderExists = (
|
||||||
|
await global.ipcRenderer.invoke(`${IPC_METHOD_BASE}.getPlsBinExists`)
|
||||||
|
).data.isExists;
|
||||||
|
updatedPlsStats.installed = isPlsFolderExists;
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
global.__HUGO_AURA__.plsStats = updatedPlsStats;
|
global.__HUGO_AURA__.plsStats = updatedPlsStats;
|
||||||
console.debug(
|
console.debug(
|
||||||
@@ -328,5 +328,7 @@
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
onSetup();
|
setTimeout(() => {
|
||||||
|
onSetup();
|
||||||
|
}, 1500);
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -7,11 +7,48 @@
|
|||||||
<div class="aura-config-page-app-bar" style="-webkit-app-region: drag">
|
<div class="aura-config-page-app-bar" style="-webkit-app-region: drag">
|
||||||
<div
|
<div
|
||||||
onclick="global.__HUGO_AURA_UI_FUNCTIONS__.config.handleNavBack()"
|
onclick="global.__HUGO_AURA_UI_FUNCTIONS__.config.handleNavBack()"
|
||||||
style="-webkit-app-region: no-drag; z-index: 2000"
|
style="-webkit-app-region: no-drag; z-index: 2000; margin-right: 0.1rem"
|
||||||
>
|
>
|
||||||
<i class="iconfont"></i>
|
<i class="iconfont"></i>
|
||||||
|
<!-- Chevron Left Icon -->
|
||||||
</div>
|
</div>
|
||||||
<p>雨光之环</p>
|
<p>雨光之环</p>
|
||||||
|
<div class="aura-config-page-app-bar-hr-vertical"></div>
|
||||||
|
<div
|
||||||
|
onclick="global.__HUGO_AURA_UI_FUNCTIONS__.config.handleNavHome()"
|
||||||
|
style="-webkit-app-region: no-drag; z-index: 2000; margin-left: 6px"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="21"
|
||||||
|
height="21"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
class="iconfont"
|
||||||
|
style="margin-top: -1.5px"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill="currentColor"
|
||||||
|
d="M6 19h3.692v-5.884h4.616V19H18v-9l-6-4.538L6 10zm-1 1V9.5l7-5.288L19 9.5V20h-5.692v-5.884h-2.616V20zm7-7.77"
|
||||||
|
stroke-width="0.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div class="aura-config-page-app-bar-spacer"></div>
|
||||||
|
<div
|
||||||
|
onclick="global.__HUGO_AURA_UI_FUNCTIONS__.config.minimizeWindow()"
|
||||||
|
style="-webkit-app-region: no-drag; z-index: 2000"
|
||||||
|
>
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<!-- Minimize Icon -->
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
onclick="global.__HUGO_AURA_UI_FUNCTIONS__.config.closeWindow()"
|
||||||
|
style="-webkit-app-region: no-drag; z-index: 2000; margin-left: 0.5rem"
|
||||||
|
>
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<!-- Failed / Cancel Icon -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,22 @@ global.__HUGO_AURA_UI_REACTIVES__.config = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
global.__HUGO_AURA_UI_FUNCTIONS__.config = {
|
global.__HUGO_AURA_UI_FUNCTIONS__.config = {
|
||||||
|
closeWindow: async () => {
|
||||||
|
if (global.__HUGO_AURA_UI_REACTIVES__.config.isConfigPendingWrite) {
|
||||||
|
await global.__HUGO_AURA_UI_FUNCTIONS__.config.handleSaveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
global.ipcRenderer.send("$aura.base.closeWindow", {
|
||||||
|
targetWindowKey: "assistant",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
minimizeWindow: () => {
|
||||||
|
global.ipcRenderer.send("$aura.base.minimizeWindow", {
|
||||||
|
targetWindowKey: "assistant",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
handleNavBack: () => {
|
handleNavBack: () => {
|
||||||
if (global.__HUGO_AURA_UI_REACTIVES__.config.isInSubPage) {
|
if (global.__HUGO_AURA_UI_REACTIVES__.config.isInSubPage) {
|
||||||
const acsDialogAreaEl = document.getElementsByClassName(
|
const acsDialogAreaEl = document.getElementsByClassName(
|
||||||
@@ -30,6 +46,19 @@ global.__HUGO_AURA_UI_FUNCTIONS__.config = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleNavHome: async () => {
|
||||||
|
if (global.__HUGO_AURA_UI_REACTIVES__.config.isConfigPendingWrite) {
|
||||||
|
global.__HUGO_AURA_UI_FUNCTIONS__.config.handleSaveConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
global.__HUGO_AURA_UI_FUNCTIONS__.config.hideConfigPage();
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
const onLeaveEvent = new CustomEvent("onCurConfigPageLeave");
|
||||||
|
document.dispatchEvent(onLeaveEvent);
|
||||||
|
}, 500);
|
||||||
|
},
|
||||||
|
|
||||||
hideConfigPage: async () => {
|
hideConfigPage: async () => {
|
||||||
const defaultHeader = document.getElementsByClassName(
|
const defaultHeader = document.getElementsByClassName(
|
||||||
"index__header__16DmR2a5"
|
"index__header__16DmR2a5"
|
||||||
|
|||||||
@@ -19,6 +19,11 @@
|
|||||||
color: rgba(0, 0, 0, 0.8);
|
color: rgba(0, 0, 0, 0.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aura-config-page-header-area.color-reverse
|
||||||
|
.aura-config-page-app-bar-hr-vertical {
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
|
||||||
.aura-config-page-header-area .iconfont {
|
.aura-config-page-header-area .iconfont {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
}
|
}
|
||||||
@@ -33,7 +38,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.aura-config-page-header-area p {
|
.aura-config-page-header-area p {
|
||||||
margin-top: -1px;
|
margin-top: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.aura-config-page-header-area.header-collapsed {
|
.aura-config-page-header-area.header-collapsed {
|
||||||
@@ -48,3 +53,16 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aura-config-page-app-bar-spacer {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aura-config-page-app-bar-hr-vertical {
|
||||||
|
position: relative;
|
||||||
|
margin-left: 8px;
|
||||||
|
width: 1px;
|
||||||
|
background: rgba(255, 255, 255, 0.5);
|
||||||
|
height: 12px;
|
||||||
|
transition: background 0.5s;
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,6 +32,14 @@
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(async (response) => {
|
.then(async (response) => {
|
||||||
|
if (response.status !== 200) {
|
||||||
|
resolve({
|
||||||
|
success: true,
|
||||||
|
data: null,
|
||||||
|
status: response.status
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const parsedData = await response.json();
|
const parsedData = await response.json();
|
||||||
|
|
||||||
resolve({
|
resolve({
|
||||||
|
|||||||
@@ -96,12 +96,9 @@ const functions = {
|
|||||||
|
|
||||||
const handleExit = async () => {
|
const handleExit = async () => {
|
||||||
const result = await awaitCompletePromise;
|
const result = await awaitCompletePromise;
|
||||||
console.debug(result);
|
|
||||||
if (result) {
|
if (result) {
|
||||||
console.debug("ret true");
|
|
||||||
return { valid: true };
|
return { valid: true };
|
||||||
} else {
|
} else {
|
||||||
console.debug("ret false");
|
|
||||||
const inputEl = document.getElementById("auraSettingsPasswd");
|
const inputEl = document.getElementById("auraSettingsPasswd");
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
inputEl.value = "";
|
inputEl.value = "";
|
||||||
@@ -155,6 +152,27 @@ const functions = {
|
|||||||
|
|
||||||
return await handleExit();
|
return await handleExit();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getCurAccessMethodCount: () => {
|
||||||
|
const fallbackMethods =
|
||||||
|
global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod
|
||||||
|
.fallbackAccessMethods;
|
||||||
|
const fallbackMethodsKeys = Object.keys(fallbackMethods);
|
||||||
|
|
||||||
|
let enabledCount = 0;
|
||||||
|
|
||||||
|
for (const method of fallbackMethodsKeys) {
|
||||||
|
if (fallbackMethods[method]) {
|
||||||
|
enabledCount += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod.showEntryIcon) {
|
||||||
|
enabledCount += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return enabledCount;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const auraSettings = [
|
const auraSettings = [
|
||||||
@@ -170,8 +188,6 @@ const auraSettings = [
|
|||||||
description: "启用后, Aura 设置 UI 需要输入密码才可访问",
|
description: "启用后, Aura 设置 UI 需要输入密码才可访问",
|
||||||
restart: false,
|
restart: false,
|
||||||
reload: false,
|
reload: false,
|
||||||
tip: true,
|
|
||||||
tipTitle: "启用访问密码将自动加密配置文件",
|
|
||||||
associateVal: null,
|
associateVal: null,
|
||||||
auraIf: () => true,
|
auraIf: () => true,
|
||||||
defaultValue: false,
|
defaultValue: false,
|
||||||
@@ -288,8 +304,142 @@ const auraSettings = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
categoryName: "外观",
|
categoryName: "访问方式",
|
||||||
child: [],
|
child: [
|
||||||
|
{
|
||||||
|
index: 0,
|
||||||
|
id: "showEntryIcon",
|
||||||
|
type: "switch",
|
||||||
|
name: "显示 HugoAura 设置图标",
|
||||||
|
description: "控制 HugoAura 设置入口图标在管家首页的显示状态",
|
||||||
|
restart: false,
|
||||||
|
reload: true,
|
||||||
|
tip: true,
|
||||||
|
tipTitle: "禁用后, HugoAura 图标将不会出现在主页右上角",
|
||||||
|
associateVal: [
|
||||||
|
"auraSettings.uiAccessMethod.fallbackAccessMethods.hotkey",
|
||||||
|
"auraSettings.uiAccessMethod.fallbackAccessMethods.touch",
|
||||||
|
],
|
||||||
|
auraIf: () => {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
auraDisable: () => {
|
||||||
|
const fallbackMethods =
|
||||||
|
global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod
|
||||||
|
.fallbackAccessMethods;
|
||||||
|
const fallbackMethodsKeys = Object.keys(fallbackMethods);
|
||||||
|
let anyEnabled = false;
|
||||||
|
|
||||||
|
for (const method of fallbackMethodsKeys) {
|
||||||
|
if (fallbackMethods[method]) {
|
||||||
|
anyEnabled = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
value: !anyEnabled,
|
||||||
|
tooltip: !anyEnabled ? "至少启用一个备选访问方式" : "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
defaultValue: false,
|
||||||
|
valueGetter: () => {
|
||||||
|
return global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod
|
||||||
|
.showEntryIcon;
|
||||||
|
},
|
||||||
|
callbackFn: async (newVal) => {
|
||||||
|
if (typeof newVal !== "boolean") return;
|
||||||
|
global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod.showEntryIcon =
|
||||||
|
newVal;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 1,
|
||||||
|
id: "allowHotkeyAccess",
|
||||||
|
type: "switch",
|
||||||
|
name: "使用快捷键打开 HugoAura 设置 UI",
|
||||||
|
description:
|
||||||
|
"启用后, 在管家首页按下 Ctrl + Shift + A 以打开 HugoAura 设置",
|
||||||
|
restart: false,
|
||||||
|
reload: true,
|
||||||
|
associateVal: [
|
||||||
|
"auraSettings.uiAccessMethod.showEntryIcon",
|
||||||
|
"auraSettings.uiAccessMethod.fallbackAccessMethods.hotkey",
|
||||||
|
"auraSettings.uiAccessMethod.fallbackAccessMethods.touch",
|
||||||
|
],
|
||||||
|
auraIf: () => {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
auraDisable: () => {
|
||||||
|
const enableCount = functions.getCurAccessMethodCount();
|
||||||
|
if (
|
||||||
|
enableCount < 2 &&
|
||||||
|
!global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod
|
||||||
|
.showEntryIcon &&
|
||||||
|
global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod
|
||||||
|
.fallbackAccessMethods.hotkey
|
||||||
|
) {
|
||||||
|
return { value: true, tooltip: "无法禁用所有访问方式" };
|
||||||
|
} else {
|
||||||
|
return { value: false };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
defaultValue: false,
|
||||||
|
valueGetter: () => {
|
||||||
|
return global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod
|
||||||
|
.fallbackAccessMethods.hotkey;
|
||||||
|
},
|
||||||
|
callbackFn: async (newVal) => {
|
||||||
|
if (typeof newVal !== "boolean") return;
|
||||||
|
global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod.fallbackAccessMethods.hotkey =
|
||||||
|
newVal;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
index: 2,
|
||||||
|
id: "allowTouchAccess",
|
||||||
|
type: "switch",
|
||||||
|
name: "使用触摸手势打开 HugoAura 设置 UI",
|
||||||
|
description:
|
||||||
|
"启用后, 在管家首页连击 7 次右上角信息栏 ( i ) 中的版本号区域以打开 HugoAura 设置",
|
||||||
|
restart: false,
|
||||||
|
reload: true,
|
||||||
|
tip: true,
|
||||||
|
tipTitle: "请在 10 秒钟内完成连击操作, 否则计时器将被重置",
|
||||||
|
associateVal: [
|
||||||
|
"auraSettings.uiAccessMethod.showEntryIcon",
|
||||||
|
"auraSettings.uiAccessMethod.fallbackAccessMethods.hotkey",
|
||||||
|
"auraSettings.uiAccessMethod.fallbackAccessMethods.touch",
|
||||||
|
],
|
||||||
|
auraIf: () => {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
auraDisable: () => {
|
||||||
|
const enableCount = functions.getCurAccessMethodCount();
|
||||||
|
if (
|
||||||
|
enableCount < 2 &&
|
||||||
|
!global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod
|
||||||
|
.showEntryIcon &&
|
||||||
|
global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod
|
||||||
|
.fallbackAccessMethods.touch
|
||||||
|
) {
|
||||||
|
return { value: true, tooltip: "无法禁用所有访问方式" };
|
||||||
|
} else {
|
||||||
|
return { value: false };
|
||||||
|
}
|
||||||
|
},
|
||||||
|
defaultValue: false,
|
||||||
|
valueGetter: () => {
|
||||||
|
return global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod
|
||||||
|
.fallbackAccessMethods.touch;
|
||||||
|
},
|
||||||
|
callbackFn: async (newVal) => {
|
||||||
|
if (typeof newVal !== "boolean") return;
|
||||||
|
global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod.fallbackAccessMethods.touch =
|
||||||
|
newVal;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
transition: opacity 0.25s;
|
transition: opacity 0.25s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aura-header-icon.aura-header-icon-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.aura-header-icon:hover {
|
.aura-header-icon:hover {
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,54 @@
|
|||||||
global.__HUGO_AURA_UI_FUNCTIONS__.headerIcon = {
|
global.__HUGO_AURA_UI_FUNCTIONS__.headerIcon = {
|
||||||
showAuraConfig: () => {
|
showAuraConfig: () => {
|
||||||
window.__HUGO_AURA_LOADER__["Aura.UI.Assistant.Config"].active = true;
|
if (global.__HUGO_AURA_LOADER__["Aura.UI.Assistant.Config"].active) return;
|
||||||
|
global.__HUGO_AURA_LOADER__["Aura.UI.Assistant.Config"].active = true;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
(() => {
|
||||||
|
let clickCounter = 0;
|
||||||
|
let clickTimeout = null;
|
||||||
|
|
||||||
|
const onMounted = () => {
|
||||||
|
if (!global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod.showEntryIcon) {
|
||||||
|
const iconEl = document.getElementsByClassName("aura-header-icon")[0];
|
||||||
|
iconEl.classList.add("aura-header-icon-hidden");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod
|
||||||
|
.fallbackAccessMethods.hotkey
|
||||||
|
) {
|
||||||
|
document.addEventListener("keydown", (event) => {
|
||||||
|
if (event.ctrlKey && event.shiftKey && event.key === "A") {
|
||||||
|
global.__HUGO_AURA_UI_FUNCTIONS__.headerIcon.showAuraConfig();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod
|
||||||
|
.fallbackAccessMethods.touch
|
||||||
|
) {
|
||||||
|
const mesModelEl = document.getElementsByClassName(
|
||||||
|
"index__mes-modal__2hRouc6M"
|
||||||
|
)[0];
|
||||||
|
const verEl = mesModelEl.children[0];
|
||||||
|
verEl.onclick = () => {
|
||||||
|
clickCounter += 1;
|
||||||
|
if (clickCounter >= 7) {
|
||||||
|
global.__HUGO_AURA_UI_FUNCTIONS__.headerIcon.showAuraConfig();
|
||||||
|
clickCounter = 0;
|
||||||
|
if (clickTimeout) {
|
||||||
|
clearTimeout(clickTimeout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
clickTimeout = setTimeout(() => {
|
||||||
|
clickCounter = 0;
|
||||||
|
}, 10000);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted();
|
||||||
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user