add v3 file path

This commit is contained in:
LinkLeong 2023-08-23 08:29:41 +01:00
parent b11d046c52
commit 3f1c7098bd
3 changed files with 8 additions and 3 deletions

View file

@ -173,7 +173,7 @@ func GetConfig() Onedrive {
config.ClientID = client_id config.ClientID = client_id
config.ClientSecret = client_secret config.ClientSecret = client_secret
config.RootFolderID = "/" config.RootFolderID = "/"
config.AuthUrl = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=" + client_id + "&response_type=code&redirect_uri=https%3A%2F%2Fcloudoauth.files.casaos.app%2Fcallback&scope=offline_access+files.readwrite.all&state=${HOST}%2Fv2%2Frecover%2FOnedrive" config.AuthUrl = "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=" + client_id + "&response_type=code&redirect_uri=https%3A%2F%2Fcloudoauth.files.casaos.app&scope=offline_access+files.readwrite.all&state=${HOST}%2Fv2%2Frecover%2FOnedrive"
config.Icon = "./img/driver/OneDrive.svg" config.Icon = "./img/driver/OneDrive.svg"
config.Region = "global" config.Region = "global"
config.RedirectUri = "https://cloudoauth.files.casaos.app" config.RedirectUri = "https://cloudoauth.files.casaos.app"

View file

@ -109,10 +109,12 @@ func main() {
v2Router := route.InitV2Router() v2Router := route.InitV2Router()
v2DocRouter := route.InitV2DocRouter(_docHTML, _docYAML) v2DocRouter := route.InitV2DocRouter(_docHTML, _docYAML)
v3File := route.InitFile()
mux := &util_http.HandlerMultiplexer{ mux := &util_http.HandlerMultiplexer{
HandlerMap: map[string]http.Handler{ HandlerMap: map[string]http.Handler{
"v1": v1Router, "v1": v1Router,
"v2": v2Router, "v2": v2Router,
"v3": v3File,
"doc": v2DocRouter, "doc": v2DocRouter,
}, },
} }
@ -146,6 +148,7 @@ func main() {
"/v1/test", "/v1/test",
route.V2APIPath, route.V2APIPath,
route.V2DocPath, route.V2DocPath,
route.V3FilePath,
} }
for _, apiPath := range routers { for _, apiPath := range routers {
err = service.MyService.Gateway().CreateRoute(&model.Route{ err = service.MyService.Gateway().CreateRoute(&model.Route{

View file

@ -27,8 +27,9 @@ import (
var ( var (
_swagger *openapi3.T _swagger *openapi3.T
V2APIPath string V2APIPath string
V2DocPath string V2DocPath string
V3FilePath string
) )
func init() { func init() {
@ -46,6 +47,7 @@ func init() {
V2APIPath = strings.TrimRight(u.Path, "/") V2APIPath = strings.TrimRight(u.Path, "/")
V2DocPath = "/doc" + V2APIPath V2DocPath = "/doc" + V2APIPath
V3FilePath = "/v3/file"
} }
func InitV2Router() http.Handler { func InitV2Router() http.Handler {