add no cors config

This commit is contained in:
Xhofe
2021-12-25 16:44:32 +08:00
parent 91c2c21522
commit 36f07ee194
6 changed files with 23 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"github.com/go-resty/resty/v2"
log "github.com/sirupsen/logrus"
"net/http"
"strings"
)
type DriverConfig struct {
@ -14,6 +15,7 @@ type DriverConfig struct {
NoLink bool // 必须本机返回的
ApiProxy bool // 使用API中转的
NeedSetLink bool // 需要设置链接的
NoCors bool // 不可以跨域
}
type Args struct {
@ -75,6 +77,16 @@ func GetDriver(name string) (driver Driver, ok bool) {
return
}
func GetNoCors() string {
res := make([]string, 0)
for k, v := range driversMap {
if v.Config().NoCors {
res = append(res, k)
}
}
return strings.Join(res, ",")
}
func GetDrivers() map[string][]Item {
res := make(map[string][]Item, 0)
for k, v := range driversMap {