Compare commits

...

10 Commits

10 changed files with 56 additions and 84 deletions

View File

@@ -103,7 +103,9 @@ function startRPC() {
});
rpc.login({ clientId }).catch(err => {
logger.error("Unable to connect to the RPC:", err);
// Since 1.6.2, it no longer print the error. This is because if discord is not opened, it will send an error.
// logger.error("Unable to connect to the RPC:", err);
logger.info("Unable to connect to the Discord RPC. Discord is maybe not launched");
});
}
@@ -132,7 +134,8 @@ async function stopRPC() {
await rpc.destroy();
} catch (err) {
logger.error("Error while closing the RPC:", err);
// Since 1.6.2, it no longer print the error. This is because if discord is not opened, it will send an error.
// logger.error("Error while closing the RPC:", err);
}
}
}

19
main.js
View File

@@ -41,7 +41,10 @@ const { logger, logSessionStart, logSessionEnd, logDir } = require("./server/log
const { configFeatures } = require("./config");
/**
* On start, enable or disable hardWareAcceleration
* In-memory snapshot of application feature flags.
*
* Note: Changes to the config file are not automatically reflected.
* A restart could be required.
*/
if (!configFeatures.enableHardwareAcceleration){
app.disableHardwareAcceleration();
@@ -50,15 +53,7 @@ if (!configFeatures.enableHardwareAcceleration){
logger.info("Enable Hardware Acceleration")
}
/**
* In-memory snapshot of application feature flags.
*
* Note: Changes to the config file are not automatically reflected.
* A restart could be required.
*/
const config = require("./config");
if(config.devMode){
if(configFeatures.devMode){
/**
* Start devTron extensions - @see https://github.com/electron/devtron
*/
@@ -117,7 +112,7 @@ app.whenReady().then(async () => {
createSplashWindow();
if (!config.devMode && !checkNativeDependencies()) return;
if (!configFeatures.devMode && !checkNativeDependencies()) return;
const { userYtDlp } = require("./server/helpers/path.helpers");
updateYtDlp(userYtDlp);
@@ -143,7 +138,7 @@ app.whenReady().then(async () => {
getMainWindow().show();
if (configFeatures.systemTray) {
createSystemTray(getMainWindow(), config.devMode);
createSystemTray(getMainWindow(), configFeatures.devMode);
}
if (configFeatures.discordRPC) startRPC();

View File

@@ -1,7 +1,7 @@
{
"name": "freedom-loader",
"productName": "Freedom Loader",
"version": "1.6.2-preview",
"version": "1.6.2",
"author": "MasterAcnolo <MasterAcnolo@users.noreply.github.com>",
"description": "Free and open-source GUI for yt-dlp — download video and audio from hundreds of platforms",
"homepage": "https://masteracnolo.github.io/Freedom-Loader-Site/",

View File

@@ -56,9 +56,9 @@
<div class="setting-item" id="theme" style="margin-left: 32px;">
<div class="setting-info">
<div style="display: flex; align-items: center; gap: 10px;">
<span class="setting-title">Thème</span>
<span class="setting-title">Theme</span>
<select id="themeSelect" data-key="theme" aria-label="Choisir le thème">
<select id="themeSelect" data-key="theme" aria-label="Choose the theme">
</select>
<button id="refresh-themes-btn" title="Refresh themes" class="refresh-themes-btn">
@@ -306,7 +306,6 @@
<!-- Scripts -->
<script src="script/toast.js"></script>
<script src="script/customConfiguration.js"></script>
<script src="script/clipboardPaste.js"></script>
<script src="script/custompath.js"></script>
<script src="script/settingsPanel.js"></script>

View File

@@ -7,7 +7,7 @@
*
* @returns {Promise<void>}
*/
async function versionLabel() {
async function displayVersionLabel() {
/**
* Raw version string from the backend (e.g., "dev-1.6.2-preview" or "v1.6.2")
* @type {string}
@@ -51,4 +51,4 @@ async function versionLabel() {
versionBadge.textContent = `${packageStateStr}${previewStr}v${baseVersion}`;
}
versionLabel();
displayVersionLabel();

View File

@@ -1,27 +0,0 @@
async function initPlatformRestrictions() {
const platform = await window.electronAPI.getProcessPlatform();
const themeSelect = document.getElementById("themeSelect");
const refreshBtn = document.getElementById("refresh-themes-btn");
/**
* Is the OS windows
* @type {boolean}
*/
const isWindows = platform === "win32";
console.log(isWindows);
// If it's windows, the button is not disabled.
themeSelect.disabled = !isWindows;
refreshBtn.disabled = !isWindows;
themeSelect.classList.toggle("disabled", !isWindows);
refreshBtn.classList.toggle("disabled", !isWindows);
if (!isWindows) {
themeSelect.title = "Themes are only available on Windows";
refreshBtn.title = "Themes are only available on Windows";
}
}

View File

@@ -121,7 +121,7 @@ async function initThemes() {
const defaultTheme = {
id: "dark",
name: "Dark",
subtitle: "Darkness is my ally",
subtitle: "Because Why Not ?",
style: {
background: {
size: "cover",

View File

@@ -5,47 +5,41 @@
* This function is safe to call once DOM is ready.
* It silently aborts if the API or elements are missing.
*/
function setupTopbarListeners() {
export function initTopBar() {
const { topbarAPI } = window;
if (!topbarAPI) return;
const minBtn = document.getElementById("minimize-btn");
const maxBtn = document.getElementById("maximize-btn");
const closeBtn = document.getElementById("close-btn");
const devtoolsBtn = document.getElementById("devtools-btn");
const logsBtn = document.getElementById("logs-btn");
const websiteBtn = document.getElementById("website-btn");
const wikiBtn = document.getElementById("wiki-btn");
const workshopBtn = document.getElementById("workshop-btn");
if (minBtn) minBtn.onclick = () => topbarAPI.minimize();
const maxBtn = document.getElementById("maximize-btn");
if (maxBtn) maxBtn.onclick = () => topbarAPI.maximize();
const closeBtn = document.getElementById("close-btn");
if (closeBtn) closeBtn.onclick = () => topbarAPI.close();
const devtoolsBtn = document.getElementById("devtools-btn");
if (devtoolsBtn) devtoolsBtn.onclick = () => topbarAPI.openDevTools();
const logsBtn = document.getElementById("logs-btn");
if (logsBtn) logsBtn.onclick = () => topbarAPI.openLogs();
const websiteBtn = document.getElementById("website-btn");
if (websiteBtn) websiteBtn.onclick = () => topbarAPI.openWebsite();
const wikiBtn = document.getElementById("wiki-btn");
if (wikiBtn) wikiBtn.onclick = () => topbarAPI.openWiki();
const workshopBtn = document.getElementById("workshop-btn");
if (workshopBtn) workshopBtn.onclick = () => topbarAPI.openWorkshop();
}
/**
* Registers topbar event listeners after DOM is fully loaded.
*/
document.addEventListener("DOMContentLoaded", setupTopbarListeners);
async function attachListeners(){
try{
const featuresList = await window.electronAPI.getFeatures();
/**
* Applies UI layout adjustments depending on feature flags
* provided by the Electron backend.
*
* Specifically handles:
* - hiding custom topbar
* - adjusting layout spacing
* - repositioning theme switcher
*/
(async function applyFeatureLayout() {
const features = await window.electronAPI.getFeatures();
if (!features.customTopBar) {
if (!featuresList.customTopBar) {
const topbar = document.getElementById("topbar");
const container = document.getElementById("container");
const themeSwitcher = document.getElementById("theme-switcher");
@@ -54,4 +48,12 @@ document.addEventListener("DOMContentLoaded", setupTopbarListeners);
if (container) container.style.marginTop = "0";
if (themeSwitcher) themeSwitcher.style.top = "30px";
}
})();
} catch (error) {
console.error("Failed to load layout features for topbar:", error);
}
}
initTopBar()
document.addEventListener("DOMContentLoaded", attachListeners)

View File

@@ -150,7 +150,7 @@ const binaryPaths = {
* - user themes are persisted in userData to survive updates
*/
const userThemesPath = path.join(app.getPath("userData"), "themes");
const defaultThemesSourcePath = path.join(resourcesPath, "theme");
const defaultThemesSourcePath = path.join("theme");
/**
* Initializes user theme directory and ensures default themes exist.

Binary file not shown.