mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
- yweb: re-introduce 'WebsiteMain.hosted_directory'
* this directory can be used to host some of your cracy stuff. yhtm, yjs and ysh will also parsed now. it is reachable with <boxip>/hosted/ * if exist a subdir named 'logos' in this directory you can use this as an external logo-dir for yweb too * path can be configured with '--with-hosted_httpddir=PATH'
This commit is contained in:
@@ -271,10 +271,18 @@ std::string CyParser::cgi_file_parsing(CyhookHandler *hh,
|
||||
bool found = false;
|
||||
std::string htmlfullfilename, yresult, html_template;
|
||||
|
||||
bool isHosted = false;
|
||||
#ifdef Y_CONFIG_USE_HOSTEDWEB
|
||||
// for hosted webs: search in hosted_directory only
|
||||
std::string _hosted=hh->WebserverConfigList["WebsiteMain.hosted_directory"];
|
||||
if((hh->UrlData["path"]).compare(0,_hosted.length(),hh->WebserverConfigList["WebsiteMain.hosted_directory"]) == 0) // hosted Web ?
|
||||
isHosted = true;
|
||||
#endif //Y_CONFIG_USE_HOSTEDWEB
|
||||
|
||||
char cwd[255];
|
||||
getcwd(cwd, 254);
|
||||
for (unsigned int i = 0; i < HTML_DIR_COUNT && !found; i++) {
|
||||
htmlfullfilename = HTML_DIRS[i] + "/" + htmlfilename;
|
||||
for (unsigned int i = 0; i < (isHosted ? 1 : HTML_DIR_COUNT) && !found; i++) {
|
||||
htmlfullfilename = (isHosted ? "" : HTML_DIRS[i]) + "/" + htmlfilename;
|
||||
std::fstream fin(htmlfullfilename.c_str(), std::fstream::in);
|
||||
if (fin.good()) {
|
||||
found = true;
|
||||
@@ -292,11 +300,11 @@ std::string CyParser::cgi_file_parsing(CyhookHandler *hh,
|
||||
}
|
||||
chdir(cwd);
|
||||
if (!found) {
|
||||
printf("[CyParser] Y-cgi:template %s not found in\n",
|
||||
htmlfilename.c_str());
|
||||
for (unsigned int i = 0; i < HTML_DIR_COUNT; i++) {
|
||||
printf("%s\n", HTML_DIRS[i].c_str());
|
||||
}
|
||||
printf("[CyParser] Y-cgi:template %s not found %s\n", htmlfilename.c_str(), isHosted ? "" : "in");
|
||||
if (!isHosted)
|
||||
for (unsigned int i = 0; i < HTML_DIR_COUNT; i++) {
|
||||
printf("%s\n", HTML_DIRS[i].c_str());
|
||||
}
|
||||
}
|
||||
return yresult;
|
||||
}
|
||||
|
Reference in New Issue
Block a user