mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-12-23 13:04:42 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cb6ef1d3f |
@@ -2,7 +2,7 @@ package common
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
SERVICENAME = "casaos"
|
SERVICENAME = "casaos"
|
||||||
VERSION = "0.4.14"
|
VERSION = "0.4.13"
|
||||||
BODY = " "
|
BODY = " "
|
||||||
RANW_NAME = "IceWhale-RemoteAccess"
|
RANW_NAME = "IceWhale-RemoteAccess"
|
||||||
)
|
)
|
||||||
|
|||||||
7
go.mod
7
go.mod
@@ -4,7 +4,7 @@ go 1.21
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d
|
github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d
|
||||||
github.com/IceWhaleTech/CasaOS-Common v0.4.11-alpha4
|
github.com/IceWhaleTech/CasaOS-Common v0.4.9-alpha6
|
||||||
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
|
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
|
||||||
github.com/deckarep/golang-set/v2 v2.3.0
|
github.com/deckarep/golang-set/v2 v2.3.0
|
||||||
github.com/deepmap/oapi-codegen v1.12.4
|
github.com/deepmap/oapi-codegen v1.12.4
|
||||||
@@ -17,7 +17,7 @@ require (
|
|||||||
github.com/golang/mock v1.6.0
|
github.com/golang/mock v1.6.0
|
||||||
github.com/gomodule/redigo v1.8.9
|
github.com/gomodule/redigo v1.8.9
|
||||||
github.com/google/go-github/v36 v36.0.0
|
github.com/google/go-github/v36 v36.0.0
|
||||||
github.com/google/uuid v1.5.0
|
github.com/google/uuid v1.3.0
|
||||||
github.com/googollee/go-socket.io v1.7.0
|
github.com/googollee/go-socket.io v1.7.0
|
||||||
github.com/gorilla/websocket v1.5.0
|
github.com/gorilla/websocket v1.5.0
|
||||||
github.com/h2non/filetype v1.1.3
|
github.com/h2non/filetype v1.1.3
|
||||||
@@ -66,7 +66,6 @@ require (
|
|||||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||||
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
|
||||||
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
|
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
|
||||||
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect
|
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect
|
||||||
github.com/golang/protobuf v1.5.3 // indirect
|
github.com/golang/protobuf v1.5.3 // indirect
|
||||||
@@ -79,7 +78,7 @@ require (
|
|||||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||||
github.com/jinzhu/now v1.1.5 // indirect
|
github.com/jinzhu/now v1.1.5 // indirect
|
||||||
github.com/josharian/intern v1.0.0 // indirect
|
github.com/josharian/intern v1.0.0 // indirect
|
||||||
github.com/klauspost/compress v1.16.7 // indirect
|
github.com/klauspost/compress v1.16.5 // indirect
|
||||||
github.com/klauspost/pgzip v1.2.5 // indirect
|
github.com/klauspost/pgzip v1.2.5 // indirect
|
||||||
github.com/labstack/echo-jwt/v4 v4.2.0 // indirect
|
github.com/labstack/echo-jwt/v4 v4.2.0 // indirect
|
||||||
github.com/labstack/gommon v0.4.2 // indirect
|
github.com/labstack/gommon v0.4.2 // indirect
|
||||||
|
|||||||
14
go.sum
14
go.sum
@@ -1,7 +1,7 @@
|
|||||||
github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d h1:62lEBImTxZ83pgzywgDNIrPPuQ+j4ep9QjqrWBn1hrU=
|
github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d h1:62lEBImTxZ83pgzywgDNIrPPuQ+j4ep9QjqrWBn1hrU=
|
||||||
github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d/go.mod h1:lW9x+yEjqKdPbE3+cf2fGPJXCw/hChX3Omi9QHTLFsQ=
|
github.com/Curtis-Milo/nat-type-identifier-go v0.0.0-20220215191915-18d42168c63d/go.mod h1:lW9x+yEjqKdPbE3+cf2fGPJXCw/hChX3Omi9QHTLFsQ=
|
||||||
github.com/IceWhaleTech/CasaOS-Common v0.4.11-alpha4 h1:W+kOJ3NcWCEAnZdjqmnjnhAG+aLbiVNXnOvV+1bHsB0=
|
github.com/IceWhaleTech/CasaOS-Common v0.4.9-alpha6 h1:ojExdb1fZDieTBYgNwopHAsW4FMGKkat4id8YwyyE0g=
|
||||||
github.com/IceWhaleTech/CasaOS-Common v0.4.11-alpha4/go.mod h1:513p+6RXPBFr98GQZbY1TCyt6Q0jWiuK6vh+gBTmNwA=
|
github.com/IceWhaleTech/CasaOS-Common v0.4.9-alpha6/go.mod h1:W/768nPd9BJXh+a72y8hUJNcmjDvyMqlXxlT+lOT3t4=
|
||||||
github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk=
|
github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk=
|
||||||
github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
|
github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=
|
||||||
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
|
||||||
@@ -84,8 +84,6 @@ github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1
|
|||||||
github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
|
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
|
||||||
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
|
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
|
||||||
github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=
|
github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=
|
||||||
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||||
github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
|
github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI=
|
||||||
@@ -121,8 +119,8 @@ github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbu
|
|||||||
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
|
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
|
||||||
github.com/google/safetext v0.0.0-20240104143208-7a7d9b3d812f h1:o2yGZLlsOj5H5uvtQNEdi6DeA0GbUP3lm0gWW5RvY0s=
|
github.com/google/safetext v0.0.0-20240104143208-7a7d9b3d812f h1:o2yGZLlsOj5H5uvtQNEdi6DeA0GbUP3lm0gWW5RvY0s=
|
||||||
github.com/google/safetext v0.0.0-20240104143208-7a7d9b3d812f/go.mod h1:H3K1Iu/utuCfa10JO+GsmKUYSWi7ug57Rk6GaDRHaaQ=
|
github.com/google/safetext v0.0.0-20240104143208-7a7d9b3d812f/go.mod h1:H3K1Iu/utuCfa10JO+GsmKUYSWi7ug57Rk6GaDRHaaQ=
|
||||||
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
|
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||||
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/googollee/go-socket.io v1.7.0 h1:ODcQSAvVIPvKozXtUGuJDV3pLwdpBLDs1Uoq/QHIlY8=
|
github.com/googollee/go-socket.io v1.7.0 h1:ODcQSAvVIPvKozXtUGuJDV3pLwdpBLDs1Uoq/QHIlY8=
|
||||||
github.com/googollee/go-socket.io v1.7.0/go.mod h1:0vGP8/dXR9SZUMMD4+xxaGo/lohOw3YWMh2WRiWeKxg=
|
github.com/googollee/go-socket.io v1.7.0/go.mod h1:0vGP8/dXR9SZUMMD4+xxaGo/lohOw3YWMh2WRiWeKxg=
|
||||||
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
|
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
|
||||||
@@ -150,8 +148,8 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm
|
|||||||
github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE=
|
github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE=
|
||||||
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||||
github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
|
||||||
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
|
github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI=
|
||||||
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
|
||||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||||
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
|
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
|
||||||
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
google_drive := google_drive.GetConfig()
|
google_drive := google_drive.GetConfig()
|
||||||
google_drive.Code = ctx.QueryParam("code")
|
google_drive.Code = ctx.QueryParam("code")
|
||||||
if len(google_drive.Code) == 0 {
|
if len(google_drive.Code) == 0 {
|
||||||
ctx.String(200, `<p>Code cannot be empty</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Code cannot be empty</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Code cannot be empty"
|
notify["message"] = "Code cannot be empty"
|
||||||
logger.Error("Then code is empty: ", zap.String("code", google_drive.Code), zap.Any("name", "google_drive"))
|
logger.Error("Then code is empty: ", zap.String("code", google_drive.Code), zap.Any("name", "google_drive"))
|
||||||
@@ -33,7 +33,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
|
|
||||||
err := google_drive.Init(ctx.Request().Context())
|
err := google_drive.Init(ctx.Request().Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.String(200, `<p>Initialization failure:`+err.Error()+`</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Initialization failure:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Initialization failure"
|
notify["message"] = "Initialization failure"
|
||||||
logger.Error("Then init error: ", zap.Error(err), zap.Any("name", "google_drive"))
|
logger.Error("Then init error: ", zap.Error(err), zap.Any("name", "google_drive"))
|
||||||
@@ -43,7 +43,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
|
|
||||||
username, err := google_drive.GetUserInfo(ctx.Request().Context())
|
username, err := google_drive.GetUserInfo(ctx.Request().Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.String(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Failed to get user information"
|
notify["message"] = "Failed to get user information"
|
||||||
logger.Error("Then get user info error: ", zap.Error(err), zap.Any("name", "google_drive"))
|
logger.Error("Then get user info error: ", zap.Error(err), zap.Any("name", "google_drive"))
|
||||||
@@ -53,7 +53,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
dmap["username"] = username
|
dmap["username"] = username
|
||||||
configs, err := service.MyService.Storage().GetConfig()
|
configs, err := service.MyService.Storage().GetConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.String(200, `<p>Failed to get rclone config:`+err.Error()+`</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Failed to get rclone config:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Failed to get rclone config"
|
notify["message"] = "Failed to get rclone config"
|
||||||
logger.Error("Then get config error: ", zap.Error(err), zap.Any("name", "google_drive"))
|
logger.Error("Then get config error: ", zap.Error(err), zap.Any("name", "google_drive"))
|
||||||
@@ -66,7 +66,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if cf["type"] == "drive" && cf["username"] == dmap["username"] {
|
if cf["type"] == "drive" && cf["username"] == dmap["username"] {
|
||||||
ctx.String(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
|
||||||
err := service.MyService.Storage().CheckAndMountByName(v)
|
err := service.MyService.Storage().CheckAndMountByName(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"]))
|
logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"]))
|
||||||
@@ -100,7 +100,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
dropbox := dropbox.GetConfig()
|
dropbox := dropbox.GetConfig()
|
||||||
dropbox.Code = ctx.QueryParam("code")
|
dropbox.Code = ctx.QueryParam("code")
|
||||||
if len(dropbox.Code) == 0 {
|
if len(dropbox.Code) == 0 {
|
||||||
ctx.String(200, `<p>Code cannot be empty</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Code cannot be empty</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Code cannot be empty"
|
notify["message"] = "Code cannot be empty"
|
||||||
logger.Error("Then code is empty error: ", zap.String("code", dropbox.Code), zap.Any("name", "dropbox"))
|
logger.Error("Then code is empty error: ", zap.String("code", dropbox.Code), zap.Any("name", "dropbox"))
|
||||||
@@ -109,7 +109,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
|
|
||||||
err := dropbox.Init(ctx.Request().Context())
|
err := dropbox.Init(ctx.Request().Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.String(200, `<p>Initialization failure:`+err.Error()+`</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Initialization failure:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Initialization failure"
|
notify["message"] = "Initialization failure"
|
||||||
logger.Error("Then init error: ", zap.Error(err), zap.Any("name", "dropbox"))
|
logger.Error("Then init error: ", zap.Error(err), zap.Any("name", "dropbox"))
|
||||||
@@ -117,7 +117,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
}
|
}
|
||||||
username, err := dropbox.GetUserInfo(ctx.Request().Context())
|
username, err := dropbox.GetUserInfo(ctx.Request().Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.String(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Failed to get user information"
|
notify["message"] = "Failed to get user information"
|
||||||
logger.Error("Then get user information: ", zap.Error(err), zap.Any("name", "dropbox"))
|
logger.Error("Then get user information: ", zap.Error(err), zap.Any("name", "dropbox"))
|
||||||
@@ -128,7 +128,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
|
|
||||||
configs, err := service.MyService.Storage().GetConfig()
|
configs, err := service.MyService.Storage().GetConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.String(200, `<p>Failed to get rclone config:`+err.Error()+`</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Failed to get rclone config:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Failed to get rclone config"
|
notify["message"] = "Failed to get rclone config"
|
||||||
logger.Error("Then get config error: ", zap.Error(err), zap.Any("name", "dropbox"))
|
logger.Error("Then get config error: ", zap.Error(err), zap.Any("name", "dropbox"))
|
||||||
@@ -141,7 +141,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if cf["type"] == "dropbox" && cf["username"] == dmap["username"] {
|
if cf["type"] == "dropbox" && cf["username"] == dmap["username"] {
|
||||||
ctx.String(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
|
||||||
err := service.MyService.Storage().CheckAndMountByName(v)
|
err := service.MyService.Storage().CheckAndMountByName(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"]))
|
logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"]))
|
||||||
@@ -185,7 +185,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
onedrive := onedrive.GetConfig()
|
onedrive := onedrive.GetConfig()
|
||||||
onedrive.Code = ctx.QueryParam("code")
|
onedrive.Code = ctx.QueryParam("code")
|
||||||
if len(onedrive.Code) == 0 {
|
if len(onedrive.Code) == 0 {
|
||||||
ctx.String(200, `<p>Code cannot be empty</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Code cannot be empty</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Code cannot be empty"
|
notify["message"] = "Code cannot be empty"
|
||||||
logger.Error("Then code is empty error: ", zap.String("code", onedrive.Code), zap.Any("name", "onedrive"))
|
logger.Error("Then code is empty error: ", zap.String("code", onedrive.Code), zap.Any("name", "onedrive"))
|
||||||
@@ -194,7 +194,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
|
|
||||||
err := onedrive.Init(ctx.Request().Context())
|
err := onedrive.Init(ctx.Request().Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.String(200, `<p>Initialization failure:`+err.Error()+`</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Initialization failure:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Initialization failure"
|
notify["message"] = "Initialization failure"
|
||||||
logger.Error("Then init error: ", zap.Error(err), zap.Any("name", "onedrive"))
|
logger.Error("Then init error: ", zap.Error(err), zap.Any("name", "onedrive"))
|
||||||
@@ -202,7 +202,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
}
|
}
|
||||||
username, driveId, driveType, err := onedrive.GetInfo(ctx.Request().Context())
|
username, driveId, driveType, err := onedrive.GetInfo(ctx.Request().Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.String(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Failed to get user information:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Failed to get user information"
|
notify["message"] = "Failed to get user information"
|
||||||
logger.Error("Then get user information: ", zap.Error(err), zap.Any("name", "onedrive"))
|
logger.Error("Then get user information: ", zap.Error(err), zap.Any("name", "onedrive"))
|
||||||
@@ -213,7 +213,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
|
|
||||||
configs, err := service.MyService.Storage().GetConfig()
|
configs, err := service.MyService.Storage().GetConfig()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.String(200, `<p>Failed to get rclone config:`+err.Error()+`</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>Failed to get rclone config:`+err.Error()+`</p><script>window.close()</script>`)
|
||||||
notify["status"] = "fail"
|
notify["status"] = "fail"
|
||||||
notify["message"] = "Failed to get rclone config"
|
notify["message"] = "Failed to get rclone config"
|
||||||
logger.Error("Then get config error: ", zap.Error(err), zap.Any("name", "onedrive"))
|
logger.Error("Then get config error: ", zap.Error(err), zap.Any("name", "onedrive"))
|
||||||
@@ -226,7 +226,7 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if cf["type"] == "onedrive" && cf["username"] == dmap["username"] {
|
if cf["type"] == "onedrive" && cf["username"] == dmap["username"] {
|
||||||
ctx.String(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
|
ctx.HTML(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
|
||||||
err := service.MyService.Storage().CheckAndMountByName(v)
|
err := service.MyService.Storage().CheckAndMountByName(v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"]))
|
logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"]))
|
||||||
@@ -270,5 +270,5 @@ func GetRecoverStorage(ctx echo.Context) error {
|
|||||||
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
service.MyService.Notify().SendNotify("casaos:file:recover", notify)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.String(200, `<p>Just close the page</p><script>window.close()</script>`)
|
return ctx.HTML(200, `<p>Just close the page</p><script>window.close()</script>`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user