Move software files one directory up, Readme

This commit is contained in:
2024-11-19 16:51:28 +01:00
parent 9fa2b753ec
commit b347df7c6e
329 changed files with 255 additions and 31 deletions

48
electron/index.ts Normal file
View File

@@ -0,0 +1,48 @@
const { app, BrowserWindow } = require("electron");
const path = require("path");
const backend = require('./../backend/server')
/**
* Create the application window
*/
function createWindow() {
const win = new BrowserWindow({
width: 1400,
height: 800,
minWidth: 800,
minHeigth: 600,
webPreferences: {
preload: path.join(__dirname, "preload.js"),
},
});
// Load HTML entry point
win.loadFile("build/src/vite/index.html");
// Maximize window
win.maximize()
// Remove menu bar
win.removeMenu()
}
app.whenReady().then(() => {
createWindow();
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
// Close the expressjs backend server on application termination
backend.close(() => {
process.exit(0)
})
});

10
electron/preload.ts Normal file
View File

@@ -0,0 +1,10 @@
window.addEventListener('DOMContentLoaded', () => {
const replaceText = (selector: any, text: any) => {
const element = document.getElementById(selector)
if (element) element.innerText = text
}
for (const dependency of ['chrome', 'node', 'electron']) {
replaceText(`${dependency}-version`, process.versions[dependency])
}
})