Created a preload.js, small changes in the package.json, main.js, index.html and script.js like removing whitespace

This commit is contained in:
2025-11-04 17:18:45 +01:00
parent 38d0934232
commit 4686d17ad9
6 changed files with 18 additions and 9 deletions
+3 -3
View File
@@ -7,8 +7,7 @@
<link rel="stylesheet" href="style.css">
</head>
<body>
<form method="post" enctype="multipart/form-data" >
<input type="file" name="uploaddatei" >
<div class="upload-container" id="uploadContainer">
@@ -17,10 +16,11 @@
</div>
<button class="custom-btn" id="manualUploadBtn">Upload video</button>
<button class="custom-btn" id="manualUploadBtn">Search video</button>
<input type="file" id="videoUpload" accept="video/*">
<script src="script.js"></script>
</body>
</html>
+3 -1
View File
@@ -19,7 +19,7 @@ function createWindow() {
}
});
mainWindow.loadFile('index.html');
mainWindow.loadFile('main/index.html');
}
app.whenReady().then(createWindow);
@@ -40,3 +40,5 @@ ipcMain.handle('convert-video', async (event, filePath) => {
});
});
});
+4
View File
@@ -0,0 +1,4 @@
const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
sendDropPath: (path) => ipcRenderer.send('file-dropped', path)
});
+1
View File
@@ -0,0 +1 @@
+5 -4
View File
@@ -17,10 +17,11 @@ uploadContainer.addEventListener('dragleave', () => {
});
uploadContainer.addEventListener('drop', (e) => {
e.preventDefault();
uploadContainer.classList.remove('dragover');
uploadContainer.addEventListener('drop', (e) => { e.preventDefault();
const file = e.dataTransfer.files[0]; // Pfad der Datei
const filePath = file.path;
console.log('Pfad:', filePath); // ggf. an den Hauptprozess senden, wenn nötig
window.electronAPI?.sendDropPath?.(filePath);
const files = e.dataTransfer.files;
handleFiles(files);
+2 -1
View File
@@ -1,7 +1,8 @@
{
"name": "electron",
"version": "1.0.0",
"main": "index.js",
"main": "main/main.js",
"type": "module",
"scripts": {
"start": "electron.",
"test": "echo \"Error: no test specified\" && exit 1"