Browse Source

Move page rendering to lib.sh

Frans Bergman 3 months ago
parent
commit
9cc6106d9b
2 changed files with 8 additions and 4 deletions
  1. 7 0
      bin/lib.sh
  2. 1 4
      bin/wesh.sh

+ 7 - 0
bin/lib.sh

@@ -8,6 +8,13 @@ get_lib_file() {
     fi
 }
 
+render_page() {
+    echo "Content-Type: text/html"
+    echo
+
+    handler "$(get_lib_file master.tpl)"
+}
+
 static_file() {
     printf "Content-Type: "
     select_mime "$1"

+ 1 - 4
bin/wesh.sh

@@ -10,8 +10,5 @@ cd ..
 if [ -f "./$REQUEST_PATH" ]; then
     static_file "./$REQUEST_PATH"
 else
-    printf "Content-Type: text/html\n"
-    printf "\n"
-
-    handler "$(get_lib_file master.tpl)"
+    render_page
 fi