Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
0xk4b1r committed Nov 1, 2024
1 parent 71fd409 commit bad3fcc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,22 @@ jobs:
git clone --single-branch --branch gh-pages https://github.com/th3cyb3rhub/TheCyberHUB.git temp
# List the contents of the temp directory to verify files are present
Get-ChildItem temp
# Check if the target folder exists and remove if necessary
if (Test-Path ".github") {
Remove-Item -Recurse -Force ".github"
}
# Copy necessary files into your source directory
Copy-Item -Recurse -Path "temp/*" -Destination "." -Force
# Create the dist directory if it doesn't exist
if (-Not (Test-Path "dist")) {
New-Item -ItemType Directory -Path "dist"
}
# Copy necessary files into the dist directory
Copy-Item -Recurse -Path "temp/*" -Destination "dist" -Force
- name: List files after copying
- name: List files in the dist directory after copying
run: |
Get-ChildItem
Get-ChildItem dist
- name: Clear Electron Builder Cache
run: |
Expand Down
6 changes: 4 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ function createWindow() {
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'), // Optional, for future use
preload: path.join(__dirname, 'preload.js'), // Path to preload.js
contextIsolation: true, // Recommended for security
enableRemoteModule: false // Disable remote module
},
});

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

Expand Down
12 changes: 12 additions & 0 deletions src/preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// preload.js
const { contextBridge, ipcRenderer } = require('electron');

// Expose an API to the renderer process
contextBridge.exposeInMainWorld('electron', {
sendMessage: (channel, data) => {
ipcRenderer.send(channel, data);
},
receiveMessage: (channel, func) => {
ipcRenderer.on(channel, (event, ...args) => func(...args));
}
});

0 comments on commit bad3fcc

Please sign in to comment.