]> Untitled Git - public.git/commitdiff
Hotfix 1.2.3 1.2.3
authorClifton Palmer <clifton.james.palmer@protonmail.com>
Thu, 26 Oct 2023 08:26:04 +0000 (03:26 -0500)
committerClifton Palmer <clifton.james.palmer@protonmail.com>
Thu, 26 Oct 2023 08:27:23 +0000 (03:27 -0500)
- Updated publish.lua to display meaningful message if links are not created
- If no links generated in publish.sh, return empty string instead of nonce
- Updated readme with more explicit httpd auth instructions

docker-compose.yml
lua/publish.lua
lua/publish.sh
readme.md

index 65080cd07923c556689692df16b21b691b296e75..7a29ceaa81357dbe93051e692a391a0d3ccb5335 100644 (file)
@@ -2,7 +2,7 @@ version: '3'
 services:
     web:
         build: .
 services:
     web:
         build: .
-        image: cjpalmer/public:1.2.2
+        image: cjpalmer/public:1.2.3
         volumes:
         - ${SHARE_ROOT}:/storage
         - public_data:/usr/local/apache2/htdocs
         volumes:
         - ${SHARE_ROOT}:/storage
         - public_data:/usr/local/apache2/htdocs
index b98e8f4a344daea49f14e5f8f8df9d7672e12e16..c0a4ff79347da9cb1fe0a92999a0dd9c63a27a81 100644 (file)
@@ -25,14 +25,19 @@ function handle(r)
 
     if pattern then
         local nonce = publish(r.context_document_root, pattern)
 
     if pattern then
         local nonce = publish(r.context_document_root, pattern)
-
-        -- if FQDN override is set,
-        -- use override instead of my own server name and port number
-        local fqdn = os.getenv('PUBLIC_FQDN_OVERRIDE')
-        fqdn = fqdn or (r.is_https and "https" or "http") .. "://" .. r.server_name .. ":" ..r.port
-
-        local uri = ("%s/%s/"):format(fqdn, nonce)
-        r:puts( ([[<a href="%s">%s</a>]]):format(uri, uri) )
+        if nonce == "" then
+            r:puts( "No links created" )
+        else
+            -- if FQDN override is set,
+            -- use override instead of my own server name and port number
+            local fqdn = os.getenv('PUBLIC_FQDN_OVERRIDE')
+            fqdn = fqdn or
+                (r.is_https and "https" or "http") ..
+                "://" .. r.server_name .. ":" ..r.port
+
+            local uri = ("%s/%s/"):format(fqdn, nonce)
+            r:puts( ([[<a href="%s">%s</a>]]):format(uri, uri) )
+        end
     else
         local template = get_form(r.context_document_root)
         r:puts( template )
     else
         local template = get_form(r.context_document_root)
         r:puts( template )
index bf88fbd5daee38d1bf49baacedec50104eafdda8..337112697f0533ad9c2b7996e935512b356a840e 100755 (executable)
@@ -18,5 +18,12 @@ do
     ln -s $fname $symlink_dir/$(echo $fname | sed 's|^.*/||')
 done
 
     ln -s $fname $symlink_dir/$(echo $fname | sed 's|^.*/||')
 done
 
-# print nonce directory
-echo $nonce
+# if nonce directory has been created,
+# print nonce
+# else no links generated, print nothing
+if [[ -d "$symlink_dir" ]]
+then
+    echo -n "$nonce"
+else
+    echo -n ""
+fi
index f8fb6dcd4150b5ee0a7bdcf6290e38841142a032..5ed18fd6e741c855fdb398eb1f8bb776dcd95563 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -9,15 +9,9 @@ docker stack deploy -c <(docker-compose config) public
 
 ### reaching the services
 
 
 ### reaching the services
 
-Must authorize self through ```$hostname```/lua/publish.lua and set up valid users on first deployment
+Must authorize self through ```$hostname```/lua/publish.lua and set up valid users on first deployment. Right now you gotta ```docker exec -it``` the container to do that.
+
 
 ```
 
 ```
-htpasswd -c passwords $username
+htpasswd -c ${HTTPD_PREFIX}/auth/passwords $username
 ```
 ```
-
-## todo
-
-* clean up temporary public directories
-    ```
-    0 * * * * find /var/www/html/public/* -depth -mtime +7 -delete
-    ```