mirror of
https://github.com/HugoAura/Seewo-HugoAura.git
synced 2026-06-27 03:34:25 +08:00
[🔄 Chore] Prepare for Aikari (2/2)
This commit is contained in:
@@ -54,6 +54,29 @@ const actions = {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
getAikariPLSRules: async (wsObj) => {
|
||||
const eventId = genRandomHex();
|
||||
wsObj.send(
|
||||
JSON.stringify({
|
||||
module: "pls",
|
||||
eventId,
|
||||
method: "config.rules.getConfig",
|
||||
})
|
||||
);
|
||||
const promise = new Promise((resolve) => {
|
||||
wsGetCallbacks.set(eventId, resolve);
|
||||
});
|
||||
const data = await promise;
|
||||
if (data.success) {
|
||||
console.debug(
|
||||
"[HugoAura / UI / Aikari OCMS] Received Aikari PLS rules: ",
|
||||
data
|
||||
);
|
||||
return data.data;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const onAikariConnectedMsgSeq = async ({ curAikariStates, wsObj }) => {
|
||||
@@ -66,6 +89,7 @@ const onAikariConnectedMsgSeq = async ({ curAikariStates, wsObj }) => {
|
||||
document.addEventListener("onAikariMessageRecv", onMsgRecvListener);
|
||||
// Get Aikari Version
|
||||
await actions.getAikariVersion(updatedAikariStates, wsObj);
|
||||
// Get Aikari Launcher Config
|
||||
const aikariLauncherConfig = await actions.getAikariLauncherConfig(wsObj);
|
||||
if (aikariLauncherConfig) {
|
||||
global.ipcRenderer.invoke(
|
||||
@@ -73,6 +97,14 @@ const onAikariConnectedMsgSeq = async ({ curAikariStates, wsObj }) => {
|
||||
aikariLauncherConfig
|
||||
);
|
||||
}
|
||||
// Get Aikari PLS Rules
|
||||
const aikariPLSRules = await actions.getAikariPLSRules(wsObj);
|
||||
if (aikariPLSRules) {
|
||||
global.ipcRenderer.invoke(
|
||||
`${IPC_METHOD_BASE}.updateAikariRules`,
|
||||
aikariPLSRules
|
||||
);
|
||||
}
|
||||
|
||||
return updatedAikariStates;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user