Implemented functionality to have the UI be able to communicate with the backend

This commit is contained in:
2025-11-12 20:00:25 +01:00
parent 449255dda1
commit fbd5368223
3 changed files with 11 additions and 2 deletions
+4 -1
View File
@@ -5,7 +5,10 @@ const { contextBridge, ipcRenderer, webUtils } = require('electron')
try { try {
contextBridge.exposeInMainWorld("explorer", { contextBridge.exposeInMainWorld("explorer", {
onFileDrop: (file) => webUtils.getPathForFile(file) onFileDrop: (file) => webUtils.getPathForFile(file)
}) })
contextBridge.exposeInMainWorld("extractor", {
extract: (file) => ipcRenderer.send("extract", file)
})
} catch (error) { } catch (error) {
console.log("Error in preload.js"); console.log("Error in preload.js");
} }
+4 -1
View File
@@ -11,6 +11,8 @@ manualUploadBtn.addEventListener('click', () => {
//function to check if one checkbox is at least klicked //function to check if one checkbox is at least klicked
function checkBoxes() { function checkBoxes() {
console.log("fuck");
try { try {
const checkboxes = document.querySelectorAll('input[name="docFormat"]'); const checkboxes = document.querySelectorAll('input[name="docFormat"]');
let isChecked = false; let isChecked = false;
@@ -25,7 +27,8 @@ function checkBoxes() {
//Code to submit the video //Code to submit the video
var pathTest = fileName.textContent + ""; var pathTest = fileName.textContent + "";
if(pathTest.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){ if(pathTest.endsWith(".mp4") || holdy.endsWith(".mov") || holdy.endsWith(".avi") || holdy.endsWith( ".mkv")){
mapFunctions.get("extraction-video-to-audio").function({inputVideoPath: pathTest, outputType:"wav"}); console.log("fuck 2");
window.extractor.extract({inputVideoPath: pathTest, outputType:"wav"})
} }
} else { } else {
//language only english at the moment //language only english at the moment
+3
View File
@@ -74,3 +74,6 @@ function createWindow() {
electron.app.whenReady().then(createWindow); electron.app.whenReady().then(createWindow);
electron.ipcMain.on("extract", (event, args) => {
console.log(args);
})