mirror of
https://github.com/HugoAura/Seewo-HugoAura.git
synced 2026-06-20 23:14:28 +08:00
Compare commits
1 Commits
v0.1.1-bet
...
vAutoBuild
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef0e39dd8c |
2
.github/ISSUE_TEMPLATE/other.yml
vendored
2
.github/ISSUE_TEMPLATE/other.yml
vendored
@@ -16,5 +16,5 @@ body:
|
||||
attributes:
|
||||
label: 提交前请确认 / Confirm before submit
|
||||
options:
|
||||
- label: 请勿利用此 Issue 类型进行闲聊 / 灌水, 如需闲聊, 可移步至 HugoAura 社区 (forum.aurax.cc)
|
||||
- label: 请勿利用此 Issue 类型进行灌水 / 闲聊, 如果您有相关需求, 可留意后续 HugoAura 的论坛 / 用户讨论群开放情况
|
||||
required: true
|
||||
|
||||
13
.github/workflows/pack.yml
vendored
13
.github/workflows/pack.yml
vendored
@@ -125,31 +125,28 @@ jobs:
|
||||
echo "[DEBUG] Files in <Working DIR>/Artifacts directory:"
|
||||
ls -la Artifacts/
|
||||
|
||||
- name: Get commit hash & build time
|
||||
- name: Get short commit hash
|
||||
run: |
|
||||
cd ./HugoAura-Code
|
||||
SHORT_HASH=$(git rev-parse --short=7 HEAD)
|
||||
FULL_HASH=$(git rev-parse HEAD)
|
||||
echo "SHORT_HASH=$SHORT_HASH" >> $GITHUB_ENV
|
||||
echo "FULL_HASH=$FULL_HASH" >> $GITHUB_ENV
|
||||
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
|
||||
|
||||
- name: Create release content
|
||||
run: |
|
||||
cat > rel_msg.txt << 'EOF'
|
||||
cat > rel_msg.txt << EOF
|
||||
## 这是 HugoAura 的 CI 自动构建版本
|
||||
|
||||
### 版本类型: 🔁 自动构建版
|
||||
|
||||
### 版本号: `vAutoBuild-${{ env.SHORT_HASH }}`
|
||||
|
||||
### 对应 Commit: [`${{ env.SHORT_HASH }}`](https://github.com/HugoAura/Seewo-HugoAura/commit/${{ env.FULL_HASH }})
|
||||
### 对应 Commit: [`${{ env.SHORT_HASH }}`](https://github.com/HugoAura/Seewo-HugoAura/commit/${{ env.GITHUB_SHA }})
|
||||
|
||||
---
|
||||
|
||||
### ⚠ 注意: CI 自动构建版本可能不稳定 / 存在较多 Bug, 更新时请留意
|
||||
|
||||
#### 🕘 构建时间: ${{ env.BUILDTIME }}
|
||||
**🕘 构建时间: ${{ env.BUILDTIME }}**
|
||||
EOF
|
||||
|
||||
- name: Upload patched ASAR
|
||||
@@ -173,6 +170,6 @@ jobs:
|
||||
prerelease: true
|
||||
generate_release_notes: false
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
files: |
|
||||
file: |
|
||||
Artifacts/app-patched.asar
|
||||
Artifacts/aura.zip
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<h1 align="center">HugoAura</h1>
|
||||
<h4 align="center">下一代希沃管家注入式修改方案</h4>
|
||||
<div align="center">
|
||||
<a href="https://github.com/HugoAura/HugoAura">首页</a> · <a href="https://hugo.aurax.cc/about">关于</a> · <a href="https://github.com/HugoAura/HugoAura/wiki">文档</a> · <a href="https://github.com/HugoAura/HugoAura/issues">反馈</a> · <a href="https://forum.aurax.cc/">社区</a>
|
||||
<a href="https://github.com/HugoAura/HugoAura">首页</a> · <a href="https://hugoaura.org/about">关于</a> · <a href="https://github.com/HugoAura/HugoAura/wiki">文档</a> · <a href="https://github.com/HugoAura/HugoAura/issues">反馈</a>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "HugoAura",
|
||||
"version": "0.1.1-beta",
|
||||
"version": "0.1.1-pre-IV",
|
||||
"description": "Aura for SeewoHugo",
|
||||
"main": "app.asar/main.js",
|
||||
"dependencies": {},
|
||||
|
||||
@@ -77,7 +77,6 @@ const buildIpcMain = (electron) => {
|
||||
};
|
||||
|
||||
const { applyBaseIpcHandler } = require("./ipcModules/baseIpcHandler");
|
||||
const { applyDebugIpcHandler } = require("./ipcModules/debugIpcHandler");
|
||||
const { applyConfigIpcHandler } = require("./ipcModules/configIpcHandler");
|
||||
const { applyFsIpcHandler } = require("./ipcModules/fsIpcHandler");
|
||||
const { applyPlsIpcHandler } = require("./ipcModules/plsIpcHandler");
|
||||
@@ -88,7 +87,6 @@ const buildIpcMain = (electron) => {
|
||||
});
|
||||
|
||||
applyBaseIpcHandler(ipcMain);
|
||||
applyDebugIpcHandler(ipcMain);
|
||||
applyConfigIpcHandler(ipcMain);
|
||||
applyFsIpcHandler(ipcMain);
|
||||
applyPlsIpcHandler(ipcMain);
|
||||
|
||||
@@ -1,73 +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();
|
||||
}
|
||||
);
|
||||
|
||||
ipcMain.handle(`${methodBase}.getAuraDirAsync`, (_evt, _arg) => {
|
||||
return {
|
||||
success: true,
|
||||
data: global.__HUGO_AURA__.auraDir,
|
||||
};
|
||||
});
|
||||
|
||||
ipcMain.on(`${methodBase}.getAuraDirSync`, (event, _arg) => {
|
||||
event.returnValue = {
|
||||
success: true,
|
||||
data: global.__HUGO_AURA__.auraDir,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = { applyBaseIpcHandler };
|
||||
// @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 };
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
// @ts-check
|
||||
|
||||
const __SCOPE = "main";
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import("electron").IpcMain} ipcMain
|
||||
*/
|
||||
const applyDebugIpcHandler = (ipcMain) => {
|
||||
const methodBase = "$aura.debug";
|
||||
};
|
||||
|
||||
module.exports = { applyDebugIpcHandler };
|
||||
@@ -418,7 +418,7 @@ const applyPlsIpcHandler = (ipcMain) => {
|
||||
*/
|
||||
(_event, arg) => {
|
||||
ipcMain.send(
|
||||
"auraWsKeepAlive",
|
||||
"desktopAssistant",
|
||||
`${methodBase}.ws.post.onReqSendMsg`,
|
||||
arg
|
||||
);
|
||||
@@ -568,7 +568,7 @@ const applyPlsIpcHandler = (ipcMain) => {
|
||||
status: "Already",
|
||||
};
|
||||
} else {
|
||||
ipcMain.send("auraWsKeepAlive", `${methodBase}.retryPlsConnect`, arg);
|
||||
ipcMain.send("desktopAssistant", `${methodBase}.retryPlsConnect`, arg);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
|
||||
@@ -8,10 +8,7 @@ const util = require("util");
|
||||
* @param {import("../aura/types/main/core").WindowName} windowName
|
||||
*/
|
||||
const initLogger = (windowName) => {
|
||||
const logDir = path.join(global.__HUGO_AURA__.auraDir, "logs");
|
||||
|
||||
global.__HUGO_AURA__.logDir = logDir;
|
||||
|
||||
const logDir = path.join(os.homedir(), "Documents", "HugoAura", "logs");
|
||||
if (!fs.existsSync(logDir)) {
|
||||
fs.mkdirSync(logDir, { recursive: true });
|
||||
}
|
||||
@@ -67,22 +64,25 @@ const initLogger = (windowName) => {
|
||||
console.error("[CRITICAL] UNCAUGHT EXCEPTION:", err);
|
||||
});
|
||||
|
||||
console.log("[HugoAura / Logger] Logger initialized. Log file:", logFile);
|
||||
console.log(
|
||||
"[HugoAura / Logger] Logger initialized. Log file:",
|
||||
logFile
|
||||
);
|
||||
};
|
||||
|
||||
const cleanupOldLogs = (logDir) => {
|
||||
try {
|
||||
const files = fs.readdirSync(logDir);
|
||||
const now = new Date();
|
||||
const daysAgo = new Date(now.getTime() - 15 * 24 * 60 * 60 * 1000);
|
||||
const sevenDaysAgo = new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000);
|
||||
|
||||
files.forEach((file) => {
|
||||
if (file.endsWith(".log")) {
|
||||
const filePath = path.join(logDir, file);
|
||||
const stats = fs.statSync(filePath);
|
||||
|
||||
// 如果文件创建时间超过两周, 则删除
|
||||
if (stats.birthtime < daysAgo) {
|
||||
// 如果文件创建时间超过 30 天, 则删除
|
||||
if (stats.birthtime < sevenDaysAgo) {
|
||||
fs.unlinkSync(filePath);
|
||||
console.log(
|
||||
`[HugoAura / Logger / Cleanup] Cleaned log file: ${file}`
|
||||
@@ -91,10 +91,7 @@ const cleanupOldLogs = (logDir) => {
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(
|
||||
"[HugoAura / Logger / Cleanup] Unexpected error occurred cleaning log file:",
|
||||
error
|
||||
);
|
||||
console.error("[HugoAura / Logger / Cleanup] Unexpected error occurred cleaning log file:", error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class WindowHooksManager {
|
||||
|
||||
const hooksPath = path.join(__dirname, "../../../aura/mainProcess/hooks");
|
||||
|
||||
/** @type {import("../../types/main/core").UIHooksMap} */
|
||||
/** @type {import("../../types/main/core").HooksMap} */
|
||||
const hooks = new Map();
|
||||
|
||||
try {
|
||||
@@ -55,9 +55,6 @@ class WindowHooksManager {
|
||||
browserWindowInstance
|
||||
) {
|
||||
const stripWindowName = windowName.split("_")[0];
|
||||
|
||||
if (!global.__HUGO_AURA__.windowHooks) return;
|
||||
|
||||
if (!global.__HUGO_AURA__.windowHooks.has(stripWindowName)) {
|
||||
console.log(
|
||||
`[HugoAura / Init / WDH] Window ${windowName} has no corresponding main process hooks, ignoring...`
|
||||
|
||||
@@ -69,7 +69,7 @@ const deepMerge = (target, source) => {
|
||||
|
||||
class ConfigManager {
|
||||
constructor() {
|
||||
this.configDir = global.__HUGO_AURA__.auraDir;
|
||||
this.configDir = path.join(os.homedir(), "Documents", "HugoAura");
|
||||
this.configPath = path.join(this.configDir, "config.json");
|
||||
this.encConfigPath = path.join(this.configDir, ".cache_2eafc8d0.dat"); // (雾
|
||||
/* ↑ 不使用 .tmp 扩展名, 不然容易真被清理了 */
|
||||
@@ -78,10 +78,10 @@ class ConfigManager {
|
||||
this.isConfigReadFailed = false;
|
||||
this.side = "unknown";
|
||||
|
||||
if (fs.existsSync(this.encConfigPath)) {
|
||||
this.useEncConfig = true;
|
||||
} else {
|
||||
if (fs.existsSync(this.configPath)) {
|
||||
this.useEncConfig = false;
|
||||
} else {
|
||||
this.useEncConfig = true;
|
||||
}
|
||||
|
||||
if (global.__HUGO_AURA_EVENT_BUS__) {
|
||||
@@ -95,38 +95,6 @@ class ConfigManager {
|
||||
}
|
||||
}
|
||||
|
||||
migrateOldConfigFile() {
|
||||
if (this.configDir === path.join(os.homedir(), "Documents", "HugoAura")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const oldConfigPath = path.join(
|
||||
os.homedir(),
|
||||
"Documents",
|
||||
"HugoAura",
|
||||
"config.json"
|
||||
);
|
||||
const oldEncConfigPath = path.join(
|
||||
os.homedir(),
|
||||
"Documents",
|
||||
"HugoAura",
|
||||
".cache_2eafc8d0.dat"
|
||||
);
|
||||
|
||||
if (fs.existsSync(oldConfigPath)) {
|
||||
fs.copyFileSync(oldConfigPath, this.configPath);
|
||||
fs.unlinkSync(oldConfigPath);
|
||||
} else if (fs.existsSync(oldEncConfigPath)) {
|
||||
fs.copyFileSync(oldEncConfigPath, this.encConfigPath);
|
||||
fs.unlinkSync(oldEncConfigPath);
|
||||
this.useEncConfig = true;
|
||||
}
|
||||
|
||||
console.log(
|
||||
`[HugoAura / Config] Moved old config file to ${this.configDir}`
|
||||
);
|
||||
}
|
||||
|
||||
getHugoAuraConfigPath() {
|
||||
return path.dirname(
|
||||
this.useEncConfig ? this.encConfigPath : this.configPath
|
||||
|
||||
@@ -26,23 +26,11 @@
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"ssa": {
|
||||
"ux": {
|
||||
"easiAssistant": {
|
||||
"autoHide": false,
|
||||
"notDisplay": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"auraSettings": {
|
||||
"settingsPasswordEnabled": false,
|
||||
"settingsPasswordWithSalt": "32703D292460CC9A3B867494D6AD9A8E4A3ADF0FAA4D6867BC4D412CC3927D02E47C6D0B1763BB53E57B2241C6193433561CDA09D7C48CA03983072B876F0965",
|
||||
"encryptConfig": false,
|
||||
"appearance": {
|
||||
"appBar": {
|
||||
"actionBtnsOnRight": false
|
||||
}
|
||||
},
|
||||
"appearance": {},
|
||||
"uiAccessMethod": {
|
||||
"showEntryIcon": true,
|
||||
"fallbackAccessMethods": {
|
||||
|
||||
@@ -6,12 +6,7 @@ const { exec, execSync } = require("child_process");
|
||||
|
||||
const LOG_PREFIX = "[HugoAura / Init / Reg";
|
||||
const LOG_PREFIX_FUNC = "[HugoAura / Reg";
|
||||
const AURA_REGISTRY_PATH = [
|
||||
"HKEY_USERS",
|
||||
".DEFAULT",
|
||||
"SOFTWARE",
|
||||
"HugoAura",
|
||||
].join("\\");
|
||||
const AURA_REGISTRY_PATH = ["HKEY_USERS", ".DEFAULT", "SOFTWARE", "HugoAura"].join("\\");
|
||||
|
||||
class RegistryManager {
|
||||
/**
|
||||
@@ -346,27 +341,19 @@ class RegistryManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} keyPath
|
||||
* @param {string} relativePath
|
||||
* @param {string} keyName
|
||||
* @param {boolean | undefined} silent
|
||||
* @param {boolean} absolute
|
||||
* @param {any} regex
|
||||
* @returns {Promise<{ success: boolean, data: string | null, error: Error | null }>}
|
||||
*/
|
||||
async readRegKey(
|
||||
keyPath,
|
||||
keyName,
|
||||
silent = false,
|
||||
absolute = false,
|
||||
regex = null
|
||||
) {
|
||||
async readRegKey(relativePath, keyName, silent = false) {
|
||||
try {
|
||||
const { stdout } = await new Promise((resolve, reject) => {
|
||||
exec(
|
||||
[
|
||||
"reg",
|
||||
"query",
|
||||
absolute ? keyPath : [AURA_REGISTRY_PATH, keyPath].join("\\"),
|
||||
[AURA_REGISTRY_PATH, relativePath].join("\\"),
|
||||
"/v",
|
||||
`\"${keyName}\"`,
|
||||
].join(" "),
|
||||
@@ -380,12 +367,12 @@ class RegistryManager {
|
||||
|
||||
if (!silent) {
|
||||
console.debug(
|
||||
`${LOG_PREFIX_FUNC} / SUCCESS] Successfully read reg key ${keyPath}/${keyName}, stdout:`,
|
||||
`${LOG_PREFIX_FUNC} / SUCCESS] Successfully read reg key ${relativePath}/${keyName}, stdout:`,
|
||||
stdout
|
||||
);
|
||||
}
|
||||
|
||||
const match = regex ? stdout.match(regex) : stdout.match(/REG_SZ\s+(.+)/);
|
||||
const match = stdout.match(/REG_SZ\s+(.+)/);
|
||||
|
||||
if (!match) {
|
||||
console.warn(`${LOG_PREFIX} / WARN] Data not found in stdout`);
|
||||
@@ -403,7 +390,10 @@ class RegistryManager {
|
||||
error: null,
|
||||
};
|
||||
} catch (e) {
|
||||
console.error(`${LOG_PREFIX} / ERROR] Failed to read reg key, error:`, e);
|
||||
console.error(
|
||||
`${LOG_PREFIX} / ERROR] Failed to read reg key, error:`,
|
||||
e
|
||||
);
|
||||
return {
|
||||
success: false,
|
||||
data: null,
|
||||
@@ -413,26 +403,18 @@ class RegistryManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} keyPath
|
||||
* @param {string} relativePath
|
||||
* @param {string} keyName
|
||||
* @param {boolean | undefined} silent
|
||||
* @param {boolean} absolute
|
||||
* @param {any} regex
|
||||
* @returns {{ success: boolean, data: string | null, error: Error | null }}
|
||||
*/
|
||||
readRegKeySync(
|
||||
keyPath,
|
||||
keyName,
|
||||
silent = false,
|
||||
absolute = false,
|
||||
regex = null
|
||||
) {
|
||||
readRegKeySync(relativePath, keyName, silent = false) {
|
||||
try {
|
||||
const readResult = execSync(
|
||||
[
|
||||
"reg",
|
||||
"query",
|
||||
absolute ? keyPath : [AURA_REGISTRY_PATH, keyPath].join("\\"),
|
||||
[AURA_REGISTRY_PATH, relativePath].join("\\"),
|
||||
"/v",
|
||||
`\"${keyName}\"`,
|
||||
].join(" "),
|
||||
@@ -442,13 +424,11 @@ class RegistryManager {
|
||||
if (readResult) {
|
||||
if (!silent) {
|
||||
console.debug(
|
||||
`${LOG_PREFIX_FUNC} / SUCCESS] Successfully read reg key ${keyPath}/${keyName}, stdout:`,
|
||||
`${LOG_PREFIX_FUNC} / SUCCESS] Successfully read reg key ${relativePath}/${keyName}, stdout:`,
|
||||
readResult
|
||||
);
|
||||
}
|
||||
const match = regex
|
||||
? readResult.match(regex)
|
||||
: readResult.match(/REG_SZ\s+(.+)/);
|
||||
const match = readResult.match(/REG_SZ\s+(.+)/);
|
||||
|
||||
if (!match) {
|
||||
console.warn(`${LOG_PREFIX} / WARN] Data not found in stdout`);
|
||||
|
||||
2
src/aura/types/render/global.d.ts
vendored
2
src/aura/types/render/global.d.ts
vendored
@@ -8,7 +8,7 @@ interface AssistantHugoAuraGlobal extends HugoAuraGlobal {
|
||||
plsSettings: Record<any, any>;
|
||||
}
|
||||
|
||||
interface AuraWSKeepAliveWindowHugoAuraGlobal extends HugoAuraGlobal {
|
||||
interface DesktopAssistantHugoAuraGlobal extends HugoAuraGlobal {
|
||||
plsWs: WebSocket | null;
|
||||
plsStats: PLSStatus;
|
||||
}
|
||||
|
||||
1
src/aura/types/shared/global.d.ts
vendored
1
src/aura/types/shared/global.d.ts
vendored
@@ -14,7 +14,6 @@ interface GlobalHugoAuraInfo {
|
||||
fsTasks?: MainProcessOnlyVal<FSTasks>;
|
||||
hookedWindows?: MainProcessOnlyVal<HookedWindowsMap>;
|
||||
ipcInit?: MainProcessOnlyVal<boolean>;
|
||||
auraDir: MainProcessOnlyVal<string>;
|
||||
plsRules?: Record<any, any> | null;
|
||||
plsSettings?: Record<any, any> | null;
|
||||
plsStats?: PLSStatus | null;
|
||||
|
||||
@@ -170,23 +170,6 @@ const renderInputArea = (entry, operationArea, descriptionArea) => {
|
||||
operationArea.classList.add("ase-operation-area-expanded");
|
||||
return inputEl;
|
||||
}
|
||||
case "button": {
|
||||
const btnEl = document.createElement("button");
|
||||
btnEl.type = "button";
|
||||
btnEl.classList.add("btn");
|
||||
switch (entry.style) {
|
||||
case "outline":
|
||||
default:
|
||||
btnEl.classList.add("btn-outline-primary");
|
||||
break;
|
||||
}
|
||||
btnEl.innerHTML = entry.buttonContent;
|
||||
btnEl.onclick = entry.callbackFn;
|
||||
(async () => {
|
||||
descriptionArea.innerHTML = await entry.valueGetter();
|
||||
})();
|
||||
return btnEl;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
2
src/aura/ui/hookDefinitions/desktopAssistant.js
Normal file → Executable file
2
src/aura/ui/hookDefinitions/desktopAssistant.js
Normal file → Executable file
@@ -6,7 +6,7 @@
|
||||
const def = {
|
||||
targets: {},
|
||||
globalStyles: ["ui/css/global.css"],
|
||||
globalJS: ["ui/js/global.js", "ui/js/pageGlobal/desktopAssistant.js"],
|
||||
globalJS: ["ui/js/global.js", "ui/js/plsConnectionManager.js"],
|
||||
onLoaded: `
|
||||
console.log('[HugoAura / UI / Hooks / Desktop Assistant] Page loaded.');
|
||||
`,
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// @ts-check
|
||||
|
||||
(() => {
|
||||
const applyHideSettings = () => {
|
||||
if (global.__HUGO_AURA_CONFIG__.ssa.ux.easiAssistant.autoHide) {
|
||||
const minimizeBtnEl = document.getElementsByClassName(
|
||||
"index__button2__2mhwC3oY"
|
||||
)[0].children[0];
|
||||
// @ts-expect-error
|
||||
minimizeBtnEl.click();
|
||||
} else if (global.__HUGO_AURA_CONFIG__.ssa.ux.easiAssistant.notDisplay) {
|
||||
const rootEl = document.getElementById("root");
|
||||
// @ts-expect-error
|
||||
rootEl.style["display"] = "none";
|
||||
}
|
||||
};
|
||||
|
||||
const onMounted = () => {
|
||||
applyHideSettings();
|
||||
};
|
||||
|
||||
onMounted();
|
||||
})();
|
||||
@@ -1,12 +1,5 @@
|
||||
// @ts-check
|
||||
(() => {
|
||||
if (!global.__HUGO_AURA__)
|
||||
global.__HUGO_AURA__ = {
|
||||
configInit: true,
|
||||
auraDir: "",
|
||||
version: "",
|
||||
};
|
||||
|
||||
if (!global.__HUGO_AURA__.plsStats)
|
||||
global.__HUGO_AURA__.plsStats = {
|
||||
installed: false,
|
||||
@@ -19,8 +12,8 @@
|
||||
};
|
||||
|
||||
const IPC_METHOD_BASE = "$aura.pls";
|
||||
const REQUIRE_BASE = "../../..";
|
||||
const __SCOPE = "auraWsKeepAlive";
|
||||
const REQUIRE_BASE = "../../aura/ui";
|
||||
const __SCOPE = "desktopAssistant";
|
||||
|
||||
const PLS_REG_PATH = "ProxyLayerServices";
|
||||
|
||||
@@ -52,7 +45,8 @@
|
||||
};
|
||||
|
||||
const calcFullAuthToken = (/** @type {string} */ authToken) => {
|
||||
const conjToken = authToken + "AuraXAuth 0xFFFFFF NeverEnds";
|
||||
const trustToken = window._ACCEPT_DATA.getData("deviceId");
|
||||
const conjToken = authToken + "AuraXAuth" + trustToken + "NeverEnds";
|
||||
const crypto = require("crypto");
|
||||
return crypto.createHash("sha512").update(conjToken).digest("hex");
|
||||
};
|
||||
@@ -319,7 +313,7 @@
|
||||
const onSetup = () => {
|
||||
if (!global.ipcRenderer) {
|
||||
// @ts-ignore
|
||||
global.ipcRenderer = require("electron").ipcRenderer;
|
||||
global.ipcRenderer = require("electron").global.ipcRenderer;
|
||||
}
|
||||
|
||||
initPlsConnection();
|
||||
|
||||
@@ -13,24 +13,18 @@
|
||||
<!-- Chevron Left Icon -->
|
||||
</div>
|
||||
<p>雨光之环</p>
|
||||
<div class="aura-config-page-app-bar-hr-vertical" id="auraConfigPageAppBarVerticalHr"></div>
|
||||
<div class="aura-config-page-app-bar-spacer space-none"></div>
|
||||
<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;
|
||||
margin-right: 0.5rem;
|
||||
"
|
||||
style="-webkit-app-region: no-drag; z-index: 2000; margin-left: 6px"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="22"
|
||||
height="22"
|
||||
width="21"
|
||||
height="21"
|
||||
viewBox="0 0 24 24"
|
||||
class="iconfont"
|
||||
style="margin-top: -1.35px"
|
||||
style="margin-top: -1.5px"
|
||||
>
|
||||
<path
|
||||
fill="currentColor"
|
||||
@@ -142,8 +136,8 @@
|
||||
<div class="aura-config-page-operation-body">
|
||||
<img src="../../aura/ui/static/config/no_limitations.svg" />
|
||||
<div>
|
||||
<p class="config-operation-title">行为改写</p>
|
||||
<p class="config-operation-description">覆写密码、禁用能力</p>
|
||||
<p class="config-operation-title">限制解除</p>
|
||||
<p class="config-operation-description">禁用密码、关闭功能</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -155,7 +149,7 @@
|
||||
<div class="aura-config-page-operation-body">
|
||||
<img src="../../aura/ui/static/config/behaviour_mon.svg" />
|
||||
<div>
|
||||
<p class="config-operation-title">操作管控</p>
|
||||
<p class="config-operation-title">行为管控</p>
|
||||
<p class="config-operation-description">窥屏提醒、数据欺骗</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -294,27 +294,6 @@ global.__HUGO_AURA_UI_FUNCTIONS__.config = {
|
||||
// TODO: Error handling
|
||||
}
|
||||
},
|
||||
|
||||
initCustomUIProps: async (refresh = false) => {
|
||||
const verticalHrEl = document.getElementById(
|
||||
"auraConfigPageAppBarVerticalHr"
|
||||
);
|
||||
const spacerElArr = document.getElementsByClassName(
|
||||
"aura-config-page-app-bar-spacer"
|
||||
);
|
||||
if (
|
||||
global.__HUGO_AURA_CONFIG__.auraSettings.appearance.appBar
|
||||
.actionBtnsOnRight
|
||||
) {
|
||||
verticalHrEl.classList.add("hidden");
|
||||
spacerElArr[0].classList.remove("space-none");
|
||||
spacerElArr[1].classList.add("space-none");
|
||||
} else if (refresh) {
|
||||
verticalHrEl.classList.remove("hidden");
|
||||
spacerElArr[0].classList.add("space-none");
|
||||
spacerElArr[1].classList.remove("space-none");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
(() => {
|
||||
@@ -412,7 +391,6 @@ global.__HUGO_AURA_UI_FUNCTIONS__.config = {
|
||||
};
|
||||
|
||||
const onMounted = () => {
|
||||
global.__HUGO_AURA_UI_FUNCTIONS__.config.initCustomUIProps();
|
||||
applyVersionInfo();
|
||||
|
||||
showAnimation();
|
||||
|
||||
@@ -58,10 +58,6 @@
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.aura-config-page-app-bar-spacer.space-none {
|
||||
flex-grow: 0;
|
||||
}
|
||||
|
||||
.aura-config-page-app-bar-hr-vertical {
|
||||
position: relative;
|
||||
margin-left: 8px;
|
||||
@@ -70,7 +66,3 @@
|
||||
height: 12px;
|
||||
transition: background 0.5s;
|
||||
}
|
||||
|
||||
.aura-config-page-app-bar-hr-vertical.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -31,20 +31,6 @@
|
||||
上报屏蔽
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button
|
||||
class="nav-link"
|
||||
id="appearance-ctl-tab"
|
||||
data-bs-toggle="pill"
|
||||
data-bs-target="#appearance-ctl-subpage"
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-controls="appearance-ctl-subpage"
|
||||
aria-selected="false"
|
||||
>
|
||||
外观与体验
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div
|
||||
@@ -59,11 +45,5 @@
|
||||
role="tabpanel"
|
||||
aria-labelledby="disable-audit-tab"
|
||||
></div>
|
||||
<div
|
||||
class="tab-pane fade"
|
||||
id="appearance-ctl-subpage"
|
||||
role="tabpanel"
|
||||
aria-labelledby="appearance-ctl-tab"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
} = require("../../aura/ui/composables/settingsRenderer");
|
||||
const { authSettings } = require(`${pathBase}/auth`);
|
||||
const { banAuditSettings } = require(`${pathBase}/audit`);
|
||||
const { uxAndAppearanceSettings } = require(`${pathBase}/uxAppearance`);
|
||||
|
||||
const initAuthSubPage = () => {
|
||||
const authSubPageEl = document.getElementById("auth-subpage");
|
||||
@@ -19,17 +18,9 @@
|
||||
settingsRenderer(banAuditSubPageEl, banAuditSettings);
|
||||
};
|
||||
|
||||
const initUxAndAppearanceSubPage = () => {
|
||||
const uxAndAppearancePageEl = document.getElementById(
|
||||
"appearance-ctl-subpage"
|
||||
);
|
||||
settingsRenderer(uxAndAppearancePageEl, uxAndAppearanceSettings);
|
||||
};
|
||||
|
||||
const onMounted = () => {
|
||||
initAuthSubPage();
|
||||
initBanAuditSubPage();
|
||||
initUxAndAppearanceSubPage();
|
||||
|
||||
const rootEl = document.getElementById("acs-disable-limit-root-el");
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
const uxAndAppearanceSettings = [
|
||||
{
|
||||
id: 0,
|
||||
categoryName: "管家助手",
|
||||
child: [
|
||||
{
|
||||
index: 0,
|
||||
id: "autoHideEasiAssistant",
|
||||
type: "switch",
|
||||
name: "自动最小化管家助手",
|
||||
description: "管家启动后, 自动将桌面右下角管家助手最小化至 Fab 形态",
|
||||
restart: true,
|
||||
reload: false,
|
||||
associateVal: ["ssa.ux.easiAssistant.notDisplay"],
|
||||
auraIf: () => true,
|
||||
defaultValue: false,
|
||||
auraDisable: () => {
|
||||
if (global.__HUGO_AURA_CONFIG__.ssa.ux.easiAssistant.notDisplay) {
|
||||
return { value: true, tooltip: '禁用 "隐藏管家助手" 以继续' };
|
||||
} else {
|
||||
return { value: false };
|
||||
}
|
||||
},
|
||||
valueGetter: () => {
|
||||
return global.__HUGO_AURA_CONFIG__.ssa.ux.easiAssistant.autoHide;
|
||||
},
|
||||
callbackFn: (newVal) => {
|
||||
if (typeof newVal !== "boolean") return;
|
||||
global.__HUGO_AURA_CONFIG__.ssa.ux.easiAssistant.autoHide = newVal;
|
||||
},
|
||||
},
|
||||
{
|
||||
index: 1,
|
||||
id: "notDisplayEasiAssistant",
|
||||
type: "switch",
|
||||
name: "隐藏管家助手",
|
||||
description: "管家启动后, 管家助手窗口将不再显示",
|
||||
restart: true,
|
||||
reload: false,
|
||||
associateVal: ["ssa.ux.easiAssistant.autoHide"],
|
||||
auraIf: () => true,
|
||||
defaultValue: false,
|
||||
auraDisable: () => {
|
||||
if (global.__HUGO_AURA_CONFIG__.ssa.ux.easiAssistant.autoHide) {
|
||||
return { value: true, tooltip: '禁用 "自动最小化管家助手" 以继续' };
|
||||
} else {
|
||||
return { value: false };
|
||||
}
|
||||
},
|
||||
valueGetter: () => {
|
||||
return global.__HUGO_AURA_CONFIG__.ssa.ux.easiAssistant.notDisplay;
|
||||
},
|
||||
callbackFn: (newVal) => {
|
||||
if (typeof newVal !== "boolean") return;
|
||||
global.__HUGO_AURA_CONFIG__.ssa.ux.easiAssistant.notDisplay = newVal;
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = { uxAndAppearanceSettings };
|
||||
@@ -17,20 +17,6 @@
|
||||
Aura 设置
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button
|
||||
class="nav-link"
|
||||
id="debug-subpage-tab"
|
||||
data-bs-toggle="pill"
|
||||
data-bs-target="#debug-subpage"
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-controls="debug-subpage"
|
||||
aria-selected="false"
|
||||
>
|
||||
调试选项
|
||||
</button>
|
||||
</li>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button
|
||||
class="nav-link"
|
||||
@@ -40,7 +26,7 @@
|
||||
type="button"
|
||||
role="tab"
|
||||
aria-controls="about-subpage"
|
||||
aria-selected="false"
|
||||
aria-selected="true"
|
||||
>
|
||||
关于项目
|
||||
</button>
|
||||
@@ -53,12 +39,6 @@
|
||||
role="tabpanel"
|
||||
aria-labelledby="aura-subpage-tab"
|
||||
></div>
|
||||
<div
|
||||
class="tab-pane fade"
|
||||
id="debug-subpage"
|
||||
role="tabpanel"
|
||||
aria-labelledby="debug-subpage-tab"
|
||||
></div>
|
||||
<div
|
||||
class="tab-pane fade"
|
||||
id="about-subpage"
|
||||
|
||||
@@ -5,21 +5,13 @@
|
||||
settingsRenderer,
|
||||
} = require("../../aura/ui/composables/settingsRenderer");
|
||||
const { auraSettings } = require(`${pathBase}/aura`);
|
||||
const { debugSettings } = require(`${pathBase}/debug`);
|
||||
|
||||
const initAuraSubPage = () => {
|
||||
const auraSettingsSubPageEl = document.getElementById("aura-subpage");
|
||||
settingsRenderer(auraSettingsSubPageEl, auraSettings);
|
||||
};
|
||||
|
||||
const initDebugSubPage = () => {
|
||||
const debugSubPageEl = document.getElementById("debug-subpage");
|
||||
settingsRenderer(debugSubPageEl, debugSettings);
|
||||
};
|
||||
|
||||
const onMounted = () => {
|
||||
initAuraSubPage();
|
||||
initDebugSubPage();
|
||||
|
||||
const rootEl = document.getElementById("acs-preferences-root-el");
|
||||
setTimeout(() => {
|
||||
|
||||
@@ -441,35 +441,6 @@ const auraSettings = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
categoryName: "外观",
|
||||
child: [
|
||||
{
|
||||
index: 0,
|
||||
id: "actionBtnsOnRight",
|
||||
type: "switch",
|
||||
name: "顶栏操作类按钮右置",
|
||||
description: "启用后, 顶栏的<b>返回首页按钮</b>将靠右放置",
|
||||
restart: false,
|
||||
reload: false,
|
||||
auraIf: () => {
|
||||
return true;
|
||||
},
|
||||
defaultValue: false,
|
||||
valueGetter: () => {
|
||||
return global.__HUGO_AURA_CONFIG__.auraSettings.appearance.appBar
|
||||
.actionBtnsOnRight;
|
||||
},
|
||||
callbackFn: async (newVal) => {
|
||||
if (typeof newVal !== "boolean") return;
|
||||
global.__HUGO_AURA_CONFIG__.auraSettings.appearance.appBar.actionBtnsOnRight =
|
||||
newVal;
|
||||
global.__HUGO_AURA_UI_FUNCTIONS__.config.initCustomUIProps(true);
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = { auraSettings };
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
const IPC_METHOD_BASE = "$aura.debug";
|
||||
|
||||
const path = require("path");
|
||||
|
||||
const debugSettings = [
|
||||
{
|
||||
id: 0,
|
||||
categoryName: "日志与输出",
|
||||
child: [
|
||||
{
|
||||
index: 0,
|
||||
id: "openHugoAuraLogDir",
|
||||
type: "button",
|
||||
style: "outline",
|
||||
name: "HugoAura 日志目录",
|
||||
description: "",
|
||||
restart: false,
|
||||
reload: false,
|
||||
associateVal: null,
|
||||
auraIf: () => true,
|
||||
buttonContent: "打开",
|
||||
valueGetter: async () => {
|
||||
if (
|
||||
global.__HUGO_AURA__.auraDir &&
|
||||
global.__HUGO_AURA__.auraDir !== ""
|
||||
) {
|
||||
return (
|
||||
"目录位置: " + path.join(global.__HUGO_AURA__.auraDir, "logs")
|
||||
);
|
||||
} else {
|
||||
return "未能获取日志目录位置";
|
||||
}
|
||||
},
|
||||
callbackFn: async (event) => {
|
||||
const childProc = require("child_process");
|
||||
childProc.spawn(`explorer.exe`, [
|
||||
`${path.join(global.__HUGO_AURA__.auraDir, "logs")}`,
|
||||
]);
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = { debugSettings };
|
||||
@@ -7,7 +7,7 @@
|
||||
transition: opacity 0.25s;
|
||||
}
|
||||
|
||||
#root.aura-header-icon-hidden .aura-header-icon {
|
||||
.aura-header-icon.aura-header-icon-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,11 +10,9 @@ global.__HUGO_AURA_UI_FUNCTIONS__.headerIcon = {
|
||||
let clickTimeout = null;
|
||||
|
||||
const onMounted = () => {
|
||||
if (
|
||||
!global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod.showEntryIcon
|
||||
) {
|
||||
const rootEl = document.getElementById("root");
|
||||
rootEl.classList.add("aura-header-icon-hidden");
|
||||
if (!global.__HUGO_AURA_CONFIG__.auraSettings.uiAccessMethod.showEntryIcon) {
|
||||
const iconEl = document.getElementsByClassName("aura-header-icon")[0];
|
||||
iconEl.classList.add("aura-header-icon-hidden");
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Aura WebSocket KeepAlive Window</title>
|
||||
<style>
|
||||
:root {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
let global = window;
|
||||
</script>
|
||||
<script src="../../../js/plsConnectionManager.js"></script>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
@@ -1,39 +0,0 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @param {Electron} electron
|
||||
*/
|
||||
const createWsWindow = (electron) => {
|
||||
const path = require("path");
|
||||
const { BrowserWindow } = electron;
|
||||
const window = new BrowserWindow({
|
||||
width: 0,
|
||||
height: 0,
|
||||
frame: false,
|
||||
skipTaskbar: true,
|
||||
transparent: true,
|
||||
alwaysOnTop: true,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
devTools: true,
|
||||
},
|
||||
});
|
||||
|
||||
window.setIgnoreMouseEvents(true);
|
||||
window.loadFile(
|
||||
path.join(
|
||||
__dirname,
|
||||
"..",
|
||||
"ui",
|
||||
"pages",
|
||||
"windows",
|
||||
"auraWsKeepAlive",
|
||||
"index.html"
|
||||
)
|
||||
);
|
||||
|
||||
return window;
|
||||
};
|
||||
|
||||
module.exports = { createWsWindow };
|
||||
@@ -6,7 +6,6 @@ if (!global.__HUGO_AURA__) {
|
||||
configInit: false,
|
||||
central: () => {},
|
||||
ipcInit: false,
|
||||
auraDir: "",
|
||||
plsStats: null,
|
||||
plsSettings: null,
|
||||
plsRules: null,
|
||||
@@ -25,7 +24,7 @@ if (!global.__HUGO_AURA_API__) {
|
||||
"https://api-aura.asaka.site",
|
||||
"https://api.hugoaura.dpdns.org",
|
||||
"https://api-aura-projekts.minorice.moe",
|
||||
"https://api.aura.vim.moe",
|
||||
"https://api.aura.vim.moe"
|
||||
],
|
||||
plsUpdate: "/api/getPLSLatestVersion",
|
||||
auraUpdate: "/api/getAuraLatestVersion",
|
||||
@@ -37,46 +36,15 @@ if (!global.__HUGO_AURA_CONFIG__) {
|
||||
global.__HUGO_AURA_CONFIG__ = {};
|
||||
}
|
||||
|
||||
const path = require("path");
|
||||
const os = require("os");
|
||||
|
||||
const MainProcessHooksManager = require("../aura/init/main/windowHooksManager");
|
||||
const RendererHooksManager = require("../aura/init/rendererHook/uiHooksManager");
|
||||
const EventBus = require("../aura/utils/eventBus");
|
||||
const NetworkHook = require("../aura/init/rendererHook/networkHook");
|
||||
const ConfigManager = require("../aura/init/shared/configManager");
|
||||
const RegistryManager = require("../aura/init/shared/registryManager");
|
||||
const { buildIpcMain } = require("../aura/init/main/ipcHandler");
|
||||
const plsUtils = require("../aura/utils/pls");
|
||||
|
||||
const { initLogger } = require("../aura/init/main/logger");
|
||||
|
||||
const getUserDocumentsDirPath = () => {
|
||||
const registryManager = new RegistryManager();
|
||||
const pathInfo = registryManager.readRegKeySync(
|
||||
'"HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\User Shell Folders"',
|
||||
"Personal",
|
||||
false,
|
||||
true,
|
||||
/REG_EXPAND_SZ\s+(.+)/
|
||||
);
|
||||
if (pathInfo.success && pathInfo.data) {
|
||||
const resolvedPath = pathInfo.data.replace(
|
||||
/%([^%]+)%/g,
|
||||
(match, varName) => {
|
||||
return process.env[varName] || match;
|
||||
}
|
||||
);
|
||||
|
||||
return resolvedPath;
|
||||
} else {
|
||||
console.error(
|
||||
"[HugoAura / Init / Logger] Failed to get the path of documents dir, using default val."
|
||||
);
|
||||
return path.join(os.homedir(), "Documents");
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import("../aura/types/main/core").LauncherArgs} param0
|
||||
@@ -98,11 +66,6 @@ const launcher = ({ central, windowName, config }) => {
|
||||
app.exit(0);
|
||||
};
|
||||
|
||||
global.__HUGO_AURA__.auraDir = path.join(
|
||||
getUserDocumentsDirPath(),
|
||||
"HugoAura"
|
||||
);
|
||||
|
||||
// >>> Init Logger <<< //
|
||||
initLogger(windowName);
|
||||
|
||||
@@ -116,7 +79,6 @@ const launcher = ({ central, windowName, config }) => {
|
||||
// >>> Init Config <<< //
|
||||
const configManager = new ConfigManager();
|
||||
configManager.side = "main";
|
||||
configManager.migrateOldConfigFile();
|
||||
configManager.ensureConfigExists();
|
||||
const loadedConfig = configManager.loadConfig();
|
||||
if (!global.__HUGO_AURA__.configInit) global.__HUGO_AURA__.configInit = true;
|
||||
@@ -150,13 +112,6 @@ const launcher = ({ central, windowName, config }) => {
|
||||
config.canOpenDevTool = true;
|
||||
}
|
||||
|
||||
// >>> Create WebSocket KeepAlive Window <<< //
|
||||
if (!global.__HUGO_AURA__.hookedWindows?.has("auraWsKeepAlive")) {
|
||||
const wsKaWin = plsUtils.createWsWindow(electron);
|
||||
// @ts-expect-error
|
||||
global.__HUGO_AURA__.hookedWindows.set("auraWsKeepAlive", wsKaWin);
|
||||
}
|
||||
|
||||
// >>> Listeners <<< //
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
// @ts-check
|
||||
|
||||
const __AURA_VERSION__ = "0.1.1-beta";
|
||||
const __AURA_VERSION__ = "0.1.1-pre-IV";
|
||||
|
||||
(() => {
|
||||
if (require.main) return; // 如果只是导入 Aura Version, 不运行闭包逻辑
|
||||
|
||||
const auraDir = require("electron").ipcRenderer.sendSync(
|
||||
"$aura.base.getAuraDirSync"
|
||||
);
|
||||
|
||||
// >>> Init Global Vars <<< //
|
||||
if (!global.__HUGO_AURA__) {
|
||||
global.__HUGO_AURA__ = {
|
||||
auraDir: auraDir.data,
|
||||
configInit: true, // preload 始终比 hook 晚, 默认 config 已初始化
|
||||
// ↑ 保留此参数的目的 -> 用于 configManager 中, configManager 的行为在 Renderer 和 Main 中是一致的
|
||||
version: __AURA_VERSION__,
|
||||
|
||||
Reference in New Issue
Block a user