Add support for localhost unauthenticated requests
- Introduced `AllowLocalhostUnauthenticated` flag allowing unauthenticated requests from localhost. - Updated authentication middleware to bypass checks for localhost when enabled. Add new Gemini CLI models and update model registry function - Introduced `GetGeminiCLIModels` for updated Gemini CLI model definitions. - Added new models: "Gemini 2.5 Flash Lite" and "Gemini 2.5 Pro". - Updated `RegisterModels` to use `GetGeminiCLIModels` in Gemini client initialization.
This commit is contained in:
@@ -233,6 +233,11 @@ func (s *Server) UpdateClients(clients []interfaces.Client, cfg *config.Config)
|
||||
// - gin.HandlerFunc: The authentication middleware handler
|
||||
func AuthMiddleware(cfg *config.Config) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
if cfg.AllowLocalhostUnauthenticated && strings.HasPrefix(c.Request.RemoteAddr, "127.0.0.1:") {
|
||||
c.Next()
|
||||
return
|
||||
}
|
||||
|
||||
if len(cfg.APIKeys) == 0 {
|
||||
c.Next()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user