Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 1,847 Bytes
3a25c0b 86259b4 3a25c0b 86259b4 3a25c0b 86259b4 3a25c0b 121b555 3a25c0b 121b555 3a25c0b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
const fs = require('fs')
const path = require('path')
// -----------------------------------------------------------
//
// attention: if you add dependencies here, you might have to edit
// forge.config.js, , the part about:
// '^\\/node_modules/(?!dotenv)$',
//
// if you have an idea to do that automatically, let me know
const dotenv = require('dotenv')
//
// -----------------------------------------------------------
dotenv.config()
try {
if (fs.existsSync(".env.local")) {
const result = dotenv.config({ path: ".env.local" })
console.log("using .env.local")
process.env = {
...process.env,
...result.parsed,
}
}
} catch (err) {
// do nothing
console.log("using .env")
}
const { app, BrowserWindow, screen } = require('electron')
try {
// used when the app is built with `npm run electron:make`
require(path.join(process.resourcesPath, 'standalone/server.js'))
} catch (err) {
// used when the app is started with `npm run electron:start`
require(path.join(process.cwd(), '.next/standalone/server.js'))
}
// TODO: load the proxy server (for AI providers that refuse browser-side clients)
// const proxyServerPath = path.join(currentDir, '.next/standalone/proxy-server.js')
// require(proxyServerPath)
const createWindow = () => {
const mainScreen = screen.getPrimaryDisplay()
const allScreens = screen.getAllDisplays()
console.log("debug:", {
mainScreen,
allScreens
})
const mainWindow = new BrowserWindow({
// copy the width and height
...mainScreen.workAreaSize,
icon: './public/logos/clapper.png'
})
mainWindow.loadURL('http://0.0.0.0:3000/')
mainWindow.on('closed', () => {
app.quit()
})
}
app.whenReady().then(() => {
createWindow()
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
}) |