alireza0 / s-ui

An advanced Web Panel • Built for SagerNet/Sing-Box
https://t.me/XrayUI
GNU General Public License v3.0
2.8k stars 442 forks source link

Use API #342

Open tinybug-m opened 2 weeks ago

tinybug-m commented 2 weeks ago

Hello dear Alireza

I would like to create connection with API to S-UI panel as an admin

as its obvious current front-end (vue axios maybe) is connected with api to backend

i wonder you writed other way to comminucate with backend ?

i want to connect to pannel edit client and get some data from panel in the safe way,

notice : i want to do this with Python in the same server

thank you alireza

tinybug-m commented 2 weeks ago

I did it with the same API for Frontend if is there any good solution i would be happy to hear, thank you

alireza0 commented 1 week ago

It was in my plan to simplify API and also use standard API in frontend. Currently my focus is on basic abilities and most of actions are now developed in frontend. I will mark this thread to have it in proper time.

tinybug-m commented 1 week ago

Thanks, Alireza, for your answer!

I’ve logged in using /api/login and successfully retrieved data with /api/load. Now, I’m working on a Python function to save new clients or update usage volume using /api/save.

But I wanted to check if I’m on the right track:

1-Every time a client is created, I load all data from /api/load.
2-Then, I update the specific inbounds that this client should have and add the new client to them.
3-Finally, for the client ("god"), I generate all usernames, passwords, and UUIDs myself, as these are generated on the frontend.

I’d really appreciate any tips or corrections if I’m missing something!

alireza0 commented 1 week ago

Please check this thread: #294

tinybug-m commented 1 week ago

Please check this thread: #294

Okay, it looks like I’m on the right track!

I have to say, though, it’s a bit surprising how you handled the backend changes, especially with inbounds when a new user joins. But hey—the code works, and you're a legend for that!

Keep up the awesome work! By the way, I’m a front-end developer and have a bit of free time, so if you ever need an extra hand, I’d love to contribute to a great project like the S-UI panel.

alireza0 commented 1 week ago

It would be appreciated! I have no time to fix UI visual problems and I am aware of many ugly results.

tinybug-m commented 1 week ago

It would be appreciated! I have no time to fix UI visual problems and I am aware of many ugly results.

I hear you, brother. I’d also appreciate any information on this. Is there a task list available for fixing the UI visual issues? Any suggestions on where to start editing in the front end would be really helpful!

tinybug-m commented 1 week ago

hello again alireza do you think its safe enough to connect to API from another server ?

and how can i improve it