Closed IITII closed 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
- I think server just need a api endpoint like:
/vnstat
, just return raw json result ofvnstat --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 ajsonversion
key with eunm value:1
,2
.
vnstatversion
,jsonversion
,interfaces
,summary
anddaily traffic
is 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 😅.
- Here is a simple vnstat dashboard write with js and bootstrap. It is onyl support
vnstat jsonverion 1
https://github.com/IITII/VNSTAT-DASHBOARD https://iitii.github.io/VNSTAT-DASHBOARD/
Thank you for sharing these examples with me, and thank you for your interest in developing vnstat-client
😄.
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?
jsonversion: 1
when vnstat version is under 2.x.jsonversion: 1
to jsonversion: 2
, maybe just interfaces id
and nick
. You can get test data with vnstat version: 1.4
and jsonverion: 1
from here: demo.jsonIn 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.
All right, good luck
Hello, first of all, thanks for your work.
Server
Client
vnstat --json
will produce ajsonversion
key with eunm value:1
,2
.vnstatversion
,jsonversion
,interfaces
,summary
anddaily traffic
is contains.Others
vnstat jsonverion 1
https://github.com/IITII/VNSTAT-DASHBOARD https://iitii.github.io/VNSTAT-DASHBOARD/