1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-09-16 07:56:24 -07:00

added manage.js and set up server restriction

This commit is contained in:
Joshua Merrell 2013-06-09 11:57:11 -07:00
parent e8b063838b
commit 28a8bea855
2 changed files with 12 additions and 1 deletions

View file

@ -0,0 +1 @@
alert("blah")

View file

@ -48,6 +48,7 @@ func fileHandle(w http.ResponseWriter, r *http.Request) {
filepath := path.Join(config.DocumentRoot, request_url)
results,err := os.Stat(filepath)
restricted := false // if true, user doesn't have permission to view the file, because read-banned, etc
if err == nil {
//the file exists, or there is a folder here
@ -72,7 +73,16 @@ func fileHandle(w http.ResponseWriter, r *http.Request) {
} else {
//the file exists, and is not a folder
//writer.Header().Add("Cache-Control", fmt.Sprintf("max-age=%d, public, must-revalidate, proxy-revalidate", 500))
serveFile(w, filepath)
if request_url == path.Join(config.SiteWebfolder+"javascript/manage.js") {
if getStaffRank() == 0 {
// we aren't logged in and tried to access manage.js
restricted = true
}
}
if !restricted {
serveFile(w, filepath)
}
}
} else {
//there is nothing at the requested address