[🤯 Refactor] Use standalone window for WebSocket connections

1. [-] 删除了对于 desktopAssistant 的 Hook 逻辑
2. [/] 现在不再使用 desktopAssistant 保活 WS 连接, 而是用一个单独的不可见窗口处理 WS (#25)
This commit is contained in:
Minoricew
2025-06-17 18:14:58 +08:00
parent f6a30351fd
commit 807ac913da
8 changed files with 84 additions and 23 deletions

View File

@@ -1,15 +0,0 @@
// @ts-check
/**
* @type {import("../../types/render/uiHook").UIHookConfig}
*/
const def = {
targets: {},
globalStyles: ["ui/css/global.css"],
globalJS: ["ui/js/global.js", "ui/js/plsConnectionManager.js"],
onLoaded: `
console.log('[HugoAura / UI / Hooks / Desktop Assistant] Page loaded.');
`,
};
module.exports = def;

View File

@@ -1,5 +1,12 @@
// @ts-check
(() => {
if (!global.__HUGO_AURA__)
global.__HUGO_AURA__ = {
configInit: true,
auraDir: "",
version: "",
};
if (!global.__HUGO_AURA__.plsStats)
global.__HUGO_AURA__.plsStats = {
installed: false,
@@ -12,8 +19,8 @@
};
const IPC_METHOD_BASE = "$aura.pls";
const REQUIRE_BASE = "../../aura/ui";
const __SCOPE = "desktopAssistant";
const REQUIRE_BASE = "../../..";
const __SCOPE = "auraWsKeepAlive";
const PLS_REG_PATH = "ProxyLayerServices";
@@ -312,7 +319,7 @@
const onSetup = () => {
if (!global.ipcRenderer) {
// @ts-ignore
global.ipcRenderer = require("electron").global.ipcRenderer;
global.ipcRenderer = require("electron").ipcRenderer;
}
initPlsConnection();

View File

@@ -0,0 +1,16 @@
<!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>