diff --git a/cmd/server/main-server.go b/cmd/server/main-server.go index 40b730ad5..6a6d441ba 100644 --- a/cmd/server/main-server.go +++ b/cmd/server/main-server.go @@ -219,10 +219,6 @@ func main() { log.Printf("error initializing wstore: %v\n", err) return } - migrateErr := wstore.TryMigrateOldHistory() - if migrateErr != nil { - log.Printf("error migrating old history: %v\n", migrateErr) - } go func() { err := shellutil.InitCustomShellStartupFiles() if err != nil { @@ -234,6 +230,12 @@ func main() { log.Printf("error ensuring initial data: %v\n", err) return } + if firstRun { + migrateErr := wstore.TryMigrateOldHistory() + if migrateErr != nil { + log.Printf("error migrating old history: %v\n", migrateErr) + } + } if window != nil { ctx, cancelFn := context.WithTimeout(context.Background(), 2*time.Second) defer cancelFn() diff --git a/emain/launchsettings.ts b/emain/launchsettings.ts index 7600c39c4..92339c915 100644 --- a/emain/launchsettings.ts +++ b/emain/launchsettings.ts @@ -12,7 +12,7 @@ export function getLaunchSettings(): SettingsType { try { const settingsContents = fs.readFileSync(settingsPath, "utf8"); return JSON.parse(settingsContents); - } catch (e) { - console.error("Unable to load settings.json to get initial launch settings", e); + } catch (_) { + // fail silently } } diff --git a/emain/platform.ts b/emain/platform.ts index 75c875946..8e67d12e4 100644 --- a/emain/platform.ts +++ b/emain/platform.ts @@ -7,6 +7,8 @@ import path from "path"; import { WaveDevVarName, WaveDevViteVarName } from "../frontend/util/isdev"; import * as keyutil from "../frontend/util/keyutil"; +const WaveHomeVarName = "WAVETERM_HOME"; + const isDev = !app.isPackaged; const isDevVite = isDev && process.env.ELECTRON_RENDERER_URL; if (isDev) { @@ -37,6 +39,10 @@ ipcMain.on("get-host-name", (event) => { // must match golang function getWaveHomeDir() { + const override = process.env[WaveHomeVarName]; + if (override) { + return override; + } return path.join(os.homedir(), isDev ? ".waveterm-dev" : ".waveterm"); } diff --git a/frontend/app/modals/tos.less b/frontend/app/modals/tos.less index 1540a139c..72d8015af 100644 --- a/frontend/app/modals/tos.less +++ b/frontend/app/modals/tos.less @@ -233,6 +233,10 @@ font-size: 14px; } + button:not(:first-child) { + margin-left: 10px; + } + button.disabled-button { cursor: default; } diff --git a/frontend/app/modals/tos.tsx b/frontend/app/modals/tos.tsx index 6bf238176..fb572bdb5 100644 --- a/frontend/app/modals/tos.tsx +++ b/frontend/app/modals/tos.tsx @@ -10,7 +10,7 @@ import { useEffect, useRef, useState } from "react"; import { FlexiModal } from "./modal"; import { QuickTips } from "@/app/element/quicktips"; -import { atoms } from "@/app/store/global"; +import { atoms, getApi } from "@/app/store/global"; import { modalsModel } from "@/app/store/modalmodel"; import { atom, PrimitiveAtom, useAtom, useAtomValue, useSetAtom } from "jotai"; import "./tos.less"; @@ -153,6 +153,58 @@ const ModalPage2 = () => { ); }; +const ModalPageLegacy = () => { + const setPageNum = useSetAtom(pageNumAtom); + const handleContinue = () => { + setPageNum(1); + }; + const handleDownloadLegacy = () => { + getApi().openExternal("https://waveterm.dev/download-legacy?ref=v7upgrade"); + }; + return ( + <> +
+
+ +
+
Welcome to Wave v0.8
+
+
+
+ We’re excited to announce the release of Wave Terminal v0.8. This update introduces a brand-new + layout engine, featuring drag-and-drop screen splitting with flexible block sizing and positioning. + We've also integrated powerful tools like file previews, an editor, web integration, and AI, all + designed to keep you focused and minimize context switching. And for the first time, Wave Terminal + runs natively on Windows! +
+
+ Wave v0.8 is less opinionated, giving you the freedom to use your standard terminal prompt and + command completions, while supporting all shells (not just bash/zsh). We've also improved + compatibility with ohmyzsh packages, removing some of the friction users experienced. It’s faster, + more performant, and provides a stronger foundation for you to build your own blocks and widgets in + the future. +
+
+ The new build is a fresh start, and a clean break from the current version. As such, your history, + settings, and configuration will not be carried over. If you'd like to continue to run the + legacy version, you will need to download it separately. +
+
+ + + ); +}; + const TosModal = () => { const modalRef = useRef(null); const [pageNum, setPageNum] = useAtom(pageNumAtom); @@ -173,7 +225,9 @@ const TosModal = () => { useEffect(() => { // on unmount, always reset pagenum - if (clientData.tosagreed) { + if (!clientData.tosagreed && clientData.hasoldhistory) { + setPageNum(0); + } else if (clientData.tosagreed) { setPageNum(2); } return () => { @@ -189,11 +243,25 @@ const TosModal = () => { window.removeEventListener("resize", updateModalHeight); }; }, []); - + let pageComp: React.JSX.Element = null; + switch (pageNum) { + case 0: + pageComp = ; + break; + case 1: + pageComp = ; + break; + case 2: + pageComp = ; + break; + } + if (pageComp == null) { + return null; + } return ( - {pageNum === 1 ? : } + {pageComp} ); diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts index 3f29a3e04..185278f47 100644 --- a/frontend/types/gotypes.d.ts +++ b/frontend/types/gotypes.d.ts @@ -44,7 +44,7 @@ declare global { type Client = WaveObj & { windowids: string[]; tosagreed?: number; - historymigrated?: boolean; + hasoldhistory?: boolean; }; // wshrpc.CommandAppendIJsonData diff --git a/package.json b/package.json index 64caa0a7a..610afd8d0 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "productName": "Wave", "description": "Open-Source AI-Native Terminal Built for Seamless Workflows", "license": "Apache-2.0", - "version": "0.8.4-beta.4", + "version": "0.8.4", "homepage": "https://waveterm.dev", "build": { "appId": "dev.commandline.waveterm" diff --git a/pkg/waveobj/wtype.go b/pkg/waveobj/wtype.go index 9494c995a..0268952c7 100644 --- a/pkg/waveobj/wtype.go +++ b/pkg/waveobj/wtype.go @@ -112,12 +112,12 @@ func (update *WaveObjUpdate) UnmarshalJSON(data []byte) error { } type Client struct { - OID string `json:"oid"` - Version int `json:"version"` - WindowIds []string `json:"windowids"` - Meta MetaMapType `json:"meta"` - TosAgreed int64 `json:"tosagreed,omitempty"` - HistoryMigrated bool `json:"historymigrated,omitempty"` + OID string `json:"oid"` + Version int `json:"version"` + WindowIds []string `json:"windowids"` + Meta MetaMapType `json:"meta"` + TosAgreed int64 `json:"tosagreed,omitempty"` + HasOldHistory bool `json:"hasoldhistory,omitempty"` } func (*Client) GetOType() string { diff --git a/pkg/wstore/wstore_dboldmigration.go b/pkg/wstore/wstore_dboldmigration.go index 53af85de3..ef767339a 100644 --- a/pkg/wstore/wstore_dboldmigration.go +++ b/pkg/wstore/wstore_dboldmigration.go @@ -83,19 +83,6 @@ func ReplaceOldHistory(ctx context.Context, hist []*OldHistoryType) error { func TryMigrateOldHistory() error { ctx, cancelFn := context.WithTimeout(context.Background(), 10*time.Second) defer cancelFn() - client, err := DBGetSingleton[*waveobj.Client](ctx) - if err != nil { - return err - } - if client.HistoryMigrated { - return nil - } - log.Printf("trying to migrate old wave history\n") - client.HistoryMigrated = true - err = DBUpdate(ctx, client) - if err != nil { - return err - } hist, err := GetAllOldHistory() if err != nil { return err @@ -108,5 +95,14 @@ func TryMigrateOldHistory() error { return err } log.Printf("migrated %d old wave history records\n", len(hist)) + client, err := DBGetSingleton[*waveobj.Client](ctx) + if err != nil { + return err + } + client.HasOldHistory = true + err = DBUpdate(ctx, client) + if err != nil { + return err + } return nil }