mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-10 23:27:50 +02:00
Added static web server and black / whitelist template
- Added static web server - Added static web server default index - Added embeded templates to blacklist / whitelist - Added wip Web Directory Manager Place the templates at ./www/templates/blacklist.html or whitelist.html to replace the build in embedded template for access control 403 error -
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -76,6 +77,22 @@ func PostBool(r *http.Request, key string) (bool, error) {
|
||||
return false, errors.New("invalid boolean given")
|
||||
}
|
||||
|
||||
// Get POST paramter as int
|
||||
func PostInt(r *http.Request, key string) (int, error) {
|
||||
x, err := PostPara(r, key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
x = strings.TrimSpace(x)
|
||||
rx, err := strconv.Atoi(x)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return rx, nil
|
||||
}
|
||||
|
||||
func FileExists(filename string) bool {
|
||||
_, err := os.Stat(filename)
|
||||
if os.IsNotExist(err) {
|
||||
|
Reference in New Issue
Block a user