Project "Tuxbox-GIT: apps": The branch, master has been updated via b87baa0024402ce77dab20bd3e7f69b2439bf3b2 (commit) from 8fa01aaff74b230431236165db6096c1a3dcc1e8 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b87baa0024402ce77dab20bd3e7f69b2439bf3b2 Author: GetAway <get-a...@t-online.de> Date: Thu Apr 2 20:23:23 2015 +0200 yWeb: introduce multilanguage (part1) switch to new ConfigFile Version 4 Signed-off-by: GetAway <get-a...@t-online.de> diff --git a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp index 3e19048..3529662 100644 --- a/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/tuxboxapi/controlapi.cpp @@ -53,9 +53,9 @@ void CControlAPI::init(CyhookHandler *hh) { if(PLUGIN_DIRS[0].empty()) { // given in nhttpd.conf - PLUGIN_DIRS[0]=hh->WebserverConfigList["PublicDocumentRoot"]; + PLUGIN_DIRS[0]=hh->WebserverConfigList["WebsiteMain.override_directory"]; PLUGIN_DIRS[0].append("/scripts"); - PLUGIN_DIRS[1]=hh->WebserverConfigList["PrivatDocumentRoot"]; + PLUGIN_DIRS[1]=hh->WebserverConfigList["WebsiteMain.directory"]; PLUGIN_DIRS[1].append("/scripts"); PLUGIN_DIRS[2]="/var/tuxbox/plugins"; PLUGIN_DIRS[3]=PLUGINDIR; diff --git a/tuxbox/neutrino/daemons/nhttpd/web/Y_Blocks.txt b/tuxbox/neutrino/daemons/nhttpd/web/Y_Blocks.txt index 1e67ab6..73d353d 100644 --- a/tuxbox/neutrino/daemons/nhttpd/web/Y_Blocks.txt +++ b/tuxbox/neutrino/daemons/nhttpd/web/Y_Blocks.txt @@ -54,7 +54,7 @@ start-block~nhttpd_save_settings {=ini-set:/var/tuxbox/config/nhttpd.conf;WebsiteMain.port;{=port=}~cache=} {=ini-set:/var/tuxbox/config/nhttpd.conf;webserver.threading;{=threading=}~cache=} {=ini-set:/var/tuxbox/config/nhttpd.conf;server.no_keep-alive_ips;{=no_keep_alive_ips=}~cache=} -{=ini-set:/var/tuxbox/config/nhttpd.conf;Tuxbox.HostedDocumentRoot;{=HostedDocRoot=}~cache=} +{=ini-set:/var/tuxbox/config/nhttpd.conf;WebsiteMain.hosted_directory;{=hosted_directory=}~cache=} {=ini-set:/var/tuxbox/config/nhttpd.conf;WebsiteMain.override_directory;{=override_directory=}~cache=} {=ini-set:/var/tuxbox/config/nhttpd.conf;mod_sendfile.mime_types;{=mod_sendfile_mime_types=}~cache=} {=ini-set:/var/tuxbox/config/nhttpd.conf;mod_sendfile.sendAll;{=mod_sendfile_sendAll=}~cache=} diff --git a/tuxbox/neutrino/daemons/nhttpd/yconfig.h b/tuxbox/neutrino/daemons/nhttpd/yconfig.h index bdd25c8..d8f80e0 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yconfig.h +++ b/tuxbox/neutrino/daemons/nhttpd/yconfig.h @@ -38,7 +38,7 @@ #define HTTPD_NAME "yhttpd" // Webserver name (can be overloaded) #define YHTTPD_NAME "yhttpd_core" // Webserver name (Name of yhttpd-core!) #define AUTH_NAME_MSG "yhhtpd" // Name in Authentication Dialogue -#define CONF_VERSION 3 // Version of yhttpd-conf file +#define CONF_VERSION 4 // Version of yhttpd-conf file #define HTTPD_KEEPALIVE_TIMEOUT 500000 // Timeout for Keep-Alive in mircoseconds //============================================================================= @@ -107,6 +107,8 @@ #define HTTPD_ERRORPAGE "/Y_ErrorPage.yhtm" #define HTTPD_SENDFILE_EXT "htm:text/html,html:text/html,xml:text/xml,txt:text/plain,jpg:image/jpeg,jpeg:image/jpeg,gif:image/gif,png:image/png,bmp:image/bmp,css:text/css,js:text/plain,img:application/octet-stream,ico:image/x-icon,m3u:application/octet-stream,tar:application/octet-stream" #define HTTPD_SENDFILE_ALL false +#define HTTPD_LANGUAGEDIR "languages" +#define HTTPD_DEFAULT_LANGUAGE "English" #define AUTHUSER "test" #define AUTHPASSWORD "test1" @@ -132,6 +134,8 @@ #define HTTPD_ERRORPAGE "/Y_ErrorPage.yhtm" #define HTTPD_SENDFILE_EXT "htm:text/html,html:text/html,xml:text/xml,txt:text/plain,jpg:image/jpeg,jpeg:image/jpeg,gif:image/gif,png:image/png,bmp:image/bmp,css:text/css,js:text/plain,img:application/octet-stream,ico:image/x-icon,m3u:application/octet-stream,tar:application/octet-stream" #define HTTPD_SENDFILE_ALL "false" +#define HTTPD_LANGUAGEDIR "languages" +#define HTTPD_DEFAULT_LANGUAGE "English" #define AUTHUSER "test" #define AUTHPASSWORD "test1" @@ -162,6 +166,8 @@ #define HTTPD_ERRORPAGE "/Y_ErrorPage.yhtm" #define HTTPD_SENDFILE_EXT "htm:text/html,html:text/html,xml:text/xml,txt:text/plain,jpg:image/jpeg,jpeg:image/jpeg,gif:image/gif,png:image/png,bmp:image/bmp,css:text/css,js:text/plain,img:application/octet-stream,ico:image/x-icon,m3u:application/octet-stream,tar:application/octet-stream,gz:text/x-gzip" #define HTTPD_SENDFILE_ALL "false" +#define HTTPD_LANGUAGEDIR "languages" +#define HTTPD_DEFAULT_LANGUAGE "English" #define AUTHUSER "root" #define AUTHPASSWORD "dbox2" @@ -197,6 +203,8 @@ #define HTTPD_ERRORPAGE "/Y_ErrorPage.yhtm" #define HTTPD_SENDFILE_EXT "htm:text/html,html:text/html,xml:text/xml,txt:text/plain,jpg:image/jpeg,jpeg:image/jpeg,gif:image/gif,png:image/png,bmp:image/bmp,css:text/css,js:text/plain,img:application/octet-stream,ico:image/x-icon,m3u:application/octet-stream,tar:application/octet-stream" #define HTTPD_SENDFILE_ALL "false" +#define HTTPD_LANGUAGEDIR "languages" +#define HTTPD_DEFAULT_LANGUAGE "English" #define AUTHUSER "root" #define AUTHPASSWORD "oxmox" diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd.cpp index 285c3b0..ef6c27b 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd.cpp @@ -4,7 +4,6 @@ //============================================================================= // system -#include <cstdio> #include <csignal> #include <unistd.h> #include <pwd.h> @@ -416,7 +415,7 @@ void Cyhttpd::ReadConfig(void) log_level_printf(3,"ReadConfig Start\n"); CConfigFile *Config = new CConfigFile(','); bool have_config = false; - if(access(HTTPD_CONFIGFILE,4) == 0) + if(access(HTTPD_CONFIGFILE, R_OK) == 0) have_config = true; Config->loadConfig(HTTPD_CONFIGFILE); // convert old config files @@ -435,10 +434,6 @@ void Cyhttpd::ReadConfig(void) Config->setString("WebsiteMain.directory", OrgConfig.getString("PrivatDocRoot", PRIVATEDOCUMENTROOT)); if(!OrgConfig.getString("PublicDocRoot", "").empty()) Config->setString("WebsiteMain.override_directory", OrgConfig.getString("PublicDocRoot", PRIVATEDOCUMENTROOT)); - if(!OrgConfig.getString("HostedDocRoot", "").empty()) - Config->setString("WebsiteMain.special_locations", "/hosted/="+OrgConfig.getString("HostedDocRoot", PRIVATEDOCUMENTROOT)); - if(!OrgConfig.getString("HostedDocRoot", "").empty()) - Config->setString("Tuxbox.HostedDocumentRoot", OrgConfig.getString("HostedDocRoot", PRIVATEDOCUMENTROOT)); // mod_auth Config->setString("mod_auth.username", OrgConfig.getString("AuthUser", AUTHUSER)); Config->setString("mod_auth.password", OrgConfig.getString("AuthPassword", AUTHPASSWORD)); @@ -450,6 +445,7 @@ void Cyhttpd::ReadConfig(void) Config->saveConfig(HTTPD_CONFIGFILE); } + // Add Defaults for Version2 if (Config->getInt32("configfile.version") < 2) { Config->setString("mod_sendfile.mime_types", HTTPD_SENDFILE_EXT); @@ -457,6 +453,15 @@ void Cyhttpd::ReadConfig(void) Config->setString("mod_sendfile.sendAll","false"); Config->saveConfig(HTTPD_CONFIGFILE); } + // Add Defaults for Version 4 + if (Config->getInt32("configfile.version") < 4) { + Config->setInt32("configfile.version", CONF_VERSION); + Config->setString("Language.selected", HTTPD_DEFAULT_LANGUAGE); + Config->setString("Language.directory", HTTPD_LANGUAGEDIR); + if (Config->getString("WebsiteMain.hosted_directory", "").empty()) + Config->setString("WebsiteMain.hosted_directory", HOSTEDDOCUMENTROOT); + Config->saveConfig(HTTPD_CONFIGFILE); + } } // configure debugging & logging if(CLogging::getInstance()->LogLevel == 0) @@ -473,9 +478,9 @@ void Cyhttpd::ReadConfig(void) webserver->conf_no_keep_alive_ips = Config->getStringVector("server.no_keep-alive_ips"); // MainSite - ConfigList["PrivatDocumentRoot"]= Config->getString("WebsiteMain.directory", PRIVATEDOCUMENTROOT); - ConfigList["PublicDocumentRoot"]= Config->getString("WebsiteMain.override_directory", PUBLICDOCUMENTROOT); - ConfigList["HostedDocumentRoot"]= Config->getString("Tuxbox.HostedDocumentRoot", HOSTEDDOCUMENTROOT); + ConfigList["WebsiteMain.directory"] = Config->getString("WebsiteMain.directory", PRIVATEDOCUMENTROOT); + ConfigList["WebsiteMain.override_directory"] = Config->getString("WebsiteMain.override_directory", PUBLICDOCUMENTROOT); + ConfigList["WebsiteMain.hosted_directory"] = Config->getString("WebsiteMain.hosted_directory", HOSTEDDOCUMENTROOT); #ifdef Y_CONFIG_USE_OPEN_SSL ConfigList["SSL"] = Config->getString("WebsiteMain.ssl", "false"); ConfigList["SSL_pemfile"] = Config->getString("WebsiteMain.ssl_pemfile", SSL_PEMFILE); @@ -490,6 +495,9 @@ void Cyhttpd::ReadConfig(void) ConfigList["server.group_name"]= Config->getString("server.group_name", ""); ConfigList["server.chroot"]= Config->getString("server.chroot", ""); + // language + ConfigList["Language.directory"] = Config->getString("Language.directory", HTTPD_LANGUAGEDIR); + ConfigList["Language.selected"] = Config->getString("Language.selected", HTTPD_DEFAULT_LANGUAGE); // Read App specifig settings by Hook CyhookHandler::Hooks_ReadConfig(Config, ConfigList); diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yresponse.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yresponse.cpp index 741fd4c..981edd5 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yresponse.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_core/yresponse.cpp @@ -70,7 +70,7 @@ bool CWebserverResponse::SendResponse() // for hosted webs: rewrite URL std::string _hosted="/hosted/"; if((Connection->Request.UrlData["path"]).compare(0,_hosted.length(),"/hosted/") == 0) // hosted Web ? - Connection->Request.UrlData["path"]=Cyhttpd::ConfigList["HostedDocumentRoot"] + Connection->Request.UrlData["path"]=Cyhttpd::ConfigList["WebsiteMain.hosted_directory"] +(Connection->Request.UrlData["path"]).substr(_hosted.length()-1); #endif //Y_CONFIG_USE_HOSTEDWEB log_level_printf(5,"UrlPath:%s\n",(Connection->Request.UrlData["path"]).c_str()); diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp index 87468f7..c8f15b2 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp @@ -167,14 +167,14 @@ std::string CmodSendfile::GetFileName(CyhookHandler *hh, std::string path, std:: else tmpfilename = path + filename; - if( access(std::string(hh->WebserverConfigList["PublicDocumentRoot"] + tmpfilename).c_str(),4) == 0) - tmpfilename = hh->WebserverConfigList["PublicDocumentRoot"] + tmpfilename; - else if( access(std::string(hh->WebserverConfigList["PublicDocumentRoot"] + tmpfilename + ".gz").c_str(),4) == 0) - tmpfilename = hh->WebserverConfigList["PublicDocumentRoot"] + tmpfilename + ".gz"; - else if(access(std::string(hh->WebserverConfigList["PrivatDocumentRoot"] + tmpfilename).c_str(),4) == 0) - tmpfilename = hh->WebserverConfigList["PrivatDocumentRoot"] + tmpfilename; - else if(access(std::string(hh->WebserverConfigList["PrivatDocumentRoot"] + tmpfilename + ".gz").c_str(),4) == 0) - tmpfilename = hh->WebserverConfigList["PrivatDocumentRoot"] + tmpfilename + ".gz"; + if( access(std::string(hh->WebserverConfigList["WebsiteMain.override_directory"] + tmpfilename).c_str(),4) == 0) + tmpfilename = hh->WebserverConfigList["WebsiteMain.override_directory"] + tmpfilename; + else if( access(std::string(hh->WebserverConfigList["WebsiteMain.override_directory"] + tmpfilename + ".gz").c_str(),4) == 0) + tmpfilename = hh->WebserverConfigList["WebsiteMain.override_directory"] + tmpfilename + ".gz"; + else if(access(std::string(hh->WebserverConfigList["WebsiteMain.directory"] + tmpfilename).c_str(),4) == 0) + tmpfilename = hh->WebserverConfigList["WebsiteMain.directory"] + tmpfilename; + else if(access(std::string(hh->WebserverConfigList["WebsiteMain.directory"] + tmpfilename + ".gz").c_str(),4) == 0) + tmpfilename = hh->WebserverConfigList["WebsiteMain.directory"] + tmpfilename + ".gz"; #ifdef Y_CONFIG_FEATUE_SENDFILE_CAN_ACCESS_ALL else if(access(tmpfilename.c_str(),4) == 0) ; diff --git a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp index 788b6d4..b4f89f9 100644 --- a/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp +++ b/tuxbox/neutrino/daemons/nhttpd/yhttpd_mods/mod_yparser.cpp @@ -56,8 +56,8 @@ void CyParser::init(CyhookHandler *hh) { if(HTML_DIRS[0].empty()) { - CyParser::HTML_DIRS[0]=hh->WebserverConfigList["PublicDocumentRoot"]; - HTML_DIRS[1]=hh->WebserverConfigList["PrivatDocumentRoot"]; + CyParser::HTML_DIRS[0]=hh->WebserverConfigList["WebsiteMain.override_directory"]; + HTML_DIRS[1]=hh->WebserverConfigList["WebsiteMain.directory"]; PLUGIN_DIRS[0]=HTML_DIRS[0]; PLUGIN_DIRS[0].append("/scripts"); PLUGIN_DIRS[1]=HTML_DIRS[1]; ----------------------------------------------------------------------- Summary of changes: .../daemons/nhttpd/tuxboxapi/controlapi.cpp | 4 +- tuxbox/neutrino/daemons/nhttpd/web/Y_Blocks.txt | 2 +- tuxbox/neutrino/daemons/nhttpd/yconfig.h | 10 +++++++- tuxbox/neutrino/daemons/nhttpd/yhttpd.cpp | 26 +++++++++++++------- .../daemons/nhttpd/yhttpd_core/yresponse.cpp | 2 +- .../daemons/nhttpd/yhttpd_mods/mod_sendfile.cpp | 16 ++++++------ .../daemons/nhttpd/yhttpd_mods/mod_yparser.cpp | 4 +- 7 files changed, 40 insertions(+), 24 deletions(-) -- Tuxbox-GIT: apps ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Tuxbox-cvs-commits mailing list Tuxbox-cvs-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits