tgdrive / teldrive

Telegram Drive
MIT License
1.8k stars 266 forks source link

"Please Wait..." upon login #347

Closed whallin closed 2 months ago

whallin commented 2 months ago

I'm encountering this recurring issue preventing me from logging into Teldrive. As soon as I enter my phone number and press "Next", it infinitely loads with no indication that the loading will ever complete.

If I try to use the "QR Login", I encounter the same issue—it infinitely loads, and the QR code never shows up.

There are no errors logged in the browser console, the Teldrive container, or the Postgres container, so troubleshooting has sort of hit a dead end.

Things I've confirmed:

Things I've tried:

I'm quite unsure what to do next. I've attached my Teldrive configuration file. The Docker Compose files I'm using are the exact same ones as those present in docker/compose.

My Teldrive config.toml: config.toml.txt

divyam234 commented 2 months ago

@whallin which platform are you using

whallin commented 2 months ago

@whallin which platform are you using

Docker, with the host running Slackware 15 (specifically, Unraid 6.12.13). Teldrive has worked before on some older version that I can't quite remember; however, it was all before the new tgdrive/postgres image was created, as well as the repository being moved to the new organization.

My docker -v output:

Docker version 24.0.9, build 2936816
divyam234 commented 2 months ago

@whallin login stuck has nothing to do with postgres .Therecan be two reasons first if your vm network can't connect to telegram servers in that case use proxy or vpn you can try pinging telegram server ips to confirm first , second if you are using teldrive as a reverse proxy with nginx make sure to enable websockets

whallin commented 2 months ago

To add to my initial report, I first thought it was a time desynchronization issue, so I made sure the clock was up to date on both my Teldrive host system and my clients, but that made no difference. However, the reported time in the Teldrive container seems incorrect. I haven't found any way to successfully confirm or fix that.

I've tried mounting the typical /etc/localtime and /etc/timezone with no success. I suppose it's not possible with a scratch-"based" image solely shipping the relevant application binaries?

you can try pinging telegram server ips to confirm first

I've gone ahead and pinged some of their IPs listed under their ASN, both in a Docker container and on the host system, and all pings seemingly reach their servers without any issues. (see https://bgp.he.net/AS62041#_prefixes)

second if you are using teldrive as a reverse proxy with nginx make sure to enable websockets

I can confirm that WebSockets are enabled and working properly (at least for other applications behind the same nginx proxy).

whallin commented 2 months ago

you can try pinging telegram server ips to confirm first

@divyam234 are there any specific Telegram domains or IPs I need to access for Teldrive to work? If so, could you list them here or send a link to a resource of some sort—just so I can make sure it isn't a firewall issue?

whallin commented 2 months ago

A little update: by proxying Teldrive through mitmproxy, I can see that it is indeed making requests to a specific couple of IPs of AS62041. When trying to run Teldrive on my own Windows machine, it requests the same servers, but this time it actually successfully proceeds with the authentication process.

Considering these two machines are running under the same network, it seems to be a host issue on the initial Slackware/Unraid machine where I encountered this problem. I downloaded the Linux binary of Teldrive and ran that instead on said machine, but I got the same result there—ruling out any networking or firewall issues related to Docker.

What it could be now, I'm quite unsure about. The DNS configurations are the same for both my Slackware/Unraid host and my Windows host, so surely it can't be anything there unless I've missed something.

If someone has the slightest idea about what's going wrong or what I can try, feel free to let me know.

whallin commented 2 months ago

Who would have thought? It was a time desynchronization issue after all.

If anyone is running Unraid and encountering this issue, or a similar one, try to resync your time — but don't do what I did. At least on my instance of Unraid 6.12.13, updating the NTP servers does NOT retrigger a date and time refresh.

What you should do instead is change your timezone to something else and then back to your correct timezone — this did, in fact, trigger a proper fetch of the correct time and date, and now Teldrive works as expected. I'm quite surprised that the just ~1-minute difference hasn't affected anything else yet, until now.

I'm marking this as closed.

Linden10 commented 3 weeks ago

Who would have thought? It was a time desynchronization issue after all.

If anyone is running Unraid and encountering this issue, or a similar one, try to resync your time — but don't do what I did. At least on my instance of Unraid 6.12.13, updating the NTP servers does NOT retrigger a date and time refresh.

What you should do instead is change your timezone to something else and then back to your correct timezone — this did, in fact, trigger a proper fetch of the correct time and date, and now Teldrive works as expected. I'm quite surprised that the just ~1-minute difference hasn't affected anything else yet, until now.

I'm marking this as closed.

Oh my gosh I was just experiencing this issue and going through the hoops trying to figure out why teldrive was suddenly not working (happening after waking my computer up). It randomly took up 50%~ of my cpu, then had issues with authenticating and loading files, and then I was stuck at the login screen...

THANK YOU FOR THE SOLUTION! For some reason, my time was desync by 1 hour! I just realized that the clock was off by an hour haha, now I'll know what to do from now on in the future! ^^