Files
darkstorm-server/internal/darkstorm_backend/crash.go
T
Caleb Gardner e4f8b31e29 (Probably) finished with docs and interfaces.
Starting to build out the actual logic.
2024-05-21 05:50:07 -05:00

74 lines
1.2 KiB
Go

package darkstorm
import "net/http"
type ArchivedCrash struct {
Error string
Stack string
Platform string
}
type IndividualCrash struct {
Platform string
Error string
Stack string
Count int
}
type CrashReport struct {
ID string
Error string
FirstLine string
Individual []IndividualCrash
}
func (c CrashReport) GetID() string {
return c.ID
}
type crashReq struct {
ID string
Platform string
Error string
Stack string
}
func (b *Backend) reportCrash(w http.ResponseWriter, r *http.Request) {
hdr, err := b.ParseHeader(r)
if hdr.k == nil || hdr.k.Perm["crash"] {
w.WriteHeader(http.StatusUnauthorized)
return
}
if err != nil {
//TODO
return
}
//TODO
}
func (b *Backend) deleteCrash(w http.ResponseWriter, r *http.Request) {
hdr, err := b.ParseHeader(r)
if hdr.k == nil || hdr.k.Perm["management"] {
w.WriteHeader(http.StatusUnauthorized)
return
}
if err != nil {
//TODO
return
}
//TODO
}
func (b *Backend) archiveCrash(w http.ResponseWriter, r *http.Request) {
hdr, err := b.ParseHeader(r)
if hdr.k == nil || hdr.k.Perm["management"] {
w.WriteHeader(http.StatusUnauthorized)
return
}
if err != nil {
//TODO
return
}
//TODO
}