Skip to content

Commit

Permalink
Fix issues with deploying on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
theterminalguy committed Nov 17, 2022
1 parent 83ec6da commit 2dc3722
Show file tree
Hide file tree
Showing 4 changed files with 403 additions and 35 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
Untiltled
out/
out/
dist/
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
"version": "0.1.0",
"private": true,
"main": "public/main.js",
"build": {
"extraMetadata": {
"main": "build/main.js"
}
},
"dependencies": {
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.4",
Expand Down Expand Up @@ -50,6 +55,7 @@
"@electron-forge/maker-rpm": "^6.0.1",
"@electron-forge/maker-squirrel": "^6.0.1",
"@electron-forge/maker-zip": "^6.0.1",
"electron": "^19.0.1"
"electron": "^19.0.1",
"electron-builder": "^23.6.0"
}
}
21 changes: 4 additions & 17 deletions public/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require("path");
const { app, BrowserWindow, ipcMain, Notification, systemPreferences } = require("electron");
const { app, BrowserWindow, ipcMain } = require("electron");

function createMainWindow() {
const win = new BrowserWindow({
Expand All @@ -24,7 +24,7 @@ function createMainWindow() {
function createCameraWindow() {
const win = new BrowserWindow({
width: 120,
height: 120,
height: 121,
maxWidth: 500,
maxHeight: 500,
resizable: false,
Expand All @@ -42,22 +42,9 @@ function createCameraWindow() {
return win;
}

app.whenReady().then(async () => {
const camAllowed = await systemPreferences.askForMediaAccess("camera").then(async (access) => {
if (!access) {
new Notification({
title: "Camera Access",
body: "Camera access is required to use this app",
}).show();
return false;
}
return true;
});

if (!camAllowed) {
app.quit();
}
app.disableHardwareAcceleration(); // for windows

app.whenReady().then(() => {
const mainWindow = createMainWindow();
const camWindow = createCameraWindow();
camWindow.setAlwaysOnTop(true, "floating", 1);
Expand Down
Loading

0 comments on commit 2dc3722

Please sign in to comment.