NerdbyteIO / FOSSBilling-CyberPanel

A Server Manager developed for FOSSBilling to allow API calls to the CyberPanel webhosting panel.
20 stars 2 forks source link

No connection error 500 #6

Closed AnTeKaPa closed 1 month ago

AnTeKaPa commented 1 month ago

Hi, first I apologise, I know you make this for free, but I'm a very far from developing anything so I need some help with this.

My situation is: I testing some configurations on a VM with Ubuntu server, CyberPanel and FossBilling, I would like to make all of them to work together.

What I find with your code, it works for FossBilling, but when I test the API calls it returns error 500, in the server logs it's shows only that a the connection is tried but your, plugin if I can call it like that, make a request to not existing directory (/api) and also it use a Token which not exist anywhere, I tried with different accounts but the Token is always same so not working.

I also checked everything what I found in Google and the only proper thing is this:

https://documenter.getpostman.com/view/2s8Yt1s9Pf?version=latest

Like I said before, I cannot develop anything, but I see in the instructions there that the apis should point to "cloudAPI" if I open this in my browser I see some kind of text related to the APIs, but when I try the same with "/api" it shows "Not exist". I can be wrong because I don't understand it at all, but if you can suggest me what to do? In the tutorial which I shared have also video and many more type of API calls which probably can be useful for your project.

BTW: I keep my configuration in local network so no real domain and no SSL, but I'm not sure is that some problem.

Thanks for your help!

jsonkenyon commented 1 month ago

@AnTeKaPa thanks for the detailed report, I’ll spin this up in my local environment and take a look and see what is going on.

jsonkenyon commented 1 month ago

Okay, so looking into this. It does look like this API is still working, though there was an issue that I was having and its always expecting https://.

Though this server module doesn't verify the ssl cert so I just forced https://. Can you test this on the following branch?

https://github.com/NerdbyteIO/FOSSBilling-CyberPanel/tree/attempt-fix-issue-6

The docs used for this server module can be found here, https://cyberpanel.docs.apiary.io/#

I know that they have also updated to use cloudAPI, I'll take a look at those and see what can be migrated/moved over, but last time I looked it looked very limited so far.

jsonkenyon commented 1 month ago

@AnTeKaPa

I've revisited the cloudAPI system and discovered that the missing component is located in the views.py of the CyberPanel API source, although it's undocumented and not found on their website/the link your provided. I will work on implementing this cloudAPI as outlined in #7, aiming to upgrade to v2 of the server manager while maintaining the existing /api endpoint for v1.

In the meantime, the new branch I've created should address the current issues you're experiencing. Please share any feedback here or in issue #7.

AnTeKaPa commented 1 month ago

Hi @jsonkenyon sorry for that were I not answer to your comments, but my daily job just not give me a chance.

Anyway thanks a lot for all of your work and very quick fix.

At the moment I tried your last version of the code and now it pass the Server Connection, so I guess it will work with the rest of the API calls, but first I have to figure out how FossBilling work to can do more specific test, but this will happen these days :)

I will be happy if you can make the new API version of CyberPanel, because if I get it correctly, it have more possible functions (or I'm wrong) unfortunately I cannot help you like I want, because of too much lack of knowledge on my side :( but always can test it for you ;)

I will follow your progress and thanks a lot again!

jsonkenyon commented 1 month ago

~The rewrite is complete and can be found in the new branch: migrate-to-cloudAPI. Please note that this is currently in beta and pending further review, as the user password change functionality has been modified in this new API. I am evaluating options to either make it work or revert to the old API endpoint for this function. Feel free to test it when convenient, and let me know your feedback. Thank you.~

Version 2 has been completed, and I've resolved the password change issue—passwords can now be changed successfully. We are now fully utilizing the /cloudAPI endpoint instead of the /api endpoint. For users who prefer Version 1.x, I've created a new branch for continued access.

Please download V2 at your convenience and test it. I've conducted tests on my local machine, and all functions appear to be working correctly. Thank you for your assistance in testing!

jsonkenyon commented 1 month ago

With the above stated, I'm going to go ahead and get this one closed out. Please feel free to reopen a new issue if you have any issues, with either v1.x or v2.x branches.