diff --git a/electron-projects/ucap-webmessenger-electron/src/index.ts b/electron-projects/ucap-webmessenger-electron/src/index.ts index 2734a605..758ab763 100644 --- a/electron-projects/ucap-webmessenger-electron/src/index.ts +++ b/electron-projects/ucap-webmessenger-electron/src/index.ts @@ -14,6 +14,8 @@ import fse from 'fs-extra'; import semver from 'semver'; import os from 'os'; import ChildProcess from 'child_process'; +import * as url from 'url'; +import * as tmp from 'tmp'; import AutoLaunch from 'auto-launch'; @@ -31,7 +33,8 @@ import { MessengerChannel, MessageChannel, AppChannel, - ClipboardChannel + ClipboardChannel, + ExternalChannel } from '@ucap-webmessenger/native-electron'; import { ElectronNotificationService } from '@ucap-webmessenger/electron-notification'; import { ElectronUpdateWindowService } from '@ucap-webmessenger/electron-update-window'; @@ -92,6 +95,8 @@ let preventQuit = false; let notificationService: ElectronNotificationService | null; let updateWindowService: ElectronUpdateWindowService | null; +tmp.setGracefulCleanup(); + function handleUncaughtException(error: Error) { preventQuit = true; @@ -773,6 +778,40 @@ ipcMain.on(AppChannel.Exit, (event: IpcMainEvent, ...args: any[]) => { appExit(); }); +ipcMain.on(ExternalChannel.OpenUrl, (event: IpcMainEvent, ...args: any[]) => { + const targetUrl = args[0]; + const options = JSON.stringify(args[1] || {}); + + tmp.file({ postfix: '.html' }, (err, name, fd, cb) => { + fse.writeFileSync( + name, + ` + + + + DS Talk Link + + + + + +