mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
33f05c6e0c
Going forward for new installations, config and data files will be stored at the platform default paths, as defined by [env-paths](https://www.npmjs.com/package/env-paths). For backwards compatibility, if the `~/.waveterm` or `WAVETERM_HOME` directory exists and contains valid data, it will be used. If this check fails, then `WAVETERM_DATA_HOME` and `WAVETERM_CONFIG_HOME` will be used. If these are not defined, then `XDG_DATA_HOME` and `XDG_CONFIG_HOME` will be used. Finally, if none of these are defined, the [env-paths](https://www.npmjs.com/package/env-paths) defaults will be used. As with the existing app, dev instances will write to `waveterm-dev` directories, while all others will write to `waveterm`.
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { ipcMain } from "electron";
|
|
import { getWebServerEndpoint } from "../frontend/util/endpoints";
|
|
import { fetch } from "../frontend/util/fetchutil";
|
|
|
|
const docsiteWebUrl = "https://docs.waveterm.dev/";
|
|
let docsiteUrl: string;
|
|
|
|
ipcMain.on("get-docsite-url", (event) => {
|
|
event.returnValue = docsiteUrl;
|
|
});
|
|
|
|
export async function initDocsite() {
|
|
const docsiteEmbeddedUrl = getWebServerEndpoint() + "/docsite/";
|
|
try {
|
|
const response = await fetch(docsiteEmbeddedUrl);
|
|
if (response.ok) {
|
|
console.log("Embedded docsite is running, using embedded version for help view");
|
|
docsiteUrl = docsiteEmbeddedUrl;
|
|
} else {
|
|
console.log(
|
|
"Embedded docsite is not running, using web version for help view",
|
|
"status: " + response?.status
|
|
);
|
|
docsiteUrl = docsiteWebUrl;
|
|
}
|
|
} catch (error) {
|
|
console.log("Failed to fetch docsite url, using web version for help view", error);
|
|
docsiteUrl = docsiteWebUrl;
|
|
}
|
|
}
|