mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-11-07 07:09:46 +00:00
Update zt
This commit is contained in:
parent
a645a7bb22
commit
5044874281
@ -13,7 +13,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *CasaOS) SetZerotierNetworkStatus(ctx echo.Context, networkId string) error {
|
func (s *CasaOS) SetZerotierNetworkStatus(ctx echo.Context, networkId string) error {
|
||||||
ip := `,"via":"10.147.20.256"`
|
ip := `,"via":"10.147.19.0"`
|
||||||
status := ctx.Request().PostFormValue("status")
|
status := ctx.Request().PostFormValue("status")
|
||||||
if status == "online" {
|
if status == "online" {
|
||||||
ip = ``
|
ip = ``
|
||||||
@ -30,11 +30,12 @@ func (s *CasaOS) SetZerotierNetworkStatus(ctx echo.Context, networkId string) er
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return ctx.JSON(http.StatusInternalServerError, codegen.BaseResponse{Message: utils.Ptr(err.Error())})
|
return ctx.JSON(http.StatusInternalServerError, codegen.BaseResponse{Message: utils.Ptr(err.Error())})
|
||||||
}
|
}
|
||||||
|
fmt.Println(string(res))
|
||||||
info := codegen.GetZTInfoOK{}
|
info := codegen.GetZTInfoOK{}
|
||||||
via := gjson.GetBytes(res, "routes.0.via").Str
|
via := gjson.GetBytes(res, "routes.0.via").Str
|
||||||
info.Id = utils.Ptr(gjson.GetBytes(res, "id").Str)
|
info.Id = utils.Ptr(gjson.GetBytes(res, "id").Str)
|
||||||
info.Name = utils.Ptr(gjson.GetBytes(res, "name").Str)
|
info.Name = utils.Ptr(gjson.GetBytes(res, "name").Str)
|
||||||
if len(via) != 0 {
|
if len(via) == 0 {
|
||||||
info.Status = utils.Ptr("online")
|
info.Status = utils.Ptr("online")
|
||||||
} else {
|
} else {
|
||||||
info.Status = utils.Ptr("offline")
|
info.Status = utils.Ptr("offline")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user