From 8dc5af9406fbf989dfe04a1a3a79a5c82c65cca7 Mon Sep 17 00:00:00 2001 From: Howl Date: Mon, 21 Nov 2016 17:04:27 +0100 Subject: [PATCH] Rename quite a few methods --- app/start.go | 4 ++-- app/v1/meta_linux.go | 2 ++ app/v1/token.go | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/start.go b/app/start.go index b586da8..a20a271 100644 --- a/app/start.go +++ b/app/start.go @@ -90,7 +90,7 @@ func Start(conf common.Conf, dbO *sqlx.DB) *gin.Engine { { gv1.POST("/tokens", Method(v1.TokenNewPOST)) gv1.POST("/tokens/new", Method(v1.TokenNewPOST)) - gv1.POST("/tokens/self/delete", Method(v1.TokenSelfDeleteGET)) + gv1.POST("/tokens/self/delete", Method(v1.TokenSelfDeletePOST)) // Auth-free API endpoints (public data) gv1.GET("/ping", Method(v1.PingGET)) @@ -147,7 +147,7 @@ func Start(conf common.Conf, dbO *sqlx.DB) *gin.Engine { gv1.GET("/meta/update", Method(v1.MetaUpdateGET, common.PrivilegeAPIMeta)) // User Managing + meta - gv1.GET("/tokens/fix_privileges", Method(v1.TokenFixPrivilegesGET, + gv1.POST("/tokens/fix_privileges", Method(v1.TokenFixPrivilegesPOST, common.PrivilegeManageUser, common.PrivilegeAPIMeta)) // in the new osu-web, the old endpoints are also in /v1 it seems. So /shrug diff --git a/app/v1/meta_linux.go b/app/v1/meta_linux.go index 2e49b9d..c094271 100644 --- a/app/v1/meta_linux.go +++ b/app/v1/meta_linux.go @@ -1,5 +1,7 @@ // +build !windows +// TODO: Make all these methods POST + package v1 import ( diff --git a/app/v1/token.go b/app/v1/token.go index 8064c6a..bee4431 100644 --- a/app/v1/token.go +++ b/app/v1/token.go @@ -131,8 +131,8 @@ func TokenNewPOST(md common.MethodData) common.CodeMessager { return r } -// TokenSelfDeleteGET deletes the token the user is connecting with. -func TokenSelfDeleteGET(md common.MethodData) common.CodeMessager { +// TokenSelfDeletePOST deletes the token the user is connecting with. +func TokenSelfDeletePOST(md common.MethodData) common.CodeMessager { if md.ID() == 0 { return common.SimpleResponse(400, "How should we delete your token if you haven't even given us one?!") } @@ -199,9 +199,9 @@ func TokenSelfGET(md common.MethodData) common.CodeMessager { return r } -// TokenFixPrivilegesGET fixes the privileges on the token of the given user, +// TokenFixPrivilegesPOST fixes the privileges on the token of the given user, // or of all the users if no user is given. -func TokenFixPrivilegesGET(md common.MethodData) common.CodeMessager { +func TokenFixPrivilegesPOST(md common.MethodData) common.CodeMessager { id := common.Int(md.Query("id")) if md.Query("id") == "self" { id = md.ID()