Fix: Using ASAR for every parts of the projects (the server is now in it) and i put the binaries in a /binaries folder. It's better for readability of the resources folder

This commit is contained in:
MasterAcnolo
2026-01-15 21:22:40 +01:00
parent e45810b54c
commit c356e2e30d
3 changed files with 22 additions and 20 deletions

11
main.js
View File

@@ -31,10 +31,10 @@ const gotLock = app.requestSingleInstanceLock();
// Native dependencies check (yt-dlp.exe, ffmpeg.exe, ffprobe.exe, Deno) // Native dependencies check (yt-dlp.exe, ffmpeg.exe, ffprobe.exe, Deno)
function checkNativeDependencies() { function checkNativeDependencies() {
const deps = [ const deps = [
{ name: "yt-dlp.exe", path: path.join(process.resourcesPath, "yt-dlp.exe") }, { name: "yt-dlp.exe", path: path.join(process.resourcesPath, "binaries","yt-dlp.exe") },
{ name: "ffmpeg.exe", path: path.join(process.resourcesPath, "ffmpeg.exe") }, { name: "ffmpeg.exe", path: path.join(process.resourcesPath, "binaries", "ffmpeg.exe") },
{ name: "ffprobe.exe", path: path.join(process.resourcesPath, "ffprobe.exe") }, { name: "ffprobe.exe", path: path.join(process.resourcesPath, "binaries", "ffprobe.exe") },
{ name: "deno.exe", path: path.join(process.resourcesPath, "deno.exe") }, { name: "deno.exe", path: path.join(process.resourcesPath, "binaries", "deno.exe") },
]; ];
const missing = deps.filter(dep => !fs.existsSync(dep.path)); const missing = deps.filter(dep => !fs.existsSync(dep.path));
let errorMsg = ""; let errorMsg = "";
@@ -193,7 +193,8 @@ app.whenReady().then(async () => {
logSessionStart(); logSessionStart();
logger.info("App Ready, Server Express starting..."); logger.info("App Ready, Server Express starting...");
const serverPath = path.join(__dirname, "server", "server.js"); const serverPath = path.join(__dirname, "server", "server.js")
const expressServer = require(serverPath); const expressServer = require(serverPath);
try { try {

View File

@@ -39,9 +39,7 @@
"files": [ "files": [
"**/*", "**/*",
"node_modules/**/*", "node_modules/**/*",
"!logs/*.json", "!logs/*.json"
"server/**/*",
"server/node_modules/**/*"
], ],
"directories": { "directories": {
"buildResources": "build" "buildResources": "build"
@@ -66,23 +64,19 @@
}, },
{ {
"from": "ressources/yt-dlp.exe", "from": "ressources/yt-dlp.exe",
"to": "yt-dlp.exe" "to": "binaries/yt-dlp.exe"
}, },
{ {
"from": "ressources/ffmpeg.exe", "from": "ressources/ffmpeg.exe",
"to": "ffmpeg.exe" "to": "binaries/ffmpeg.exe"
}, },
{ {
"from": "ressources/ffprobe.exe", "from": "ressources/ffprobe.exe",
"to": "ffprobe.exe" "to": "binaries/ffprobe.exe"
}, },
{ {
"from": "ressources/deno.exe", "from": "ressources/deno.exe",
"to": "deno.exe" "to": "binaries/deno.exe"
},
{
"from": "server",
"to": "server"
}, },
{ {
"from": "config/config.json", "from": "config/config.json",

View File

@@ -3,6 +3,8 @@ const fs = require("fs");
const { app } = require("electron"); const { app } = require("electron");
const config = require("../../config"); const config = require("../../config");
const { logger } = require("../logger.js");
let userYtDlp; let userYtDlp;
let ffmpegPath; let ffmpegPath;
let denoPath; let denoPath;
@@ -11,16 +13,21 @@ const sourceYtDlp = path.join(process.resourcesPath, "yt-dlp.exe");
if (config.localMode) { if (config.localMode) {
userYtDlp = path.join(__dirname, "../../ressources/yt-dlp.exe"); userYtDlp = path.join(__dirname, "../../ressources/yt-dlp.exe");
ffmpegPath = path.join(__dirname, "../../ressources"); // <- contient ffmpeg.exe et ffprobe.exe ffmpegPath = path.join(__dirname, "../../ressources/"); // <- contient ffmpeg.exe et ffprobe.exe
denoPath = path.join(__dirname, "../../ressources/deno.exe"); denoPath = path.join(__dirname, "../../ressources/deno.exe");
} else { } else {
userYtDlp = path.join(app.getPath("userData"), "yt-dlp.exe"); userYtDlp = path.join(app.getPath("userData"),"binaries","yt-dlp.exe");
ffmpegPath = path.join(process.resourcesPath, "ffmpeg.exe"); ffmpegPath = path.join(process.resourcesPath, "binaries","ffmpeg.exe");
denoPath = path.join(process.resourcesPath, "deno.exe"); denoPath = path.join(process.resourcesPath, "binaries","deno.exe");
if (!fs.existsSync(userYtDlp)) { if (!fs.existsSync(userYtDlp)) {
fs.copyFileSync(sourceYtDlp, userYtDlp); fs.copyFileSync(sourceYtDlp, userYtDlp);
} }
} }
if (!userYtDlp){ logger.error("Missing YT-DLP")}
if (!ffmpegPath){ logger.error("Missing FFMPEG")}
if (!denoPath){ logger.error("Missing DENO")}
module.exports = { userYtDlp, ffmpegPath, denoPath }; module.exports = { userYtDlp, ffmpegPath, denoPath };