go-proxy-bingai/api/index.go
adams549659584 681b0caf97 fix: 🐛 fix auth
2023-05-26 15:12:41 +08:00

24 lines
485 B
Go

package api
import (
"adams549659584/go-proxy-bingai/api/helper"
"adams549659584/go-proxy-bingai/common"
"net/http"
"strings"
)
func Index(w http.ResponseWriter, r *http.Request) {
if r.URL.Path == "/" {
http.Redirect(w, r, common.PROXY_WEB_PAGE_PATH, http.StatusFound)
return
}
if strings.HasPrefix("/turing", r.URL.Path) {
if !helper.CheckAuth(r) {
helper.UnauthorizedResult(w)
return
}
}
common.NewSingleHostReverseProxy(common.BING_URL).ServeHTTP(w, r)
}