Skip to content

Commit

Permalink
Merge pull request #73 from Xunop/main
Browse files Browse the repository at this point in the history
Clean up comments for better readability and clarity
  • Loading branch information
Xunop authored Mar 13, 2024
2 parents ec86f82 + d79da5b commit aff0f2b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
11 changes: 0 additions & 11 deletions api/v1/oauth_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,6 @@ func Authorize(c *gin.Context) {
// Redirect user to login page if user not login or
// Get code directly if user has logged in
err := srv.HandleAuthorizeRequest(w, r)
// clients, _ := srv.Manager.GetClient(c, r.Form.Get("client_id"))
// var item ClientStoreItem
// if err := clientAdapter.SelectOne(c, &item, fmt.Sprintf("SELECT * FROM %s WHERE id = $1", "oauth2_clients"), r.Form.Get("client_id")); err != nil {
// log.Log.Errorf("\n----DEBUG----: %s\n", err.Error())
// log.Log.Printf("\nau :: client: %s\n", item)
// log.Log.Printf("\nau :: client_id: %s\n", r.Form.Get("client_id"))
// log.Log.Errorf("\n----DEBUG----: %s\n", err.Error())
// return
// }
// log.Log.Printf("\nau :: client: %s\n", clients)
// log.Log.Printf("\nau :: client_id: %s\n", r.Form.Get("client_id"))
if err != nil {
c.JSON(http.StatusInternalServerError, result.Failed(result.InternalErr.Wrap(err)))
return
Expand Down
6 changes: 1 addition & 5 deletions middleware/request_limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ import (
"github.com/gin-gonic/gin"
)

func HelloHandler(w http.ResponseWriter, req *http.Request) {
w.Write([]byte("Hello, World!"))
}

// Custom limiter
// Example: RequestRateLimiter(3, time.Minute) represents 3 requests per minute
func RequestRateLimiter(maxRequests int64, period time.Duration) gin.HandlerFunc {
rate := float64(maxRequests) / float64(period.Seconds())
limiter := tollbooth.NewLimiter(rate, nil)
Expand Down

0 comments on commit aff0f2b

Please sign in to comment.