Skip to content

Commit 66d6faa

Browse files
committed
Merge branch 'development'
2 parents 20a6338 + b4b66e3 commit 66d6faa

File tree

4 files changed

+46
-3
lines changed

4 files changed

+46
-3
lines changed

daemon/api/types/servers.go

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ type HostInfoBase struct {
4040
MultihopPort int `json:"multihop_port"`
4141
Load float32 `json:"load"`
4242
V2RayHost string `json:"v2ray"`
43+
ISP string `json:"isp"`
4344
}
4445

4546
func (h HostInfoBase) GetHostInfoBase() HostInfoBase {

ui/src/components/Component-Servers.vue

+15
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
isFastestServerConfig === true ? '202px' : null
205205
"
206206
:server="server"
207+
:isCanShowIspInfo="this.$store.state.settings.showHosts !== true || isFastestServerConfig === true"
207208
:isFavoriteServersView="isFavoritesView"
208209
:isCountryFirst="sortTypeStr === 'Country'"
209210
:onExpandClick="onServerExpandClick"
@@ -282,6 +283,17 @@
282283
</div>
283284
</div>
284285
</div>
286+
<!-- per-host ISP info -->
287+
<div v-if="host.isp && showISPInfo" style="
288+
display: flex;
289+
font-size: 12px;
290+
color: grey;
291+
overflow: hidden;
292+
white-space: nowrap;
293+
padding-left: 40px; margin-bottom: 4px; margin-top: -2px;">
294+
ISP: {{ host.isp }}
295+
</div>
296+
285297
</button>
286298
</div>
287299
</div>
@@ -388,6 +400,9 @@ export default {
388400
isShowFavoriteDescriptionBlock: function () {
389401
return this.isFavoritesView === true && this.favorites.length == 0;
390402
},
403+
showISPInfo: function () {
404+
return this.$store.state.settings.showISPInfo;
405+
},
391406
servers: function () {
392407
return this.$store.getters["vpnState/activeServers"];
393408
},

ui/src/components/blocks/block-selected-server.vue

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
:isLargeText="true"
2424
:server="this.server"
2525
:serverHostName="this.serverHostName"
26+
:isCanShowIspInfo="true"
2627
:isFastestServer="isFastestServer"
2728
:isRandomServer="isRandomServer"
2829
:isShowPingPicture="!(isFastestServer || isRandomServer)"

ui/src/components/controls/control-server-name.vue

+29-3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ export default {
8282
isFastestServer: Boolean,
8383
isRandomServer: Boolean,
8484
85+
isCanShowIspInfo: Boolean,
86+
8587
onExpandClick: Function,
8688
isExpanded: Boolean,
8789
SecondLineMaxWidth: String,
@@ -116,16 +118,40 @@ export default {
116118
return `${this.server.city}, ${this.server.country_code}`;
117119
}
118120
},
121+
selectedHost: function () {
122+
if (!this.serverHostName) return null;
123+
const hostId = this.serverHostName.split(".")[0];
124+
if (this.server && this.server.hosts && hostId) {
125+
return this.server.hosts.find((h) => h.hostname.startsWith(hostId+"."));
126+
}
127+
return null;
128+
},
119129
selectedHostInfo: function () {
120130
if (!this.serverHostName) return "";
121131
return "(" + this.serverHostName.split(".")[0] + ")";
122132
},
123133
isp: function () {
124-
if (!this.server || !this.server.isp) return "";
125-
return "(ISP: " + this.server.isp + ")";
134+
const selectedHost = this.selectedHost;
135+
if (selectedHost && selectedHost.isp)
136+
{
137+
// return ISP info for selected host
138+
return "(ISP: " + selectedHost.isp + ")";
139+
}
140+
else if (this.server && this.server.isp)
141+
{
142+
// check if all hosts have the same ISP
143+
// if yes, return ISP info for the server
144+
const allSameISP = this.server.hosts.every(
145+
(h) => h.isp === this.server.hosts[0].isp
146+
);
147+
if (allSameISP)
148+
return "(ISP: " + this.server.isp + ")";
149+
else
150+
return "";
151+
}
126152
},
127153
showISPInfo: function () {
128-
return this.$store.state.settings.showISPInfo;
154+
return this.$store.state.settings.showISPInfo && this.isCanShowIspInfo === true;
129155
},
130156
131157
multilineFirstLine: function () {

0 commit comments

Comments
 (0)