From f17d069aae3f7d66009711c462a73c03e150063c Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sat, 24 Dec 2016 00:28:07 +0100 Subject: [PATCH] controlapi: add possibility to check for updates Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4183335244ca9f7c88409d803c9b4b291719cb41 Author: vanhofen 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 --- src/nhttpd/tuxboxapi/controlapi.cpp | 34 ++++++++++++++++++++++++++++- src/nhttpd/tuxboxapi/controlapi.h | 1 + 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index fbd5dada6..eb293334a 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -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); +} diff --git a/src/nhttpd/tuxboxapi/controlapi.h b/src/nhttpd/tuxboxapi/controlapi.h index 86c49a598..ee16cd450 100644 --- a/src/nhttpd/tuxboxapi/controlapi.h +++ b/src/nhttpd/tuxboxapi/controlapi.h @@ -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;