add version check

This commit is contained in:
Evan Simkowitz 2024-12-18 10:49:22 -08:00
parent 370c53dac0
commit 061279afaa
No known key found for this signature in database
9 changed files with 76 additions and 13 deletions

View File

@ -96,7 +96,7 @@ tasks:
cmds:
- cmd: '{{.RMRF}} "make"'
ignore_error: true
- yarn build:prod && yarn electron-builder -c electron-builder.config.cjs -p never
- yarn build:prod && yarn electron-builder -c electron-builder.config.cjs -p never {{.CLI_ARGS}}
deps:
- yarn
- docsite:build:embedded

View File

@ -26,6 +26,7 @@ wsh editconfig
| Key Name | Type | Function |
| ------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| app:globalhotkey | string | A systemwide keybinding to open your most recent wave window. This is a set of key names separated by `:`. For more info, see [Customizable Systemwide Global Hotkey](#customizable-systemwide-global-hotkey) |
| app:dismissarchitecturewarning | bool | Disable warnings on app start when you are using a non-native architecture for Wave. For more info, see [Why does Wave warn me about ARM64 translation when it launches?](./faq#why-does-wave-warn-me-about-arm64-translation-when-it-launches). |
| ai:preset | string | the default AI preset to use |
| ai:baseurl | string | Set the AI Base Url (must be OpenAI compatible) |
| ai:apitoken | string | your AI api token |

View File

@ -34,3 +34,9 @@ Just remember in JSON, backslashes need to be escaped. So add this to your [sett
### Can I use WSH outside of Wave?
`wsh` is an internal CLI for extending control over Wave to the command line, you can learn more about it [here](./wsh). To prevent misuse by other applications, `wsh` requires an access token provided by Wave to work and will not function outside of the app.
## Why does Wave warn me about ARM64 translation when it launches?
macOS and Windows both have compatibility layers that allow x64 applications to run on ARM computers. This helps more apps run on these systems while developers work to add native ARM support to their applications, however it comes with significant performance tradeoffs. To get the best experience using Wave, it is recommended to install the version of Wave that is natively-compiled for your computer. You can find the right version by consulting our [Installation Instructions](./gettingstarted#installation)
You can disable this warning by setting `app:dismissarchitecturewarning=true` in [your configurations](./config.mdx).

View File

@ -14,6 +14,35 @@ Wave Terminal is a modern terminal that includes graphical capabilities like web
<PlatformProvider>
<PlatformSelectorButton />
### Platform requirements
<PlatformItem platforms={["mac"]}>
- Supported architectures: Apple Silicon, x64
- Supported OS version: macOS 11 Big Sur or later
</PlatformItem>
<PlatformItem platforms={["windows"]}>
- Supported architectures: x64
- Supported OS version: Windows 10 1809 or later, Windows 11
:::note
ARM64 is planned, but is currently blocked by upstream dependencies (see [Windows ARM Support](https://github.com/wavetermdev/waveterm/issues/928)).
:::
</PlatformItem>
<PlatformItem platforms={["linux"]}>
- Supported architectures: x64, ARM64
- Supported OS version: must have glibc-2.28 or later (Debian >=10, RHEL >=8, Ubuntu >=20.04, etc.)
</PlatformItem>
### Package managers
<PlatformItem platforms={["mac"]}>

View File

@ -47,6 +47,7 @@ import { getLaunchSettings } from "./launchsettings";
import { log } from "./log";
import { makeAppMenu } from "./menu";
import {
checkIfRunningUnderARM64Translation,
getElectronAppBasePath,
getElectronAppUnpackedBasePath,
getWaveConfigDir,
@ -565,15 +566,6 @@ process.on("uncaughtException", (error) => {
});
async function appMain() {
// Check if the user is requesting the version from the command line, if so, return it and bail out.
const args = process.argv;
if (args?.length > 1 && (args[1] === "--version" || args[1] === "-v")) {
const versionInfo = getWaveVersion();
console.log(`Wave Terminal v${versionInfo.version} (build ${versionInfo.buildTime})`);
electronApp.quit();
return;
}
// Set disableHardwareAcceleration as early as possible, if required.
const launchSettings = getLaunchSettings();
if (launchSettings?.["window:disablehardwareacceleration"]) {
@ -597,6 +589,7 @@ async function appMain() {
await electronApp.whenReady();
configureAuthKeyRequestInjection(electron.session.defaultSession);
const fullConfig = await services.FileService.GetFullConfig();
checkIfRunningUnderARM64Translation(fullConfig);
ensureHotSpareTab(fullConfig);
await relaunchBrowserWindows();
await initDocsite();
@ -626,6 +619,15 @@ async function appMain() {
}
}
// Check if the user is requesting the version from the command line, if so, return it and bail out.
const args = process.argv;
console.log("args", args);
if (args?.length > 1 && (args.includes("--version") || args.includes("-v"))) {
const pkg = require("../package.json");
console.log(`Wave Terminal v${pkg.version}`);
electronApp.quit();
}
appMain().catch((e) => {
console.log("appMain error", e);
electronApp.quit();

View File

@ -1,7 +1,8 @@
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import { app, ipcMain } from "electron";
import { fireAndForget } from "@/util/util";
import { app, dialog, ipcMain, shell } from "electron";
import envPaths from "env-paths";
import { existsSync, mkdirSync } from "fs";
import os from "os";
@ -40,6 +41,27 @@ const WaveConfigHomeVarName = "WAVETERM_CONFIG_HOME";
const WaveDataHomeVarName = "WAVETERM_DATA_HOME";
const WaveHomeVarName = "WAVETERM_HOME";
export function checkIfRunningUnderARM64Translation(fullConfig: FullConfigType) {
if (!fullConfig.settings["app:dismissarchitecturewarning"] && app.runningUnderARM64Translation) {
console.log("Running under ARM64 translation, alerting user");
const dialogOpts: Electron.MessageBoxOptions = {
type: "warning",
buttons: ["See documentation", "Dismiss"],
title: "Wave has detected a performance issue",
message: `Wave has detected that it is running in ARM64 translation mode.\n\nThis may cause performance issues.\n\nPlease download the native version of Wave for your architecture (${unameArch})`,
};
const choice = dialog.showMessageBoxSync(null, dialogOpts);
if (choice === 0) {
// Open the documentation URL
console.log("Opening documentation URL");
fireAndForget(() => shell.openExternal("https://docs.waveterm.dev"));
} else {
console.log("User dismissed the dialog");
}
}
}
/**
* Gets the path to the old Wave home directory (defaults to `~/.waveterm`).
* @returns The path to the directory if it exists and contains valid data for the current app, otherwise null.

View File

@ -618,6 +618,7 @@ declare global {
type SettingsType = {
"app:*"?: boolean;
"app:globalhotkey"?: string;
"app:dismissarchitecturewarning"?: boolean;
"ai:*"?: boolean;
"ai:preset"?: string;
"ai:apitype"?: string;

View File

@ -8,6 +8,7 @@ package wconfig
const (
ConfigKey_AppClear = "app:*"
ConfigKey_AppGlobalHotkey = "app:globalhotkey"
ConfigKey_AppDismissArchitectureWarning = "app:dismissarchitecturewarning"
ConfigKey_AiClear = "ai:*"
ConfigKey_AiPreset = "ai:preset"

View File

@ -35,6 +35,7 @@ const AnySchema = `
type SettingsType struct {
AppClear bool `json:"app:*,omitempty"`
AppGlobalHotkey string `json:"app:globalhotkey,omitempty"`
AppDismissArchitectureWarning bool `json:"app:dismissarchitecturewarning,omitempty"`
AiClear bool `json:"ai:*,omitempty"`
AiPreset string `json:"ai:preset,omitempty"`