Skip to content

Commit 6da664e

Browse files
refactor(#367): use new fn with 2nd dialog
1 parent 92353fc commit 6da664e

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

protonvpn_cli/connection.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,6 @@ def show_dialog(headline, choices, stop=False):
5757

5858
pull_server_data()
5959

60-
features = {
61-
1: "Secure-Core",
62-
2: "Tor",
63-
4: "P2P",
64-
8: "Streaming",
65-
}
6660
server_tiers = {0: "F", 1: "B", 2: "P"}
6761

6862
servers = get_servers()
@@ -106,21 +100,17 @@ def show_dialog(headline, choices, stop=False):
106100
get_server_value(servername, "Load", servers)
107101
).rjust(3, " ")
108102

109-
servers_features = []
110-
feat = int(get_server_value(servername, 'Features', servers))
111-
for bit_flag in features:
112-
if (feat & bit_flag) != 0:
113-
servers_features.append(features[bit_flag])
103+
server_features = get_server_features(servername, servers)
114104

115-
if len(servers_features) == 0:
116-
servers_features.append("Normal")
105+
if len(server_features) == 0:
106+
server_features.append("Normal")
117107

118108
tier = server_tiers[
119109
get_server_value(servername, "Tier", servers)
120110
]
121111

122112
choices.append((servername, "Load: {0}% | {1} | {2}".format(
123-
load, tier, ", ".join(servers_features)
113+
load, tier, ", ".join(server_features)
124114
)))
125115

126116
server_result = show_dialog("Choose the server to connect:", choices)

0 commit comments

Comments
 (0)