show the buildtimes in the about page

This commit is contained in:
sawka 2024-08-08 13:39:17 -07:00
parent 44f4a02cf7
commit 4641271bfa
2 changed files with 19 additions and 17 deletions

View File

@ -158,7 +158,7 @@ func main() {
_, err := strconv.Atoi(pidStr) _, err := strconv.Atoi(pidStr)
if err == nil { if err == nil {
// use fmt instead of log here to make sure it goes directly to stderr // use fmt instead of log here to make sure it goes directly to stderr
fmt.Fprintf(os.Stderr, "WAVESRV-ESTART ws:%s web:%s\n", wsListener.Addr(), webListener.Addr()) fmt.Fprintf(os.Stderr, "WAVESRV-ESTART ws:%s web:%s version:%s buildtime:%s\n", wsListener.Addr(), webListener.Addr(), WaveVersion, BuildTime)
} }
} }
}() }()

View File

@ -20,6 +20,8 @@ import { fireAndForget } from "../frontend/util/util";
import { configureAutoUpdater, updater } from "./updater"; import { configureAutoUpdater, updater } from "./updater";
const electronApp = electron.app; const electronApp = electron.app;
let WaveVersion = "unknown"; // set by WAVESRV-ESTART
let WaveBuildTime = 0; // set by WAVESRV-ESTART
const WaveAppPathVarName = "WAVETERM_APP_PATH"; const WaveAppPathVarName = "WAVETERM_APP_PATH";
const WaveSrvReadySignalPidVarName = "WAVETERM_READY_SIGNAL_PID"; const WaveSrvReadySignalPidVarName = "WAVETERM_READY_SIGNAL_PID";
@ -113,15 +115,14 @@ function getGoAppBasePath(): string {
const wavesrvBinName = `wavesrv.${unameArch}`; const wavesrvBinName = `wavesrv.${unameArch}`;
function getWaveSrvPath(): string { function getWaveSrvPath(): string {
if (process.platform === "win32") {
const winBinName = `${wavesrvBinName}.exe`;
const appPath = path.join(getGoAppBasePath(), "bin", winBinName);
return `& "${appPath}"`;
}
return path.join(getGoAppBasePath(), "bin", wavesrvBinName); return path.join(getGoAppBasePath(), "bin", wavesrvBinName);
} }
function getWaveSrvPathWin(): string {
const winBinName = `${wavesrvBinName}.exe`;
const appPath = path.join(getGoAppBasePath(), "bin", winBinName);
return `& "${appPath}"`;
}
function getWaveSrvCwd(): string { function getWaveSrvCwd(): string {
return getWaveHomeDir(); return getWaveHomeDir();
} }
@ -141,12 +142,7 @@ function runWaveSrv(): Promise<boolean> {
const envCopy = { ...process.env }; const envCopy = { ...process.env };
envCopy[WaveAppPathVarName] = getGoAppBasePath(); envCopy[WaveAppPathVarName] = getGoAppBasePath();
envCopy[WaveSrvReadySignalPidVarName] = process.pid.toString(); envCopy[WaveSrvReadySignalPidVarName] = process.pid.toString();
let waveSrvCmd: string; const waveSrvCmd = getWaveSrvPath();
if (process.platform === "win32") {
waveSrvCmd = getWaveSrvPathWin();
} else {
waveSrvCmd = getWaveSrvPath();
}
console.log("trying to run local server", waveSrvCmd); console.log("trying to run local server", waveSrvCmd);
const proc = child_process.spawn(getWaveSrvPath(), { const proc = child_process.spawn(getWaveSrvPath(), {
cwd: getWaveSrvCwd(), cwd: getWaveSrvCwd(),
@ -181,14 +177,20 @@ function runWaveSrv(): Promise<boolean> {
}); });
rlStderr.on("line", (line) => { rlStderr.on("line", (line) => {
if (line.includes("WAVESRV-ESTART")) { if (line.includes("WAVESRV-ESTART")) {
const addrs = /ws:([a-z0-9.:]+) web:([a-z0-9.:]+)/gm.exec(line); const startParams = /ws:([a-z0-9.:]+) web:([a-z0-9.:]+) version:([a-z0-9.]+) buildtime:(\d+)/gm.exec(line);
if (addrs == null) { if (startParams == null) {
console.log("error parsing WAVESRV-ESTART line", line); console.log("error parsing WAVESRV-ESTART line", line);
electronApp.quit(); electronApp.quit();
return; return;
} }
process.env[WSServerEndpointVarName] = addrs[1]; process.env[WSServerEndpointVarName] = startParams[1];
process.env[WebServerEndpointVarName] = addrs[2]; process.env[WebServerEndpointVarName] = startParams[2];
WaveVersion = startParams[3];
WaveBuildTime = parseInt(startParams[4]);
electron.app.setAboutPanelOptions({
applicationVersion: "v" + WaveVersion,
version: (isDev ? "dev-" : "") + String(WaveBuildTime),
});
waveSrvReadyResolve(true); waveSrvReadyResolve(true);
return; return;
} }