MyOwnFreeHost API Client
#11
Nice work Hans, I always thought the IF client area looked pretty cool so it's neat that you've released this so people can build their own client area (I guess...). Smile
  Reply
#12
Does MOFH not support jQuery by default in new cPanel?
  Reply
#13
(04-26-2017, 08:44 AM)ddeveloper Wrote: Does MOFH not support jQuery by default in new cPanel?

jQuery is supported if you look through the source code but unfortunately it is loaded too late at least in my case. So, I used a defer function to run my code after jquery is loaded. Here is my sample:

Code:
function defer(method) {
 if (window.jQuery)
   method();
 else
   setTimeout(function() { defer(method) }, 50);
}

defer(runNow);

runNow() is my function which contains all my code. One issue I have not been able to bypass yet is Angular. AngularJS doesn't finish loading by the time my script is executed therefore if I remove any icons or such, it doesn't work. I think I may need to wait for the page to completely finish loading or something else. I may just do a time out of 1 or 2 seconds.
  Reply
#14
(04-26-2017, 08:44 AM)ddeveloper Wrote: Does MOFH not support jQuery by default in new cPanel?

I like that the new panel has a MUCH cleaner dom tree, but the JS is a confusing mess.

From what I've seen, the main page uses AngularJS, some pages have jQuery and some have nothing. And (at least on the main page) the libraries are loaded through RequireJS which I don't understand how to use.

I tried to just bring my own version of jQuery, but for some reason that kicks me out of the control panel (which I suspect is caused by some JS forcing the "powered by cPanel" thing to be there).

I ended up porting most of my old jQuery hacks to plain JS which seems to work on all pages. Except for the fact that the icons on the home page are now being blocked until the ads are loaded because I inject the ad blocks using JS as well, which makes it way too slow for comfort. If anyone has any tips on how to work around that, I'd love to know Wink

(04-26-2017, 06:53 PM)ninth Wrote: One issue I have not been able to bypass yet is Angular. AngularJS doesn't finish loading by the time my script is executed therefore if I remove any icons or such, it doesn't work. I think I may need to wait for the page to completely finish loading or something else. I may just do a time out of 1 or 2 seconds.

The content of the home page icons is loaded as JSON in the main HTML document. So you can just modify the content before Angular loads it.
Owner of InfinityFree (formerly Grendel Hosting) and XVHOST.
  Reply
#15
(04-27-2017, 08:37 AM)Hans Wrote:
(04-26-2017, 08:44 AM)ddeveloper Wrote: Does MOFH not support jQuery by default in new cPanel?

I like that the new panel has a MUCH cleaner dom tree, but the JS is a confusing mess.

From what I've seen, the main page uses AngularJS, some pages have jQuery and some have nothing. And (at least on the main page) the libraries are loaded through RequireJS which I don't understand how to use.

I tried to just bring my own version of jQuery, but for some reason that kicks me out of the control panel (which I suspect is caused by some JS forcing the "powered by cPanel" thing to be there).

I ended up porting most of my old jQuery hacks to plain JS which seems to work on all pages. Except for the fact that the icons on the home page are now being blocked until the ads are loaded because I inject the ad blocks using JS as well, which makes it way too slow for comfort. If anyone has any tips on how to work around that, I'd love to know Wink

 Yeah I do not know much JS, just need based learning. I'll look how you utilized your old jQuery to plain JS and will probably do the same for now. Moreover, I'm having problem with adsense showing ads in cPanel. I hope I get things working in cPanel.

The vistapanel logo showed up also instead of the logo I saved in mofh admin panel. Is there any way around it?
  Reply
#16
(04-27-2017, 05:03 PM)ddeveloper Wrote:
(04-27-2017, 08:37 AM)Hans Wrote:
(04-26-2017, 08:44 AM)ddeveloper Wrote: Does MOFH not support jQuery by default in new cPanel?

I like that the new panel has a MUCH cleaner dom tree, but the JS is a confusing mess.

From what I've seen, the main page uses AngularJS, some pages have jQuery and some have nothing. And (at least on the main page) the libraries are loaded through RequireJS which I don't understand how to use.

I tried to just bring my own version of jQuery, but for some reason that kicks me out of the control panel (which I suspect is caused by some JS forcing the "powered by cPanel" thing to be there).

I ended up porting most of my old jQuery hacks to plain JS which seems to work on all pages. Except for the fact that the icons on the home page are now being blocked until the ads are loaded because I inject the ad blocks using JS as well, which makes it way too slow for comfort. If anyone has any tips on how to work around that, I'd love to know Wink

 Yeah I do not know much JS, just need based learning. I'll look how you utilized your old jQuery to plain JS and will probably do the same for now. Moreover, I'm having problem with adsense showing ads in cPanel. I hope I get things working in cPanel.

The vistapanel logo showed up also instead of the logo I saved in mofh admin panel. Is there any way around it?

For my the cPanel logo is showing, not sure why or how really, I had my own logo in place but I don't mind it showing up as just cPanel either.

@Hans no idea that was the case, will take a look at it and see. Thanks!
  Reply
#17
how do i get the client area working
  Reply
#18
(04-29-2017, 05:53 PM)noobkilervip Wrote: how do i get the client area working

This is just a API Client. You would need to build your own user registration and sign up and then connect the API Client to your code so you can make requests to the WHM API Endpoint of MOFH.

If you have a framework for user registration and authentication, then do you need help with setting up the API Client? You will need composer. Install composer and at your project root install the API Client:
Code:
composer require hansadema/mofh-client


If you don't have a framework for user registration and login, make one! I used was PHP Login Advanced. Unfortunately it seems the git repository has been taken offline and I cannot provide mine as it is too heavily modified. There are still many other solutions you can use or frameworks. Another solution may be this: http://subinsb.com/php-logsys. I have not tested it so I cannot say how well it may or may not work.
  Reply
#19
I am looking in to do this as a project of with some skilled peaple and open sourceing it that act like profreehost or use whmcs or boxbilling
  Reply
#20
(04-29-2017, 06:10 PM)noobkilervip Wrote: I am looking in to do this as a project of with some skilled peaple and open sourceing it that act like profreehost or use whmcs or boxbilling

I don't really see the adaption for that. Building an entire reseller user panel and API client for MOFH would only leave you to a limited number of users and the only people really using it will be free web hosts. Unless you are thinking about making something like WHMCS and BoxBilling with the additional support for MOFH then that is another case.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)