-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reset src-electron from quasar project
- Loading branch information
Showing
8 changed files
with
510 additions
and
470 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* eslint-disable */ | ||
|
||
declare namespace NodeJS { | ||
interface ProcessEnv { | ||
QUASAR_ELECTRON_PRELOAD: string; | ||
APP_URL: string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { app, BrowserWindow, nativeTheme } from 'electron'; | ||
import path from 'path'; | ||
import os from 'os'; | ||
|
||
// needed in case process is undefined under Linux | ||
const platform = process.platform || os.platform(); | ||
|
||
try { | ||
if (platform === 'win32' && nativeTheme.shouldUseDarkColors === true) { | ||
require('fs').unlinkSync( | ||
path.join(app.getPath('userData'), 'DevTools Extensions') | ||
); | ||
} | ||
} catch (_) {} | ||
|
||
let mainWindow: BrowserWindow | undefined; | ||
|
||
function createWindow() { | ||
/** | ||
* Initial window options | ||
*/ | ||
mainWindow = new BrowserWindow({ | ||
icon: path.resolve(__dirname, 'icons/icon.png'), // tray icon | ||
fullscreen: process.env.NODE_ENV !== 'Development', | ||
useContentSize: true, | ||
webPreferences: { | ||
contextIsolation: true, | ||
// More info: https://v2.quasar.dev/quasar-cli-vite/developing-electron-apps/electron-preload-script | ||
preload: path.resolve(__dirname, process.env.QUASAR_ELECTRON_PRELOAD), | ||
}, | ||
}); | ||
|
||
mainWindow.loadURL(process.env.APP_URL); | ||
|
||
if (process.env.DEBUGGING) { | ||
// if on DEV or Production with debug enabled | ||
mainWindow.webContents.openDevTools(); | ||
} else { | ||
// we're on production; no access to devtools pls | ||
mainWindow.webContents.on('devtools-opened', () => { | ||
mainWindow?.webContents.closeDevTools(); | ||
}); | ||
} | ||
|
||
mainWindow.on('closed', () => { | ||
mainWindow = undefined; | ||
}); | ||
} | ||
|
||
app.whenReady().then(createWindow); | ||
|
||
app.on('window-all-closed', () => { | ||
if (platform !== 'darwin') { | ||
app.quit(); | ||
} | ||
}); | ||
|
||
app.on('activate', () => { | ||
if (mainWindow === undefined) { | ||
createWindow(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/** | ||
* This file is used specifically for security reasons. | ||
* Here you can access Nodejs stuff and inject functionality into | ||
* the renderer thread (accessible there through the "window" object) | ||
* | ||
* WARNING! | ||
* If you import anything from node_modules, then make sure that the package is specified | ||
* in package.json > dependencies and NOT in devDependencies | ||
* | ||
* Example (injects window.myAPI.doAThing() into renderer thread): | ||
* | ||
* import { contextBridge } from 'electron' | ||
* | ||
* contextBridge.exposeInMainWorld('myAPI', { | ||
* doAThing: () => {} | ||
* }) | ||
* | ||
* WARNING! | ||
* If accessing Node functionality (like importing @electron/remote) then in your | ||
* electron-main.ts you will need to set the following when you instantiate BrowserWindow: | ||
* | ||
* mainWindow = new BrowserWindow({ | ||
* // ... | ||
* webPreferences: { | ||
* // ... | ||
* sandbox: false // <-- to be able to import @electron/remote in preload script | ||
* } | ||
* } | ||
*/ |
27 changes: 0 additions & 27 deletions
27
src-frontend/src-electron/main-process/electron-main.dev.js
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.