hulxv / vnstat-client

GUI Client for vnStat Network Monitor for Linux or GNU/Linux
https://hulxv.github.io/vnstat-client/
GNU General Public License v2.0
150 stars 10 forks source link

Some suggestions for vnstat server/client #16

Closed IITII closed 2 years ago

IITII commented 2 years ago

Hello, first of all, thanks for your work.

Server

https://github.com/Hulxv/vnstat-server

  • I think server just need a api endpoint like: /vnstat, just return raw json result of vnstat --json. Beside, basic auth like username/password is engough for current server.

Client

https://github.com/Hulxv/vnstat-client

Others

https://github.com/IITII/VNSTAT-DASHBOARD https://iitii.github.io/VNSTAT-DASHBOARD/

IITII commented 2 years ago

I had implement the server without auth via nodejs.

I hope this will help you.

https://github.com/IITII/VNSTAT-DASHBOARD/tree/backend. https://github.com/IITII/VNSTAT-DASHBOARD/blob/6903ffccdbcaf473244556735996a6cea994a153/services/vnstat.service.js#L48

hulxv commented 2 years ago
  • I think server just need a api endpoint like: /vnstat, just return raw json result of vnstat --json. Beside, basic auth like username/password is engough for current server.

I think that is not enough, I need to read information from the database directly, And I have already finished about 80% from vnstat-server, But some things remain, such as authentication and some final touches.

  • As I know, vnstat --json will produce a jsonversion key with eunm value: 1, 2.
    • vnstatversion, jsonversion, interfaces, summary and daily trafficis contains.
  • Vnstat version may be under 2.x in some old distribution.
  • So, Is it possible to support old vnstat jsonversion ?

Honestly, I don't know what jsonversion is used for, But I just vnstat --json in exporting data to a json file and nothing else. So, I think it isn't a big deal. If you have more details, can you advise me?

  • Client is build by next.js and electron, I think it is possible move to web with a little change.

I'm thinking of adding this idea to the server, But maybe in the future because that takes more time and I want to release first version as soon as possible 😅.

Thank you for sharing these examples with me, and thank you for your interest in developing vnstat-client 😄.

IITII commented 2 years ago

Sorry for my late reply.

Honestly, I don't know what jsonversion is used for, But I just vnstat --json in exporting data to a json file and nothing else. So, I think it isn't a big deal.
If you have more details, can you advise me?

hulxv commented 2 years ago

In vnstat-server and the same thing in vnstat-client, I don't use vnstat --json, Because I get data from the database directly and respond with it. So, I think it doesn't will be a big deal.

IITII commented 2 years ago

All right, good luck