controlapi: add possibility to check for updates

Origin commit data
------------------
Branch: ni/coolstream
Commit: 4183335244
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-12-24 (Sat, 24 Dec 2016)

Origin message was:
------------------
- controlapi: add possibility to check for updates

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-12-24 00:28:07 +01:00
parent 1b38e15320
commit f17d069aae
2 changed files with 34 additions and 1 deletions

View File

@@ -61,6 +61,9 @@ extern cVideo * videoDecoder;
#include "gui/infoicons.h"
extern CInfoIcons *InfoIcons; /* neutrino.cpp */
//NI
#include "gui/update.h"
extern CPlugins *g_PluginList;//for relodplugins
extern CBouquetManager *g_bouquetManager;
#define EVENTDEV "/dev/input/input0"
@@ -237,7 +240,8 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]=
{"getdir", &CControlAPI::getDirCGI, "+xml"},
{"getmovies", &CControlAPI::getMoviesCGI, "+xml"},
//NI
{"infoicons", &CControlAPI::InfoIconsCGI, "text/plain"}
{"infoicons", &CControlAPI::InfoIconsCGI, "text/plain"},
{"updateinfo", &CControlAPI::UpdateInfoCGI, ""}
};
//-----------------------------------------------------------------------------
// Main Dispatcher
@@ -3962,3 +3966,31 @@ void CControlAPI::InfoIconsCGI(CyhookHandler *hh)
hh->SendOk();
}
//NI
//-------------------------------------------------------------------------
/** Display update info
*
* @param hh CyhookHandler
*
* @par nhttpd-usage
* @code
* /control/updateinfo[?format=plain|json|xml]
* @endcode
*
*/
//-----------------------------------------------------------------------------
void CControlAPI::UpdateInfoCGI(CyhookHandler *hh)
{
hh->outStart();
std::string result = "";
CFlashUpdate update;
if (update.checkOnlineVersion())
result = hh->outPair("available", "yes", false);
else
result = hh->outPair("available", "no", false);
result = hh->outObject("update", result);
hh->SendResult(result);
}

View File

@@ -138,6 +138,7 @@ private:
std::string getSubdirectories(CyhookHandler *hh, std::string path, std::string result);
void InfoIconsCGI(CyhookHandler *hh); //NI
void UpdateInfoCGI(CyhookHandler *hh); //NI
protected:
CNeutrinoAPI *NeutrinoAPI;