From cc91306e411141ca8db161810f7123edea1f537c Mon Sep 17 00:00:00 2001 From: aandrew-me Date: Sat, 6 Sep 2025 12:20:41 +0300 Subject: [PATCH] Fix title rendering issue --- src/renderer.js | 65 +++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/src/renderer.js b/src/renderer.js index 0d9de44..dc1bfcb 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -128,7 +128,7 @@ if (os.platform() === "darwin") { showMacYtdlpPopup(); } else { ytDlpIsPresent = true; - setLocalStorageYtDlp(ytDlpPath) + setLocalStorageYtDlp(ytDlpPath); } } @@ -142,11 +142,11 @@ if (os.platform() === "freebsd") { .trim(); ytDlpIsPresent = true; - setLocalStorageYtDlp(ytDlpPath) + setLocalStorageYtDlp(ytDlpPath); } catch (error) { console.log(error); - hidePasteBtn() + hidePasteBtn(); getId("incorrectMsg").textContent = i18n.__( "No yt-dlp found in PATH. Make sure you have the full executable. App will not work" @@ -163,9 +163,9 @@ if (process.env.YTDOWNLOADER_YTDLP_PATH) { ytDlp = new YTDlpWrap(`"${ytDlpPath}"`); ytDlpIsPresent = true; - setLocalStorageYtDlp(ytDlpPath) + setLocalStorageYtDlp(ytDlpPath); } else { - hidePasteBtn() + hidePasteBtn(); getId("incorrectMsg").textContent = i18n.__( "You have specified YTDOWNLOADER_YTDLP_PATH, but no file exists there." @@ -183,9 +183,8 @@ if ( const localStorageytDlpPath = localStorage.getItem("ytdlp"); if (fs.existsSync(localStorageytDlpPath)) { - - logYtDlpPresent(ytDlpPath) - + logYtDlpPresent(ytDlpPath); + ytDlp = new YTDlpWrap(`"${ytDlpPath}"`); cp.spawn(`${ytDlpPath}`, ["-U"]).stdout.on("data", (data) => @@ -195,11 +194,10 @@ if ( ipcRenderer.send("ready-for-links"); ytDlpIsPresent = true; - setLocalStorageYtDlp(ytDlpPath) + setLocalStorageYtDlp(ytDlpPath); } } - if ( !ytDlpIsPresent && !process.env.YTDOWNLOADER_YTDLP_PATH && @@ -228,16 +226,16 @@ if ( downloadYtDlp(ytDlpDownloadPath); } else { - logYtDlpPresent(ytDlpPath) - + logYtDlpPresent(ytDlpPath); + ytDlp = new YTDlpWrap(`"${ytDlpPath}"`); cp.spawn(`${ytDlpPath}`, ["-U"]).stdout.on("data", (data) => console.log(data.toString("utf8")) ); - + ipcRenderer.send("ready-for-links"); - setLocalStorageYtDlp(ytDlpPath) + setLocalStorageYtDlp(ytDlpPath); } }); } @@ -254,20 +252,18 @@ if (os.platform() === "win32") { .trim(); } catch (error) { console.log(error); - - getId("incorrectMsg").textContent = i18n.__( - "No ffmpeg found in PATH" - ); + + getId("incorrectMsg").textContent = i18n.__("No ffmpeg found in PATH"); } } else { ffmpeg = `"${__dirname}/../ffmpeg"`; } if (process.env.YTDOWNLOADER_FFMPEG_PATH) { - ffmpeg = `"${process.env.YTDOWNLOADER_FFMPEG_PATH}"` + ffmpeg = `"${process.env.YTDOWNLOADER_FFMPEG_PATH}"`; if (fs.existsSync(process.env.YTDOWNLOADER_FFMPEG_PATH)) { - console.log("Using YTDOWNLOADER_FFMPEG_PATH") + console.log("Using YTDOWNLOADER_FFMPEG_PATH"); } else { getId("incorrectMsg").textContent = i18n.__( "You have specified YTDOWNLOADER_FFMPEG_PATH, but no file exists there." @@ -275,8 +271,7 @@ if (process.env.YTDOWNLOADER_FFMPEG_PATH) { } } -console.log(ffmpeg) - +console.log(ffmpeg); getId("closeHidden").addEventListener("click", () => { hideHidden(); @@ -425,9 +420,22 @@ async function getInfo(url) { getId("hidden").style.display = "inline-block"; getId("hidden").classList.add("scaleUp"); - getId("title").innerHTML = - `${i18n.__("Title ")}: ` + - ``; + const titleElement = getId("title"); + titleElement.textContent = ""; + + titleElement.append( + Object.assign(document.createElement("b"), { + textContent: i18n.__("Title "), + }), + ": ", + Object.assign(document.createElement("input"), { + className: "title", + id: "titleName", + type: "text", + value: title, + onchange: renameTitle, + }) + ); let audioSize = 0; let defaultVideoFormat = 144; @@ -1627,11 +1635,10 @@ function logYtDlpPresent(ytDlpPath) { console.log(ytDlpPath); } - function hidePasteBtn() { - getId("pasteUrl").style.display = "none" + getId("pasteUrl").style.display = "none"; } function setLocalStorageYtDlp(ytDlpPath) { - localStorage.setItem("ytdlp", ytDlpPath) -} \ No newline at end of file + localStorage.setItem("ytdlp", ytDlpPath); +}