Skip to content

Commit bad3fcc

Browse files
committed
fix: build
1 parent 71fd409 commit bad3fcc

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

.github/workflows/build.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,22 @@ jobs:
2626
git clone --single-branch --branch gh-pages https://github.com/th3cyb3rhub/TheCyberHUB.git temp
2727
# List the contents of the temp directory to verify files are present
2828
Get-ChildItem temp
29+
2930
# Check if the target folder exists and remove if necessary
3031
if (Test-Path ".github") {
3132
Remove-Item -Recurse -Force ".github"
3233
}
33-
# Copy necessary files into your source directory
34-
Copy-Item -Recurse -Path "temp/*" -Destination "." -Force
34+
# Create the dist directory if it doesn't exist
35+
if (-Not (Test-Path "dist")) {
36+
New-Item -ItemType Directory -Path "dist"
37+
}
38+
39+
# Copy necessary files into the dist directory
40+
Copy-Item -Recurse -Path "temp/*" -Destination "dist" -Force
3541
36-
- name: List files after copying
42+
- name: List files in the dist directory after copying
3743
run: |
38-
Get-ChildItem
44+
Get-ChildItem dist
3945
4046
- name: Clear Electron Builder Cache
4147
run: |

src/main.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ function createWindow() {
66
width: 800,
77
height: 600,
88
webPreferences: {
9-
preload: path.join(__dirname, 'preload.js'), // Optional, for future use
9+
preload: path.join(__dirname, 'preload.js'), // Path to preload.js
10+
contextIsolation: true, // Recommended for security
11+
enableRemoteModule: false // Disable remote module
1012
},
1113
});
1214

13-
// Load the built HTML file from the dist folder
15+
// Load the built React app from the 'build' folder (adjust the path as necessary)
1416
win.loadFile(path.join(__dirname, '../dist/index.html'));
1517
}
1618

src/preload.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// preload.js
2+
const { contextBridge, ipcRenderer } = require('electron');
3+
4+
// Expose an API to the renderer process
5+
contextBridge.exposeInMainWorld('electron', {
6+
sendMessage: (channel, data) => {
7+
ipcRenderer.send(channel, data);
8+
},
9+
receiveMessage: (channel, func) => {
10+
ipcRenderer.on(channel, (event, ...args) => func(...args));
11+
}
12+
});

0 commit comments

Comments
 (0)