From 5e05f276c5ea784df0de86d70bf7aab2e5de32d5 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 9 Sep 2021 12:30:24 +1000 Subject: Rejig the web stuff. Move to examples to example/var/www. Move the web socket to scRoot/var/run. Make the name of the web socket configurable. Populate the scRoot/var/www from exomples if it's empty. Everyone uses SledjChisl.css now. Some clean ups. Comment++ --- example/etc/apache2/sledjchisl.fcgi.conf | 7 +- example/var/www/html/SledjChisl.css | 89 +++++++++++++++++++++++ example/var/www/html/SledjHamr.png | Bin 0 -> 1655233 bytes example/var/www/html/SledjHamrIcon.png | Bin 0 -> 95362 bytes example/var/www/html/SledjHamrIconSmall.png | Bin 0 -> 8535 bytes example/var/www/html/about.html | 13 ++++ example/var/www/html/debugStyle.css | 36 +++++++++ example/var/www/html/help.html | 13 ++++ example/var/www/html/loginpage.html | 50 +++++++++++++ example/var/www/html/password_help.html | 13 ++++ example/var/www/html/register.html | 17 +++++ example/var/www/html/stats.html | 29 ++++++++ example/www/SledjChisl.css | 63 ---------------- example/www/SledjHamr.png | Bin 1655233 -> 0 bytes example/www/SledjHamrIcon.png | Bin 95362 -> 0 bytes example/www/SledjHamrIconSmall.png | Bin 8535 -> 0 bytes example/www/about.html | 11 --- example/www/debugStyle.css | 36 --------- example/www/help.html | 11 --- example/www/loginpage.html | 109 ---------------------------- example/www/password_help.html | 11 --- example/www/register.html | 15 ---- example/www/stats.html | 41 ----------- src/.sledjChisl.conf.lua | 7 +- src/sledjchisl/sledjchisl.c | 83 ++++++++++----------- 25 files changed, 305 insertions(+), 349 deletions(-) create mode 100644 example/var/www/html/SledjChisl.css create mode 100644 example/var/www/html/SledjHamr.png create mode 100644 example/var/www/html/SledjHamrIcon.png create mode 100644 example/var/www/html/SledjHamrIconSmall.png create mode 100644 example/var/www/html/about.html create mode 100644 example/var/www/html/debugStyle.css create mode 100644 example/var/www/html/help.html create mode 100644 example/var/www/html/loginpage.html create mode 100644 example/var/www/html/password_help.html create mode 100644 example/var/www/html/register.html create mode 100644 example/var/www/html/stats.html delete mode 100644 example/www/SledjChisl.css delete mode 100644 example/www/SledjHamr.png delete mode 100644 example/www/SledjHamrIcon.png delete mode 100644 example/www/SledjHamrIconSmall.png delete mode 100644 example/www/about.html delete mode 100644 example/www/debugStyle.css delete mode 100644 example/www/help.html delete mode 100644 example/www/loginpage.html delete mode 100644 example/www/password_help.html delete mode 100644 example/www/register.html delete mode 100644 example/www/stats.html diff --git a/example/etc/apache2/sledjchisl.fcgi.conf b/example/etc/apache2/sledjchisl.fcgi.conf index 95458cd..06002bd 100644 --- a/example/etc/apache2/sledjchisl.fcgi.conf +++ b/example/etc/apache2/sledjchisl.fcgi.conf @@ -11,8 +11,11 @@ LoadModule proxy_fcgi_module /usr/lib/apache2/modules/mod_proxy_fcgi.so AllowOverride All + + # Any request ENDING in .fcgi gets passed to that unix:...socket, piped as FGCI protocol to localhost. + # That last bit isn't documented, this helped - https://www.linuxquestions.org/questions/linux-server-73/understanding-apache-proxy-unix-sockets-with-pipe-localhost-4175627589/ - SetHandler "proxy:unix:///opt/opensim_SC/caches/sledjchisl.socket|fcgi://localhost/" + SetHandler "proxy:unix:///opt/opensim_SC/var/run/sledjchisl.socket|fcgi://localhost/" ErrorLog ${APACHE_LOG_DIR}/error.log @@ -31,7 +34,7 @@ LoadModule proxy_fcgi_module /usr/lib/apache2/modules/mod_proxy_fcgi.so - SetHandler "proxy:unix:///opt/opensim_SC/caches/sledjchisl.socket|fcgi://localhost/" + SetHandler "proxy:unix:///opt/opensim_SC/var/run/sledjchisl.socket|fcgi://localhost/" diff --git a/example/var/www/html/SledjChisl.css b/example/var/www/html/SledjChisl.css new file mode 100644 index 0000000..95b55cb --- /dev/null +++ b/example/var/www/html/SledjChisl.css @@ -0,0 +1,89 @@ +html, body +{ + background-color: black; + color: white; + font-family: 'sans-serif'; + margin: 0; + padding: 0; +} + +a {color: aqua;} +a:link {color: aqua;} +a:visited {color: fuchsia;} +a:hover {color: blue;} +a:active {color: red;} + +button +{ + background-color: darkgreen; + color: white; + font-family: 'sans-serif'; +} +button:hover {color: blue;} +button:active {color: red;} + +label +{ + background-color:darkgreen; + color: white; + font-family: 'sans-serif'; + font-size: 160%; +} +input +{ + background-color:darkblue; + color: white; + font-family: 'sans-serif'; + font-size: 80%; +} +textarea +{ + background-color:darkblue; + color: white; + font-family: 'sans-serif'; + font-size: 80%; + /* What idiot thought aligning the label with the bottom of textareas was a good default? */ + vertical-align: top; +} + +.container +{ + position: relative; + text-align: left; +} +.top-left +{ + position: absolute; + top: 8px; + left: 16px; + width: 30%; +} +.top-right +{ + position: absolute; + top: 8px; + right: 16px; + width: 30%; +} +.centre +{ + position: absolute; + top: 50%; + left: 50%; + width: 30%; + transform: translate(-50%, -50%); +} +.bottom-left +{ + position: absolute; + bottom: 8px; + left: 16px; + width: 30%; +} +.bottom-right +{ + position: absolute; + bottom: 8px; + right: 16px; + width: 30%; +} diff --git a/example/var/www/html/SledjHamr.png b/example/var/www/html/SledjHamr.png new file mode 100644 index 0000000..9089573 Binary files /dev/null and b/example/var/www/html/SledjHamr.png differ diff --git a/example/var/www/html/SledjHamrIcon.png b/example/var/www/html/SledjHamrIcon.png new file mode 100644 index 0000000..e3b50e1 Binary files /dev/null and b/example/var/www/html/SledjHamrIcon.png differ diff --git a/example/var/www/html/SledjHamrIconSmall.png b/example/var/www/html/SledjHamrIconSmall.png new file mode 100644 index 0000000..a1a6d72 Binary files /dev/null and b/example/var/www/html/SledjHamrIconSmall.png differ diff --git a/example/var/www/html/about.html b/example/var/www/html/about.html new file mode 100644 index 0000000..7294c21 --- /dev/null +++ b/example/var/www/html/about.html @@ -0,0 +1,13 @@ + +About this grid + + + + + + + +

This is a virtual world, usually called a grid, based on opensim-SC.

+

 

+ + diff --git a/example/var/www/html/debugStyle.css b/example/var/www/html/debugStyle.css new file mode 100644 index 0000000..98645cc --- /dev/null +++ b/example/var/www/html/debugStyle.css @@ -0,0 +1,36 @@ +.hoverWrapper0:hover #hoverShow0 +{ + display: block; + border-style: solid; + border-color: fuchsia; +} +.hoverWrapper0 #hoverShow0 +{ + display: none; + background-color: #222222; + text-align: left; + position: absolute; + width: 100%; + border-style: solid; + border-color: fuchsia; +} +.hoverWrapper1:hover #hoverShow1 +{ + display: block; + border-style: solid; + border-color: fuchsia; +} +.hoverWrapper1 #hoverShow1 +{ + display: none; + background-color: #222222; + text-align: left; + position: absolute; + width: 100%; + border-style: solid; + border-color: fuchsia; +} +.hoverItem +{ + border: 1px solid fuchsia; +} diff --git a/example/var/www/html/help.html b/example/var/www/html/help.html new file mode 100644 index 0000000..17022d8 --- /dev/null +++ b/example/var/www/html/help.html @@ -0,0 +1,13 @@ + +Help for this grid + + + + + + + +

Include help for your grid here.

+

 

+ + diff --git a/example/var/www/html/loginpage.html b/example/var/www/html/loginpage.html new file mode 100644 index 0000000..38d5761 --- /dev/null +++ b/example/var/www/html/loginpage.html @@ -0,0 +1,50 @@ + +<!--#echo var="grid" --> splash page + + + + + + + + +
+ SledjHamr +
+

+

+

DEBUG

+
+

DEBUG log

+ +
+
+

+

Add your fancy splash page for here.

+

 

+

 

+

 

+

Perhaps describe here.

+
+
+

is

+

Login URI -

+

 

+

There are members of this grid.

+

There are locals and hypergrid visitors in world.

+

There are locals out on the hypergrid.

+

There have been locals and visitors on this grid in the last month.

+

There are regions, though some might not be online right now.

+
+
+

Maybe add some news or events here, or something.

+
+
+

CSS by Taylor Temper, photo by onefang rejected.

+
+
+

is running , + part of the SledjHamr project.

+
+ + diff --git a/example/var/www/html/password_help.html b/example/var/www/html/password_help.html new file mode 100644 index 0000000..db6c659 --- /dev/null +++ b/example/var/www/html/password_help.html @@ -0,0 +1,13 @@ + +Password help for this grid + + + + + + + +

Include password help for your grid here.

+

 

+ + diff --git a/example/var/www/html/register.html b/example/var/www/html/register.html new file mode 100644 index 0000000..e37d2b0 --- /dev/null +++ b/example/var/www/html/register.html @@ -0,0 +1,17 @@ + + Account for this grid + + + + + + + +

Include account registration help for your grid here.

+

 

+

If you want to register an account on this grid, ask the person that runs it to do that for you.

+

 

+

If you want to register an account on this grid, click here (when it's written).

+

 

+ + diff --git a/example/var/www/html/stats.html b/example/var/www/html/stats.html new file mode 100644 index 0000000..a48ee01 --- /dev/null +++ b/example/var/www/html/stats.html @@ -0,0 +1,29 @@ + + <!--#echo var="grid" --> stats page + + + + + + + + +

statistics.

+

Grid is -

+

Login URI -

+

Login page - /loginpage.html">/loginpage.html

+

There are members of this grid.

+

There are locals and hypergrid visitors in world right now.

+

There are locals out on the hypergrid right now.

+

There have been locals and hypergrid visitors on this grid in the last 30 days ( total).

+

There have been locals and hypergrid visitors on this grid in the last 60 days ( total).

+

There are regions, though might not be online right now.

+

There may be regions online, with a total area of roughly square metres.

+

There are varregions that might be online now.

+

There are normal regions that might be online now.

+

is running , + part of the SledjHamr project.

+

This statistics page will update every two minutes.

+
+ + diff --git a/example/www/SledjChisl.css b/example/www/SledjChisl.css deleted file mode 100644 index fb19f89..0000000 --- a/example/www/SledjChisl.css +++ /dev/null @@ -1,63 +0,0 @@ -html, body -{ - margin: 0; - padding: 0; - color: white; -} -a {color: green;} -a:link {color: green;} -a:visited {color: purple;} -a:hover {color: red;} -a:active {color: blue;} - -.container -{ - position: relative; - text-align: left; -} - -.top-left -{ - position: absolute; - top: 8px; - left: 16px; - height: 30%; - width: 30%; -} - -.top-right -{ - position: absolute; - top: 8px; - right: 16px; - height: 30%; - width: 30%; -} - -.centre -{ - position: absolute; - top: 50%; - left: 50%; - height: 30%; - width: 30%; - transform: translate(-50%, -50%); -} - -.bottom-left -{ - position: absolute; - bottom: 8px; - left: 16px; - height: 30%; - width: 30%; -} - -.bottom-right -{ - position: absolute; - bottom: 8px; - right: 16px; - height: 30%; - width: 30%; -} diff --git a/example/www/SledjHamr.png b/example/www/SledjHamr.png deleted file mode 100644 index 9089573..0000000 Binary files a/example/www/SledjHamr.png and /dev/null differ diff --git a/example/www/SledjHamrIcon.png b/example/www/SledjHamrIcon.png deleted file mode 100644 index e3b50e1..0000000 Binary files a/example/www/SledjHamrIcon.png and /dev/null differ diff --git a/example/www/SledjHamrIconSmall.png b/example/www/SledjHamrIconSmall.png deleted file mode 100644 index a1a6d72..0000000 Binary files a/example/www/SledjHamrIconSmall.png and /dev/null differ diff --git a/example/www/about.html b/example/www/about.html deleted file mode 100644 index 3afc962..0000000 --- a/example/www/about.html +++ /dev/null @@ -1,11 +0,0 @@ - -About this grid - - - - - -This is a virtual world, usually called a grid, based on opensim-SC. -

 

- - diff --git a/example/www/debugStyle.css b/example/www/debugStyle.css deleted file mode 100644 index 98645cc..0000000 --- a/example/www/debugStyle.css +++ /dev/null @@ -1,36 +0,0 @@ -.hoverWrapper0:hover #hoverShow0 -{ - display: block; - border-style: solid; - border-color: fuchsia; -} -.hoverWrapper0 #hoverShow0 -{ - display: none; - background-color: #222222; - text-align: left; - position: absolute; - width: 100%; - border-style: solid; - border-color: fuchsia; -} -.hoverWrapper1:hover #hoverShow1 -{ - display: block; - border-style: solid; - border-color: fuchsia; -} -.hoverWrapper1 #hoverShow1 -{ - display: none; - background-color: #222222; - text-align: left; - position: absolute; - width: 100%; - border-style: solid; - border-color: fuchsia; -} -.hoverItem -{ - border: 1px solid fuchsia; -} diff --git a/example/www/help.html b/example/www/help.html deleted file mode 100644 index 9a75aa6..0000000 --- a/example/www/help.html +++ /dev/null @@ -1,11 +0,0 @@ - -Help for this grid - - - - - -Include help for your grid here. -

 

- - diff --git a/example/www/loginpage.html b/example/www/loginpage.html deleted file mode 100644 index 7a221dc..0000000 --- a/example/www/loginpage.html +++ /dev/null @@ -1,109 +0,0 @@ - -<!--#echo var="grid" --> splash page - - - - - - - - -
- SledjHamr -
-

-

-

DEBUG

-
-

DEBUG log

- -
-
-

-

Add your fancy splash page for here.

-

 

-

 

-

 

-

Perhaps describe here.

-
-
-

is

-

Login URI -

-

 

-

There are members of this grid.

-

There are locals and hypergrid visitors in world.

-

There are locals out on the hypergrid.

-

There have been locals and visitors on this grid in the last month.

-

There are regions, though some might not be online right now.

-
-
-

Maybe add some news or events here, or something.

-
-
-

CSS by Taylor Temper, photo by onefang rejected.

-
-
-

is running , - part of the SledjHamr project.

-
- - diff --git a/example/www/password_help.html b/example/www/password_help.html deleted file mode 100644 index aef6bd5..0000000 --- a/example/www/password_help.html +++ /dev/null @@ -1,11 +0,0 @@ - -Password help for this grid - - - - - -Include password help for your grid here. -

 

- - diff --git a/example/www/register.html b/example/www/register.html deleted file mode 100644 index 46317e6..0000000 --- a/example/www/register.html +++ /dev/null @@ -1,15 +0,0 @@ - -Account for this grid - - - - - -Include account registration help for your grid here. -

 

-

If you want to register an account on this grid, ask the person that runs it to do that for you.

-

 

-

If you want to register an account on this grid, click here (when it's written).

-

 

- - diff --git a/example/www/stats.html b/example/www/stats.html deleted file mode 100644 index 7b51b06..0000000 --- a/example/www/stats.html +++ /dev/null @@ -1,41 +0,0 @@ - - <!--#echo var="grid" --> stats page - - - - - - - - -

statistics.

-

Grid is -

-

Login URI -

-

Login page - /loginpage.html">/loginpage.html

-

There are members of this grid.

-

There are locals and hypergrid visitors in world right now.

-

There are locals out on the hypergrid right now.

-

There have been locals and hypergrid visitors on this grid in the last 30 days ( total).

-

There have been locals and hypergrid visitors on this grid in the last 60 days ( total).

-

There are regions, though might not be online right now.

-

There may be regions online, with a total area of roughly square metres.

-

There are varregions that might be online now.

-

There are normal regions that might be online now.

-

is running , - part of the SledjHamr project.

-

This statistics page will update every two minutes.

-
- - diff --git a/src/.sledjChisl.conf.lua b/src/.sledjChisl.conf.lua index cede4e4..61d709d 100644 --- a/src/.sledjChisl.conf.lua +++ b/src/.sledjChisl.conf.lua @@ -14,7 +14,7 @@ config = ["debug"] = false; ["scUser"] = "opensimsc"; ["Tconsole"] = "SledjChisl"; - ["Tsocket"] = "opensim-tmux.socket"; + ["Tsocket"] = "opensim-tmux.socket"; -- Ends up in scRoot/var/run ["Ttab"] = "SC"; ["loadAverageInc"] = 0.7; ["simTimeOut"] = 45; -- seconds @@ -22,9 +22,8 @@ config = ["backupIARsim"] = "Sandbox"; ["rsync"] = ""; ["rsyncPort"] = 0; - ["webRoot"] = "/var/www/html"; - ["webHost"] = "localhost"; - ["URL"] = "sledjchisl.fcgi"; + ["webRoot"] = "/var/www/html"; -- Relative to scRoot. + ["webSocket"] = "sledjchisl.socket"; -- Ends up in scRoot/var/run ["webIframers"] = ""; -- Space separated list of hosts allowed to iFrame us, coz someone asked. Include the "https://" bit. ["seshRenew"] = 10 * 60; -- seconds ["idleTimeOut"] = 30 * 60; -- seconds diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index b333357..e5e6460 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -535,7 +535,7 @@ char *backupIARsim = "Sandbox"; char *rSync = ""; int rSyncPort = 0; char *webRoot = "/var/www/html"; -char *URL = "fcgi-bin/sledjchisl.fcgi"; +char *webSocket = "sledjchisl.socket"; char *ToS = "Be good."; char *webIframers = ""; int seshRenew = 10 * 60; @@ -1428,7 +1428,6 @@ static void testOpenSim(simData *simd, char *sim, char *type, int count, int win - static int getIntFromIni(qlisttbl_t *ini, char *name) { int ret; @@ -4151,6 +4150,7 @@ cookie *setCookie(reqData *Rd, char *cki, char *value) ret->httpOnly = TRUE; ret->site = CS_STRICT; ret->secure = TRUE; +// TODO - can we use Rd->Script here? ret->path = getStrH(Rd->headers, "SCRIPT_NAME"); Rd->Rcookies->put(Rd->Rcookies, cook, ret, sizeof(cookie)); free(ret); @@ -4259,27 +4259,13 @@ static void HTMLheader(qgrow_t *reply, char *title) " %s\n" " \n" " \n" + " \n" , title); - reply->addstrf(reply, " \n"); if (DEBUG) reply->addstrf(reply, " \n"); reply->addstrf(reply, - " \n" " \n" " \n" " \n" @@ -5080,9 +5066,6 @@ t("checkSLOSpassword(%s, %s, %s, ", password, salt, passwordHash, fail); return ret; } - - - char *checkLinky(reqData *Rd) { // TODO - should be from Rd.shs->linky-hashish @@ -5109,7 +5092,10 @@ char *checkLinky(reqData *Rd) // "%s" "

\n", "grid_no_reply", Rd->Host, - Rd->Host, Rd->RUri + "grid_no_reply", Rd->Host, + "grid_no_reply", Rd->Host, + "grid_no_reply", Rd->Host +// Rd->Host, Rd->RUri // ,t1, t0 ); free(t1); @@ -8073,12 +8059,12 @@ static void cleanup(void) { C("Caught signal, or quitting, cleaning up."); - char *cmd = xmprintf("%s/sledjchisl.socket", scRun); + char *cmd = xmprintf("%s/%s", scRun, webSocket); if (isWeb && qfile_exist(cmd)) { V("Deleting web socket."); - if (shellMeFail("rm %s/sledjchisl.socket", scRun)) + if (shellMeFail("rm %s/%s", scRun, webSocket)) E("rm command failed!"); } free(cmd); @@ -8191,7 +8177,7 @@ int scanForConfigs(char **cPaths) if ((tmp = configs->getstr(configs, "rsync", false)) != NULL) {rSync = tmp; V("Setting rsync = %s", rSync);} if ((vd = configs->getstr(configs, "rsyncPort", false)) != NULL) {rSyncPort = (int) *((float *) vd); V("Setting rsyncPort = %s", rSyncPort);} if ((tmp = configs->getstr(configs, "webRoot", false)) != NULL) {webRoot = tmp; V("Setting webRoot = %s", webRoot);} - if ((tmp = configs->getstr(configs, "URL", false)) != NULL) {URL = tmp; V("Setting URL = %s", URL);} + if ((tmp = configs->getstr(configs, "webSocket", false)) != NULL) {webSocket = tmp; V("Setting webSocket = %s", webSocket);} if ((vd = configs->get (configs, "seshRenew", NULL, false)) != NULL) {seshRenew = (int) *((float *) vd); V("Setting seshRenew = %d", seshRenew);} if ((vd = configs->get (configs, "idleTimeOut", NULL, false)) != NULL) {idleTimeOut = (int) *((float *) vd); V("Setting idleTimeOut = %d", idleTimeOut);} if ((vd = configs->get (configs, "seshTimeOut", NULL, false)) != NULL) {seshTimeOut = (int) *((float *) vd); V("Setting seshTimeOut = %d", seshTimeOut);} @@ -8483,7 +8469,7 @@ Copy correct config/config.ini to there. // A bit chicken and egg here. // We need to be the correct user to set the correct perms on the scRun directory // But we wont be the correct user until we run tmux as that user. -// The path to sledjchisl.socket needs to be readable by the www-data group. So the FCGI socket will work. +// The path to the web socket needs to be readable by the www-data group. So the FCGI socket will work. // AND it needs to be group sticky on opensimsc group. So the tmux socket will work. // Put both in scRun, and make it other readable? // TODO - No idea of the SECURITY HOLE that might cause. @@ -8570,7 +8556,7 @@ Copy correct config/config.ini to there. // Make the FCGI socket world read / write, coz we can't set it to group www-data, since -G only works for root, and we ain't root. // TODO - BIG SECURITY HOLE??? "bash -c 'export PATH=%s:$PATH; printf \"\\033]0;FCGI web server\\007\"; sleep 2;" // The sleep is so that both are not creating the .shini files at the same time. - "spawn-fcgi -n -u %s -s %s/sledjchisl.socket -M 0666 -G www-data -- /usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl %s; " + "spawn-fcgi -n -u %s -s %s/%s -M 0666 -G www-data -- /usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl %s; " "cd %s; bash'" , pre, Tcmd, scRun, Tsocket, scBin, @@ -8580,7 +8566,7 @@ Copy correct config/config.ini to there. Tconsole, Tconsole, scBin, - scUser, scRun, scRoot, FLAG(v) ? "-v" : "", + scUser, scRun, webSocket, scRoot, FLAG(v) ? "-v" : "", scRoot ); free(pre); @@ -8638,31 +8624,36 @@ Copy correct config/config.ini to there. and by a privileged process */ V("Making directories in %s.", scRoot); - if ((! qfile_exist(scBin)) && (! qfile_mkdir(scBin, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scBin); - if ((! qfile_exist(scEtc)) && (! qfile_mkdir(scEtc, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scEtc); - if ((! qfile_exist(scLib)) && (! qfile_mkdir(scLib, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scLib); - if ((! qfile_exist(scBackup)) && (! qfile_mkdir(scBackup, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scBackup); - if ((! qfile_exist(scCache)) && (! qfile_mkdir(scCache, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scCache); - if ((! qfile_exist(scData)) && (! qfile_mkdir(scData, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scData); - if ((! qfile_exist(scLog)) && (! qfile_mkdir(scLog, S_IRWXU, true))) C("Unable to create path %s", scLog); - if ((! qfile_exist(scTemp)) && (! qfile_mkdir(scTemp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scTemp); + if ((! qfile_exist(scBin)) && (! qfile_mkdir(scBin, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scBin); + if ((! qfile_exist(scEtc)) && (! qfile_mkdir(scEtc, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scEtc); + if ((! qfile_exist(scLib)) && (! qfile_mkdir(scLib, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scLib); + if ((! qfile_exist(scBackup)) && (! qfile_mkdir(scBackup, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scBackup); + if ((! qfile_exist(scCache)) && (! qfile_mkdir(scCache, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scCache); + if ((! qfile_exist(scData)) && (! qfile_mkdir(scData, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scData); + if ((! qfile_exist(scLog)) && (! qfile_mkdir(scLog, S_IRWXU, true))) C("Unable to create path %s", scLog); + if ((! qfile_exist(scTemp)) && (! qfile_mkdir(scTemp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", scTemp); tmp = xmprintf("%s/sessions", scCache); - if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); + if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); free(tmp); tmp = xmprintf("%s/users", scData); - if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); + if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); free(tmp); tmp = xmprintf("%s/db", scData); - if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); + if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); free(tmp); tmp = xmprintf("%s/config", scRoot); - if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); + if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); free(tmp); tmp = xmprintf("%s/AssetFiles/data", scRoot); - if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); + if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); free(tmp); - tmp = xmprintf("%s/web", scRoot); - if ((! qfile_exist(tmp)) && (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", tmp); + tmp = xmprintf("%s/var/www/html", scRoot); + if (! qfile_exist(tmp)) + { + if (! qfile_mkdir(tmp, S_IRWXU | S_IRGRP | S_IXGRP, true)) C("Unable to create path %s", tmp); + free(tmp); + if (shellMeFail("cp %s/current/example/var/www/html/* %s/var/www/html", scRoot, scRoot)) C("Unable to copy files to %s/var/www/html", scRoot); + } free(tmp); /* TODO - tighten up security. @@ -9004,7 +8995,7 @@ Create the /opt/opensim-SC directory structure. // FCGI_LISTENSOCK_FILENO is the socket to the web server. // STDOUT and STDERR go to the web servers error log, or at least it does in Apache 2 mod_fcgid. - I("Running SledjChisl inside a web server, pid %d, socket %s/sledjchisl.socket.", getpid(), scRun); + I("Running SledjChisl inside a web server, pid %d, socket %s/%s.", getpid(), scRun, webSocket); if (0 == toys.optc) D("no args"); @@ -9144,7 +9135,7 @@ t("BODY"); free(Body); santize(Rd->body); - D("%s %s://%s%s -> %s%s", Rd->Method, Rd->Scheme, Rd->Host, Rd->RUri, webRoot, Rd->Path); + D("%s %s://%s%s -> %s%s%s", Rd->Method, Rd->Scheme, Rd->Host, Rd->RUri, scRoot, webRoot, Rd->Path); D("Started FCGI web request ROLE = %s, body is %s bytes, pid %d.", Role, Length, getpid()); if (NULL == Rd->Path) @@ -9208,7 +9199,7 @@ t("BODY"); } memset(toybuf, 0, sizeof(toybuf)); - snprintf(toybuf, sizeof(toybuf), "%s%s", webRoot, Rd->Path); + snprintf(toybuf, sizeof(toybuf), "%s%s%s", scRoot, webRoot, Rd->Path); HTMLfile *thisFile = checkHTMLcache(toybuf); if (NULL == thisFile) { @@ -9335,7 +9326,7 @@ sendReply: fcgiDone: FCGI_Finish(); - snprintf(toybuf, sizeof(toybuf), " for %s %s://%s%s -> %s%s", Rd->Method, Rd->Scheme, Rd->Host, Rd->RUri, webRoot, Rd->Path); + snprintf(toybuf, sizeof(toybuf), " for %s %s://%s%s -> %s%s%s", Rd->Method, Rd->Scheme, Rd->Host, Rd->RUri, scRoot, webRoot, Rd->Path); if (NULL != Rd->outQuery) free(Rd->outQuery); if (NULL != Rd->shs.name) free(Rd->shs.name); Rd->shs.name = NULL; -- cgit v1.1