Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update electron & remote & user agents #515

Merged
merged 13 commits into from
Dec 30, 2021
Merged

Conversation

Araxeus
Copy link
Collaborator

@Araxeus Araxeus commented Dec 12, 2021

fix #507, fix #526, fix #17, fix #8, fix #327

@Araxeus Araxeus mentioned this pull request Dec 12, 2021
@Araxeus Araxeus force-pushed the fix-useragents branch 2 times, most recently from 94e8214 to 3425767 Compare December 12, 2021 22:31
@Araxeus Araxeus changed the title update user agents update electron & remote & user agents Dec 13, 2021
@Araxeus Araxeus mentioned this pull request Dec 13, 2021
@WhiteHusky
Copy link

Logging in is still pretty jank. I had to clear my data (or as much as I could), then try to sign in, then switch into my own account, then hard refresh. The home page is, for some reason, still showing the generic home page but now I get access to my library.

I swore there was Chromecast support but I guess I might've dreamt it up.

@WhiteHusky
Copy link

Correction, now it shows my front page after navigating around.

@WhiteHusky
Copy link

And now opening and closing it breaks it again. Google really doesn't want us embedding YTM huh?

@Araxeus
Copy link
Collaborator Author

Araxeus commented Dec 13, 2021

@WhiteHusky It really should work now, did you update dependencies using yarn? did you try building and installing?

@keliel
Copy link

keliel commented Dec 13, 2021

Login worked for me instantly. Although there were no navigation items except for search, after returning back to home page.
Also login screens looked a bit different (old?) compared to what I am currently used to with Google/Youtube.
The package versions you updated here, are the newest ones, right? Or are there any other parameters that might've been missed?

@keliel
Copy link

keliel commented Dec 14, 2021

For reference, this is what it would look like in the competing YTM app. I noticed that here is says "sign in to continue to Youtube Music", but in case of this PR it shows the "sign into all of google" page and mentions "sign in to continue to Youtube", which might be a hint :)

image

@keliel
Copy link

keliel commented Dec 14, 2021

Okay nvm. They are having the same issue now. Seems like this is a common problem suddenly appearing with Electron apps, maybe?

@keliel
Copy link

keliel commented Dec 14, 2021

Over there the fix also included opening their "guest" login separately without actually using it. That one does in fact look like the one that comes out after this PR here :)

image

@Araxeus
Copy link
Collaborator Author

Araxeus commented Dec 14, 2021

It is indeed an electron problem that has nothing to do with the app. see electron/electron#22346 (comment)

this PR kinda works for some reason - it will try the first time with the normal mode, then if it fails it switches to the "One account. All of Google" mode, which works but if used then for unknown reasons it breaks the navigation until the app is restarted (but it stays logged in so the only problem is the navigation bug after log in)

@keliel
Copy link

keliel commented Dec 14, 2021

Is it possible to force a restart after successful login in the second case? If so, I would say that it is an acceptable workaround.

On another note regarding this PR: a273f6f is out of scope in my opinion. Or does it have anything to do with the initial problem or resulting issues? I am guessing the simultaneous update to electron was needed for the remote package to work? (4 major versions is pretty big)

@Araxeus
Copy link
Collaborator Author

Araxeus commented Dec 14, 2021

Is it possible to force a restart after successful login in the second case? If so, I would say that it is an acceptable workaround.

Latest version actually works good for me when built and installed (still buggy in dev mode)


a273f6f is out of scope in my opinion.

Well yes but its just that suddenly with the new electron version player.videoMode_ sometimes doesn't reflect the real value when videoStarted() is called, so I just switched to the old way of checking


update to electron was needed for the remote package to work?

More like the update to the remote package was needed because of the electron update.
That update is for mainly for the 2 following reasons:

  • Electron 12 is deprecated since 16/11/2021 (and with it the remote module)
  • Update to electron 16 since there shouldn't be any breaking changes affecting this project except the remote module and that way we get the latest chromium which performs better & more secure & less bugs

@Araxeus
Copy link
Collaborator Author

Araxeus commented Dec 14, 2021

@KimBum here are windows binaries with the latest changes
https://www.mediafire.com/folder/fvjiihmu3ka2z/Youtube-Music+useragents-patch+v3

try installing via the setup this time

@keliel
Copy link

keliel commented Dec 14, 2021

@Araxeus works like you said. First time failed, but second time works fine. Navigation also showed up for me, since reload seemed to happen automatically.

I did notice however, that the disable-autoplay plugin seems to be broken now. Stops each time I try to press play 😞

@keliel
Copy link

keliel commented Dec 14, 2021

Seems to work some of the time when the tooltip for "press to play" appears, but even though I just reinstalled it, the tooltip is not shown for the first startup 🤨

Copy link
Owner

@th-ch th-ch left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, tested on MacOS, looks promising! But I would separate the electron upgrade which might require more work

package.json Show resolved Hide resolved
index.js Show resolved Hide resolved
index.js Show resolved Hide resolved
@Araxeus
Copy link
Collaborator Author

Araxeus commented Dec 15, 2021

@th-ch Sorry but I really can't separate it now since remote doesn't work for me anymore no matter what I do
-which means I can't even test another PR without the updated electron version

disable-autoplay plugin seems to be broken now. Stops each time I try to press play

@KimBum I actually can't replicate anything? could you check again maybe>

  • downloader plugins (unrecognized flag --experimental-wasm-bulk-memory + SharedArrayBuffer is not defined are fixed with baeebd1

allow override of useragent in config for more flexibility

@th-ch this useragent isn't really doing much, the actual fix is that when it fails (some accounts are shadowbanned) - it tries again with the original useragent which does work currently if login initially fail

youtube-music/index.js

Lines 185 to 191 in 8f2ed30

win.webContents.session.webRequest.onBeforeSendHeaders((details, cb) => {
// this will only happen if login failed, and "retry" was pressed
if (win.webContents.getURL().startsWith("https://accounts.google.com") && details.url.startsWith("https://accounts.google.com")){
details.requestHeaders["User-Agent"] = originalUserAgent;
}
cb({ requestHeaders: details.requestHeaders });
});

* --experimental-wasm-bulk-memory
* SharedArrayBuffer
* getFolder from front
* ytdl-core 4.9.2
@Araxeus
Copy link
Collaborator Author

Araxeus commented Dec 16, 2021

  • Downloader issues are fixed

  • I've also fixed and updated both custom-electron-prompt&titlebar packages

All thats left is that disable-autoplay bug that I can't personally replicate. can anyone look into it?
windows setup 16/12/2021: https://www.mediafire.com/folder/fvjiihmu3ka2z/Youtube-Music+useragents-patch+v4

Its also worth noting that the portable version of the app / dev version has a bug in those 2 scenarios:

  • logged in failed, retried with alternate useragent and succedeed
  • Launched the app (sometimes, about 1/5 times for me)

in which all navbar items disappear except the search button:

image

No idea why would it ever happen, but it never happens if the app is installed - so maybe whenever you release a new version you should consider not including the portable version or add a warning?

(According to my testing, this bug has no relation to the useragent, which makes sense since installing gets rid of it)

@Araxeus Araxeus marked this pull request as ready for review December 20, 2021 14:41
Copy link
Owner

@th-ch th-ch left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for the fix and the upgrade! Merging, will release a new version with all the recent changes

@th-ch th-ch merged commit 56ac2b3 into th-ch:master Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants