reports!!!! and PoW!!!!!!!

this has taken quite a while (8 ish hours) but reports and proof of work challenges are completely implemented

the proof of work challenges are bit iffy and could be gpu accelerated which is bad, so i plan to eventually switch to something memory hard like argon2id

references used for pow:
https://dev.to/ratmd/simple-proof-of-work-in-javascript-3kgm
https://anubis.techaro.lol/docs/design/how-anubis-works
https://anubis.techaro.lol/docs/design/why-proof-of-work

as well as some other posts or repos found when searching
This commit is contained in:
2026-11-20 21:31:37 -05:00
parent ee03411154
commit 5c2427b096
14 changed files with 470 additions and 15 deletions
+3 -1
View File
@@ -6,7 +6,7 @@ import (
"gorm.io/gorm"
)
func newRouter(db *gorm.DB, cfg Config, pages *Pages, tracker *AccessTracker) http.Handler {
func newRouter(db *gorm.DB, cfg Config, pages *Pages, tracker *AccessTracker, cStore *ChallengeStore) http.Handler {
mux := http.NewServeMux()
fs := http.FileServer(http.Dir("static"))
mux.Handle("GET /css/", fs)
@@ -20,6 +20,8 @@ func newRouter(db *gorm.DB, cfg Config, pages *Pages, tracker *AccessTracker) ht
mux.HandleFunc("GET /tos", staticPage(pages, "tos.html"))
mux.HandleFunc("GET /privacy", staticPage(pages, "privacy.html"))
mux.HandleFunc("GET /faq", faqHandler(pages, cfg))
mux.HandleFunc("GET /report", reportPageHandler(pages, cStore, cfg))
mux.HandleFunc("POST /report", reportUploadHandler(db, cfg, pages, cStore))
uploads := http.NewServeMux()
uploads.HandleFunc("GET /{id}", contentHandler(db, cfg, tracker))
uploads.HandleFunc("GET /{id}/info", contentInfoHandler(db, tracker))