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

Whatsapp Web User-Agent #5210

Closed
GhostValk opened this issue Jan 28, 2020 · 15 comments
Closed

Whatsapp Web User-Agent #5210

GhostValk opened this issue Jan 28, 2020 · 15 comments
Labels
status: can't reproduce Issues which can't be reproduced. status: needs triage Issues/PRs which need some deeper investigation.

Comments

@GhostValk
Copy link

Hi!

For some reason (probably some whatsapp update), i'm no longer able to use the desktop version of whatsapp (whatsapp web). I remember when i started using qb i had to try quite some user agents to get it working and i was wondering if you guys know one that works now.

@The-Compiler
Copy link
Member

What Qt version, backend and qutebrowser version (see :version)? Does it work with --temp-basedir?

(There's a reason the issue template asks you for this - so I don't have to 😉)

@GhostValk
Copy link
Author

GhostValk commented Jan 28, 2020

No template did pop up when i created the new message.

Qt: 5.14.0
PyQt: 5.14.1

Yes, with -temp-basedir it works

@The-Compiler
Copy link
Member

No template did pop up when i created the new message.

I guess you clicked "feature request" rather than "bug report" or "support" then.

Qt: 5.14.0 / PyQt: 5.14.1

...what qutebrowser version?

Yes, with -temp-basedir it works

Can you show :open qute://configdiff please? (Though it might not be that, some WhatsApp issues only happen when logging in a second time rather than signing up)

@The-Compiler The-Compiler added the status: needs triage Issues/PRs which need some deeper investigation. label Jan 28, 2020
@GhostValk
Copy link
Author

GhostValk commented Jan 28, 2020

I clicked "New Issue". Qb versión is 1.9, but it was still in 1.8, i just upgraded it to see if it was fixed, but no.

Output from that command is:

auto_save.session = true
bindings.commands = {"normal": {"1": "tab-focus 1", "2": "tab-focus 2", "3": "tab-focus 3", "4": "tab-focus 4", "5": "tab-focus 5", "6": "tab-focus 6", "7": "tab-focus 7", "8": "tab-focus 8", "9": "tab-focus -1", "<Alt+m>": "tab-move -", "<Alt+n>": "tab-move +", "<Left>": "back", "<Right>": "forward", "f": "hint all tab", "g": "set-cmd-text -s :open ", "h": "back", "j": "tab-prev", "k": "tab-next", "l": "forward", "mpv": "spawn --userscript /Users/Ghost/Desktop/Call.sh {clipboard}", "t": "set-cmd-text -s :open -t"}}
colors.tabs.bar.bg = black
colors.tabs.even.bg = black
colors.tabs.even.fg = #33ff33
colors.tabs.odd.bg = black
colors.tabs.odd.fg = #33ff33
completion.open_categories = ["history"]
completion.shrink = true
completion.web_history.max_items = 10
content.cookies.accept = all
content.cookies.store = true
content.headers.user_agent = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Safari/605.1.15
*://www.instagram.com/*: content.headers.user_agent = Mozilla/5.0 (iPhone; CPU iPhone OS 12_1_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1
content.pdfjs = true
content.plugins = true
content.proxy = system
fonts.hints = bold 20pt monospace
fonts.monospace = "Roboto Mono for Powerline"
fonts.statusbar = 12pt monospace
fonts.tabs = 12pt monospace
input.insert_mode.auto_enter = false
input.insert_mode.auto_leave = true
input.insert_mode.auto_load = false
input.insert_mode.leave_on_load = true
input.insert_mode.plugins = false
new_instance_open_target = tab
statusbar.hide = false
statusbar.position = bottom
statusbar.widgets = ["tabs", "keypress", "url", "scroll", "history", "progress"]
tabs.max_width = 100
tabs.min_width = 70
tabs.position = left
tabs.width = 10%
zoom.default = 100%

I think the problem is in the UA, what's the user agent for default --temp-basedir qb instance=


(edited for readability by @The-Compiler)

@The-Compiler
Copy link
Member

You can do :config-unset content.headers.user_agent to get the default back; or you can use the :set completion to see it.

However, it shouldn't matter much with v1.9.0 as that includes a workaround for exactly this issue - are you sure you are in fact running the new version after the update (and it didn't just open a new window in the old one)?

@GhostValk
Copy link
Author

GhostValk commented Jan 28, 2020

Yeah, totally sure, and still, bug was also present in 1.8x, it started like today when reloading whatsapp webpage.

Changing UA doesn't do anything, still not working.

@The-Compiler
Copy link
Member

Well, I can reproduce with v1.8.0 and it works fine in v1.9.0 here. Does anything change if you hit Shift-R to force a reload?

@The-Compiler The-Compiler added the status: can't reproduce Issues which can't be reproduced. label Jan 30, 2020
@GhostValk
Copy link
Author

I got it fixed. After changing User Agent back to default i deleted the cache and then opened qb and worked fine. I'm guessing maybe the UA is somehow stored in the cache.

Regarding the same, not sure if you remember, but i asked some time ago about the site-specific ua not working for me, i'm guessing maybe something similar is happening, i think after you open some sites for the first time, the user-agent you are using gets saved in the cache for that website, and regardless of you switching it later, it reads it from the cache (not for all sites thou, fb and google work fine when switchnig it).

@GhostValk GhostValk reopened this Jan 31, 2020
@GhostValk
Copy link
Author

Sadly the problem persists, after reloading the page a couple times in these 2 days, suddenly stopped working and the previous fix is not working anymore. Maybe whatsapp is doing some changes in the web version.

@GhostValk
Copy link
Author

GhostValk commented Jan 31, 2020

I did some testing, commented every single setting i modified in config.py, deleted the caché and started both normal qb and qb with --temp-basedir, so they both were basically the same and the one with --temp-basedir works while the normal qb doesn't. I checked :version, user agent and it's exactly the same in both.

Screen Shot 2020-01-31 at 12 18 50

What differences are between normal qb and qb with the flag --temp-basedir other than the config file?

@The-Compiler
Copy link
Member

I was able to reproduce now. Forcing a reload with Shift-R fixes it, but I now also pushed a site-specific quirk which does essentially that.

but i asked some time ago about the site-specific ua not working for me, i'm guessing maybe something similar is happening

The Instagram thing is unrelated - like I described there, the UA a website gets via JavaScript always is the global one.

i think after you open some sites for the first time, the user-agent you are using gets saved in the cache for that website, and regardless of you switching it later, it reads it from the cache

Something like that seems to be happening for WhatsApp Web.

What differences are between normal qb and qb with the flag --temp-basedir other than the config file?

You don't have state like cookies. This issue only happens when visiting the WhatsApp Web site when already registered via the QR code, not with the registration itself.

@GhostValk
Copy link
Author

Well, after a couple reopenings and cache deletings i managed to get it working again. I'm gonna dig into some way of deleting whatsapp cookies from the browser to made somi kind of autofix.

Thanks a lot!

@The-Compiler
Copy link
Member

FWIW as a workaround, you can put this in a greasemonkey/whatsapp.user.js file inside qutebrowser's data directory (see :version):

// ==UserScript==
// @include https://web.whatsapp.com/
// ==/UserScript==
if (document.body.innerText.replace(/\n/g, ' ').search(/whatsapp works with.*to use whatsapp.*update/i) !== -1)
	navigator.serviceWorker.getRegistration().then(function (r) { r.unregister(); document.location.reload() });

@GhostValk
Copy link
Author

Ohhh, didn't know you could run greasemonkey scripts in qb, great! Thanks a lot!

@3ruce
Copy link

3ruce commented May 22, 2020

OK, so on Debian Buster, adding the greasemonkey/whatsapp.user.js file and the user agent below did the trick...

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

qutebrowser --version shows

qutebrowser v1.6.1
Git commit:
Backend: QtWebEngine (Chromium 65.0.3325.230)

CPython: 3.7.3
Qt: 5.11.3
PyQt: 5.11.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: can't reproduce Issues which can't be reproduced. status: needs triage Issues/PRs which need some deeper investigation.
Projects
None yet
Development

No branches or pull requests

3 participants