File tree 3 files changed +26
-6
lines changed
3 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -26,16 +26,22 @@ jobs:
26
26
git clone --single-branch --branch gh-pages https://github.com/th3cyb3rhub/TheCyberHUB.git temp
27
27
# List the contents of the temp directory to verify files are present
28
28
Get-ChildItem temp
29
+
29
30
# Check if the target folder exists and remove if necessary
30
31
if (Test-Path ".github") {
31
32
Remove-Item -Recurse -Force ".github"
32
33
}
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
35
41
36
- - name : List files after copying
42
+ - name : List files in the dist directory after copying
37
43
run : |
38
- Get-ChildItem
44
+ Get-ChildItem dist
39
45
40
46
- name : Clear Electron Builder Cache
41
47
run : |
Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ function createWindow() {
6
6
width : 800 ,
7
7
height : 600 ,
8
8
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
10
12
} ,
11
13
} ) ;
12
14
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)
14
16
win . loadFile ( path . join ( __dirname , '../dist/index.html' ) ) ;
15
17
}
16
18
Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments