From f1c3651ba5116febc0df64a165f67619d75915cc Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Wed, 31 May 2017 14:19:10 -0400 Subject: [PATCH] API CHANGE: sysadm/iocage - "action"="listplugins" Add this API call to list all the available plugins for iocage. REST Request (example): ------------------------------- PUT /sysadm/iocage { "action" : "listplugins" } WebSocket Request: ------------------------------- { "namespace" : "sysadm", "args" : { "action" : "listplugins" }, "name" : "iocage", "id" : "fooid" } Response: ------------------------------- { "args": { "listplugins": { "remote": { "btsync": { "description": "Resilient, fast and scalable file sync software for enterprises and individuals.", "id": "btsync", "name": "BitTorrent Sync" }, "couchpotato": { "description": "CouchPotato is an automatic NZB and torrent downloader.", "id": "couchpotato", "name": "CouchPotato" }, "crashplan": { "description": "Computer backup and data storage made simple.", "id": "crashplan", "name": "Crashplan" }, "deluge": { "description": "Bittorrent client using Python, and libtorrent-rasterbar", "id": "deluge", "name": "Deluge" }, "emby": { "description": "Home media server built using mono and other open source technologies", "id": "emby", "name": "Emby" }, "gitlab": { "description": "Powerful features for modern software development", "id": "gitlab", "name": "GitLab" }, "jenkins": { "description": "Jenkins CI", "id": "jenkins", "name": "Jenkins" }, "jenkins-lts": { "description": "Jenkins CI (Long Term Support Version)", "id": "jenkins-lts", "name": "Jenkins (LTS)" }, "madsonic": { "description": "Open-source web-based media streamer and jukebox.", "id": "madsonic", "name": "MadSonic" }, "nextcloud": { "description": "Access, share and protect your files, calendars, contacts, communication & more at home and in your enterprise.", "id": "nextcloud", "name": "NextCloud" }, "plexmediaserver": { "description": "The Plex media server system", "id": "plexmediaserver", "name": "Plex Media Server" }, "plexmediaserver-plexpass": { "description": "The Plex media server system", "id": "plexmediaserver-plexpass", "name": "Plex Media Server (PlexPass)" }, "quasselcore": { "description": "Quassel Core is a daemon/headless IRC client, part of Quassel, that supports 24/7 connectivity. Quassel Client can be attached to it to.", "id": "quasselcore", "name": "Quasselcore" }, "sickrage": { "description": "Automatic Video Library Manager for TV Shows", "id": "sickrage", "name": "SickRage" }, "sonarr": { "description": "PVR for Usenet and BitTorrent users", "id": "sonarr", "name": "Sonarr" }, "subsonic": { "description": "Open-source web-based media streamer and jukebox.", "id": "subsonic", "name": "SubSonic" }, "syncthing": { "description": "Personal cloud sync", "id": "syncthing", "name": "Syncthing" }, "transmission": { "description": "Fast and lightweight daemon BitTorrent client", "id": "transmission", "name": "Transmission" } } } }, "id": "fooid", "name": "response", "namespace": "sysadm" } Changelog: yes --- src/server/WebBackend.cpp | 1 + src/server/library/sysadm-iocage.cpp | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/server/WebBackend.cpp b/src/server/WebBackend.cpp index f6696b0..f479869 100644 --- a/src/server/WebBackend.cpp +++ b/src/server/WebBackend.cpp @@ -715,6 +715,7 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmIocageRequest(const QJsonVal ok = true; out->insert("listjails", sysadm::Iocage::listReleases()); }*/ + else if(act=="listplugins"){ retObj = sysadm::Iocage::listPlugins(); } ok = !retObj.keys().isEmpty(); if(ok){ out->insert(act,retObj); } } //end of "action" key usage diff --git a/src/server/library/sysadm-iocage.cpp b/src/server/library/sysadm-iocage.cpp index e28a983..386fea5 100644 --- a/src/server/library/sysadm-iocage.cpp +++ b/src/server/library/sysadm-iocage.cpp @@ -13,7 +13,8 @@ using namespace sysadm; // ============ GLOBAL OPTIONS ============== -// Current activation status +// Current activation status +// ##NOT-WORKING in 5/23/17 build of iocage (0.9.8.1)## QJsonObject Iocage::activateStatus(){ QJsonObject retObject; bool success = false; @@ -126,13 +127,20 @@ QJsonObject Iocage::listReleases(){ QJsonObject Iocage::listPlugins(){ QJsonObject retObject; - //Not sure about format of this yet (just commited upstream) - just treat it as line-delimited for now. (2/16/17) - //locally downloaded plugins - QStringList local = General::RunCommand("iocage list -ph ").split("\n"); - retObject.insert("local", QJsonArray::fromStringList(local) ); //Remote plugins available for download/use QStringList remote = General::RunCommand("iocage list -Ph").split("\n"); - retObject.insert("remote", QJsonArray::fromStringList(remote)); + QJsonObject plugins; + for(int i=0; i