From 6c493b2054f9c0e46706b38460ca9e55453b68c4 Mon Sep 17 00:00:00 2001 From: Giulio De Matteis Date: Tue, 15 Dec 2020 14:07:39 +0100 Subject: [PATCH] User friendly alert when the Mini Player is opened in a non-album page --- main.js | 11 ++++++++--- package.json | 7 ++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 97b0193..886bfba 100644 --- a/main.js +++ b/main.js @@ -61,7 +61,7 @@ function createWindow(){ mainWindowState.manage(mainWindow); mainWindow.loadURL(url.format({ - pathname: 'planetsmashers.bandcamp.com/album/too-much-information-2', + pathname: 'bandcamp.com', protocol: 'https:', slashes: true })); @@ -118,8 +118,10 @@ function openDialog(title, message){ click(){ let webPageUrl = mainWindow.webContents.getURL(); - if(webPageUrl !== 'https://bandcamp.com/') - request({ + var subdomain = webPageUrl.split('.')[1].replace('https://','') ? webPageUrl.split('.')[0].replace('https://','') : false; + + if(subdomain !== 'bandcamp' && subdomain !== 'daily'){ + request({ uri: webPageUrl, }, function(error, response, body) { @@ -203,6 +205,9 @@ function openDialog(title, message){ } }); + }else{ + openDialog('Bandcamp Desktop - Error', 'Mini Player can be opened only in album pages.') + } }, }, { diff --git a/package.json b/package.json index faebe87..50a48c0 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "bandcamp-desktop", "productName": "Bandcamp Desktop", - "version": "2.3.1", - "description": "bandcamp Desktop is a desktop application written by Giulio De Matteis.\r It allows you to use bandcamp.com in an easy and quick way.", + "version": "2.3.2", + "description": "Bandcamp Desktop is a crossplatform desktop application. It allows you to use bandcamp.com in an easy and quick way. Keep listening to music while you explore the website.", "main": "main.js", "scripts": { "start": "electron .", @@ -51,7 +51,8 @@ "linux": { "icon": "bandcamp-logo.png", "target": [ - "AppImage" + "AppImage", + "deb" ], "category": "Music" }