feat: Add browser documentation
This commit is contained in:
@@ -477,6 +477,35 @@ export function setupSystemHandlers(): void {
|
||||
return { opened: true };
|
||||
});
|
||||
|
||||
ipcMain.handle('open-docusaurus-docs', async () => {
|
||||
let snapshot = getLocalApiSnapshot();
|
||||
|
||||
if (snapshot.status !== 'running' || !snapshot.baseUrl || !snapshot.docusaurusEnabled) {
|
||||
const currentSettings = getDesktopSettingsSnapshot();
|
||||
|
||||
updateDesktopSettings({
|
||||
localApi: {
|
||||
...currentSettings.localApi,
|
||||
enabled: true,
|
||||
docusaurusEnabled: true
|
||||
}
|
||||
});
|
||||
await applyLocalApiSettings();
|
||||
snapshot = getLocalApiSnapshot();
|
||||
}
|
||||
|
||||
if (snapshot.status !== 'running' || !snapshot.baseUrl) {
|
||||
return { opened: false, reason: snapshot.error ?? 'Local documentation server is not running' };
|
||||
}
|
||||
|
||||
if (!snapshot.docusaurusEnabled) {
|
||||
return { opened: false, reason: 'Docusaurus docs are disabled' };
|
||||
}
|
||||
|
||||
await shell.openExternal(`${snapshot.baseUrl}/docusaurus/`);
|
||||
return { opened: true };
|
||||
});
|
||||
|
||||
ipcMain.handle('relaunch-app', () => {
|
||||
app.relaunch();
|
||||
app.exit(0);
|
||||
|
||||
Reference in New Issue
Block a user