Update Data Directories and Environment Variables (#59)

* phase 1 of wave runtime migration.  update waveterm_dev, build vars, waveterm_app_path.  fix errors with plugins readmes and screenshot directories.  use asset loaders in webpack.  fix window-empty styles.  wave-migrate script.  remove unused scripthaus commands.  other fixes

* waveterm_home directory.  lots of internal scbase prompt names to wave

* update waveterm.lock file

* change wave data directories.  remove welcome modal code

* update waveterm.db name

* fix Wave menu (add back default items).  Update TOS modal words

* fix typescript errors
This commit is contained in:
sawka 2023-11-01 01:26:19 -07:00 committed by GitHub
parent 15a4719b17
commit afc5bbd212
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 256 additions and 701 deletions

View File

@ -0,0 +1,18 @@
#!/bin/bash
if [ ! -d ~/prompt ]; then
echo "~/prompt directory does not exist, will not migrate"
exit 1;
fi
if [ -d ~/.wave ]; then
echo "~/.wave directory already exists, will not migrate"
exit 1;
fi
mv ~/prompt ~/.wave
cd ~/.wave
mv prompt.db wave.db
mv prompt.db-wal wave.db-wal
mv prompt.db-shm wave.db-shm
mv prompt.authkey wave.authkey

View File

@ -27,7 +27,7 @@ node_modules/.bin/electron-rebuild
```bash
# @scripthaus command electron
# @scripthaus cd :playbook
PROMPT_DEV=1 PCLOUD_ENDPOINT="https://ot2e112zx5.execute-api.us-west-2.amazonaws.com/dev" node_modules/.bin/electron dist-dev/emain.js
WAVETERM_DEV=1 PCLOUD_ENDPOINT="https://ot2e112zx5.execute-api.us-west-2.amazonaws.com/dev" node_modules/.bin/electron dist-dev/emain.js
```
```bash
@ -60,8 +60,7 @@ node_modules/.bin/electron-forge make
rm -rf dist/
rm -rf bin/
rm -rf build/
node_modules/.bin/webpack --config webpack.prod.js
node_modules/.bin/webpack --config webpack.electron.prod.js
node_modules/.bin/webpack --env prod
GO_LDFLAGS="-s -w -X main.BuildTime=$(date +'%Y%m%d%H%M')"
(cd waveshell; GOOS=darwin GOARCH=amd64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-darwin.amd64 main-waveshell.go)
(cd waveshell; GOOS=darwin GOARCH=arm64 go build -ldflags="$GO_LDFLAGS" -o ../bin/mshell/mshell-v0.3-darwin.arm64 main-waveshell.go)
@ -113,22 +112,6 @@ rm *.dmg
"out/Wave-darwin-arm64/Wave.app"
```
```bash
# @scripthaus command sync-webshare-dev
# @scripthaus cd :playbook
# no-cache for dev
aws --profile prompt-s3 s3 sync webshare/static s3://prompt-devshare-static/static --cache-control 'no-cache'
aws --profile prompt-s3 s3 sync webshare/dist-dev s3://prompt-devshare-static/dist-dev --cache-control 'no-cache'
```
```bash
# @scripthaus command sync-webshare
# @scripthaus cd :playbook
# no-cache for dev
aws --profile prompt-s3 s3 sync webshare/static s3://prompt-share-static/static --cache-control 'no-cache'
aws --profile prompt-s3 s3 sync webshare/dist s3://prompt-share-static/dist --cache-control 'no-cache'
```
```bash
# @scripthaus command build-wavesrv
cd wavesrv

View File

@ -24,7 +24,7 @@ import {
import { RemotesModal } from "./connections/connections";
import { TosModal } from "./common/modals/modals";
import { MainSideBar } from "./sidebar/MainSideBar";
import { DisconnectedModal, ClientStopModal, AlertModal, WelcomeModal, AboutModal } from "./common/modals/modals";
import { DisconnectedModal, ClientStopModal, AlertModal, AboutModal } from "./common/modals/modals";
import { ErrorBoundary } from "./common/error/errorboundary";
import "./app.less";
@ -124,9 +124,6 @@ class App extends React.Component<{}, {}> {
<If condition={GlobalModel.needsTos()}>
<TosModal />
</If>
<If condition={GlobalModel.welcomeModalOpen.get()}>
<WelcomeModal />
</If>
<If condition={GlobalModel.aboutModalOpen.get()}>
<AboutModal />
</If>

View File

@ -1,367 +0,0 @@
// Copyright 2023, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
import * as React from "react";
import * as mobxReact from "mobx-react";
import * as mobx from "mobx";
import { boundMethod } from "autobind-decorator";
import { If, For } from "tsx-control-statements/components";
import cn from "classnames";
import dayjs from "dayjs";
import localizedFormat from "dayjs/plugin/localizedFormat";
import { GlobalModel, GlobalCommandRunner } from "../../../model/model";
import { Markdown } from "../common";
import * as util from "../../../util/util";
import { ReactComponent as XmarkIcon } from "../../assets/icons/line/xmark.svg";
import { ReactComponent as WarningIcon } from "../../assets/icons/line/triangle-exclamation.svg";
import { ReactComponent as ShieldCheck } from "../../assets/icons/line/shield_check.svg";
import { ReactComponent as Help } from "../../assets/icons/line/help_filled.svg";
import { ReactComponent as Github } from "../../assets/icons/line/github.svg";
dayjs.extend(localizedFormat);
type OV<V> = mobx.IObservableValue<V>;
@mobxReact.observer
class DisconnectedModal extends React.Component<{}, {}> {
logRef: any = React.createRef();
showLog: mobx.IObservableValue<boolean> = mobx.observable.box(false);
@boundMethod
restartServer() {
GlobalModel.restartWaveSrv();
}
@boundMethod
tryReconnect() {
GlobalModel.ws.connectNow("manual");
}
componentDidMount() {
if (this.logRef.current != null) {
this.logRef.current.scrollTop = this.logRef.current.scrollHeight;
}
}
componentDidUpdate() {
if (this.logRef.current != null) {
this.logRef.current.scrollTop = this.logRef.current.scrollHeight;
}
}
@boundMethod
handleShowLog(): void {
mobx.action(() => {
this.showLog.set(!this.showLog.get());
})();
}
render() {
let model = GlobalModel;
let logLine: string = null;
let idx: number = 0;
return (
<div className="prompt-modal disconnected-modal modal is-active">
<div className="modal-background"></div>
<div className="modal-content">
<div className="message-header">
<div className="modal-title">Prompt Client Disconnected</div>
</div>
<If condition={this.showLog.get()}>
<div className="inner-content">
<div className="ws-log" ref={this.logRef}>
<For each="logLine" index="idx" of={GlobalModel.ws.wsLog}>
<div key={idx} className="ws-logline">
{logLine}
</div>
</For>
</div>
</div>
</If>
<footer>
<div className="footer-text-link" style={{ marginLeft: 10 }} onClick={this.handleShowLog}>
<If condition={!this.showLog.get()}>
<i className="fa-sharp fa-solid fa-plus" /> Show Log
</If>
<If condition={this.showLog.get()}>
<i className="fa-sharp fa-solid fa-minus" /> Hide Log
</If>
</div>
<div className="flex-spacer" />
<button onClick={this.tryReconnect} className="button">
<span className="icon">
<i className="fa-sharp fa-solid fa-rotate" />
</span>
<span>Try Reconnect</span>
</button>
<button onClick={this.restartServer} className="button is-danger" style={{ marginLeft: 10 }}>
<WarningIcon className="icon" />
<span>Restart Server</span>
</button>
</footer>
</div>
</div>
);
}
}
@mobxReact.observer
class ClientStopModal extends React.Component<{}, {}> {
@boundMethod
refreshClient() {
GlobalModel.refreshClient();
}
render() {
let model = GlobalModel;
let cdata = model.clientData.get();
let title = "Client Not Ready";
return (
<div className="prompt-modal client-stop-modal modal is-active">
<div className="modal-background"></div>
<div className="modal-content">
<div className="message-header">
<div className="modal-title">[prompt] {title}</div>
</div>
<div className="inner-content">
<If condition={cdata == null}>
<div>Cannot get client data.</div>
</If>
</div>
<footer>
<button onClick={this.refreshClient} className="button">
<span className="icon">
<i className="fa-sharp fa-solid fa-rotate" />
</span>
<span>Hard Refresh Client</span>
</button>
</footer>
</div>
</div>
);
}
}
@mobxReact.observer
class LoadingSpinner extends React.Component<{}, {}> {
render() {
return (
<div className="loading-spinner">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
);
}
}
@mobxReact.observer
class AlertModal extends React.Component<{}, {}> {
@boundMethod
closeModal(): void {
GlobalModel.cancelAlert();
}
@boundMethod
handleOK(): void {
GlobalModel.confirmAlert();
}
render() {
let message = GlobalModel.alertMessage.get();
if (message == null) {
return null;
}
let title = message.title ?? (message.confirm ? "Confirm" : "Alert");
let isConfirm = message.confirm;
return (
<div className="modal prompt-modal wave-modal is-active alert-modal">
<div className="modal-background" />
<div className="modal-content">
<header>
<p className="modal-title">
<WarningIcon className="icon" />
{title}
</p>
<div className="close-icon hoverEffect" title="Close (Escape)" onClick={this.closeModal}>
<XmarkIcon />
</div>
</header>
<If condition={message.markdown}>
<Markdown text={message.message} extraClassName="inner-content" />
</If>
<If condition={!message.markdown}>
<div className="inner-content content">
<p>{message.message}</p>
</div>
</If>
<footer>
<If condition={isConfirm}>
<div onClick={this.closeModal} className="button is-prompt-cancel is-outlined is-small">
Cancel
</div>
<div onClick={this.handleOK} className="button is-prompt-green is-outlined is-small">
OK
</div>
</If>
<If condition={!isConfirm}>
<div onClick={this.handleOK} className="button is-prompt-green is-small">
OK
</div>
</If>
</footer>
</div>
</div>
);
}
}
@mobxReact.observer
class WelcomeModal extends React.Component<{}, {}> {
totalPages: number = 3;
pageNum: OV<number> = mobx.observable.box(1, { name: "welcome-pagenum" });
@boundMethod
closeModal(): void {
mobx.action(() => {
GlobalModel.welcomeModalOpen.set(false);
})();
}
@boundMethod
goNext(): void {
mobx.action(() => {
this.pageNum.set(this.pageNum.get() + 1);
})();
}
@boundMethod
goPrev(): void {
mobx.action(() => {
this.pageNum.set(this.pageNum.get() - 1);
})();
}
renderDot(num: number): any {
if (num == this.pageNum.get()) {
return <i key={String(num)} className="fa-sharp fa-solid fa-circle" />;
}
return <i key={String(num)} className="fa-sharp fa-regular fa-circle" />;
}
renderDots(): any {
let elems: any = [];
for (let i = 1; i <= this.totalPages; i++) {
let elem = this.renderDot(i);
elems.push(elem);
}
return elems;
}
render() {
let pageNum = this.pageNum.get();
return (
<div className={cn("modal welcome-modal prompt-modal is-active")}>
<div className="modal-background" onClick={this.closeModal} />
<div className="modal-content">
<header>
<div className="modal-title">welcome to [prompt]</div>
<div className="close-icon hoverEffect" title="Close (Escape)" onClick={this.closeModal}>
<XmarkIcon />
</div>
</header>
<div className={cn("inner-content content", { "is-hidden": pageNum != 1 })}>
<p>
Prompt is a new terminal to help save you time and keep your command-line life organized.
Here's a couple quick tips to get your started!
</p>
</div>
<footer>
<If condition={pageNum > 1}>
<button className={cn("button is-dark prev-button is-small")} onClick={this.goPrev}>
<span className="icon is-small">
<i className="fa-sharp fa-regular fa-angle-left" />
</span>
<span>Prev</span>
</button>
</If>
<If condition={pageNum == 1}>
<div className="prev-spacer" />
</If>
<div className="flex-spacer" />
<div className="dots">{this.renderDots()}</div>
<div className="flex-spacer" />
<If condition={pageNum < this.totalPages}>
<button className="button is-dark next-button is-small" onClick={this.goNext}>
<span>Next</span>
<span className="icon is-small">
<i className="fa-sharp fa-regular fa-angle-right" />
</span>
</button>
</If>
<If condition={pageNum == this.totalPages}>
<button className="button is-dark next-button is-small" onClick={this.closeModal}>
<span>Done</span>
</button>
</If>
</footer>
</div>
</div>
);
}
}
@mobxReact.observer
class TosModal extends React.Component<{}, {}> {
@boundMethod
acceptTos(): void {
GlobalCommandRunner.clientAcceptTos();
}
render() {
return (
<div className={cn("modal tos-modal wave-modal is-active")}>
<div className="modal-background" />
<div className="modal-content">
<div className="modal-content-wrapper">
<header>
<div className="modal-title">Welcome to Wave Terminal!</div>
<div className="modal-subtitle">Lets set everything for you</div>
</header>
<div className="content">
<div className="item">
<ShieldCheck />
<div className="item-inner">
<div className="item-title">Telemetry</div>
</div>
</div>
<div className="item">
<Help />
<div className="item-inner"></div>
</div>
<div className="item">
<Github />
<div className="item-inner"></div>
</div>
{/* <p>
<a target="_blank" href={util.makeExternLink("https://www.commandline.dev/tos")}>
Full Terms of Service
</a>
</p> */}
</div>
<footer>
<div className="flex-spacer" />
<div onClick={this.acceptTos} className="button is-prompt-green is-outlined is-small">
Accept Terms of Service
</div>
</footer>
</div>
</div>
</div>
);
}
}
export { WelcomeModal, LoadingSpinner, ClientStopModal, AlertModal, DisconnectedModal, TosModal };

View File

@ -17,6 +17,7 @@ import { ClientDataType } from "../../../types/types";
import close from "../../assets/icons/close.svg";
import { ReactComponent as WarningIcon } from "../../assets/icons/line/triangle-exclamation.svg";
import { ReactComponent as XmarkIcon } from "../../assets/icons/line/xmark.svg";
import shield from "../../assets/icons/shield_check.svg";
import help from "../../assets/icons/help_filled.svg";
import github from "../../assets/icons/github.svg";
@ -25,7 +26,7 @@ import logo from "../../assets/waveterm-logo-with-bg.svg";
dayjs.extend(localizedFormat);
// @ts-ignore
const VERSION = __PROMPT_VERSION__;
const VERSION = __WAVETERM_VERSION__;
type OV<V> = mobx.IObservableValue<V>;
@ -72,7 +73,7 @@ class DisconnectedModal extends React.Component<{}, {}> {
<div className="modal-background"></div>
<div className="modal-content">
<div className="message-header">
<div className="modal-title">Prompt Client Disconnected</div>
<div className="modal-title">Wave Client Disconnected</div>
</div>
<If condition={this.showLog.get()}>
<div className="inner-content">
@ -128,7 +129,7 @@ class ClientStopModal extends React.Component<{}, {}> {
<div className="modal-background"></div>
<div className="modal-content">
<div className="message-header">
<div className="modal-title">[prompt] {title}</div>
<div className="modal-title">{title}</div>
</div>
<div className="inner-content">
<If condition={cdata == null}>
@ -224,101 +225,6 @@ class AlertModal extends React.Component<{}, {}> {
}
}
@mobxReact.observer
class WelcomeModal extends React.Component<{}, {}> {
totalPages: number = 3;
pageNum: OV<number> = mobx.observable.box(1, { name: "welcome-pagenum" });
@boundMethod
closeModal(): void {
mobx.action(() => {
GlobalModel.welcomeModalOpen.set(false);
})();
}
@boundMethod
goNext(): void {
mobx.action(() => {
this.pageNum.set(this.pageNum.get() + 1);
})();
}
@boundMethod
goPrev(): void {
mobx.action(() => {
this.pageNum.set(this.pageNum.get() - 1);
})();
}
renderDot(num: number): any {
if (num == this.pageNum.get()) {
return <i key={String(num)} className="fa-sharp fa-solid fa-circle" />;
}
return <i key={String(num)} className="fa-sharp fa-regular fa-circle" />;
}
renderDots(): any {
let elems: any = [];
for (let i = 1; i <= this.totalPages; i++) {
let elem = this.renderDot(i);
elems.push(elem);
}
return elems;
}
render() {
let pageNum = this.pageNum.get();
return (
<div className={cn("modal welcome-modal prompt-modal is-active")}>
<div className="modal-background" onClick={this.closeModal} />
<div className="modal-content">
<header>
<div className="modal-title">About</div>
<div className="close-icon hoverEffect" title="Close (Escape)" onClick={this.closeModal}>
<XmarkIcon />
</div>
</header>
<div className={cn("inner-content content", { "is-hidden": pageNum != 1 })}>
<p>
Prompt is a new terminal to help save you time and keep your command-line life organized.
Here's a couple quick tips to get your started!
</p>
</div>
<footer>
<If condition={pageNum > 1}>
<button className={cn("button is-dark prev-button is-small")} onClick={this.goPrev}>
<span className="icon is-small">
<i className="fa-sharp fa-regular fa-angle-left" />
</span>
<span>Prev</span>
</button>
</If>
<If condition={pageNum == 1}>
<div className="prev-spacer" />
</If>
<div className="flex-spacer" />
<div className="dots">{this.renderDots()}</div>
<div className="flex-spacer" />
<If condition={pageNum < this.totalPages}>
<button className="button is-dark next-button is-small" onClick={this.goNext}>
<span>Next</span>
<span className="icon is-small">
<i className="fa-sharp fa-regular fa-angle-right" />
</span>
</button>
</If>
<If condition={pageNum == this.totalPages}>
<button className="button is-dark next-button is-small" onClick={this.closeModal}>
<span>Done</span>
</button>
</If>
</footer>
</div>
</div>
);
}
}
@mobxReact.observer
class TosModal extends React.Component<{}, {}> {
state = {
@ -352,60 +258,66 @@ class TosModal extends React.Component<{}, {}> {
<div className="modal-background" />
<div className="modal-content tos-modal-content">
<div className="modal-content-wrapper">
<header className="tos-header">
<header className="tos-header unselectable">
<div className="modal-title">Welcome to Wave Terminal!</div>
<div className="modal-subtitle">Lets set everything for you</div>
</header>
<div className="content tos-content">
<div className="content tos-content unselectable">
<div className="item">
<img src={shield} alt="Privacy" />
<div className="item-inner">
<div className="item-title">Telemetry</div>
<div className="item-text">
We dont collect any personal info, only crash logs and IP address to make Wave
better. If you like, you can disable telemetry now or late.
We only collect minimal <i>anonymous</i> telemetry data to help us
understand how many people are using Wave.
</div>
<div className="item-field">
<div className="item-field" style={{marginTop: 2}}>
<Toggle
checked={!cdata.clientopts.notelemetry}
onChange={this.handleChangeTelemetry}
/>
<div className="item-label">Basic Telemetry</div>
<div className="item-label">Telemetry {cdata.clientopts.notelemetry ? "Disabled" : "Enabled"}</div>
</div>
</div>
</div>
<div className="item">
<img src={help} alt="Help" />
<div className="item-inner">
<div className="item-title">Help</div>
<div className="item-text">
If you need any help or you have feature request, you can join{" "}
<a target="_blank" href={util.makeExternLink("https://discord.gg/XfvZ334gwU")}>
our Discord
<img src={help} alt="Help" />
</a>
<div className="item-inner">
<div className="item-title">Join our Community</div>
<div className="item-text">
Get help, submit feature requests, report bugs,
or just chat with fellow terminal enthusiasts.<br/>
<a target="_blank" href={util.makeExternLink("https://discord.gg/XfvZ334gwU")}>
Join the Wave&nbsp;Discord&nbsp;Channel
</a>
.
</div>
</div>
</div>
<div className="item">
<img src={github} alt="Github" />
<div className="item-inner">
<div className="item-title">Like Wave? Give us a star</div>
<div className="item-text">
Rankings are very important for small startups like us, it helps other people to
know about us. If you like Wave, please consider giving us a star on our{" "}
<a
target="_blank"
href={util.makeExternLink("https://github.com/wavetermdev/waveterm")}
>
Github Repository
<img src={github} alt="Github" />
</a>
<div className="item-inner">
<div className="item-title">Support us on GitHub</div>
<div className="item-text">
We're <i>open source</i> and committed to providing a free terminal for individual
users. Please show your support us by giving us a star on{" "}
<a
target="_blank"
href={util.makeExternLink("https://github.com/wavetermdev/waveterm")}
>
Github&nbsp;(wavetermdev/waveterm)
</a>
.
</div>
</div>
</div>
</div>
<footer>
<footer className="unselectable">
<div>
<Checkbox
checked={this.state.isChecked}
@ -541,4 +453,4 @@ class AboutModal extends React.Component<{}, {}> {
}
}
export { WelcomeModal, LoadingSpinner, ClientStopModal, AlertModal, DisconnectedModal, TosModal, AboutModal };
export { LoadingSpinner, ClientStopModal, AlertModal, DisconnectedModal, TosModal, AboutModal };

View File

@ -23,9 +23,9 @@ import "./modals.less";
type OV<V> = mobx.IObservableValue<V>;
// @ts-ignore
const VERSION = __PROMPT_VERSION__;
const VERSION = __WAVETERM_VERSION__;
// @ts-ignore
const BUILD = __PROMPT_BUILD__;
const BUILD = __WAVETERM_BUILD__;
const ScreenDeleteMessage = `
Are you sure you want to delete this screen/tab?

View File

@ -408,13 +408,13 @@ class CreateRemote extends React.Component<{ model: RemotesModalModel; remoteEdi
<InfoMessage width={350}>
<ul>
<li>
<b>startup</b> - connect when [prompt] starts.
<b>startup</b> - Connect when Wave Terminal starts.
</li>
<li>
<b>auto</b> - connect when you first run a command using this connection.
<b>auto</b> - Connect when you first run a command using this connection.
</li>
<li>
<b>manual</b> - connect manually. Note, if your connection requires manual input,
<b>manual</b> - Connect manually. Note, if your connection requires manual input,
like an OPT code, you must use this setting.
</li>
</ul>
@ -703,13 +703,13 @@ class EditRemoteSettings extends React.Component<
<InfoMessage width={350}>
<ul>
<li>
<b>startup</b> - connect when [prompt] starts.
<b>startup</b> - Connect when Wave Terminal starts.
</li>
<li>
<b>auto</b> - connect when you first run a command using this connection.
<b>auto</b> - Connect when you first run a command using this connection.
</li>
<li>
<b>manual</b> - connect manually. Note, if your connection requires manual input,
<b>manual</b> - Connect manually. Note, if your connection requires manual input,
like an OPT code, you must use this setting.
</li>
</ul>

View File

@ -118,13 +118,6 @@ class MainSideBar extends React.Component<{}, {}> {
GlobalModel.showWebShareView();
}
@boundMethod
handleWelcomeClick(): void {
mobx.action(() => {
GlobalModel.welcomeModalOpen.set(true);
})();
}
@boundMethod
handleSettingsClick(): void {
mobx.action(() => {

View File

@ -41,6 +41,26 @@
}
}
.window-empty {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
padding: 10px;
height: 100%;
color: #ccc;
code {
background-color: transparent;
color: #4e9a06;
}
&.should-fade {
opacity: 1;
animation: fade-in 2.5s;
}
}
.share-tag {
color: @term-white;
position: absolute;

View File

@ -16,7 +16,7 @@ import * as T from "../../../types/types";
import localizedFormat from "dayjs/plugin/localizedFormat";
import { InlineSettingsTextEdit, RemoteStatusLight } from "../../common/common";
import { getRemoteStr } from "../../common/prompt/prompt";
import { GlobalModel, ScreenLines, Screen } from "../../../model/model";
import { GlobalModel, ScreenLines, Screen, Session } from "../../../model/model";
import { Line } from "../../line/linecomps";
import { LinesView } from "../../line/linesview";
import * as util from "../../../util/util";
@ -36,16 +36,16 @@ dayjs.extend(localizedFormat);
type OV<V> = mobx.IObservableValue<V>;
@mobxReact.observer
class ScreenView extends React.Component<{ screen: Screen }, {}> {
class ScreenView extends React.Component<{ session: Session, screen: Screen }, {}> {
render() {
let { screen } = this.props;
let { session, screen } = this.props;
if (screen == null) {
return <div className="screen-view">(no screen found)</div>;
}
let fontSize = GlobalModel.termFontSize.get();
return (
<div className="screen-view" data-screenid={screen.screenId}>
<ScreenWindowView key={screen.screenId + ":" + fontSize} screen={screen} />
<ScreenWindowView key={screen.screenId + ":" + fontSize} session={session} screen={screen} />
</div>
);
}
@ -219,7 +219,7 @@ class NewTabSettings extends React.Component<{ screen: Screen }, {}> {
// screen is not null
@mobxReact.observer
class ScreenWindowView extends React.Component<{ screen: Screen }, {}> {
class ScreenWindowView extends React.Component<{ session: Session, screen: Screen }, {}> {
rszObs: any;
windowViewRef: React.RefObject<any>;
@ -303,7 +303,7 @@ class ScreenWindowView extends React.Component<{ screen: Screen }, {}> {
<div className="window-view" ref={this.windowViewRef} data-screenid={screen.screenId}>
<div key="lines" className="lines"></div>
<div key="window-empty" className={cn("window-empty", { "should-fade": fade })}>
<div>{message}</div>
<div className="text-standard">{message}</div>
</div>
</div>
);
@ -344,7 +344,7 @@ class ScreenWindowView extends React.Component<{ screen: Screen }, {}> {
}
render() {
let { screen } = this.props;
let { session, screen } = this.props;
let win = this.getScreenLines();
if (win == null || !win.loaded.get()) {
return this.renderError("...", true);
@ -379,8 +379,18 @@ class ScreenWindowView extends React.Component<{ screen: Screen }, {}> {
</div>
</div>
<If condition={lines.length == 0}>
<If condition={true}>
<NewTabSettings screen={screen}/>
</If>
<If condition={false}>
<div className="window-view" ref={this.windowViewRef} data-screenid={screen.screenId}>
<div key="lines" className="lines"></div>
<div key="window-empty" className={cn("window-empty")}>
<div><code className="text-standard">[workspace="{session.name.get()}" screen="{screen.name.get()}"]</code></div>
</div>
</div>
</If>
</If>
<If condition={screen.isWebShared()}>
<div key="share-tag" className="share-tag">
<If condition={this.shareCopied.get()}>

View File

@ -39,7 +39,7 @@ class WorkspaceView extends React.Component<{}, {}> {
<div className={cn("session-view", { "is-hidden": isHidden })} data-sessionid={session.sessionId}>
<ScreenTabs session={session} />
<ErrorBoundary>
<ScreenView screen={activeScreen} />
<ScreenView session={session} screen={activeScreen} />
<div className="cmdinput-height-placeholder" style={{ height: cmdInputHeight }}></div>
<CmdInput />
</ErrorBoundary>

View File

@ -13,15 +13,15 @@ import * as util from "util";
import { sprintf } from "sprintf-js";
import { v4 as uuidv4 } from "uuid";
const PromptAppPathVarName = "PROMPT_APP_PATH";
const PromptDevVarName = "PROMPT_DEV";
const AuthKeyFile = "prompt.authkey";
const WaveAppPathVarName = "WAVETERM_APP_PATH";
const WaveDevVarName = "WAVETERM_DEV";
const AuthKeyFile = "waveterm.authkey";
const DevServerEndpoint = "http://127.0.0.1:8090";
const ProdServerEndpoint = "http://127.0.0.1:1619";
let isDev = process.env[PromptDevVarName] != null;
let scHome = getPromptHomeDir();
ensureDir(scHome);
let isDev = process.env[WaveDevVarName] != null;
let waveHome = getWaveHomeDir();
ensureDir(waveHome);
let DistDir = isDev ? "dist-dev" : "dist";
let GlobalAuthKey = "";
let instanceId = uuidv4();
@ -43,7 +43,7 @@ let loggerConfig = {
winston.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }),
winston.format.printf((info) => `${info.timestamp} ${info.message}`)
),
transports: [new winston.transports.File({ filename: path.join(scHome, "waveterm-app.log"), level: "info" })],
transports: [new winston.transports.File({ filename: path.join(waveHome, "waveterm-app.log"), level: "info" })],
};
if (isDev) {
loggerConfig.transports.push(new winston.transports.Console());
@ -59,15 +59,15 @@ function log(...msg) {
console.log = log;
console.log(
sprintf(
"waveterm-app starting, PROMPT_HOME=%s, apppath=%s arch=%s/%s",
scHome,
"waveterm-app starting, WAVETERM_HOME=%s, apppath=%s arch=%s/%s",
waveHome,
getAppBasePath(),
unamePlatform,
unameArch
)
);
if (isDev) {
console.log("prompt-app PROMPT_DEV set");
console.log("waveterm-app WAVETERM_DEV set");
}
let app = electron.app;
app.setName(isDev ? "Wave (Dev)" : "Wave");
@ -79,20 +79,20 @@ electron.dialog.showErrorBox = (title, content) => {
};
// must match golang
function getPromptHomeDir() {
let scHome = process.env.PROMPT_HOME;
if (scHome == null) {
function getWaveHomeDir() {
let waveHome = process.env.WAVETERM_HOME;
if (waveHome == null) {
let homeDir = process.env.HOME;
if (homeDir == null) {
homeDir = "/";
}
scHome = path.join(homeDir, isDev ? "prompt-dev" : "prompt");
waveHome = path.join(homeDir, isDev ? ".waveterm-dev" : ".waveterm");
}
return scHome;
return waveHome;
}
// for dev, this is just the github.com/commandlinedev/prompt-client directory
// for prod, this is .../Prompt.app/Contents/Resources/app
// for dev, this is just the waveterm directory
// for prod, this is .../Wave.app/Contents/Resources/app
function getAppBasePath() {
return path.dirname(__dirname);
}
@ -113,14 +113,14 @@ function getWaveSrvPath() {
function getWaveSrvCmd() {
let waveSrvPath = getWaveSrvPath();
let scHome = getPromptHomeDir();
let logFile = path.join(scHome, "wavesrv.log");
let waveHome = getWaveHomeDir();
let logFile = path.join(waveHome, "wavesrv.log");
return `${waveSrvPath} >> "${logFile}" 2>&1`;
}
function getWaveSrvCwd() {
let scHome = getPromptHomeDir();
return scHome;
let waveHome = getWaveHomeDir();
return waveHome;
}
function ensureDir(dir) {
@ -128,7 +128,7 @@ function ensureDir(dir) {
}
function readAuthKey() {
let homeDir = getPromptHomeDir();
let homeDir = getWaveHomeDir();
let authKeyFileName = path.join(homeDir, AuthKeyFile);
if (!fs.existsSync(authKeyFileName)) {
let authKeyStr = String(uuidv4());
@ -152,11 +152,18 @@ let menuTemplate = [
click: () => {
MainWindow?.webContents.send('menu-item-about');
}
}
},
{ type: "separator" },
{ role: "services" },
{ type: "separator" },
{ role: "hide" },
{ role: "hideOthers" },
{ type: "separator" },
{ role: "quit" },
],
},
{
label: "File",
label: "Filemenu",
submenu: [{ role: "close" }, { role: "forceReload" }],
},
{
@ -509,9 +516,9 @@ function runWaveSrv() {
pReject = argReject;
});
let envCopy = Object.assign({}, process.env);
envCopy[PromptAppPathVarName] = getAppBasePath();
envCopy[WaveAppPathVarName] = getAppBasePath();
if (isDev) {
envCopy[PromptDevVarName] = "1";
envCopy[WaveDevVarName] = "1";
}
console.log("trying to run local server", getWaveSrvPath());
let proc = child_process.spawn("/bin/bash", ["-c", getWaveSrvCmd()], {

View File

@ -10,9 +10,9 @@ import * as DOMPurify from "dompurify";
import { loadFonts } from "./util/util";
// @ts-ignore
let VERSION = __PROMPT_VERSION__;
let VERSION = __WAVETERM_VERSION__;
// @ts-ignore
let BUILD = __PROMPT_BUILD__;
let BUILD = __WAVETERM_BUILD__;
loadFonts();
@ -34,4 +34,4 @@ document.addEventListener("DOMContentLoaded", () => {
(window as any).sprintf = sprintf;
(window as any).DOMPurify = DOMPurify;
console.log("PROMPT", VERSION, BUILD);
console.log("WaveTerm", VERSION, BUILD);

View File

@ -97,9 +97,9 @@ const RemoteColors = ["red", "green", "yellow", "blue", "magenta", "cyan", "whit
const TabColors = ["green", "blue", "yellow", "pink", "magenta", "cyan", "violet", "orange", "red", "white"];
// @ts-ignore
const VERSION = __PROMPT_VERSION__;
const VERSION = __WAVETERM_VERSION__;
// @ts-ignore
const BUILD = __PROMPT_BUILD__;
const BUILD = __WAVETERM_BUILD__;
type LineContainerModel = {
loadTerminalRenderer: (elem: Element, line: LineType, cmd: Cmd, width: number) => void;
@ -2697,9 +2697,6 @@ class Model {
name: "alertMessage",
});
alertPromiseResolver: (result: boolean) => void;
welcomeModalOpen: OV<boolean> = mobx.observable.box(false, {
name: "welcomeModalOpen",
});
aboutModalOpen: OV<boolean> = mobx.observable.box(false, {
name: "aboutModalOpen",
});
@ -2978,14 +2975,6 @@ class Model {
GlobalModel.lineSettingsModal.set(null);
didSomething = true;
}
if (GlobalModel.welcomeModalOpen.get()) {
GlobalModel.welcomeModalOpen.set(false);
didSomething = true;
}
if (GlobalModel.welcomeModalOpen.get()) {
GlobalModel.welcomeModalOpen.set(false);
didSomething = true;
}
})();
return didSomething;
}

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
# placeholder

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
# placeholder

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
# placeholder

22
versionmeta.json Normal file
View File

@ -0,0 +1,22 @@
{
"packages": [
{
"type": "dmg",
"arch": "macos-arm64",
"channel": "stable",
"updated": "2023-10-31",
"version": "v0.4.0",
"sha": "016876cf3e9fb600d6798891c8566a7ac5d1446a",
"url": "https://www.getprompt.dev/download/prompt-macos-arm64-v0.4.0.dmg"
},
{
"type": "dmg",
"arch": "macos-amd64",
"channel": "stable",
"updated": "2023-10-31",
"version": "v0.4.0",
"sha": "d0bc280e4630a716126e47e700d8d4364db966e6",
"url": "https://www.getprompt.dev/download/prompt-macos-x86-v0.4.0.dmg"
}
]
}

View File

@ -48,8 +48,8 @@ const HttpWriteTimeout = 21 * time.Second
const HttpMaxHeaderBytes = 60000
const HttpTimeoutDuration = 21 * time.Second
const MainServerAddr = "127.0.0.1:1619" // PromptServer, P=16, S=19, PS=1619
const WebSocketServerAddr = "127.0.0.1:1623" // PromptWebsock, P=16, W=23, PW=1623
const MainServerAddr = "127.0.0.1:1619" // wavesrv, P=16, S=19, PS=1619
const WebSocketServerAddr = "127.0.0.1:1623" // wavesrv:websocket, P=16, W=23, PW=1623
const MainServerDevAddr = "127.0.0.1:8090"
const WebSocketServerDevAddr = "127.0.0.1:8091"
const WSStateReconnectTime = 30 * time.Second
@ -763,11 +763,11 @@ func installSignalHandlers() {
func doShutdown(reason string) {
shutdownOnce.Do(func() {
log.Printf("[prompt] local server %v, start shutdown\n", reason)
log.Printf("[wave] local server %v, start shutdown\n", reason)
sendTelemetryWrapper()
log.Printf("[prompt] closing db connection\n")
log.Printf("[wave] closing db connection\n")
sstore.CloseDB()
log.Printf("[prompt] *** shutting down local server\n")
log.Printf("[wave] *** shutting down local server\n")
time.Sleep(1 * time.Second)
syscall.Kill(syscall.Getpid(), syscall.SIGINT)
time.Sleep(5 * time.Second)
@ -787,14 +787,13 @@ func main() {
return
}
scHomeDir := scbase.GetPromptHomeDir()
log.Printf("[prompt] *** starting local server\n")
log.Printf("[prompt] local server version %s+%s\n", scbase.PromptVersion, scbase.BuildTime)
log.Printf("[prompt] homedir = %q\n", scHomeDir)
scHomeDir := scbase.GetWaveHomeDir()
log.Printf("[wave] *** starting wavesrv version %s+%s\n", scbase.WaveVersion, scbase.BuildTime)
log.Printf("[wave] homedir = %q\n", scHomeDir)
scLock, err := scbase.AcquirePromptLock()
scLock, err := scbase.AcquireWaveLock()
if err != nil || scLock == nil {
log.Printf("[error] cannot acquire prompt lock: %v\n", err)
log.Printf("[error] cannot acquire wave lock: %v\n", err)
return
}
if len(os.Args) >= 2 && strings.HasPrefix(os.Args[1], "--migrate") {
@ -804,7 +803,7 @@ func main() {
}
return
}
authKey, err := scbase.ReadPromptAuthKey()
authKey, err := scbase.ReadWaveAuthKey()
if err != nil {
log.Printf("[error] %v\n", err)
return

View File

@ -379,7 +379,7 @@ func doCmdHistoryExpansion(ctx context.Context, ids resolvedIds, cmdStr string)
return doHistoryExpansion(ctx, ids, -1)
}
if strings.HasPrefix(cmdStr, "!-") {
return "", fmt.Errorf("prompt does not support negative history offsets, use a stable positive history offset instead: '![linenum]'")
return "", fmt.Errorf("wave does not support negative history offsets, use a stable positive history offset instead: '![linenum]'")
}
m := histExpansionRe.FindStringSubmatch(cmdStr)
if m == nil {
@ -435,7 +435,7 @@ func SyncCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.
}
runPacket := packet.MakeRunPacket()
runPacket.ReqId = uuid.New().String()
runPacket.CK = base.MakeCommandKey(ids.ScreenId, scbase.GenPromptUUID())
runPacket.CK = base.MakeCommandKey(ids.ScreenId, scbase.GenWaveUUID())
runPacket.UsePty = true
ptermVal := defaultStr(pk.Kwargs["pterm"], DefaultPTERM)
runPacket.TermOpts, err = GetUITermOpts(pk.UIContext.WinSize, ptermVal)
@ -531,7 +531,7 @@ func RunCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.U
// runPacket.State is set in remote.RunCommand()
runPacket := packet.MakeRunPacket()
runPacket.ReqId = uuid.New().String()
runPacket.CK = base.MakeCommandKey(ids.ScreenId, scbase.GenPromptUUID())
runPacket.CK = base.MakeCommandKey(ids.ScreenId, scbase.GenWaveUUID())
runPacket.UsePty = true
ptermVal := defaultStr(pk.Kwargs["pterm"], DefaultPTERM)
runPacket.TermOpts, err = GetUITermOpts(pk.UIContext.WinSize, ptermVal)
@ -575,7 +575,7 @@ func addToHistory(ctx context.Context, pk *scpacket.FeCommandPacketType, history
return fmt.Errorf("cannot add to history, error looking up incognito status of screen: %v", err)
}
hitem := &sstore.HistoryItemType{
HistoryId: scbase.GenPromptUUID(),
HistoryId: scbase.GenWaveUUID(),
Ts: time.Now().UnixMilli(),
UserId: DefaultUserId,
SessionId: ids.SessionId,
@ -1115,7 +1115,7 @@ func RemoteNewCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (ss
return nil, fmt.Errorf("/remote:new %v", err)
}
r := &sstore.RemoteType{
RemoteId: scbase.GenPromptUUID(),
RemoteId: scbase.GenWaveUUID(),
RemoteType: sstore.RemoteTypeSsh,
RemoteAlias: editArgs.Alias,
RemoteCanonicalName: editArgs.CanonicalName,
@ -1606,7 +1606,7 @@ func CrCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.Up
func makeDynCmd(ctx context.Context, metaCmd string, ids resolvedIds, cmdStr string, termOpts sstore.TermOpts) (*sstore.CmdType, error) {
cmd := &sstore.CmdType{
ScreenId: ids.ScreenId,
LineId: scbase.GenPromptUUID(),
LineId: scbase.GenWaveUUID(),
CmdStr: cmdStr,
RawCmdStr: cmdStr,
Remote: ids.Remote.RemotePtr,
@ -1631,7 +1631,7 @@ func makeDynCmd(ctx context.Context, metaCmd string, ids resolvedIds, cmdStr str
func makeStaticCmd(ctx context.Context, metaCmd string, ids resolvedIds, cmdStr string, cmdOutput []byte) (*sstore.CmdType, error) {
cmd := &sstore.CmdType{
ScreenId: ids.ScreenId,
LineId: scbase.GenPromptUUID(),
LineId: scbase.GenWaveUUID(),
CmdStr: cmdStr,
RawCmdStr: cmdStr,
Remote: ids.Remote.RemotePtr,
@ -3654,7 +3654,7 @@ func ClientShowCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (s
buf.WriteString(fmt.Sprintf(" %-15s %s\n", "telemetry", boolToStr(clientData.ClientOpts.NoTelemetry, "off", "on")))
buf.WriteString(fmt.Sprintf(" %-15s %d\n", "db-version", dbVersion))
buf.WriteString(fmt.Sprintf(" %-15s %s\n", "client-version", clientVersion))
buf.WriteString(fmt.Sprintf(" %-15s %s %s\n", "server-version", scbase.PromptVersion, scbase.BuildTime))
buf.WriteString(fmt.Sprintf(" %-15s %s %s\n", "server-version", scbase.WaveVersion, scbase.BuildTime))
buf.WriteString(fmt.Sprintf(" %-15s %s (%s)\n", "arch", scbase.ClientArch(), scbase.MacOSRelease()))
update := &sstore.ModelUpdate{
Info: &sstore.InfoMsgType{

View File

@ -22,6 +22,8 @@ import (
"time"
"github.com/armon/circbuf"
"github.com/creack/pty"
"github.com/google/uuid"
"github.com/wavetermdev/waveterm/waveshell/pkg/base"
"github.com/wavetermdev/waveterm/waveshell/pkg/packet"
"github.com/wavetermdev/waveterm/waveshell/pkg/shexec"
@ -29,8 +31,6 @@ import (
"github.com/wavetermdev/waveterm/wavesrv/pkg/scbase"
"github.com/wavetermdev/waveterm/wavesrv/pkg/scpacket"
"github.com/wavetermdev/waveterm/wavesrv/pkg/sstore"
"github.com/creack/pty"
"github.com/google/uuid"
"golang.org/x/mod/semver"
)
@ -1133,7 +1133,7 @@ func addScVarsToState(state *packet.ShellState) *packet.ShellState {
rtn := *state
envMap := shexec.DeclMapFromState(&rtn)
envMap["PROMPT"] = &shexec.DeclareDeclType{Name: "PROMPT", Value: "1", Args: "x"}
envMap["PROMPT_VERSION"] = &shexec.DeclareDeclType{Name: "PROMPT_VERSION", Value: scbase.PromptVersion, Args: "x"}
envMap["PROMPT_VERSION"] = &shexec.DeclareDeclType{Name: "PROMPT_VERSION", Value: scbase.WaveVersion, Args: "x"}
rtn.ShellVars = shexec.SerializeDeclMap(envMap)
return &rtn
}

View File

@ -28,16 +28,16 @@ import (
)
const HomeVarName = "HOME"
const PromptHomeVarName = "PROMPT_HOME"
const PromptDevVarName = "PROMPT_DEV"
const WaveHomeVarName = "WAVETERM_HOME"
const WaveDevVarName = "WAVETERM_DEV"
const SessionsDirBaseName = "sessions"
const ScreensDirBaseName = "screens"
const PromptLockFile = "prompt.lock"
const PromptDirName = "prompt"
const PromptDevDirName = "prompt-dev"
const PromptAppPathVarName = "PROMPT_APP_PATH"
const PromptVersion = "v0.5.0"
const PromptAuthKeyFileName = "prompt.authkey"
const WaveLockFile = "waveterm.lock"
const WaveDirName = ".waveterm" // must match emain.ts
const WaveDevDirName = ".waveterm-dev" // must match emain.ts
const WaveAppPathVarName = "WAVETERM_APP_PATH"
const WaveVersion = "v0.5.0"
const WaveAuthKeyFileName = "waveterm.authkey"
const MShellVersion = "v0.3.0"
const DefaultMacOSShell = "/bin/bash"
@ -47,23 +47,23 @@ var BaseLock = &sync.Mutex{}
var BuildTime = "-"
func IsDevMode() bool {
pdev := os.Getenv(PromptDevVarName)
pdev := os.Getenv(WaveDevVarName)
return pdev != ""
}
// must match js
func GetPromptHomeDir() string {
scHome := os.Getenv(PromptHomeVarName)
func GetWaveHomeDir() string {
scHome := os.Getenv(WaveHomeVarName)
if scHome == "" {
homeVar := os.Getenv(HomeVarName)
if homeVar == "" {
homeVar = "/"
}
pdev := os.Getenv(PromptDevVarName)
pdev := os.Getenv(WaveDevVarName)
if pdev != "" {
scHome = path.Join(homeVar, PromptDevDirName)
scHome = path.Join(homeVar, WaveDevDirName)
} else {
scHome = path.Join(homeVar, PromptDirName)
scHome = path.Join(homeVar, WaveDirName)
}
}
@ -71,7 +71,7 @@ func GetPromptHomeDir() string {
}
func MShellBinaryDir() string {
appPath := os.Getenv(PromptAppPathVarName)
appPath := os.Getenv(WaveAppPathVarName)
if appPath == "" {
appPath = "."
}
@ -111,13 +111,13 @@ func MShellBinaryReader(version string, goos string, goarch string) (io.ReadClos
return fd, nil
}
func createPromptAuthKeyFile(fileName string) (string, error) {
func createWaveAuthKeyFile(fileName string) (string, error) {
fd, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
return "", err
}
defer fd.Close()
keyStr := GenPromptUUID()
keyStr := GenWaveUUID()
_, err = fd.Write([]byte(keyStr))
if err != nil {
return "", err
@ -125,24 +125,24 @@ func createPromptAuthKeyFile(fileName string) (string, error) {
return keyStr, nil
}
func ReadPromptAuthKey() (string, error) {
homeDir := GetPromptHomeDir()
func ReadWaveAuthKey() (string, error) {
homeDir := GetWaveHomeDir()
err := ensureDir(homeDir)
if err != nil {
return "", fmt.Errorf("cannot find/create PROMPT_HOME directory %q", homeDir)
return "", fmt.Errorf("cannot find/create WAVETERM_HOME directory %q", homeDir)
}
fileName := path.Join(homeDir, PromptAuthKeyFileName)
fileName := path.Join(homeDir, WaveAuthKeyFileName)
fd, err := os.Open(fileName)
if err != nil && errors.Is(err, fs.ErrNotExist) {
return createPromptAuthKeyFile(fileName)
return createWaveAuthKeyFile(fileName)
}
if err != nil {
return "", fmt.Errorf("error opening prompt authkey:%s: %v", fileName, err)
return "", fmt.Errorf("error opening wave authkey:%s: %v", fileName, err)
}
defer fd.Close()
buf, err := io.ReadAll(fd)
if err != nil {
return "", fmt.Errorf("error reading prompt authkey:%s: %v", fileName, err)
return "", fmt.Errorf("error reading wave authkey:%s: %v", fileName, err)
}
keyStr := string(buf)
_, err = uuid.Parse(keyStr)
@ -152,13 +152,13 @@ func ReadPromptAuthKey() (string, error) {
return keyStr, nil
}
func AcquirePromptLock() (*os.File, error) {
homeDir := GetPromptHomeDir()
func AcquireWaveLock() (*os.File, error) {
homeDir := GetWaveHomeDir()
err := ensureDir(homeDir)
if err != nil {
return nil, fmt.Errorf("cannot find/create PROMPT_HOME directory %q", homeDir)
return nil, fmt.Errorf("cannot find/create WAVETERM_HOME directory %q", homeDir)
}
lockFileName := path.Join(homeDir, PromptLockFile)
lockFileName := path.Join(homeDir, WaveLockFile)
fd, err := os.Create(lockFileName)
if err != nil {
return nil, err
@ -182,7 +182,7 @@ func EnsureSessionDir(sessionId string) (string, error) {
if ok {
return sdir, nil
}
scHome := GetPromptHomeDir()
scHome := GetWaveHomeDir()
sdir = path.Join(scHome, SessionsDirBaseName, sessionId)
err := ensureDir(sdir)
if err != nil {
@ -196,8 +196,8 @@ func EnsureSessionDir(sessionId string) (string, error) {
// deprecated (v0.1.8)
func GetSessionsDir() string {
promptHome := GetPromptHomeDir()
sdir := path.Join(promptHome, SessionsDirBaseName)
waveHome := GetWaveHomeDir()
sdir := path.Join(waveHome, SessionsDirBaseName)
return sdir
}
@ -211,7 +211,7 @@ func EnsureScreenDir(screenId string) (string, error) {
if ok {
return sdir, nil
}
scHome := GetPromptHomeDir()
scHome := GetWaveHomeDir()
sdir = path.Join(scHome, ScreensDirBaseName, screenId)
err := ensureDir(sdir)
if err != nil {
@ -224,8 +224,8 @@ func EnsureScreenDir(screenId string) (string, error) {
}
func GetScreensDir() string {
promptHome := GetPromptHomeDir()
sdir := path.Join(promptHome, ScreensDirBaseName)
waveHome := GetWaveHomeDir()
sdir := path.Join(waveHome, ScreensDirBaseName)
return sdir
}
@ -236,7 +236,7 @@ func ensureDir(dirName string) error {
if err != nil {
return err
}
log.Printf("[prompt] created directory %q\n", dirName)
log.Printf("[wave] created directory %q\n", dirName)
info, err = os.Stat(dirName)
}
if err != nil {
@ -277,7 +277,7 @@ func PtyOutFile(screenId string, lineId string) (string, error) {
return fmt.Sprintf("%s/%s.ptyout.cf", sdir, lineId), nil
}
func GenPromptUUID() string {
func GenWaveUUID() string {
for {
rtn := uuid.New().String()
_, err := strconv.Atoi(rtn[0:8])

View File

@ -532,7 +532,7 @@ func GetSessionByName(ctx context.Context, name string) (*SessionType, error) {
// if sessionName == "", it will be generated
func InsertSessionWithName(ctx context.Context, sessionName string, activate bool) (*ModelUpdate, error) {
var newScreen *ScreenType
newSessionId := scbase.GenPromptUUID()
newSessionId := scbase.GenWaveUUID()
txErr := WithTx(ctx, func(tx *TxWrap) error {
names := tx.SelectStrings(`SELECT name FROM session`)
sessionName = fmtUniqueName(sessionName, "workspace-%d", len(names)+1, names)
@ -684,7 +684,7 @@ func InsertScreen(ctx context.Context, sessionId string, origScreenName string,
return fmt.Errorf("cannot create screen, base screen not found")
}
}
newScreenId = scbase.GenPromptUUID()
newScreenId = scbase.GenWaveUUID()
screen := &ScreenType{
SessionId: sessionId,
ScreenId: newScreenId,
@ -1258,7 +1258,7 @@ func UpdateRemoteState(ctx context.Context, sessionId string, screenId string, r
ri = dbutil.GetMapGen[*RemoteInstance](tx, query, sessionId, screenId, remotePtr.OwnerId, remotePtr.RemoteId, remotePtr.Name)
if ri == nil {
ri = &RemoteInstance{
RIId: scbase.GenPromptUUID(),
RIId: scbase.GenWaveUUID(),
Name: remotePtr.Name,
SessionId: sessionId,
ScreenId: screenId,
@ -2035,7 +2035,7 @@ func UpdateCurrentActivity(ctx context.Context, update ActivityUpdate) error {
if len(tzName) > MaxTzNameLen {
tzName = tzName[0:MaxTzNameLen]
}
tx.Exec(query, dayStr, tdata, tzName, tzOffset, scbase.PromptVersion, scbase.ClientArch(), scbase.BuildTime, scbase.MacOSRelease())
tx.Exec(query, dayStr, tdata, tzName, tzOffset, scbase.WaveVersion, scbase.ClientArch(), scbase.BuildTime, scbase.MacOSRelease())
}
tdata.NumCommands += update.NumCommands
tdata.FgMinutes += update.FgMinutes
@ -2052,7 +2052,7 @@ func UpdateCurrentActivity(ctx context.Context, update ActivityUpdate) error {
clientversion = ?,
buildtime = ?
WHERE day = ?`
tx.Exec(query, tdata, scbase.PromptVersion, scbase.BuildTime, dayStr)
tx.Exec(query, tdata, scbase.WaveVersion, scbase.BuildTime, dayStr)
return nil
})
if txErr != nil {

View File

@ -20,21 +20,21 @@ import (
"sync"
"time"
"github.com/google/uuid"
"github.com/jmoiron/sqlx"
"github.com/sawka/txwrap"
"github.com/wavetermdev/waveterm/waveshell/pkg/base"
"github.com/wavetermdev/waveterm/waveshell/pkg/packet"
"github.com/wavetermdev/waveterm/waveshell/pkg/shexec"
"github.com/wavetermdev/waveterm/wavesrv/pkg/dbutil"
"github.com/wavetermdev/waveterm/wavesrv/pkg/scbase"
"github.com/google/uuid"
"github.com/jmoiron/sqlx"
"github.com/sawka/txwrap"
_ "github.com/mattn/go-sqlite3"
)
const LineNoHeight = -1
const DBFileName = "prompt.db"
const DBFileNameBackup = "backup.prompt.db"
const DBFileName = "waveterm.db"
const DBFileNameBackup = "backup.waveterm.db"
const MaxWebShareLineCount = 50
const MaxWebShareScreenCount = 3
const MaxLineStateSize = 4 * 1024 // 4k for now, can raise if needed
@ -145,12 +145,12 @@ func lineIdFromCK(ck base.CommandKey) string {
}
func GetDBName() string {
scHome := scbase.GetPromptHomeDir()
scHome := scbase.GetWaveHomeDir()
return path.Join(scHome, DBFileName)
}
func GetDBBackupName() string {
scHome := scbase.GetPromptHomeDir()
scHome := scbase.GetWaveHomeDir()
return path.Join(scHome, DBFileNameBackup)
}
@ -1091,7 +1091,7 @@ func makeNewLineText(screenId string, userId string, text string) *LineType {
rtn := &LineType{}
rtn.ScreenId = screenId
rtn.UserId = userId
rtn.LineId = scbase.GenPromptUUID()
rtn.LineId = scbase.GenWaveUUID()
rtn.Ts = time.Now().UnixMilli()
rtn.LineLocal = true
rtn.LineType = LineTypeText
@ -1160,7 +1160,7 @@ func EnsureLocalRemote(ctx context.Context) error {
}
// create the local remote
localRemote := &RemoteType{
RemoteId: scbase.GenPromptUUID(),
RemoteId: scbase.GenWaveUUID(),
RemoteType: RemoteTypeSsh,
RemoteAlias: LocalRemoteAlias,
RemoteCanonicalName: fmt.Sprintf("%s@%s", user.Username, hostName),
@ -1177,7 +1177,7 @@ func EnsureLocalRemote(ctx context.Context) error {
}
log.Printf("[db] added local remote '%s', id=%s\n", localRemote.RemoteCanonicalName, localRemote.RemoteId)
sudoRemote := &RemoteType{
RemoteId: scbase.GenPromptUUID(),
RemoteId: scbase.GenWaveUUID(),
RemoteType: RemoteTypeSsh,
RemoteAlias: "sudo",
RemoteCanonicalName: fmt.Sprintf("sudo@%s@%s", user.Username, hostName),

View File

@ -2,15 +2,15 @@
```bash
# @scripthaus command dump-schema-dev
sqlite3 /Users/mike/prompt-dev/prompt.db .schema > db/schema.sql
sqlite3 ~/.waveterm-dev/waveterm.db .schema > db/schema.sql
```
```bash
# @scripthaus command opendb-dev
sqlite3 /Users/mike/prompt-dev/prompt.db
sqlite3 ~/.waveterm-dev/waveterm.db
```
```bash
# @scripthaus command build
go build -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M')" -o bin/local-server ./cmd
go build -ldflags "-X main.BuildTime=$(date +'%Y%m%d%H%M')" -o bin/wavesrv ./cmd
```

View File

@ -72,9 +72,9 @@ var electronDev = webpackMerge.merge(electronCommon, {
patterns: [{ from: "src/electron/preload.js", to: "preload.js" }],
}),
new webpack.DefinePlugin({
__PROMPT_DEV__: "true",
__PROMPT_VERSION__: JSON.stringify(VERSION),
__PROMPT_BUILD__: JSON.stringify("devbuild"),
__WAVETERM_DEV__: "true",
__WAVETERM_VERSION__: JSON.stringify(VERSION),
__WAVETERM_BUILD__: JSON.stringify("devbuild"),
}),
],
});
@ -90,9 +90,9 @@ var electronProd = webpackMerge.merge(electronCommon, {
patterns: [{ from: "src/electron/preload.js", to: "preload.js" }],
}),
new webpack.DefinePlugin({
__PROMPT_DEV__: "false",
__PROMPT_VERSION__: JSON.stringify(VERSION),
__PROMPT_BUILD__: JSON.stringify(BUILD),
__WAVETERM_DEV__: "false",
__WAVETERM_VERSION__: JSON.stringify(VERSION),
__WAVETERM_BUILD__: JSON.stringify(BUILD),
}),
],
optimization: {

View File

@ -1,36 +0,0 @@
const webpack = require("webpack");
const merge = require("webpack-merge");
const common = require("./webpack.electron.js");
const moment = require("dayjs");
const VERSION = require("../version.js");
const path = require("path");
function makeBuildStr() {
let buildStr = moment().format("YYYYMMDD-HHmmss");
console.log("Prompt Electron " + VERSION + " build " + buildStr);
return buildStr;
}
const BUILD = makeBuildStr();
let merged = merge.merge(common, {
mode: "production",
output: {
path: path.resolve(__dirname, "../dist"),
filename: "[name].js",
},
devtool: "source-map",
optimization: {
minimize: true,
},
});
merged.plugins.push(
new webpack.DefinePlugin({
__PROMPT_DEV__: "false",
__PROMPT_VERSION__: JSON.stringify(VERSION),
__PROMPT_BUILD__: JSON.stringify(BUILD),
})
);
module.exports = merged;

View File

@ -69,11 +69,11 @@ var webCommon = {
},
{
test: /\.md$/,
use: "raw-loader",
type: "asset/source",
},
{
test: /\.(png|jpe?g|gif)$/i,
use: "file-loader",
type: "asset/resource",
},
],
},
@ -102,9 +102,9 @@ var webDev = webpackMerge.merge(webCommon, {
new MiniCssExtractPlugin({ filename: "[name].css", ignoreOrder: true }),
new LodashModuleReplacementPlugin(),
new webpack.DefinePlugin({
__PROMPT_DEV__: "true",
__PROMPT_VERSION__: JSON.stringify(VERSION),
__PROMPT_BUILD__: JSON.stringify("devbuild"),
__WAVETERM_DEV__: "true",
__WAVETERM_VERSION__: JSON.stringify(VERSION),
__WAVETERM_BUILD__: JSON.stringify("devbuild"),
}),
],
watchOptions: {
@ -118,14 +118,14 @@ var webProd = webpackMerge.merge(webCommon, {
path: path.resolve(__dirname, "../dist"),
filename: "[name].js",
},
devtool: false,
devtool: "source-map",
plugins: [
new MiniCssExtractPlugin({ filename: "[name].css", ignoreOrder: true }),
new LodashModuleReplacementPlugin(),
new webpack.DefinePlugin({
__PROMPT_DEV__: "false",
__PROMPT_VERSION__: JSON.stringify(VERSION),
__PROMPT_BUILD__: JSON.stringify(BUILD),
__WAVETERM_DEV__: "false",
__WAVETERM_VERSION__: JSON.stringify(VERSION),
__WAVETERM_BUILD__: JSON.stringify(BUILD),
}),
],
optimization: {