Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion com.burnttoasters.rosi.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</screenshot>
</screenshots>
<releases>
<release version="4.0.0" date="2026-03-31"/>
<release version="4.0.1" date="2026-03-31"/>
</releases>
<content_rating type="oars-1.1"/>
</component>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rosi",
"version": "4.0.0",
"version": "4.0.1",
"private": true,
"description": "Electron GUI for yt-dlp",
"keywords": [
Expand Down
35 changes: 28 additions & 7 deletions src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ process.on('uncaughtException', (error) => {
try {
killAllProcesses();
} catch {}
try {
cancelFormats();
} catch {}
try {
dialog.showErrorBox(
'Fatal Error',
Expand Down Expand Up @@ -75,6 +78,7 @@ let mainWindow: BrowserWindow | null = null;
let splashWindow: BrowserWindow | null = null;
let mainWindowCloseInProgress = false;
let mainWindowCloseTimer: NodeJS.Timeout | null = null;
let appQuitting = false;

function getMainWindow() {
return mainWindow;
Expand Down Expand Up @@ -278,6 +282,7 @@ function createWindow() {

mainWindowCloseTimer = setTimeout(() => {
log.warn('Timed out waiting for renderer settings flush. Closing window.');
mainWindowCloseInProgress = false;
if (mainWindow && !mainWindow.isDestroyed()) {
mainWindow.destroy();
}
Expand Down Expand Up @@ -391,14 +396,15 @@ void app.whenReady().then(() => {
});

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
if (process.platform !== 'darwin' || appQuitting) app.quit();
});

app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});

app.on('before-quit', () => {
appQuitting = true;
try {
killAllProcesses();
} catch (error) {
Expand Down Expand Up @@ -461,7 +467,10 @@ ipcMain.handle('save-settings', (_, data) => {

ipcMain.handle('detect-gpu', () => detectGpu());

ipcMain.on('reset-settings', () => {
ipcMain.on('reset-settings', (event) => {
if (mainWindow && !mainWindow.isDestroyed() && event.sender?.id !== mainWindow.webContents.id) {
return;
}
try {
const saved = saveSettings(getDefaultSettings(), mainWindow);
if (!saved) {
Expand Down Expand Up @@ -531,9 +540,17 @@ ipcMain.handle('getFormats', async (_, url) => {
return errorResult('INTERNAL_ERROR', message);
}
});
ipcMain.on('cancel-formats', () => cancelFormats());
ipcMain.on('cancel-formats', (event) => {
if (mainWindow && !mainWindow.isDestroyed() && event.sender?.id !== mainWindow.webContents.id) {
return;
}
cancelFormats();
});

ipcMain.handle('download-video', (event, options) => {
if (mainWindow && !mainWindow.isDestroyed() && event.sender?.id !== mainWindow.webContents.id) {
return errorResult('VALIDATION_ERROR', 'Unauthorized sender.');
}
const validation = validateDownloadRequestPayload(options);
if (!validation.ok) {
return errorResult(validation.error.code, validation.error.message, validation.error.details);
Expand All @@ -548,7 +565,10 @@ ipcMain.handle('download-video', (event, options) => {
}
});

ipcMain.on('cancel-download', () => {
ipcMain.on('cancel-download', (event) => {
if (mainWindow && !mainWindow.isDestroyed() && event.sender?.id !== mainWindow.webContents.id) {
return;
}
try {
cancelActiveSession(true);
} catch (error) {
Expand Down Expand Up @@ -609,9 +629,10 @@ ipcMain.handle('show-notification', (_, options) => {

notification.on('click', () => {
try {
if (mainWindow && !mainWindow.isDestroyed()) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
const win = getMainWindow();
if (win && !win.isDestroyed()) {
if (win.isMinimized()) win.restore();
win.focus();
}
if (validation.data.filePath) {
shell.showItemInFolder(validation.data.filePath);
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/rosiEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,10 @@ function updateProgressBar(percent, statusText = null, detailsText = null) {
const bar = document.getElementById('progress-bar');
const details = document.getElementById('progress-details');

if (percentEl) percentEl.textContent = `${Math.round(percent)}%`;
const clamped = Math.max(0, Math.min(100, percent));
if (percentEl) percentEl.textContent = `${Math.round(clamped)}%`;
if (bar) {
bar.style.width = `${percent}%`;
bar.style.width = `${clamped}%`;
bar.classList.remove('indeterminate');
}
if (statusText && statusEl) statusEl.textContent = statusText;
Expand Down
Loading