Bladeren bron

Updated routing logic for personal homepage handler

Toby Chui 3 jaren geleden
bovenliggende
commit
743ad3bcb8
3 gewijzigde bestanden met toevoegingen van 155 en 2 verwijderingen
  1. 3 2
      mod/www/www.go
  2. 42 0
      web/SystemAO/www/index.html
  3. 110 0
      web/SystemAO/www/pconf.json

+ 3 - 2
mod/www/www.go

@@ -49,8 +49,9 @@ func (h *Handler) RouteRequest(w http.ResponseWriter, r *http.Request) {
 		http.ServeFile(w, r, "web/SystemAO/www/index.html")
 		return
 	} else if filepath.ToSlash(filepath.Dir(r.URL.Path)) == "/www" {
-		//Reaching file under www root and not root. Redirect to www root
-		http.Redirect(w, r, "/www/", 307)
+		//Missing the last / at the end of the path
+		r.URL.Path = r.URL.Path + "/"
+		http.Redirect(w, r, filepath.ToSlash(filepath.Dir(r.URL.Path))+"/", http.StatusTemporaryRedirect)
 		return
 	}
 

+ 42 - 0
web/SystemAO/www/index.html

@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <!-- Meta headers for mobile devices-->
+        <meta name="apple-mobile-web-app-capable" content="yes" />
+        <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
+        <meta charset="UTF-8">
+        <meta name="theme-color" content="#4b75ff">
+        <link rel="icon" href="favicon.png">
+
+        <!-- CSS and JavaScript, access to scripe folder is not blocked for non logged in users-->
+        <link rel="stylesheet" href="../script/semantic/semantic.min.css">
+        <script src="../script/jquery.min.js"></script>
+        <script src="../script/semantic/semantic.min.js"></script>
+        <title>Web Root</title>
+        <style>
+            body{
+                background-color:white;
+            }
+        </style>
+    </head>
+    <body>
+        <div class="ui container" id="particles-js">
+            <br><br>
+            <a class="ui basic right floated button" href="../"><i class="home icon"></i>Back</a>
+            <h1>Web Root Document</h1>
+            <div class="ui divider"></div>
+
+            This is the root document of the home page service for this ArozOS Host.<br>
+            To browse a user's homepage, enter the username as subpath for the URL (i.e. www/username)<br><br>
+            To shutdown the homepage feature, set -enable_homepage flag to false from your startup script and restart. <br>
+            All users that are not logged in will be redirected to login page instead.
+
+            <div class="ui divider"></div>
+            <p>To change this file, edit web/SystemAO/www/index.html<br>
+            ArozOS Project, CopyRight tobychui 2016 - <span class="year"></span></p>
+        </div>
+        <script>
+            $(".year").text(new Date().getFullYear());
+        </script>
+    </body>
+</html>

+ 110 - 0
web/SystemAO/www/pconf.json

@@ -0,0 +1,110 @@
+{
+  "particles": {
+    "number": {
+      "value": 80,
+      "density": {
+        "enable": true,
+        "value_area": 631.3280775270874
+      }
+    },
+    "color": {
+      "value": "#090909"
+    },
+    "shape": {
+      "type": "circle",
+      "stroke": {
+        "width": 0,
+        "color": "#3e3d3d"
+      },
+      "polygon": {
+        "nb_sides": 5
+      },
+      "image": {
+        "src": "img/github.svg",
+        "width": 100,
+        "height": 100
+      }
+    },
+    "opacity": {
+      "value": 0.5,
+      "random": false,
+      "anim": {
+        "enable": false,
+        "speed": 1,
+        "opacity_min": 0.1,
+        "sync": false
+      }
+    },
+    "size": {
+      "value": 3,
+      "random": true,
+      "anim": {
+        "enable": false,
+        "speed": 40,
+        "size_min": 0.1,
+        "sync": false
+      }
+    },
+    "line_linked": {
+      "enable": true,
+      "distance": 150,
+      "color": "#b9b9b9",
+      "opacity": 0.4,
+      "width": 1
+    },
+    "move": {
+      "enable": true,
+      "speed": 6,
+      "direction": "none",
+      "random": false,
+      "straight": false,
+      "out_mode": "out",
+      "bounce": false,
+      "attract": {
+        "enable": false,
+        "rotateX": 600,
+        "rotateY": 1200
+      }
+    }
+  },
+  "interactivity": {
+    "detect_on": "canvas",
+    "events": {
+      "onhover": {
+        "enable": true,
+        "mode": "repulse"
+      },
+      "onclick": {
+        "enable": false,
+        "mode": "push"
+      },
+      "resize": true
+    },
+    "modes": {
+      "grab": {
+        "distance": 400,
+        "line_linked": {
+          "opacity": 1
+        }
+      },
+      "bubble": {
+        "distance": 400,
+        "size": 40,
+        "duration": 2,
+        "opacity": 8,
+        "speed": 3
+      },
+      "repulse": {
+        "distance": 118.24324324324314,
+        "duration": 0.4
+      },
+      "push": {
+        "particles_nb": 4
+      },
+      "remove": {
+        "particles_nb": 2
+      }
+    }
+  },
+  "retina_detect": true
+}