|
|
|
@ -202,6 +202,15 @@ func getUser(w http.ResponseWriter, r *http.Request) {
@@ -202,6 +202,15 @@ func getUser(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
fmt.Fprintf(w, string(ret)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func getVerification(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
loggedIn, _ := detectUser(r, "getVerification") |
|
|
|
|
if !loggedIn { |
|
|
|
|
notFoundPage(w, r) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
http.ServeFile(w, r, r.URL.Path) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func runWeb() { |
|
|
|
|
defer log.PanicSafe() |
|
|
|
|
router := mux.NewRouter().StrictSlash(true) |
|
|
|
@ -212,12 +221,12 @@ func runWeb() {
@@ -212,12 +221,12 @@ func runWeb() {
|
|
|
|
|
router.HandleFunc("/api/login", tryLogin) |
|
|
|
|
router.HandleFunc("/api/pending", getPending) |
|
|
|
|
router.HandleFunc("/api/verifications", getVerifications) |
|
|
|
|
router.HandleFunc("/api/image/", getVerification) |
|
|
|
|
router.HandleFunc("/api/probations", getProbations) |
|
|
|
|
router.HandleFunc("/api/passreq", reqPass) |
|
|
|
|
router.HandleFunc("/api/user", getUser) |
|
|
|
|
router.HandleFunc("/", greetUser) |
|
|
|
|
router.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("./static")))) |
|
|
|
|
router.PathPrefix("/verifications/").Handler(http.StripPrefix("/verifications/", http.FileServer(http.Dir("./verifications")))) |
|
|
|
|
log.LogInfo("Starting server") |
|
|
|
|
log.LogErrorType(http.ListenAndServe(":8080", router)) |
|
|
|
|
} |
|
|
|
|