mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-04-21 07:02:05 +00:00
feat(security): add configuration to toggle Gemini CLI endpoint access
Closes: #2445
This commit is contained in:
@@ -50,6 +50,16 @@ func (h *GeminiCLIAPIHandler) Models() []map[string]any {
|
||||
// CLIHandler handles CLI-specific requests for Gemini API operations.
|
||||
// It restricts access to localhost only and routes requests to appropriate internal handlers.
|
||||
func (h *GeminiCLIAPIHandler) CLIHandler(c *gin.Context) {
|
||||
if h.Cfg == nil || !h.Cfg.EnableGeminiCLIEndpoint {
|
||||
c.JSON(http.StatusForbidden, handlers.ErrorResponse{
|
||||
Error: handlers.ErrorDetail{
|
||||
Message: "Gemini CLI endpoint is disabled",
|
||||
Type: "forbidden",
|
||||
},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
requestHost := c.Request.Host
|
||||
requestHostname := requestHost
|
||||
if hostname, _, errSplitHostPort := net.SplitHostPort(requestHost); errSplitHostPort == nil {
|
||||
|
||||
Reference in New Issue
Block a user