Skip to content

Commit

Permalink
add v3 file path
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkLeong committed Aug 23, 2023
1 parent b11d046 commit 3f1c709
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion drivers/onedrive/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
Expand Down Expand Up @@ -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{
Expand Down
6 changes: 4 additions & 2 deletions route/v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ import (
var (
_swagger *openapi3.T

V2APIPath string
V2DocPath string
V2APIPath string
V2DocPath string
V3FilePath string
)

func init() {
Expand All @@ -46,6 +47,7 @@ func init() {

V2APIPath = strings.TrimRight(u.Path, "/")
V2DocPath = "/doc" + V2APIPath
V3FilePath = "/v3/file"
}

func InitV2Router() http.Handler {
Expand Down

0 comments on commit 3f1c709

Please sign in to comment.