diff --git a/desktop/main.cjs b/desktop/main.cjs
--- a/desktop/main.cjs
+++ b/desktop/main.cjs
@@ -1,4 +1,4 @@
-const { app, BrowserWindow, shell, Menu } = require('electron');
+const { app, BrowserWindow, shell, Menu, ipcMain } = require('electron');
const fs = require('fs');
const path = require('path');
@@ -79,6 +79,21 @@
titleBarStyle: 'hidden',
trafficLightPosition: { x: 20, y: 24 },
backgroundColor: '#0A0A0A',
+ webPreferences: {
+ preload: path.join(__dirname, 'preload.cjs'),
+ },
+ });
+
+ const updateNavigationState = () => {
+ win.webContents.send('on-navigate', {
+ canGoBack: win.webContents.canGoBack(),
+ canGoForward: win.webContents.canGoForward(),
+ });
+ };
+ win.webContents.on('did-navigate-in-page', updateNavigationState);
+ ipcMain.on('clear-history', () => {
+ win.webContents.clearHistory();
+ updateNavigationState();
});
win.webContents.setWindowOpenHandler(({ url: openURL }) => {
diff --git a/desktop/preload.cjs b/desktop/preload.cjs
new file mode 100644
--- /dev/null
+++ b/desktop/preload.cjs
@@ -0,0 +1,12 @@
+const { contextBridge, ipcRenderer } = require('electron');
+
+const bridge = {
+ onNavigate: callback => {
+ const withEvent = (event, ...args) => callback(...args);
+ ipcRenderer.on('on-navigate', withEvent);
+ return () => ipcRenderer.removeListener('on-navigate', withEvent);
+ },
+ clearHistory: () => ipcRenderer.send('clear-history'),
+};
+
+contextBridge.exposeInMainWorld('electronContextBridge', bridge);
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -32,6 +32,7 @@
import Chat from './chat/chat.react';
import { TooltipProvider } from './chat/tooltip-provider';
import NavigationArrows from './components/navigation-arrows.react';
+import electron from './electron';
import InputStateContainer from './input/input-state-container.react';
import LoadingIndicator from './loading-indicator.react';
import { MenuProvider } from './menu-provider.react';
@@ -127,6 +128,9 @@
history.replace(newURL);
}
}
+ if (loggedIn !== prevProps.loggedIn) {
+ electron?.clearHistory();
+ }
}
onWordmarkClicked = () => {
@@ -175,9 +179,8 @@
}
}
- const shouldShowNavigationArrows = false;
let navigationArrows = null;
- if (shouldShowNavigationArrows) {
+ if (electron) {
navigationArrows =