diff --git a/src/interface/desktop/about.html b/src/interface/desktop/about.html
new file mode 100644
index 00000000..deff03e1
--- /dev/null
+++ b/src/interface/desktop/about.html
@@ -0,0 +1,88 @@
+
+
+
+
+ Khoj - About
+
+
+
+
+
+
+
+
+
+
+ Khoj for Desktop
+
+
+
+
+
+
+
+
+
diff --git a/src/interface/desktop/main.js b/src/interface/desktop/main.js
index c7466edc..82e54c42 100644
--- a/src/interface/desktop/main.js
+++ b/src/interface/desktop/main.js
@@ -1,5 +1,6 @@
-const { app, BrowserWindow, ipcMain, Tray, Menu, nativeImage } = require('electron');
+const { app, BrowserWindow, ipcMain, Tray, Menu, nativeImage, shell } = require('electron');
const todesktop = require("@todesktop/runtime");
+const khojPackage = require('./package.json');
todesktop.init();
@@ -390,11 +391,12 @@ app.whenReady().then(() => {
app.setAboutPanelOptions({
applicationName: "Khoj",
- applicationVersion: "0.0.1",
- version: "0.0.1",
- authors: "Khoj Team",
+ applicationVersion: khojPackage.version,
+ version: khojPackage.version,
+ authors: "Saba Imran, Debanjum Singh Solanky and contributors",
website: "https://khoj.dev",
- iconPath: path.join(__dirname, 'assets', 'khoj.png')
+ copyright: "GPL v3",
+ iconPath: path.join(__dirname, 'assets', 'icons', 'favicon-128x128.png')
});
app.on('ready', async() => {
@@ -418,6 +420,43 @@ app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})
+/*
+** About Page
+*/
+
+let aboutWindow;
+
+function openAboutWindow() {
+ if (aboutWindow) { aboutWindow.focus(); return; }
+
+ aboutWindow = new BrowserWindow({
+ width: 400,
+ height: 400,
+ titleBarStyle: 'hidden',
+ show: false,
+ webPreferences: {
+ preload: path.join(__dirname, 'preload.js'),
+ nodeIntegration: true,
+ },
+ });
+
+ aboutWindow.loadFile('about.html');
+
+ // Pass OS, Khoj version to About page
+ aboutWindow.webContents.on('did-finish-load', () => {
+ aboutWindow.webContents.send('appInfo', { version: khojPackage.version, platform: process.platform });
+ });
+
+ // Open links in external browser
+ aboutWindow.webContents.setWindowOpenHandler(({ url }) => {
+ shell.openExternal(url);
+ return { action: 'deny' };
+ });
+
+ aboutWindow.once('ready-to-show', () => { aboutWindow.show(); });
+ aboutWindow.on('closed', () => { aboutWindow = null; });
+}
+
/*
** System Tray Icon
*/
@@ -441,6 +480,7 @@ app.whenReady().then(() => {
{ label: 'Search', type: 'normal', click: () => { openWindow('search.html') }},
{ label: 'Configure', type: 'normal', click: () => { openWindow('config.html') }},
{ type: 'separator' },
+ { label: 'About Khoj', type: 'normal', click: () => { openAboutWindow(); } },
{ label: 'Quit', type: 'normal', click: () => { app.quit() } }
])
diff --git a/src/interface/desktop/preload.js b/src/interface/desktop/preload.js
index 89c56062..3228fdb0 100644
--- a/src/interface/desktop/preload.js
+++ b/src/interface/desktop/preload.js
@@ -52,3 +52,7 @@ contextBridge.exposeInMainWorld('tokenAPI', {
setToken: (token) => ipcRenderer.invoke('setToken', token),
getToken: () => ipcRenderer.invoke('getToken')
})
+
+contextBridge.exposeInMainWorld('appInfoAPI', {
+ getInfo: (callback) => ipcRenderer.on('appInfo', callback)
+})
diff --git a/src/interface/desktop/utils.js b/src/interface/desktop/utils.js
index 87552106..8f9c0aeb 100644
--- a/src/interface/desktop/utils.js
+++ b/src/interface/desktop/utils.js
@@ -12,3 +12,15 @@ I am ✨Khoj✨, your open-source, personal AI copilot.
See my source code at https://github.com/khoj-ai/khoj
Read my operating manual at https://docs.khoj.dev
`);
+
+
+window.appInfoAPI.getInfo((_, info) => {
+ let khojVersionElement = document.getElementById("about-page-version");
+ if (khojVersionElement) {
+ khojVersionElement.innerHTML = `${info.version}`;
+ }
+ let khojTitleElement = document.getElementById("about-page-title");
+ if (khojTitleElement) {
+ khojTitleElement.innerHTML = 'Khoj for ' + (info.platform === 'win32' ? 'Windows' : info.platform === 'darwin' ? 'macOS' : 'Linux') + '';
+ }
+});