2022-10-03 13:44:41 +02:00
|
|
|
const { ipcRenderer, dialog } = require('electron');
|
2022-10-07 00:07:54 +02:00
|
|
|
var DecompressZip = require('decompress-zip');
|
2022-09-20 19:14:04 +02:00
|
|
|
|
|
|
|
ipcRenderer.on("download complete", (event, file) => {
|
|
|
|
console.log(file); // Full file path
|
2022-10-03 13:44:41 +02:00
|
|
|
// Datei entpacken
|
2022-09-20 19:14:04 +02:00
|
|
|
});
|
2022-10-03 13:44:41 +02:00
|
|
|
|
2022-09-20 19:14:04 +02:00
|
|
|
ipcRenderer.on("download progress", (event, progress) => {
|
2022-10-03 13:44:41 +02:00
|
|
|
const cleanProgressInPercentages = Math.floor(progress.percent * 100); // Without decimal point
|
|
|
|
document.getElementById('progressbar').value = cleanProgressInPercentages;
|
2022-09-21 18:25:29 +02:00
|
|
|
});
|
|
|
|
|
2022-10-07 00:07:54 +02:00
|
|
|
let donwloadBtn = document.getElementById('download');
|
|
|
|
donwloadBtn.addEventListener('click', (e) => {
|
2022-10-03 13:44:41 +02:00
|
|
|
let directoryPath = document.getElementById('dirBox');
|
|
|
|
let urlPath = document.getElementById('urlBox');
|
|
|
|
ipcRenderer.send("download", {
|
|
|
|
url: urlPath.value,
|
|
|
|
properties: { directory: directoryPath.value }
|
|
|
|
});
|
2022-10-02 21:35:42 +02:00
|
|
|
});
|
|
|
|
|
2022-10-07 00:07:54 +02:00
|
|
|
let directoryBtn = document.getElementById('dirs');
|
|
|
|
directoryBtn.addEventListener('click', (e) => {
|
|
|
|
window.postMessage({
|
|
|
|
type: 'select-dirs'
|
|
|
|
})
|
2022-10-03 13:44:41 +02:00
|
|
|
});
|
|
|
|
|
2022-10-14 13:01:49 +02:00
|
|
|
ipcRenderer.on("filepath", (event, file) => {
|
|
|
|
document.getElementById('dirBox').innerText = file;
|
|
|
|
});
|
|
|
|
|
2022-10-07 00:07:54 +02:00
|
|
|
let extractBtn = document.getElementById('extract');
|
2022-10-14 13:01:49 +02:00
|
|
|
extractBtn.addEventListener('click', () => {
|
2022-10-07 00:07:54 +02:00
|
|
|
let directoryPath = document.getElementById('dirBox');
|
|
|
|
let urlPath = document.getElementById('urlBox');
|
|
|
|
ipcRenderer.send("extract", {
|
|
|
|
url: urlPath.value,
|
|
|
|
properties: { directory: directoryPath.value }
|
2022-10-03 13:44:41 +02:00
|
|
|
});
|
2022-10-07 00:07:54 +02:00
|
|
|
});
|