-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Embed static copy of docsite for help view (#949)
This will take the latest artifact from the waveterm-docs repo and embed it in the app binary. When the help view is launched, it will be served from our backend. If the embedded copy doesn't exist, such as in unpackaged versions of the app or in locally packaged versions, it will use the hosted site instead. There is a sibling PR in the docs repository to build the embedded version of the app (strips out some external links, removes Algolia DocSearch, updates the baseUrl) wavetermdev/waveterm-docs#46
- Loading branch information
1 parent
cee46a6
commit 74cda37
Showing
13 changed files
with
120 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { getWebServerEndpoint } from "@/util/endpoints"; | ||
import { fetch } from "@/util/fetchutil"; | ||
import { ipcMain } from "electron"; | ||
|
||
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", response); | ||
docsiteUrl = docsiteWebUrl; | ||
} | ||
} catch (error) { | ||
console.log("Failed to fetch docsite url, using web version for help view", error); | ||
docsiteUrl = docsiteWebUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.