Update network name

This commit is contained in:
LinkLeong 2023-05-23 09:39:02 +01:00
parent e2c81f8099
commit 9b025c099f
3 changed files with 7 additions and 4 deletions

View File

@ -4,4 +4,5 @@ const (
SERVICENAME = "casaos" SERVICENAME = "casaos"
VERSION = "0.4.4" VERSION = "0.4.4"
BODY = "" BODY = ""
RANW_NAME = "IceWhale-RemoteAccess"
) )

View File

@ -6,6 +6,7 @@ import (
"net/http" "net/http"
"strings" "strings"
"github.com/IceWhaleTech/CasaOS/common"
"github.com/IceWhaleTech/CasaOS/pkg/utils/httper" "github.com/IceWhaleTech/CasaOS/pkg/utils/httper"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
@ -91,7 +92,7 @@ func CheckNetwork(c *gin.Context) {
return return
} }
name := gjson.GetBytes(res, "name").Str name := gjson.GetBytes(res, "name").Str
if name == "icewhale-casaos" { if name == common.RANW_NAME {
fmt.Println(string(res)) fmt.Println(string(res))
networkId = gjson.GetBytes(res, "id").Str networkId = gjson.GetBytes(res, "id").Str
break break
@ -156,7 +157,7 @@ func JoinAndUpdateNet(address, networkId string) {
} }
func CreateNet(address string) string { func CreateNet(address string) string {
body := `{ body := `{
"name": "icewhale-casaos", "name": "` + common.RANW_NAME + `",
"private": false, "private": false,
"v4AssignMode": { "v4AssignMode": {
"zt": true "zt": true

View File

@ -6,6 +6,7 @@ import (
"github.com/IceWhaleTech/CasaOS-Common/utils" "github.com/IceWhaleTech/CasaOS-Common/utils"
"github.com/IceWhaleTech/CasaOS/codegen" "github.com/IceWhaleTech/CasaOS/codegen"
"github.com/IceWhaleTech/CasaOS/common"
"github.com/IceWhaleTech/CasaOS/pkg/utils/httper" "github.com/IceWhaleTech/CasaOS/pkg/utils/httper"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/tidwall/gjson" "github.com/tidwall/gjson"
@ -55,7 +56,7 @@ func (s *CasaOS) GetZerotierInfo(ctx echo.Context) error {
return ctx.JSON(http.StatusInternalServerError, codegen.BaseResponse{Message: utils.Ptr(err.Error())}) return ctx.JSON(http.StatusInternalServerError, codegen.BaseResponse{Message: utils.Ptr(err.Error())})
} }
name := gjson.GetBytes(res, "name").Str name := gjson.GetBytes(res, "name").Str
if name == "icewhale-casaos" { if name == common.RANW_NAME {
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 = &name info.Name = &name