Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "luna",
"version": "1.16.1-beta",
"version": "1.16.2-beta",
"description": "A client mod for the Tidal music app for plugins",
"author": {
"name": "Inrixia",
Expand Down
11 changes: 7 additions & 4 deletions plugins/dev/src/ipc.native.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
export const getNativeIPCEvents = (): Record<string, string> => require("./original.asar/app/shared/client/ClientMessageChannelEnum.js").default;
export const getRenderIPCEvents = (): Record<string, string> => require("./original.asar/app/shared/AppEventEnum.js").default;
const toPlainRecord = <T extends Record<string, string>>(record: T): Record<string, string> => Object.fromEntries(Object.entries(record));

export const getNativeIPCEvents = (): Record<string, string> =>
toPlainRecord(require("./original.asar/app/shared/client/ClientMessageChannelEnum.js").default);
export const getRenderIPCEvents = (): Record<string, string> => toPlainRecord(require("./original.asar/app/shared/AppEventEnum.js").default);

const ipcListeners: Record<string, (_: any, ...args: any[]) => void> = {};
export const startRenderIpcLog = async () => {
const { ipcMain } = await import("electron");
const { ipcMain } = require("electron");
for (const eventName of Object.values(await getRenderIPCEvents())) {
ipcListeners[eventName] = (_, ...args) => console.log("[@luna/dev.native]", "Render -> Native", eventName, ...args);
ipcMain.on(eventName, ipcListeners[eventName]);
}
};
export const stopRenderIpcLog = async () => {
if (Object.keys(ipcListeners).length <= 0) return;
const { ipcMain } = await import("electron");
const { ipcMain } = require("electron");
for (const eventName in ipcListeners) {
ipcMain.removeListener(eventName, ipcListeners[eventName]);
delete ipcListeners[eventName];
Expand Down
Loading