From 3f1c7098bdeb116eb4161e86a3e24ba49c4de81a Mon Sep 17 00:00:00 2001 From: LinkLeong Date: Wed, 23 Aug 2023 08:29:41 +0100 Subject: [PATCH] add v3 file path --- drivers/onedrive/util.go | 2 +- main.go | 3 +++ route/v2.go | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/onedrive/util.go b/drivers/onedrive/util.go index e6ceeb7..8d7fa2f 100644 --- a/drivers/onedrive/util.go +++ b/drivers/onedrive/util.go @@ -173,7 +173,7 @@ func GetConfig() Onedrive { config.ClientID = client_id config.ClientSecret = client_secret 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.Region = "global" config.RedirectUri = "https://cloudoauth.files.casaos.app" diff --git a/main.go b/main.go index 0240a0e..8e3cca1 100644 --- a/main.go +++ b/main.go @@ -109,10 +109,12 @@ func main() { v2Router := route.InitV2Router() v2DocRouter := route.InitV2DocRouter(_docHTML, _docYAML) + v3File := route.InitFile() mux := &util_http.HandlerMultiplexer{ HandlerMap: map[string]http.Handler{ "v1": v1Router, "v2": v2Router, + "v3": v3File, "doc": v2DocRouter, }, } @@ -146,6 +148,7 @@ func main() { "/v1/test", route.V2APIPath, route.V2DocPath, + route.V3FilePath, } for _, apiPath := range routers { err = service.MyService.Gateway().CreateRoute(&model.Route{ diff --git a/route/v2.go b/route/v2.go index dbe7ead..e68c566 100644 --- a/route/v2.go +++ b/route/v2.go @@ -27,8 +27,9 @@ import ( var ( _swagger *openapi3.T - V2APIPath string - V2DocPath string + V2APIPath string + V2DocPath string + V3FilePath string ) func init() { @@ -46,6 +47,7 @@ func init() { V2APIPath = strings.TrimRight(u.Path, "/") V2DocPath = "/doc" + V2APIPath + V3FilePath = "/v3/file" } func InitV2Router() http.Handler {