Files
Freedom-Loader/app/ytDlpUpdater.js
MasterAcnolo 0218664c5a refactor: add full documentation and fix theme loading robustness
- Add JSDoc comments across frontend and backend modules
- Improve code readability and maintainability with consistent documentation style
- Document Electron IPC handlers, UI utilities, and theme system
- Add missing function/class documentation in theme loader and app services
- Minor structural improvements and cleanup across Electron main process modules
- Minor fixes on variable names
2026-05-31 20:38:42 +02:00

35 lines
1.0 KiB
JavaScript

const { execFile } = require("child_process");
const { logger } = require("../server/logger");
/**
* Attempts to update the local yt-dlp binary using its built-in update command.
*
* This function:
* - Executes yt-dlp with the `-U` flag
* - Logs update output or warnings if update fails
* - Never throws: update failure is non-blocking by design
*
* @param {string} ytDlpPath - Absolute path to the yt-dlp executable
*/
function updateYtDlp(ytDlpPath) {
logger.info("yt-dlp update check starting...");
/**
* Executes yt-dlp CLI process in a non-interactive mode.
* Used here specifically for self-update via `-U` flag.
*/
execFile(ytDlpPath, ["-U"], (err, stdout) => {
/**
* Handles yt-dlp update result:
* - Logs warning if update fails (network, binary issues, permissions)
* - Logs stdout output when update succeeds
*/
if (err) logger.warn("yt-dlp update failed (continuing):", err.message);
else logger.info(`yt-dlp update: ${stdout.trim()}`);
});
}
module.exports = { updateYtDlp };