- logos: WINE-based desktop app (offline-capable) - logos-web: Electron wrapper for web app - logos-install: one-time GUI installer
52 lines
1.6 KiB
JavaScript
52 lines
1.6 KiB
JavaScript
const { app, BrowserWindow, session, shell } = require('electron');
|
|
const path = require('path');
|
|
|
|
// Use a dedicated data directory for persistent storage
|
|
const userDataPath = path.join(app.getPath('home'), '.local/share/logos-app');
|
|
app.setPath('userData', userDataPath);
|
|
|
|
function createWindow() {
|
|
const win = new BrowserWindow({
|
|
width: 1400,
|
|
height: 900,
|
|
minWidth: 900,
|
|
minHeight: 600,
|
|
title: 'Logos Bible Software',
|
|
icon: path.join(__dirname, 'icon.svg'),
|
|
webPreferences: {
|
|
nodeIntegration: false,
|
|
contextIsolation: true,
|
|
partition: 'persist:logos',
|
|
// Allow IndexedDB, localStorage, and Cache API to persist
|
|
enableRemoteModule: false,
|
|
},
|
|
});
|
|
|
|
// Load Logos web app
|
|
win.loadURL('https://app.logos.com');
|
|
|
|
// Keep external links in the app when they're Faithlife domains
|
|
win.webContents.setWindowOpenHandler(({ url }) => {
|
|
if (url.includes('logos.com') || url.includes('faithlife.com') || url.includes('biblia.com')) {
|
|
return { action: 'allow', overrideBrowserWindowOptions: {
|
|
webPreferences: { partition: 'persist:logos' }
|
|
}};
|
|
}
|
|
shell.openExternal(url);
|
|
return { action: 'deny' };
|
|
});
|
|
|
|
// Chrome user agent for full web app support
|
|
win.webContents.userAgent =
|
|
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36';
|
|
}
|
|
|
|
app.whenReady().then(createWindow);
|
|
|
|
app.on('window-all-closed', () => {
|
|
if (process.platform !== 'darwin') app.quit();
|
|
});
|
|
|
|
app.on('activate', () => {
|
|
if (BrowserWindow.getAllWindows().length === 0) createWindow();
|
|
});
|