2026-05-19 18:56:17 +08:00
|
|
|
package middleware
|
|
|
|
|
|
2026-08-24 21:50:48 +08:00
|
|
|
import (
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
"github.com/1Panel-dev/1Panel/core/utils/publicshare"
|
|
|
|
|
)
|
2026-05-19 18:56:17 +08:00
|
|
|
|
|
|
|
|
func ShouldProxyToAgent(reqPath string) bool {
|
|
|
|
|
if strings.HasPrefix(reqPath, "/1panel/swagger") || !strings.HasPrefix(reqPath, "/api/v2") {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
if strings.HasPrefix(reqPath, "/api/v2/core") && !strings.HasPrefix(reqPath, "/api/v2/core/xpack") {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
return true
|
|
|
|
|
}
|
2026-08-04 09:37:26 +08:00
|
|
|
|
|
|
|
|
func IsPublicFileShareAPI(reqPath string) bool {
|
2026-08-24 21:50:48 +08:00
|
|
|
return publicshare.IsAPI(reqPath)
|
2026-08-04 09:37:26 +08:00
|
|
|
}
|