Finished with crash requests

Change Log to Count
Added option to get user count
Moved functions to VerifyHeader
Added user delete
This commit is contained in:
Caleb Gardner
2024-06-11 13:42:58 -05:00
parent 99c881b51e
commit df3fe83c5f
8 changed files with 241 additions and 84 deletions
+36 -5
View File
@@ -1,17 +1,48 @@
package darkstorm
import "net/http"
import (
"log"
"net/http"
)
type Log struct {
type CountLog struct {
ID string
Platform string
Date int
}
func (l Log) GetID() string {
return l.ID
func (c CountLog) GetID() string {
return c.ID
}
func (b *Backend) log(w http.ResponseWriter, r *http.Request) {
func (b *Backend) countLog(w http.ResponseWriter, r *http.Request) {
hdr, err := b.VerifyHeader(w, r, "count", false)
if hdr == nil {
if err == nil {
log.Println("request key parsing error:", err)
}
return
}
//TODO
}
func (b *Backend) getCount(w http.ResponseWriter, r *http.Request) {
hdr, err := b.VerifyHeader(w, r, "management", true)
if hdr == nil {
if err == nil {
log.Println("request key parsing error:", err)
}
return
}
var ap App
if hdr.Key.AppID == b.managementKeyID {
ap = b.apps[r.PathValue("appID")]
if ap == nil {
ReturnError(w, http.StatusBadRequest, "badRequest", "Bad request")
return
}
} else {
ap = b.GetApp(hdr.Key)
}
//TODO
}