From adcc564d350b1b1016fd8c68208b71a42b541ecc Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Wed, 18 Sep 2024 12:06:34 -0700 Subject: [PATCH] Fix emain package error --- emain/authkey.ts | 2 +- emain/emain-wsh.ts | 4 ++-- emain/emain.ts | 4 ++-- emain/platform.ts | 2 +- emain/updater.ts | 24 ++++++++++++------------ 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/emain/authkey.ts b/emain/authkey.ts index 8b24eea0f..257794253 100644 --- a/emain/authkey.ts +++ b/emain/authkey.ts @@ -1,8 +1,8 @@ // Copyright 2024, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 -import { getWebServerEndpoint, getWSServerEndpoint } from "@/util/endpoints"; import { ipcMain } from "electron"; +import { getWebServerEndpoint, getWSServerEndpoint } from "../frontend/util/endpoints"; const AuthKeyHeader = "X-AuthKey"; export const AuthKeyEnv = "AUTH_KEY"; diff --git a/emain/emain-wsh.ts b/emain/emain-wsh.ts index db62e3ba8..45812456e 100644 --- a/emain/emain-wsh.ts +++ b/emain/emain-wsh.ts @@ -1,9 +1,9 @@ // Copyright 2024, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 -import { RpcResponseHelper, WshClient } from "@/app/store/wshclient"; import electron from "electron"; -import { getWebContentsByBlockId, webGetSelector } from "emain/emain-web"; +import { RpcResponseHelper, WshClient } from "../frontend/app/store/wshclient"; +import { getWebContentsByBlockId, webGetSelector } from "./emain-web"; type WaveBrowserWindow = Electron.BrowserWindow & { waveWindowId: string; readyPromise: Promise }; diff --git a/emain/emain.ts b/emain/emain.ts index 51154f872..5138cb19a 100644 --- a/emain/emain.ts +++ b/emain/emain.ts @@ -1,9 +1,7 @@ // Copyright 2024, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 -import { initElectronWshrpc } from "@/app/store/wshrpcutil"; import * as electron from "electron"; -import { ElectronWshClientType } from "emain/emain-wsh"; import { FastAverageColor } from "fast-average-color"; import fs from "fs"; import * as child_process from "node:child_process"; @@ -16,11 +14,13 @@ import * as util from "util"; import winston from "winston"; import { initGlobal } from "../frontend/app/store/global"; import * as services from "../frontend/app/store/services"; +import { initElectronWshrpc } from "../frontend/app/store/wshrpcutil"; import { WSServerEndpointVarName, WebServerEndpointVarName, getWebServerEndpoint } from "../frontend/util/endpoints"; import { fetch } from "../frontend/util/fetchutil"; import * as keyutil from "../frontend/util/keyutil"; import { fireAndForget } from "../frontend/util/util"; import { AuthKey, AuthKeyEnv, configureAuthKeyRequestInjection } from "./authkey"; +import { ElectronWshClientType } from "./emain-wsh"; import { getAppMenu } from "./menu"; import { getElectronAppBasePath, diff --git a/emain/platform.ts b/emain/platform.ts index f40f31634..209ea1b59 100644 --- a/emain/platform.ts +++ b/emain/platform.ts @@ -1,10 +1,10 @@ // Copyright 2024, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 -import { WaveDevVarName, WaveDevViteVarName } from "@/util/isdev"; import { app, ipcMain } from "electron"; import os from "os"; import path from "path"; +import { WaveDevVarName, WaveDevViteVarName } from "../frontend/util/isdev"; import * as keyutil from "../frontend/util/keyutil"; const isDev = !app.isPackaged; diff --git a/emain/updater.ts b/emain/updater.ts index 8665d0f97..f9784d933 100644 --- a/emain/updater.ts +++ b/emain/updater.ts @@ -1,10 +1,10 @@ // Copyright 2024, Command Line Inc. // SPDX-License-Identifier: Apache-2.0 -import { isDev } from "@/util/isdev"; -import * as electron from "electron"; +import { BrowserWindow, dialog, ipcMain, Notification } from "electron"; import { autoUpdater } from "electron-updater"; -import * as services from "../frontend/app/store/services"; +import { FileService } from "../frontend/app/store/services"; +import { isDev } from "../frontend/util/isdev"; import { fireAndForget } from "../frontend/util/util"; export let updater: Updater; @@ -63,7 +63,7 @@ export class Updater { // Display the update banner and create a system notification this.status = "ready"; - const updateNotification = new electron.Notification({ + const updateNotification = new Notification({ title: "Wave Terminal", body: "A new version of Wave Terminal is ready to install.", }); @@ -83,7 +83,7 @@ export class Updater { private set status(value: UpdaterStatus) { this._status = value; - electron.BrowserWindow.getAllWindows().forEach((window) => { + BrowserWindow.getAllWindows().forEach((window) => { window.webContents.send("app-update-status", value); }); } @@ -133,7 +133,7 @@ export class Updater { type: "info", message: "There are currently no updates available.", }; - electron.dialog.showMessageBox(electron.BrowserWindow.getFocusedWindow(), dialogOpts); + dialog.showMessageBox(BrowserWindow.getFocusedWindow(), dialogOpts); } // Only update the last check time if this is an automatic check. This ensures the interval remains consistent. @@ -153,10 +153,10 @@ export class Updater { detail: "A new version has been downloaded. Restart the application to apply the updates.", }; - const allWindows = electron.BrowserWindow.getAllWindows(); + const allWindows = BrowserWindow.getAllWindows(); if (allWindows.length > 0) { - await electron.dialog - .showMessageBox(electron.BrowserWindow.getFocusedWindow() ?? allWindows[0], dialogOpts) + await dialog + .showMessageBox(BrowserWindow.getFocusedWindow() ?? allWindows[0], dialogOpts) .then(({ response }) => { if (response === 0) { this.installUpdate(); @@ -176,8 +176,8 @@ export class Updater { } } -electron.ipcMain.on("install-app-update", () => fireAndForget(() => updater?.promptToInstallUpdate())); -electron.ipcMain.on("get-app-update-status", (event) => { +ipcMain.on("install-app-update", () => fireAndForget(() => updater?.promptToInstallUpdate())); +ipcMain.on("get-app-update-status", (event) => { event.returnValue = updater?.status; }); @@ -201,7 +201,7 @@ export async function configureAutoUpdater() { try { console.log("Configuring updater"); - const settings = (await services.FileService.GetFullConfig()).settings; + const settings = (await FileService.GetFullConfig()).settings; updater = new Updater(settings); await updater.start(); } catch (e) {