v2box 0.3.1__tar.gz → 0.3.2__tar.gz

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.
Files changed (28) hide show
  1. {v2box-0.3.1 → v2box-0.3.2}/PKG-INFO +1 -1
  2. {v2box-0.3.1 → v2box-0.3.2}/pyproject.toml +1 -1
  3. {v2box-0.3.1 → v2box-0.3.2}/v2box/__init__.py +1 -1
  4. {v2box-0.3.1 → v2box-0.3.2}/v2box/cli/main.py +5 -2
  5. {v2box-0.3.1 → v2box-0.3.2}/v2box/core/testing.py +25 -0
  6. {v2box-0.3.1 → v2box-0.3.2}/v2box.egg-info/PKG-INFO +1 -1
  7. {v2box-0.3.1 → v2box-0.3.2}/README.md +0 -0
  8. {v2box-0.3.1 → v2box-0.3.2}/setup.cfg +0 -0
  9. {v2box-0.3.1 → v2box-0.3.2}/v2box/cli/__init__.py +0 -0
  10. {v2box-0.3.1 → v2box-0.3.2}/v2box/core/__init__.py +0 -0
  11. {v2box-0.3.1 → v2box-0.3.2}/v2box/core/config.py +0 -0
  12. {v2box-0.3.1 → v2box-0.3.2}/v2box/core/link_builder.py +0 -0
  13. {v2box-0.3.1 → v2box-0.3.2}/v2box/core/server_config.py +0 -0
  14. {v2box-0.3.1 → v2box-0.3.2}/v2box/core/service.py +0 -0
  15. {v2box-0.3.1 → v2box-0.3.2}/v2box/core/store.py +0 -0
  16. {v2box-0.3.1 → v2box-0.3.2}/v2box/core/subscription.py +0 -0
  17. {v2box-0.3.1 → v2box-0.3.2}/v2box/parsers/__init__.py +0 -0
  18. {v2box-0.3.1 → v2box-0.3.2}/v2box/parsers/hysteria2.py +0 -0
  19. {v2box-0.3.1 → v2box-0.3.2}/v2box/parsers/shadowsocks.py +0 -0
  20. {v2box-0.3.1 → v2box-0.3.2}/v2box/parsers/socks.py +0 -0
  21. {v2box-0.3.1 → v2box-0.3.2}/v2box/parsers/trojan.py +0 -0
  22. {v2box-0.3.1 → v2box-0.3.2}/v2box/parsers/vless.py +0 -0
  23. {v2box-0.3.1 → v2box-0.3.2}/v2box/parsers/vmess.py +0 -0
  24. {v2box-0.3.1 → v2box-0.3.2}/v2box.egg-info/SOURCES.txt +0 -0
  25. {v2box-0.3.1 → v2box-0.3.2}/v2box.egg-info/dependency_links.txt +0 -0
  26. {v2box-0.3.1 → v2box-0.3.2}/v2box.egg-info/entry_points.txt +0 -0
  27. {v2box-0.3.1 → v2box-0.3.2}/v2box.egg-info/requires.txt +0 -0
  28. {v2box-0.3.1 → v2box-0.3.2}/v2box.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: v2box
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: 一键将代理节点链接导入 sing-box,轻松管理、测速、切换节点
5
5
  Author: v2box contributors
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "v2box"
7
- version = "0.3.1"
7
+ version = "0.3.2"
8
8
  description = "一键将代理节点链接导入 sing-box,轻松管理、测速、切换节点"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1,3 +1,3 @@
1
1
  """v2box - 一键将代理节点链接导入 sing-box,轻松管理、测速、切换节点"""
2
2
 
3
- __version__ = "0.3.1"
3
+ __version__ = "0.3.2"
@@ -551,10 +551,13 @@ def cmd_status():
551
551
  if use_lan:
552
552
  console.print("[green]✓[/green] 局域网代理已开启")
553
553
 
554
- # Clash API
555
- from v2box.core.testing import is_clash_api_available
554
+ # Clash API + 实时节点查询
555
+ from v2box.core.testing import is_clash_api_available, get_current_node_via_api
556
556
  if is_clash_api_available():
557
557
  console.print("[green]✓[/green] Clash API 可用 (127.0.0.1:9090)")
558
+ current = get_current_node_via_api()
559
+ if current:
560
+ console.print(f"[bold green]当前连接:[/bold green] {current['now']}")
558
561
  elif is_active:
559
562
  console.print("[yellow]⚠[/yellow] Clash API 不可用")
560
563
 
@@ -129,3 +129,28 @@ def is_clash_api_available() -> bool:
129
129
  """检查 Clash API 是否可用。"""
130
130
  result = _api_request("/version", timeout=2)
131
131
  return result is not None
132
+
133
+
134
+ def get_current_node_via_api() -> dict | None:
135
+ """通过 Clash API 查询当前生效的节点信息。
136
+
137
+ 会自动解析嵌套选择器(proxy -> auto -> 实际节点)。
138
+
139
+ Returns:
140
+ {"now": "实际节点名", "mode": "auto 或 manual"}
141
+ 失败返回 None
142
+ """
143
+ result = _api_request("/proxies/proxy", timeout=3)
144
+ if not result or "now" not in result:
145
+ return None
146
+
147
+ selected = result["now"]
148
+
149
+ # 若 proxy 选择器指向 auto(urltest 组),再查一层获取实际节点
150
+ if selected == "auto":
151
+ auto_result = _api_request("/proxies/auto", timeout=3)
152
+ if auto_result and "now" in auto_result:
153
+ return {"now": auto_result["now"], "mode": "auto"}
154
+ return {"now": "auto (未知)", "mode": "auto"}
155
+
156
+ return {"now": selected, "mode": "manual"}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: v2box
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: 一键将代理节点链接导入 sing-box,轻松管理、测速、切换节点
5
5
  Author: v2box contributors
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes