Skip to content

Commit

Permalink
add entrypoints to for flags
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintWish committed Sep 28, 2024
1 parent b096f74 commit ab8e060
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
9 changes: 9 additions & 0 deletions cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ func Run(args []string) (error) {
r.Delete("/delete/{uuid}", con.UnsafeDeleteCharacter)
})

r.Route("/user", func(r chi.Router) {
r.Post("/ban/{steamid:[0-9]+}", con.NotAvailable)
r.Post("/unban/{steamid:[0-9]+}", con.NotAvailable)
r.Post("/admin/{steamid:[0-9]+}", con.NotAvailable)
r.Post("/unadmin/{steamid:[0-9]+}", con.NotAvailable)
r.Post("/donor/{steamid:[0-9]+}", con.NotAvailable)
r.Post("/undonor/{steamid:[0-9]+}", con.NotAvailable)
})

r.Get("/refresh", func(w http.ResponseWriter, r *http.Request) {
if err := a.LoadLists(); err != nil {
response.Error(w, err)
Expand Down
14 changes: 9 additions & 5 deletions internal/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ func New(service *service.Service, log *slog.Logger, cfg *config.Config, opts Op
}
}

// DEPRECIATED
func (c *Controller) DepreciatedAPIVersion(w http.ResponseWriter, r *http.Request) {
response.DepreciatedError(w)
}

func (c *Controller) NotAvailable(w http.ResponseWriter, r *http.Request) {
response.NotAvailable(w)
}

//GET map/{name}/{hash}
func (c *Controller) GetMapVerify(w http.ResponseWriter, r *http.Request) {
if !c.config.Verify.EnforceMap {
Expand Down Expand Up @@ -131,9 +140,4 @@ func (c *Controller) GetBanVerify(w http.ResponseWriter, r *http.Request) {

response.Result(w, false)
return
}

// DEPRECIATED
func (c *Controller) DepreciatedAPIVersion(w http.ResponseWriter, r *http.Request) {
response.DepreciatedError(w)
}
10 changes: 10 additions & 0 deletions pkg/response/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,14 @@ func DepreciatedError(w http.ResponseWriter) {
w: w,
}
resp.SendJson()
}

func NotAvailable(w http.ResponseWriter) {
resp := Response{
Status: false,
Code: http.StatusNotImplemented,
Error: "Not available!",
w: w,
}
resp.SendJson()
}

0 comments on commit ab8e060

Please sign in to comment.