Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1886c9954b | ||
|
|
c942503351 | ||
|
|
806fc42379 | ||
|
|
06a49f0272 | ||
|
|
a99bcdc437 | ||
|
|
2d4378423b |
@@ -1,7 +1,7 @@
|
||||
FROM alpine:latest
|
||||
LABEL maintainer="goedge.cdn@gmail.com"
|
||||
ENV TZ "Asia/Shanghai"
|
||||
ENV VERSION 1.2.1
|
||||
ENV VERSION 1.2.2
|
||||
ENV ROOT_DIR /usr/local/goedge
|
||||
ENV TAR_FILE edge-admin-linux-amd64-plus-v${VERSION}.zip
|
||||
ENV TAR_URL "https://dl.goedge.cn/edge/v${VERSION}/edge-admin-linux-amd64-plus-v${VERSION}.zip"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package teaconst
|
||||
|
||||
const (
|
||||
Version = "1.2.1"
|
||||
Version = "1.2.2"
|
||||
|
||||
APINodeVersion = "1.2.1"
|
||||
APINodeVersion = "1.2.2"
|
||||
|
||||
ProductName = "Edge Admin"
|
||||
ProcessName = "edge-admin"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
)
|
||||
@@ -22,3 +23,8 @@ func JSONClone(v interface{}) (interface{}, error) {
|
||||
|
||||
return nv, nil
|
||||
}
|
||||
|
||||
// 判断JSON数据是否为null
|
||||
func JSONIsNull(jsonData []byte) bool {
|
||||
return len(jsonData) == 0 || bytes.Equal(jsonData, []byte("null"))
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package utils_test
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
||||
"github.com/iwind/TeaGo/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -23,3 +24,12 @@ func TestJSONClone(t *testing.T) {
|
||||
t.Logf("%p, %#v", c, c)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func TestJSONIsNull(t *testing.T) {
|
||||
var a = assert.NewAssertion(t)
|
||||
a.IsTrue(utils.JSONIsNull(nil))
|
||||
a.IsTrue(utils.JSONIsNull([]byte{}))
|
||||
a.IsTrue(utils.JSONIsNull([]byte("null")))
|
||||
a.IsFalse(utils.JSONIsNull([]byte{1, 2, 3}))
|
||||
}
|
||||
@@ -28,7 +28,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
}
|
||||
this.Data["webId"] = webConfig.Id
|
||||
|
||||
locationMaps := []maps.Map{}
|
||||
var locationMaps = []maps.Map{}
|
||||
if webConfig.Locations != nil {
|
||||
for _, location := range webConfig.Locations {
|
||||
err := location.ExtractPattern()
|
||||
@@ -46,7 +46,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
pieces := strings.Split(location.Pattern, " ")
|
||||
var pieces = strings.Split(location.Pattern, " ")
|
||||
if len(pieces) == 2 {
|
||||
m["pattern"] = pieces[1]
|
||||
m["patternTypeName"] = serverconfigs.FindLocationPatternTypeName(location.PatternType())
|
||||
|
||||
@@ -23,7 +23,12 @@ func (this *IndexAction) Init() {
|
||||
func (this *IndexAction) RunGet(params struct {
|
||||
LocationId int64
|
||||
}) {
|
||||
locationConfig := this.Data.Get("locationConfig").(*serverconfigs.HTTPLocationConfig)
|
||||
var location = this.Data.Get("locationConfig")
|
||||
if location == nil {
|
||||
this.NotFound("location", params.LocationId)
|
||||
return
|
||||
}
|
||||
var locationConfig = location.(*serverconfigs.HTTPLocationConfig)
|
||||
|
||||
this.Data["patternTypes"] = serverconfigs.AllLocationPatternTypes()
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@ func NewLocationHelper() *LocationHelper {
|
||||
}
|
||||
|
||||
func (this *LocationHelper) BeforeAction(actionPtr actions.ActionWrapper) {
|
||||
action := actionPtr.Object()
|
||||
var action = actionPtr.Object()
|
||||
if action.Request.Method != http.MethodGet {
|
||||
return
|
||||
}
|
||||
|
||||
serverIdString := action.ParamString("serverId")
|
||||
locationIdString := action.ParamString("locationId")
|
||||
var serverIdString = action.ParamString("serverId")
|
||||
var locationIdString = action.ParamString("locationId")
|
||||
|
||||
action.Data["leftMenuItemIsDisabled"] = true
|
||||
action.Data["mainMenu"] = "server"
|
||||
@@ -39,7 +39,7 @@ func (this *LocationHelper) BeforeAction(actionPtr actions.ActionWrapper) {
|
||||
if parentActionValue.IsValid() {
|
||||
parentAction, isOk := parentActionValue.Interface().(actionutils.ParentAction)
|
||||
if isOk {
|
||||
locationId := action.ParamInt64("locationId")
|
||||
var locationId = action.ParamInt64("locationId")
|
||||
locationConfig, isOk := FindLocationConfig(&parentAction, locationId)
|
||||
if !isOk {
|
||||
return
|
||||
|
||||
@@ -2,9 +2,12 @@ package locationutils
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
"github.com/iwind/TeaGo/types"
|
||||
)
|
||||
|
||||
// FindLocationConfig 查找路由规则配置
|
||||
@@ -15,6 +18,11 @@ func FindLocationConfig(parentAction *actionutils.ParentAction, locationId int64
|
||||
return
|
||||
}
|
||||
|
||||
if utils.JSONIsNull(locationConfigResp.LocationJSON) {
|
||||
parentAction.ErrorPage(errors.New("location '" + types.String(locationId) + "' not found"))
|
||||
return
|
||||
}
|
||||
|
||||
locationConfig = &serverconfigs.HTTPLocationConfig{}
|
||||
err = json.Unmarshal(locationConfigResp.LocationJSON, locationConfig)
|
||||
if err != nil {
|
||||
|
||||
@@ -4538,7 +4538,7 @@ example2.com
|
||||
<div style="margin-top: 1em" v-if="!isAdding">
|
||||
<button type="button" class="ui button tiny" @click.prevent="add">+</button>
|
||||
</div>
|
||||
</div>`}),Vue.component("http-web-root-box",{props:["v-root-config","v-is-location","v-is-group"],data:function(){let e=this.vRootConfig;return null==(e=null==e?{isPrior:!1,isOn:!0,dir:"",indexes:[],stripPrefix:"",decodePath:!1,isBreak:!1}:e).indexes&&(e.indexes=[]),{rootConfig:e,advancedVisible:!1}},methods:{changeAdvancedVisible:function(e){this.advancedVisible=e},addIndex:function(){let t=this;teaweb.popup("/servers/server/settings/web/createIndex",{height:"10em",callback:function(e){t.rootConfig.indexes.push(e.data.index)}})},removeIndex:function(e){this.rootConfig.indexes.$remove(e)},isOn:function(){return(!this.vIsLocation&&!this.vIsGroup||this.rootConfig.isPrior)&&this.rootConfig.isOn}},template:`<div>
|
||||
</div>`}),Vue.component("http-web-root-box",{props:["v-root-config","v-is-location","v-is-group"],data:function(){let e=this.vRootConfig;return null==(e=null==e?{isPrior:!1,isOn:!1,dir:"",indexes:[],stripPrefix:"",decodePath:!1,isBreak:!1}:e).indexes&&(e.indexes=[]),{rootConfig:e,advancedVisible:!1}},methods:{changeAdvancedVisible:function(e){this.advancedVisible=e},addIndex:function(){let t=this;teaweb.popup("/servers/server/settings/web/createIndex",{height:"10em",callback:function(e){t.rootConfig.indexes.push(e.data.index)}})},removeIndex:function(e){this.rootConfig.indexes.$remove(e)},isOn:function(){return(!this.vIsLocation&&!this.vIsGroup||this.rootConfig.isPrior)&&this.rootConfig.isOn}},template:`<div>
|
||||
<input type="hidden" name="rootJSON" :value="JSON.stringify(rootConfig)"/>
|
||||
<table class="ui table selectable definition">
|
||||
<prior-checkbox :v-config="rootConfig" v-if="vIsLocation || vIsGroup"></prior-checkbox>
|
||||
|
||||
@@ -12676,7 +12676,7 @@ Vue.component("http-web-root-box", {
|
||||
if (rootConfig == null) {
|
||||
rootConfig = {
|
||||
isPrior: false,
|
||||
isOn: true,
|
||||
isOn: false,
|
||||
dir: "",
|
||||
indexes: [],
|
||||
stripPrefix: "",
|
||||
|
||||
@@ -5,7 +5,7 @@ Vue.component("http-web-root-box", {
|
||||
if (rootConfig == null) {
|
||||
rootConfig = {
|
||||
isPrior: false,
|
||||
isOn: true,
|
||||
isOn: false,
|
||||
dir: "",
|
||||
indexes: [],
|
||||
stripPrefix: "",
|
||||
|
||||
Reference in New Issue
Block a user