added stuff, broke some other stuff, made admin auth!
Signed-off-by: ari melody <ari@arimelody.me>
This commit is contained in:
parent
0d1e694b59
commit
5631c4bd87
26 changed files with 1615 additions and 1401 deletions
34
global/global.go
Normal file
34
global/global.go
Normal file
|
@ -0,0 +1,34 @@
|
|||
package global
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
var LAST_MODIFIED = time.Now()
|
||||
|
||||
var MimeTypes = map[string]string{
|
||||
"css": "text/css; charset=utf-8",
|
||||
"png": "image/png",
|
||||
"jpg": "image/jpg",
|
||||
"webp": "image/webp",
|
||||
"html": "text/html",
|
||||
"asc": "text/plain",
|
||||
"pub": "text/plain",
|
||||
"js": "application/javascript",
|
||||
}
|
||||
|
||||
func IsModified(req *http.Request, last_modified time.Time) bool {
|
||||
if len(req.Header["If-Modified-Since"]) == 0 || len(req.Header["If-Modified-Since"][0]) == 0 {
|
||||
return true
|
||||
}
|
||||
request_time, err := time.Parse(http.TimeFormat, req.Header["If-Modified-Since"][0])
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
if request_time.Before(last_modified) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue