donaldzou / WGDashboard

Simple dashboard for WireGuard VPN written in Python & Vue.js
https://donaldzou.github.io/WGDashboard-Documentation/
Apache License 2.0
1.63k stars 250 forks source link

Statistics in the web panel does not work #291

Closed Johnnykson closed 3 months ago

Johnnykson commented 3 months ago

Hi! Statistics in the web panel do not work, peers are created, interfaces are turned on and off, but there are no statistics, neither about traffic, nor about the fact that the peer is active. Снимок экрана 2024-08-06 004126 At the moment the active peer is trrrrr, but the web panel does not display it, error in the console:

Uncaught 
TypeError: Cannot read properties of null (reading 'target')
    at e (content.js:2:88025)

Снимок экрана 2024-08-06 004909

barryboom commented 3 months ago

i can confirm i seen this same experience

donaldzou commented 3 months ago

Ohhhhhhh kay this is something new, I will look into that. Just to confirm, the peers are connected and there are traffic showing on peer side WireGuard?

donaldzou commented 3 months ago

Nvm... I think is another issue running with Gunicorn, should be perfectly fine in debug mode

donaldzou commented 3 months ago

Some good news, I've managed to fix the issue. It was due to Gunicorn not actually spawn the 2 background threads in main process.. Should be good now :) Thanks again for bringing this up.

Screenshot 2024-08-05 at 3 43 39 PM

Regarding @Johnnykson's issue

Uncaught 
TypeError: Cannot read properties of null (reading 'target')
    at e (content.js:2:88025)

I'm thinking this might cause by your browser or one of the browser plugin? WGDashboard doesn't use any .js file named content.js

Johnnykson commented 3 months ago
root@v2553761:/opt/wgdashboard/src# ./wgd.sh start
------------------------------------------------------------
[WGDashboard] Starting WGDashboard with Gunicorn in the background.
[WGDashboard] Activate Python Virtual Environment under ./venv
Failed to read config file: ./gunicorn.conf.py
Traceback (most recent call last):
  File "/opt/wgdashboard/src/venv/lib/python3.10/site-packages/gunicorn/app/base.py", line 111, in get_config_from_filename
    spec.loader.exec_module(mod)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/wgdashboard/src/./gunicorn.conf.py", line 1, in <module>
    import dashboard
  File "/opt/wgdashboard/src/dashboard.py", line 353, in <module>
    class PeerShareLinks:
  File "/opt/wgdashboard/src/dashboard.py", line 382, in PeerShareLinks
    def addLink(self, Configuration: str, Peer: str, ExpireDate: datetime = None) -> tuple[bool, message]:
NameError: name 'message' is not defined

Hi, i see this on the latest version

donaldzou commented 3 months ago

Hi yes my bad, I forgot to push the latest when I was doing some testing. Should be good now.

Johnnykson commented 3 months ago

Hi yes my bad, I forgot to push the latest when I was doing some testing. Should be good now.

I also noticed that the folder is called wgdashboard and not WGDashboard. everything is running now, but I can't get into the web panel, it says:

Sorry, your username or password is incorrect.

wtf 🤣

Johnnykson commented 3 months ago

Hi yes my bad, I forgot to push the latest when I was doing some testing. Should be good now.

I also noticed that the folder is called wgdashboard and not WGDashboard. everything is running now, but I can't get into the web panel, it says:

Sorry, your username or password is incorrect.

wtf 🤣

oh, sorry, I'm an idiot, I should have entered: admin / admin

donaldzou commented 3 months ago

lol you have a heart attack, just got off to grab breakfast and saw your comment. Let me know if it is working for you and I can close this issue 😁

Johnnykson commented 3 months ago

lol you have a heart attack, just got off to grab breakfast and saw your comment. Let me know if it is working for you and I can close this issue 😁

ehhhhh, so far everything is good and works great! Bon appetit!