ruby-clash-systray 1.0.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cc7c16ff0e0524a3cf3fab3dd0d673f09f7c79fbf8f4787e5e79e941670e650b
|
|
4
|
+
data.tar.gz: 38a76bd7b9fb6a87e087d5f72f1d3a7e72bdb1626d7a18991206db5cb4e4ba5e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ddd065ccadc4facd6a4eba05b49b6451522975ab05ee8f7145df2fff51727c307da35dbeb6d9368b18db813a6f95d517c6ab7cdaa9e2efd8aa0ba4520ca0c9a5
|
|
7
|
+
data.tar.gz: 9d4e5c1f660fe30986d367c584c74ca2bd4db296901572111ee88b872e8f8908afd24c4a41175eeaae2988bd08a0d73f85abe6ca774d35d396eae3865bd2def6
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
class Systray < RubyQt6::Bando::QWidget
|
|
2
|
-
|
|
3
|
-
def self.extract_proxy_name(str)
|
|
4
|
-
str.to_s.split(" | ")[0].strip
|
|
5
|
-
end
|
|
2
|
+
private
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
def hlpr_extract_proxy_name(str)
|
|
5
|
+
str.to_s.split(" | ")[0].strip
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def hlpr_inject_proxy_name(*arr)
|
|
9
|
+
arr.join(" | ")
|
|
10
10
|
end
|
|
11
11
|
end
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
class Systray < RubyQt6::Bando::QWidget
|
|
2
2
|
private
|
|
3
3
|
|
|
4
|
+
def initialize_ui
|
|
5
|
+
initialize_actions
|
|
6
|
+
initialize_menu
|
|
7
|
+
initialize_tray
|
|
8
|
+
end
|
|
9
|
+
|
|
4
10
|
def initialize_actions
|
|
5
11
|
@open_dashboard_action = QAction.new("Dashboard", self)
|
|
6
12
|
@open_dashboard_action.triggered.connect(self, :_on_open_dashboard_action_triggered)
|
|
@@ -61,18 +67,18 @@ class Systray < RubyQt6::Bando::QWidget
|
|
|
61
67
|
|
|
62
68
|
def update_proxies_actions_delayinfo
|
|
63
69
|
@proxies_actions.each do |proxy_action|
|
|
64
|
-
proxy_name =
|
|
70
|
+
proxy_name = hlpr_extract_proxy_name(proxy_action.text)
|
|
65
71
|
proxy_action.set_text(proxy_name)
|
|
66
72
|
end
|
|
67
73
|
|
|
68
74
|
@selectors_actions.each do |action|
|
|
69
75
|
Clash.api.GET_group_delay(action.text, on_success: ->(data) {
|
|
70
76
|
@proxies_actions.each do |proxy_action|
|
|
71
|
-
proxy_name =
|
|
77
|
+
proxy_name = hlpr_extract_proxy_name(proxy_action.text)
|
|
72
78
|
proxy_delay = data[proxy_name]
|
|
73
79
|
next unless proxy_delay
|
|
74
80
|
|
|
75
|
-
text =
|
|
81
|
+
text = hlpr_inject_proxy_name(proxy_name, "#{proxy_delay} ms")
|
|
76
82
|
proxy_action.set_text(text)
|
|
77
83
|
end
|
|
78
84
|
})
|
|
@@ -12,9 +12,7 @@ class Systray < RubyQt6::Bando::QWidget
|
|
|
12
12
|
def initialize
|
|
13
13
|
super
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
initialize_menu
|
|
17
|
-
initialize_tray
|
|
15
|
+
initialize_ui
|
|
18
16
|
end
|
|
19
17
|
|
|
20
18
|
def show
|
|
@@ -41,7 +39,7 @@ class Systray < RubyQt6::Bando::QWidget
|
|
|
41
39
|
return unless checked
|
|
42
40
|
|
|
43
41
|
group = sender.parent.menu_action.text
|
|
44
|
-
proxy =
|
|
42
|
+
proxy = hlpr_extract_proxy_name(sender.text)
|
|
45
43
|
Clash.api.PUT_proxies(group, proxy, on_success: ->(_) {})
|
|
46
44
|
end
|
|
47
45
|
end
|