Forráskód Böngészése

Completed permission denied page for share

TC pushbot 5 4 éve
szülő
commit
870a4d270b

+ 15 - 3
mod/share/share.go

@@ -161,7 +161,7 @@ func (s *Manager) HandleShareAccess(w http.ResponseWriter, r *http.Request) {
 					w.WriteHeader(http.StatusForbidden)
 					w.Write([]byte("401 - Forbidden"))
 				} else {
-					w.Write([]byte("Permission Denied page WIP"))
+					ServePermissionDeniedPage(w)
 				}
 				return
 			}
@@ -187,7 +187,7 @@ func (s *Manager) HandleShareAccess(w http.ResponseWriter, r *http.Request) {
 					w.WriteHeader(http.StatusForbidden)
 					w.Write([]byte("401 - Forbidden"))
 				} else {
-					w.Write([]byte("Permission Denied page WIP"))
+					ServePermissionDeniedPage(w)
 				}
 				return
 			}
@@ -224,7 +224,7 @@ func (s *Manager) HandleShareAccess(w http.ResponseWriter, r *http.Request) {
 					w.WriteHeader(http.StatusForbidden)
 					w.Write([]byte("401 - Forbidden"))
 				} else {
-					w.Write([]byte("Permission Denied page WIP"))
+					ServePermissionDeniedPage(w)
 				}
 				return
 			}
@@ -737,6 +737,18 @@ func (s *Manager) FileIsShared(rpath string) bool {
 	return shareUUID != ""
 }
 
+func ServePermissionDeniedPage(w http.ResponseWriter) {
+	w.WriteHeader(http.StatusForbidden)
+	pageContent := []byte("Permissioned Denied")
+	if fileExists("system/share/permissionDenied.html") {
+		content, err := ioutil.ReadFile("system/share/permissionDenied.html")
+		if err == nil {
+			pageContent = content
+		}
+	}
+	w.Write([]byte(pageContent))
+}
+
 /*
 	Validate Share Mode string
 	will return

+ 57 - 0
system/share/permissionDenied.html

@@ -0,0 +1,57 @@
+<!DOCTYPE HTML>
+<html>
+    <head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <title>Permission Denied</title>
+    <link rel="stylesheet" href="script/skeleton/offline.css">
+    <link rel="stylesheet" href="script/skeleton/normalize.css">
+    <link rel="stylesheet" href="script/skeleton/skeleton.css">
+    <script type="application/javascript" src="script/jquery.min.js"></script>
+    <style>
+        .bar{
+            height: 12px;
+            background-color: #1a1a1a;
+            width: 100%;
+        }
+
+        .footer{
+            position: absolute;
+            bottom: 0px;
+            height: 100px;
+            width: 100%;
+            background-color: #1a1a1a;
+            padding: 20px;
+            color: white;
+        }
+    </style>
+    </head>
+    <body>
+        <div class="bar"></div>
+        <br>
+        <div class="container">
+            <div class="row">
+                <div class="one-half column">
+                    <br><br>
+                    <h3>Permission Denied</h3>
+                    <p>Permission settings on this share did not include your user group. That is all we know.</p>
+                </div>
+                <div class="one-half column">
+                    <img style="pointer-events: none;" src="img/public/share/denied.png">
+                </div>
+            </div>
+           
+        </div>
+        <div class="footer">
+            <div class="container">
+                Cloud File Sharing Interface, Powered by <a style="color: white;" href="http://arozos.com">arozos</a>
+            </div>
+        </div>
+      
+
+        
+    <script>
+     
+    </script>
+    </body>
+</html>

BIN
web/img/public/share/denied.png


BIN
web/img/public/share/denied.psd


BIN
web/img/public/share/notfound.png


BIN
web/img/public/share/notfound.psd