rdavydov / Twitch-Channel-Points-Miner-v2

A simple script that will watch a stream for you and earn the channel points.
GNU General Public License v3.0
1.21k stars 351 forks source link

I can't see any chart #411

Closed Deses closed 10 months ago

Deses commented 10 months ago

Describe the bug

I installed your app on my unraid server using docker. Edited the conf file to enable the WebUI:

twitch_miner.analytics(host="0.0.0.0", port=5000, refresh=5, days_ago=7) # Start the Analytics web-server

Then I set up Nginx-Reverse-Proxy to connect through http://tpm.unraid.nas/ rather than http://192.168.1.130:5000/.

I can access the WebUI just fine and I can see the logs and how the points increase, but the graph is stuck at loading.

Chrome's Dev Console shows this:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'replace')
    at changeStreamer (script.js:225:38)
    at script.js:299:9
pagedata-script.js:1 CaptureThumbnail error TypeError: a.getContext(...).drawWindow is not a function
    at pagedata-script.js:1:12510
    at pagedata-script.js:1:12723
    at pagedata-script.js:1:13055
    at pagedata-script.js:1:13059
(anonymous) @ pagedata-script.js:1

Firefox' Dev Console shows this:

Uncaught (in promise) TypeError: streamer is null
    changeStreamer http://tpm.unraid.nas/assets/script.js:225
    renderStreamers http://tpm.unraid.nas/assets/script.js:299

Basically, streamer is null. But here's the kicker:

If I click on any of the streamer names, the chart loads and any page refresh works OK because the browser remembers my selection.

The bug, apparently, is that there's no streamer selected on first page load and that's why the chart crashes.

Steps to reproduce

Expected behavior

The graphs load.

Operating system

Unraid 6.12.4

Python version

Python 3.12.0

Miner version

v2-1.9.0

Other relevant software versions

No response

Logs

It's not an error of the backend.

Additional context

No response

rdavydov commented 10 months ago

First of all, does it work fine on http://192.168.1.130:5000 ?

And only then you should proceed with http://tpm.unraid.nas

Deses commented 10 months ago

I've updated the issue with my findings. Please take a look at it.

The reverse proxy is not an issue btw.

rdavydov commented 10 months ago

I see now. I made some changes recently so it can remember which streamer was selected. Yep, incognito is the reason, need to fix the code to select the first streamer if it is the first opening ever.

Deses commented 10 months ago

incognito is the reason

Any first run of the app will encounter this issue until a name of a streamer is clicked. Then the error will never happen again. I just used incognito to reproduce the issue. :P

rdavydov commented 10 months ago

Yes, gotcha. Incognito = clean browser localStorage, same as on the first opening. ;)