Merge branch 'dev' into feature/blog

This commit is contained in:
ari melody 2025-09-07 16:23:37 +01:00
commit bf9289400e
Signed by: ari
GPG key ID: 60B5F0386E3DDB7E
2 changed files with 44 additions and 47 deletions

14
main.go
View file

@ -33,6 +33,7 @@ import (
const DB_VERSION = 1
const DEFAULT_PORT int64 = 8080
const HRT_DATE int64 = 1756478697
func main() {
fmt.Printf("made with <3 by ari melody\n\n")
@ -574,11 +575,10 @@ func CheckRequest(app *model.AppState, next http.Handler) http.Handler {
return
}
// same with .php and awkward double-slash requests.
// obviously these don't affect me, but these tend to be lazy intrusion
// attempts. if that's what you're about, i don't want you on my site.
if strings.HasPrefix(r.URL.Path, "//") ||
strings.HasSuffix(r.URL.Path, ".php") ||
// obviously .php requests these don't affect me, but these tend to be
// lazy wordpress intrusion attempts. if that's what you're about, i
// don't want you on my site.
if strings.HasSuffix(r.URL.Path, ".php") ||
strings.HasSuffix(r.URL.Path, ".php7") {
http.NotFound(w, r)
fmt.Fprintf(
@ -606,6 +606,10 @@ func DefaultHeaders(next http.Handler) http.Handler {
"X-Powered-By",
PoweredByStrings[rand.Intn(len(PoweredByStrings))],
)
w.Header().Add(
"X-Days-Since-HRT",
fmt.Sprint(math.Round(time.Since(time.Unix(HRT_DATE, 0)).Hours() / 24)),
)
next.ServeHTTP(w, r)
})
}