diff --git a/internal/web/actions/default/log/exportExcel.go b/internal/web/actions/default/log/exportExcel.go index c20dfa3f..e97454f8 100644 --- a/internal/web/actions/default/log/exportExcel.go +++ b/internal/web/actions/default/log/exportExcel.go @@ -4,7 +4,6 @@ import ( "bytes" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" - "github.com/iwind/TeaGo/lists" timeutil "github.com/iwind/TeaGo/utils/time" "github.com/tealeg/xlsx/v3" "strconv" @@ -69,17 +68,13 @@ func (this *ExportExcelAction) RunGet(params struct { return } if regionResp.IpRegion != nil { - pieces := []string{} - if len(regionResp.IpRegion.Country) > 0 { - pieces = append(pieces, regionResp.IpRegion.Country) + regionName = regionResp.IpRegion.Summary + + // remove isp from regionName + var index = strings.LastIndex(regionName, "|") + if index > 0 { + regionName = regionName[:index] } - if len(regionResp.IpRegion.Province) > 0 && !lists.ContainsString(pieces, regionResp.IpRegion.Province) { - pieces = append(pieces, regionResp.IpRegion.Province) - } - if len(regionResp.IpRegion.City) > 0 && !lists.ContainsString(pieces, regionResp.IpRegion.City) && !lists.ContainsString(pieces, strings.TrimSuffix(regionResp.IpRegion.Province, "市")) { - pieces = append(pieces, regionResp.IpRegion.City) - } - regionName = strings.Join(pieces, " ") if len(regionResp.IpRegion.Isp) > 0 { ispName = regionResp.IpRegion.Isp diff --git a/internal/web/actions/default/log/index.go b/internal/web/actions/default/log/index.go index 3d2f2704..6a61dc38 100644 --- a/internal/web/actions/default/log/index.go +++ b/internal/web/actions/default/log/index.go @@ -4,10 +4,8 @@ import ( "github.com/TeaOSLab/EdgeAdmin/internal/configloaders" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" - "github.com/iwind/TeaGo/lists" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" - "strings" ) type IndexAction struct { @@ -72,11 +70,7 @@ func (this *IndexAction) RunGet(params struct { return } if regionResp.IpRegion != nil { - pieces := []string{regionResp.IpRegion.Summary} - if len(regionResp.IpRegion.Isp) > 0 && !lists.ContainsString(pieces, regionResp.IpRegion.Isp) { - pieces = append(pieces, "| "+regionResp.IpRegion.Isp) - } - regionName = strings.Join(pieces, " ") + regionName = regionResp.IpRegion.Summary } logMaps = append(logMaps, maps.Map{ diff --git a/internal/web/actions/default/servers/ipbox/index.go b/internal/web/actions/default/servers/ipbox/index.go index 5b3e0858..d8b4d249 100644 --- a/internal/web/actions/default/servers/ipbox/index.go +++ b/internal/web/actions/default/servers/ipbox/index.go @@ -7,6 +7,7 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" + "strings" "time" ) @@ -30,7 +31,14 @@ func (this *IndexAction) RunGet(params struct { return } if regionResp.IpRegion != nil { - this.Data["regions"] = regionResp.IpRegion.Summary + var regionName = regionResp.IpRegion.Summary + + // remove isp from regionName + var index = strings.LastIndex(regionName, "|") + if index > 0 { + regionName = regionName[:index] + } + this.Data["regions"] = regionName } else { this.Data["regions"] = "" } diff --git a/internal/web/actions/default/servers/iplists/index.go b/internal/web/actions/default/servers/iplists/index.go index 81e2ecf0..ff58323e 100644 --- a/internal/web/actions/default/servers/iplists/index.go +++ b/internal/web/actions/default/servers/iplists/index.go @@ -8,6 +8,7 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" + "strings" "time" ) @@ -165,6 +166,13 @@ func (this *IndexAction) RunGet(params struct { var ipRegion = regionResp.IpRegion if ipRegion != nil { region = ipRegion.Summary + + // remove isp from regionName + var index = strings.LastIndex(region, "|") + if index > 0 { + region = region[:index] + } + isp = ipRegion.Isp } } diff --git a/internal/web/actions/default/servers/iplists/items.go b/internal/web/actions/default/servers/iplists/items.go index 8a2243a3..840dac7e 100644 --- a/internal/web/actions/default/servers/iplists/items.go +++ b/internal/web/actions/default/servers/iplists/items.go @@ -8,6 +8,7 @@ import ( "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" "github.com/iwind/TeaGo/maps" timeutil "github.com/iwind/TeaGo/utils/time" + "strings" "time" ) @@ -116,6 +117,13 @@ func (this *ItemsAction) RunGet(params struct { var ipRegion = regionResp.IpRegion if ipRegion != nil { region = ipRegion.Summary + + // remove isp from regionName + var index = strings.LastIndex(region, "|") + if index > 0 { + region = region[:index] + } + isp = ipRegion.Isp } } diff --git a/internal/web/actions/default/servers/server/log/viewPopup.go b/internal/web/actions/default/servers/server/log/viewPopup.go index 1b2ec2e7..c8ff891b 100644 --- a/internal/web/actions/default/servers/server/log/viewPopup.go +++ b/internal/web/actions/default/servers/server/log/viewPopup.go @@ -93,8 +93,16 @@ func (this *ViewPopupAction) RunGet(params struct { } region := regionResp.IpRegion if region != nil { + var regionName = region.Summary + + // remove isp from regionName + var index = strings.LastIndex(regionName, "|") + if index > 0 { + regionName = regionName[:index] + } + regionMap = maps.Map{ - "full": region.Summary, + "full": regionName, "isp": region.Isp, } } diff --git a/web/public/js/components.js b/web/public/js/components.js index b6014353..e2f69ddd 100644 --- a/web/public/js/components.js +++ b/web/public/js/components.js @@ -4325,7 +4325,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio 更多选项收起选项 -`}),Vue.component("download-link",{props:["v-element","v-file","v-value"],created:function(){let e=this;setTimeout(function(){e.url=e.composeURL()},1e3)},data:function(){let e=this.vFile;return{file:e=null!=e&&0!=e.length?e:"unknown-file",url:this.composeURL()}},methods:{composeURL:function(){let e="";if(null!=this.vValue)e=this.vValue;else{var t=document.getElementById(this.vElement);if(null==t)return void teaweb.warn("找不到要下载的内容");null==(e=t.innerText)&&(e=t.textContent)}return Tea.url("/ui/download",{file:this.file,text:e})}},template:''}),Vue.component("values-box",{props:["values","v-values","size","maxlength","name","placeholder"],data:function(){let e=this.values;return null==e&&(e=[]),{realValues:e=null!=this.vValues&&"object"==typeof this.vValues?this.vValues:e,isUpdating:!1,isAdding:!1,index:0,value:"",isEditing:!1}},methods:{create:function(){this.isAdding=!0;var e=this;setTimeout(function(){e.$refs.value.focus()},200)},update:function(e){this.cancel(),this.isUpdating=!0,this.index=e,this.value=this.realValues[e];var t=this;setTimeout(function(){t.$refs.value.focus()},200)},confirm:function(){0!=this.value.length&&(this.isUpdating?Vue.set(this.realValues,this.index,this.value):this.realValues.push(this.value),this.cancel(),this.$emit("change",this.realValues))},remove:function(e){this.realValues.$remove(e),this.$emit("change",this.realValues)},cancel:function(){this.isUpdating=!1,this.isAdding=!1,this.value=""},updateAll:function(e){this.realValues=e},addValue:function(e){this.realValues.push(e)},startEditing:function(){this.isEditing=!this.isEditing}},template:`
+`}),Vue.component("download-link",{props:["v-element","v-file","v-value"],created:function(){let e=this;setTimeout(function(){e.url=e.composeURL()},1e3)},data:function(){let e=this.vFile;return{file:e=null!=e&&0!=e.length?e:"unknown-file",url:this.composeURL()}},methods:{composeURL:function(){let e="";if(null!=this.vValue)e=this.vValue;else{var t=document.getElementById(this.vElement);if(null==t)return void teaweb.warn("找不到要下载的内容");null==(e=t.innerText)&&(e=t.textContent)}return Tea.url("/ui/download",{file:this.file,text:e})}},template:''}),Vue.component("values-box",{props:["values","v-values","size","maxlength","name","placeholder"],data:function(){let e=this.values;return null==e&&(e=[]),{realValues:e=null!=this.vValues&&"object"==typeof this.vValues?this.vValues:e,isUpdating:!1,isAdding:!1,index:0,value:"",isEditing:!1}},methods:{create:function(){this.isAdding=!0;var e=this;setTimeout(function(){e.$refs.value.focus()},200)},update:function(e){this.cancel(),this.isUpdating=!0,this.index=e,this.value=this.realValues[e];var t=this;setTimeout(function(){t.$refs.value.focus()},200)},confirm:function(){0!=this.value.length&&(this.isUpdating?Vue.set(this.realValues,this.index,this.value):this.realValues.push(this.value),this.cancel(),this.$emit("change",this.realValues))},remove:function(e){this.realValues.$remove(e),this.$emit("change",this.realValues)},cancel:function(){this.isUpdating=!1,this.isAdding=!1,this.value=""},updateAll:function(e){this.realValues=e},addValue:function(e){this.realValues.push(e)},startEditing:function(){this.isEditing=!this.isEditing},allValues:function(){return this.realValues}},template:`
{{value}}
[修改] diff --git a/web/public/js/components.src.js b/web/public/js/components.src.js index 1dcb378e..25c88654 100755 --- a/web/public/js/components.src.js +++ b/web/public/js/components.src.js @@ -12764,6 +12764,9 @@ Vue.component("values-box", { startEditing: function () { this.isEditing = !this.isEditing + }, + allValues: function () { + return this.realValues } }, template: `
diff --git a/web/public/js/components/common/values-box.js b/web/public/js/components/common/values-box.js index 30fbd98b..78b176b2 100644 --- a/web/public/js/components/common/values-box.js +++ b/web/public/js/components/common/values-box.js @@ -68,6 +68,9 @@ Vue.component("values-box", { startEditing: function () { this.isEditing = !this.isEditing + }, + allValues: function () { + return this.realValues } }, template: `