d99kris / nchat

Terminal-based Telegram / WhatsApp client for Linux and macOS
MIT License
669 stars 47 forks source link

No QR code generated when setting up whatsapp #172

Closed hit0wnzzz closed 8 months ago

hit0wnzzz commented 9 months ago

trying to setup whatsapp and the qr code does not appear for scanning.

`x@x:~/nchat$ nchat --setup Protocols:

  1. Dummy
  2. Telegram
  3. WhatsAppMd
  4. Exit setup Select protocol (3): 2

WARNING: This functionality is in no way affiliated with, authorized, maintained, sponsored or endorsed by WhatsApp or any of its affiliates or subsidiaries. WhatsApp may disable or suspend accounts violating their Terms of Service. Use at your own risk. You may abort this setup wizard by pressing CTRL-C.

Enter phone number (ex. +6511111111): +

Open WhatsApp on your phone, click the menu bar and select "Linked deviced". Click on "Link a device", unlock the phone and aim its camera at the Qr code displayed on the computer screen.

Setup failed`

uname -a Linux Zaku 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

hit0wnzzz commented 9 months ago

telegram setup does work.

d99kris commented 9 months ago

Hi @hit0wnzzz - can I check what your DISPLAY environment variable is set to?

echo $DISPLAY

nchat uses this variable on Linux to determine whether to show a QR code in the image viewer chosen by xdg-open, or to display it in the terminal.

One can force nchat to display the QR code in the terminal by clearing the variable before running setup, e.g:

unset DISPLAY
nchat -s

I'll try look into improving the X detection, but short-term maybe I'll just add a FAQ in the README, as it seems others on WSL / WSL2 encounter this too - example #118 - however I don't see it in my Win 10 WSL2 (Ubuntu 22.04).

hit0wnzzz commented 9 months ago

that fixed it!

d99kris commented 9 months ago

Updated the doc in above commit, adding a FAQ item for this type of issue.

d99kris commented 8 months ago

This should be fixed in above commit, no longer requiring the unset DISPLAY workaround.

EduardoStarZ commented 4 months ago

Hi @hit0wnzzz - can I check what your DISPLAY environment variable is set to?

echo $DISPLAY

nchat uses this variable on Linux to determine whether to show a QR code in the image viewer chosen by xdg-open, or to display it in the terminal.

One can force nchat to display the QR code in the terminal by clearing the variable before running setup, e.g:

unset DISPLAY
nchat -s

I'll try look into improving the X detection, but short-term maybe I'll just add a FAQ in the README, as it seems others on WSL / WSL2 encounter this too - example #118 - however I don't see it in my Win 10 WSL2 (Ubuntu 22.04).

Description

Hello, i was trying to setup nchat in my laptop.

While the setup for Telegram went without any issues, the setup for Whatsapp does not either try to use xdg-open for the QR code login or display the QR code directly into the terminal.

I went into the issues session on github to try and find mentions of at least a similar issue, then i bumped across this one and did tried to use the fix with unset DISPLAY, however, without any success

Log File

Bellow is the output of the log.txt file located under ~/.nchat/log.txt:

2024-05-23 14:29:16.383 | INFO  | starting nchat v4.41  (main.cpp:239)
2024-05-23 14:29:26.271 | ERROR | whatsmeow Client outdated (405) connect failure (client version: 2.2353.59)  (gowm.go:448)
2024-05-23 14:29:26.272 | WARN  | qr channel result "err-client-outdated"  (gowm.go:1643)
2024-05-23 14:29:26.291 | ERROR | whatsmeow Error reading from websocket: websocket: close 1006 (abnormal closure): unexpected EOF  (gowm.go:448)

How to reproduce it

On a Linux Arch environment, use paru to install the latest stable version of nchat using paru -S nchat.

Environment

Linux Arch x86_64 Nchat Version: v4.41 Shell : zsh 5.9 (using oh-my-zsh) Terminal : st Paru Version: v2.0.1 (libalpm v14.0.0)

d99kris commented 4 months ago

While the setup for Telegram went without any issues, the setup for Whatsapp does not either try to use xdg-open for the QR code login or display the QR code directly into the terminal.

2024-05-23 14:29:16.383 | INFO  | starting nchat v4.41  (main.cpp:239)
2024-05-23 14:29:26.271 | ERROR | whatsmeow Client outdated (405) connect failure (client version: 2.2353.59)  (gowm.go:448)
2024-05-23 14:29:26.272 | WARN  | qr channel result "err-client-outdated"  (gowm.go:1643)
2024-05-23 14:29:26.291 | ERROR | whatsmeow Error reading from websocket: websocket: close 1006 (abnormal closure): unexpected EOF  (gowm.go:448)

Hello! A new stable version of nchat v4.50 was released on Tuesday addressing the WhatsApp Client outdated issue. It looks like the nchat AUR stable package still points to v4.41 so you may try reaching out to the AUR package maintainer to request an update. Alternatively you can switch to the nchat-git AUR package, or another option is building manually from source (either stable v4.50 or latest git master).

EduardoStarZ commented 4 months ago

Thank you for your time helping me, will try to run this ASAP

btw, awesome TUI app, i'm already in love

d99kris commented 4 months ago

Thank you for your time helping me, will try to run this ASAP

btw, awesome TUI app, i'm already in love

Thanks, glad you like it 👍