Skip to content

Commit

Permalink
chore: update the user agent for the chrome signin trick
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Dec 6, 2019
1 parent 4b64f7a commit 3f36c34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ app.setAppUserModelId('com.marshallofsound.gpmdp.core');
let newUserAgent = mainWindow.webContents.getUserAgent().replace(/Electron\/.+? /g, '');

// Spoof the user agent to bypass the sign in issue (#3545)
if (Settings.get('spoofUserAgent')) {
newUserAgent = Settings.get('spoofedUserAgent');
if (Settings.get('userAgent')) {
newUserAgent = Settings.get('userAgent');
}

mainWindow.webContents.session.setUserAgent(newUserAgent);
Expand Down
2 changes: 1 addition & 1 deletion src/main/utils/_initialSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ export default {
enableWin10MediaServiceTrackInfo: true,
lastFMMapThumbToHeart: true,
service: 'google-play-music',
spoofedUserAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36',
userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/80.0.3904.70 Safari/537.36',
spoofUserAgent: true,
};

7 comments on commit 3f36c34

@jostrander
Copy link
Collaborator

@jostrander jostrander commented on 3f36c34 Dec 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this user agent is incorrect, which is why YTM is failing to load. The official Chromium UA has both Chromium and Chrome in it, and you are using a version (80) that is only in dev, so may not be supported yet.

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/78.0.3904.108 Chrome/78.0.3904.108 Safari/537.36

It also looks like you may have transposed numbers for the version, there is no 80.0.3904.70, but there is a 78.0.3904.108.

image

@cja769
Copy link

@cja769 cja769 commented on 3f36c34 Dec 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @jostrander said, switching to YTM says that the library couldn't be optimized however, at least for Ubuntu 18.04, I'm able to log in and access GPM with this UA

@MarshallOfSound
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jostrander I'm deliberately hand crafting this UA. Putting "Chrome" in the UA triggers the sign in check. Need to find a way to put "Chrome" in the UA only after you're signed in

@jostrander
Copy link
Collaborator

@jostrander jostrander commented on 3f36c34 Dec 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could change the UA on the fly based on the URL?
https://accounts.google.com/
vs
https://play.google.com
vs
https://music.google.com

@MarshallOfSound
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by the time we know the URL it might be too late for the UA to change / be updated. Can check tonight though

@Max9403
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed my Firefox UA works (can both login and listen to music on YTM and GPM)

Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0

@MarshallOfSound
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Max9403 You're a hero, that's the golden User Agent. Would have take a while for me to start trying Gecko UA's.

Initial tests show that that work, I'll push it up to master and drop some builds for other folks to test. Thanks for sharing 🙇

Please sign in to comment.