]> git.plutz.net Git - httpchat/commitdiff
read _DATA and _EXEC from environment, force nickname setting
authorPaul Hänsch <paul@plutz.net>
Tue, 17 Nov 2020 19:54:39 +0000 (20:54 +0100)
committerPaul Hänsch <paul@plutz.net>
Tue, 17 Nov 2020 19:54:39 +0000 (20:54 +0100)
index.cgi

index a5665c14796e542f2b61f6b610a07bdabd8e9322..ff9e563f356689f95115ddb1aaac6f4f4df42bbe 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -1,7 +1,7 @@
 #!/bin/sh
 
-_EXEC=.
-_DATA=.
+_EXEC="${_EXEC:-.}"
+_DATA="${_DATA:-.}"
 SESSION_TIMEOUT=43200
 . "$_EXEC/cgilite/logging.sh"
 . "$_EXEC/cgilite/cgilite.sh"
@@ -59,10 +59,11 @@ settings_menu(){
 case ${LOCATION} in
   webchat.css)
     . "$_EXEC/cgilite/file.sh"
-    FILE "$_EXEC/webchat.css"
-    exit 0
+    FILE "$_EXEC/${LOCATION}"
+    return 0
     ;;
   \&?*)
+    [ "$(COOKIE nick)" -o "$QUERY_STRING" = settings ] || REDIRECT "/$LOCATION?settings#nick"
     chatfile="$_DATA/${LOCATION}/channel"
     . "$_EXEC/channel.sh"
     exit 0