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/
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 @@ + +
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 @@ + +
+
DEBUG
++
+
+
Perhaps describe here.
++
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.
+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 @@ + +
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 @@ + +
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 @@ - -- - 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 @@ - -
- - 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 @@ - -
-
DEBUG
--
-
-
Perhaps describe here.
--
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/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 @@ - -
-
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 @@ - -
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) "