Skip to content

Commit

Permalink
User friendly alert when the Mini Player is opened in a non-album page
Browse files Browse the repository at this point in the history
  • Loading branch information
themagiulio committed Dec 15, 2020
1 parent 68a92d8 commit 6c493b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 8 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}));
Expand Down Expand Up @@ -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) {

Expand Down Expand Up @@ -203,6 +205,9 @@ function openDialog(title, message){
}

});
}else{
openDialog('Bandcamp Desktop - Error', 'Mini Player can be opened only in album pages.')
}
},
},
{
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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 .",
Expand Down Expand Up @@ -51,7 +51,8 @@
"linux": {
"icon": "bandcamp-logo.png",
"target": [
"AppImage"
"AppImage",
"deb"
],
"category": "Music"
}
Expand Down

0 comments on commit 6c493b2

Please sign in to comment.