Author Topic: FPP v2.x plugin integration  (Read 1687 times)

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: FPP v2.x plugin integration
« Reply #30 on: January 19, 2019, 11:27:08 AM »
I dont want to break something by editing a file and checking it in and breaking something. I did that once... :( . But the ability to have something listed, or moderated using an ISSUES list on GitHub, where the url to the pluginInfo.json file can be posted there and those that are experienced, can add it to the REPO file.  the plugin install is Use at your own risk if it is not in the Main Repo list.

I made a note to move the pluginList.js to another repository we can share out to more people.  That will also give us a separate github issues tracker for adding in requests for updating the list.

I also added some more items to my ToDo for this this morning.  I am going to move the install/uninstall/info logic to endpoints in the new REST API.  To install a plugin, you pass the plugin's pluginInfo.json,  to delete, you issue a DELETE call to /api/plugin/:PLUGINREPONAME, etc..  I haven't hooked up the "updates are pending" and "upgrade plugin X" code yet, so I may as well do it through the API instead of fppjson.php.

I changed the text at the top of the page to:  "If you do not see the plugin you are looking for, you can manually add a plugin to the list by providing the URL for the plugin's pluginInfo.json file below and clicking the 'Retrieve Plugin Info' button:"
-
Chris

Offline jcross

  • Developer
  • ******
  • Join Date: Dec 2014
  • Location: Brandon, Manitoba, Canada
  • Posts: 141
  • Kudos: 1
    • Crosslights Christmas
Re: FPP v2.x plugin integration
« Reply #31 on: January 19, 2019, 02:19:16 PM »
What about building a simple ui editor on this site that allows developers to add/modify the json in the repo without having to manually edit the file... Or just host that json here instead of github?  The script could also validate endpoints and such before making the changes.

And I see my duh moment with the plugin manager option on the menu.
« Last Edit: January 19, 2019, 02:25:39 PM by jcross »

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: FPP v2.x plugin integration
« Reply #32 on: January 19, 2019, 04:08:53 PM »
What about building a simple ui editor on this site that allows developers to add/modify the json in the repo without having to manually edit the file... Or just host that json here instead of github?  The script could also validate endpoints and such before making the changes.

I think you guys are overcomplicating it a little.  :) The pluginList.js file is just a simple javascript array.  If a plugin author can't edit the array to add a new line, then I'm not sure how much I trust the plugin they are creating. :)

Here's the current file:

Code: [Select]
var pluginList = [
    [ 'fpp-BigButtons', 'https://raw.githubusercontent.com/FalconChristmas/fpp-BigButtons/master/pluginInfo.json' ],
    [ 'fpp-vastfmt', 'https://raw.githubusercontent.com/FalconChristmas/fpp-vastfmt/master/pluginInfo.json' ],
    [ 'big-green-button', 'https://raw.githubusercontent.com/FalconChristmas/big-green-button/master/pluginInfo.json' ],
    [ 'fpp-matrixtools', 'https://raw.githubusercontent.com/cpinkham/fpp-matrixtools/master/pluginInfo.json' ],
    [ 'fpp-after-hours', 'https://raw.githubusercontent.com/jcrossbdn/fpp-after-hours/master/pluginInfo.json' ],
    [ 'fpp-plugin-Template', 'https://raw.githubusercontent.com/FalconChristmas/fpp-plugin-Template/master/pluginInfo.json' ]
];

Once you have tested your plugin installby manually specifying the location of the pluginInfo.json file at the top of the plugin manager page, then you just need to edit the pluginList.js file to add a line and reload the plugin manager.  If the page doesn't work, then you may have a typo in the pluginList.js file.  If the page does work and shows your new plugin, then all is good.

One other thing about the plugin list.  The plugin manager page loads the pluginInfo.json files by firing off ajax calls.  So the order in the pluginList.js file doesn't necessarily govern the order on the page, whichever pluginInfo.json file loads first gets listed first in the array.  I thought about preallocating entries in the table, but I don't know which section to put the plugin in until the pluginInfo.json file is returned, so things would get a bit complicated.  I put the installed plugins at the top because those are likely of most interest with installable ones next and then incompatible plugins.

Offline jcross

  • Developer
  • ******
  • Join Date: Dec 2014
  • Location: Brandon, Manitoba, Canada
  • Posts: 141
  • Kudos: 1
    • Crosslights Christmas
Re: FPP v2.x plugin integration
« Reply #33 on: January 19, 2019, 04:18:42 PM »
Quote
I think you guys are overcomplicating it a little.  :) The pluginList.js file is just a simple javascript array.  If a plugin author can't edit the array to add a new line, then I'm not sure how much I trust the plugin they are creating. :)


lol, yup.  In my day job I write software for end users so always try to make it dummy proof.  Since this will be developers making the edits there "shouldn't" be issues as long as the test plan you mentioned is followed.

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: FPP v2.x plugin integration
« Reply #34 on: January 19, 2019, 05:27:26 PM »
Let me know if I am missing something, I am trying to make it easier on both plugin authors and plugin users.

I started work on adding the REST endpoints today so I should have the update code hooked up tonight or tomorrow hopefully.

Offline Bshaver

  • Developer
  • ******
  • Join Date: Aug 2014
  • Location: Denver, CO
  • Posts: 1,426
  • Kudos: 22
Re: FPP v2.x plugin integration
« Reply #35 on: January 19, 2019, 05:33:40 PM »
I'm going to switch one of my VMs to the Dev branch to see this in action  and do some work on some of my plugins to re-install them.
Denver Colorado
45,000 blinky blinks mix of pixels and 130 AC Channels (powered by Minleon & Lynx) ALL Powered by FPP and Falcon!

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: FPP v2.x plugin integration
« Reply #36 on: January 20, 2019, 12:47:14 PM »
OK, I moved the pluginList to its own separate git repository.  This also has the advantage that users don't have to pull in the latest FPP updates to get the updated plugin list.  In the process, I converted it to a JSON file instead of JavaScript.  The only real difference as far as plugin authors are concerned is that the file uses double quotes instead of single quotes around the strings.  The file is in a new 'fpp-pluginList' git repository which can be shared for admin.

Here's the current pluginList.json file in the repository:

https://github.com/FalconChristmas/fpp-pluginList/blob/master/pluginList.json

I also converted the plugin manager page to load the installed plugin list and installed pluginInfo.json files via the new API calls and added the calls to the API help page.  I'm going to try to get the other functions (install/uninstall/upgrade) hooked up tonight and fix the version comparison issue.

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: FPP v2.x plugin integration
« Reply #37 on: January 20, 2019, 05:21:08 PM »
OK, one more change.

Put the min/max version numbers in pluginInfo.json in quotes.  This helps fix the issue of comparing 1.1 vs 1.10.  If we use just a float in JSON, those both will get converted to 1.1 in JavaScript.  If we embed them in quotes, then we can compare them.  I created a Javascript helper function CompareFPPVersions() to compare two version strings so that the code understands that v1.9 is less than v1.10.  If the min/max version number is actually a number in the json, the script converts it to a string, but it is best to enter these as a string to begin with so we don't have issues with trailing zeroes being dropped.

Also, if you have a plugin that is compatible with v1.x, you can put the min version as 1.0 and the max as 1.9999.  In the master branch, the version shows up as 2.1xxx where xxx is the commit number after the last tag, so using 2.9999 would catch all v2.x releases along with the master branch.

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: FPP v2.x plugin integration
« Reply #38 on: January 22, 2019, 06:07:36 PM »
OK, I pushed some more code to this tonight.  Updating a plugin via the UI now works as long as the plugin allows.

I think I'm pretty much done with most of these changes for now.  I can install the Viewer Control plugin by manually providing the pluginInfo.json URL at the top of the Plugin Manager so will probably shift some focus back to that and start getting some input on the plugin and web site from some alpha/beta testers.

Let me know if you see any issues or are ready to get write access to the pluginList.json file in the other repository. :)

Offline jcross

  • Developer
  • ******
  • Join Date: Dec 2014
  • Location: Brandon, Manitoba, Canada
  • Posts: 141
  • Kudos: 1
    • Crosslights Christmas
Re: FPP v2.x plugin integration
« Reply #39 on: January 22, 2019, 09:37:39 PM »
OK, I pushed some more code to this tonight.  Updating a plugin via the UI now works as long as the plugin allows.

I think I'm pretty much done with most of these changes for now.  I can install the Viewer Control plugin by manually providing the pluginInfo.json URL at the top of the Plugin Manager so will probably shift some focus back to that and start getting some input on the plugin and web site from some alpha/beta testers.

Let me know if you see any issues or are ready to get write access to the pluginList.json file in the other repository. :)




Just checking out your changes.  I saw the After Hours plugin showing up as available (it was already installed on that pi) but when I clicked install I got the message "ERROR: The (fpp-after-hours) plugin is already installed".  So I manually removed it and installed it again using the UI.  It installed and showed up on the list properly.  I then made a copy, uninstalled it from the UI and moved the copy back into the plugins directory and it showed up so it must have been in a strange state on my end (this was the dev pi) since I cannot reproduce it again.


-The system package dependencies did not install (don't know if they are supposed to or if this is just for information in the pluginInfo.json file??)
-adding a custom url and clicking Retrieve Plugin Info keeps duplicating entries in the list, however, the duplicates are removed on page refresh so no real issue there.


Great work!
Oh and I may as well make the request to get access to the pluginList.json in that new repo:)

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
FPP v2.x plugin integration
« Reply #40 on: January 22, 2019, 09:48:52 PM »
I can add something to the UI to make it so that it wont list an item twice if it is already found.

The dependency code isnt hooked up yet, I will probably work on that next unless other issues are found.

I think the error you received the first time may be something only looking for a directory and not the pluginInfo.json file.  I will double check that.

Offline ghormann

  • Newbie
  • *
  • Join Date: Oct 2016
  • Location:
  • Posts: 20
  • Kudos: 0
    • Christmas as the Hormanns
Re: FPP v2.x plugin integration
« Reply #41 on: January 23, 2019, 05:52:59 PM »
Going forward, where (besides the code) is going to be the best spot to document how authors should develop plugins?




Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: FPP v2.x plugin integration
« Reply #42 on: January 23, 2019, 08:02:45 PM »
Going forward, where (besides the code) is going to be the best spot to document how authors should develop plugins?

Im thinking of having a lot of this in the template plugin.  This way if you want to create a new plugin, you just install the template plugin, use its clone button to make a new plugin from the template, and then go in and edit existing PHP files, stub functions, and scripts.  We can have some form of docs as well.  This can go in an appendix to the FPP manual or in a separate doc.

Offline CaptainMurdoch

  • Administrator
  • *****
  • Join Date: Sep 2013
  • Location: Washington
  • Posts: 9,856
  • Kudos: 214
Re: FPP v2.x plugin integration
« Reply #43 on: January 23, 2019, 08:05:27 PM »
I can add something to the UI to make it so that it wont list an item twice if it is already found.

I added some code to remove any existing item in the list if you try to re-add the same item.  This fixes the issue and also lets you load a remote pluginInfo.json for a locally installed plugin or reload the pluginInfo.json multiple times during development.

Offline Poporacer

  • Hero Member
  • *****
  • Join Date: Dec 2017
  • Location: Meridian Idaho
  • Posts: 533
  • Kudos: 7
Re: FPP v2.x plugin integration
« Reply #44 on: January 24, 2019, 08:25:47 AM »
Because we are working on an updated FPP manual, I plan on putting the information about plugins/development in a separate chapter.
If to err is human, I am more human than most people.

 

Back to top