Closed Racass closed 4 years ago
While this does look very nice, I do not think I will be accepting the PR at this time. If you can make this a plugin instead, that would be better.
Try the plugin - if it doesn't work for you, I can reconsider the PR.
I will try to change it to a plugin. As soon as I implement it, I update here.
Thanks!
Awesome, leave this PR opwn in the mean time.
Plugins are added via name, not path:
addPlugin("NameOfPlugin");
That's all that is needed.
Make sure plugins are installed properly too (case sensitive):
./plugins/PiVPN/
(Remember the spelling, and case!)
PiVPN Folder includes:
PiVPN.php
Other depends can be here too
inside PiVPN.php
:
<?php
/* Example plugin */
// Name must end in "Plugin"!
class PiVPNPlugin extends Plugin{
public function __construct(){
parent::__construct(); //Required
return true;
}
public function initialize(){
return true;
}
public function onCustomPageLinks($sess){
// Add custom page link
echo '<li><a href="#" onclick="pageLoad(\'PiVPN\');"><i class="fa fa-check"></i> PiVPN Custom Page</a></li>';
return true;
}
public function onCustomPage($sess,&$post){
//Be careful not to override system pages.
if($post['page'] == "PiVPN"){
echo "<h3>This should be displayed only on the custom page for PiVPN!</h3>";
echo "<p>Oh, Hello there!</p>";
// You can also do an include(__DIR__."/customPage.php"); where customPage is a custom PHP file made specifically for the plugin.
}
return true;
}
}
?>
Thanks. I was having a pretty bad time to put this to word. I just made the example plugin work, by putting the folder name, like: addPlugins("Examples")
Thanks!
Just to point out -> You do not need to commit & push every time you save, make some changes, test, and if it works, then push.
I'm committing and pushing because i'm not at home and it is better to change it on my notebook than do a remote connection to my raspberry and change there. I just have a SSH connection open and commit here pull there
Might I suggest this: https://github.com/mitchellurgero/Codiad
It's a web based IDE (I use it to develop OpenRSD actually), which can help with not needing to push/pull/commit this.
Run it on your Pi, and use a browser to go from there :)
I finished the plugin! I did a "master plugin" where i will add some other stuff. Right now I'm planning a plugin installer via browser. Here's the repository of the plugin: https://github.com/Racass/PiMasterized
I think we can close this pull request
BTW, thanks for the help!
I did a change on the openrsd that I think will be good for a lot of people. I'm sending a PDF file that contains some images, where you can see the pivpn clients table: final.pdf.
The idea was to beautify the return of the connected clients on openVPN, taking some important information:
I changed the PiVPN Profiles button to a dropdown, and put the pivpn clients there. I tested PiVPN Profiles to check if my change would affect it, but it was OK. I used the refresh button idea on pivpn profiles to the pivpn clients page too.
Note: On the images, IPs are all 0.0.0.0 for security reasons. The page followed openrsd way of using php.