Skip to content

Commit

Permalink
fix(desktop): v0.0.8 fix ipc error problem with import data from othe…
Browse files Browse the repository at this point in the history
…r files
  • Loading branch information
moonrailgun committed Oct 16, 2023
1 parent 73d68bb commit 2b329db
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion client/desktop/release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tailchat-desktop",
"version": "0.0.7",
"version": "0.0.8",
"description": "A foundation for scalable desktop apps",
"license": "MIT",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion client/desktop/src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ipcMain.on('ipc-example', async (event, arg) => {
event.reply('ipc-example', msgTemplate('pong'));
});

ipcMain.handle(CONSTANT.DESKTOP_CAPTURER_GET_SOURCES, async (event, opts) => {
ipcMain.handle('DESKTOP_CAPTURER_GET_SOURCES', async (event, opts) => {
const sources = await desktopCapturer.getSources({
types: ['window', 'screen'],
});
Expand Down
15 changes: 5 additions & 10 deletions client/desktop/src/main/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import {
IpcRendererEvent,
webFrame,
} from 'electron';
import { CONSTANT } from './util';

export type Channels =
| 'ipc-example'
| 'webview-message'
| 'close'
| 'selectServer'
| 'selectCapturerSource';
| 'selectServer';

contextBridge.exposeInMainWorld('electron', {
ipcRenderer: {
Expand All @@ -28,14 +26,11 @@ contextBridge.exposeInMainWorld('electron', {
once(channel: Channels, func: (...args: unknown[]) => void) {
ipcRenderer.once(channel, (_event, ...args) => func(...args));
},
getDesktopCapturerSource:
async (): Promise<Electron.DesktopCapturerSource> => {
const source = await ipcRenderer.invoke(
CONSTANT.DESKTOP_CAPTURER_GET_SOURCES
);
async getDesktopCapturerSource(): Promise<Electron.DesktopCapturerSource> {
const source = await ipcRenderer.invoke('DESKTOP_CAPTURER_GET_SOURCES');

return source;
},
return source;
},
},
});

Expand Down
4 changes: 0 additions & 4 deletions client/desktop/src/main/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,3 @@ export function resolveHtmlPath(htmlFileName: string) {
export function getDefaultLoggerPath(): string {
return log.transports.file.getFile().path;
}

export const CONSTANT = {
DESKTOP_CAPTURER_GET_SOURCES: 'DESKTOP_CAPTURER_GET_SOURCES',
};

0 comments on commit 2b329db

Please sign in to comment.