xray-manager 2.0.0 → 2.0.1

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.
package/README.md CHANGED
@@ -60,6 +60,33 @@
60
60
 
61
61
  ---
62
62
 
63
+ ## ⚡ 30秒快速安装
64
+
65
+ ```bash
66
+ # 一键安装 Xray + VLESS + Reality(复制粘贴即可)
67
+ wget https://raw.githubusercontent.com/DanOps-1/Xray-VPN-OneClick/main/scripts/install.sh -O xray-install.sh && sudo bash xray-install.sh
68
+ ```
69
+
70
+ <details>
71
+ <summary>📦 其他安装方式(npm / 国内加速 / git clone)</summary>
72
+
73
+ ```bash
74
+ # npm 全局安装(需要 Node.js 18+)
75
+ npm install -g xray-manager && sudo xm install
76
+
77
+ # 国内服务器加速
78
+ wget https://ghproxy.com/https://raw.githubusercontent.com/DanOps-1/Xray-VPN-OneClick/main/scripts/install.sh -O xray-install.sh && sudo bash xray-install.sh
79
+
80
+ # 克隆仓库安装
81
+ git clone https://github.com/DanOps-1/Xray-VPN-OneClick.git && cd Xray-VPN-OneClick/scripts && sudo bash install.sh
82
+ ```
83
+
84
+ </details>
85
+
86
+ > **系统要求:** Linux (Ubuntu 22.04+ / Debian 11+ / CentOS 9+),512MB RAM,公网 IP
87
+
88
+ ---
89
+
63
90
  ## 📸 界面预览
64
91
 
65
92
  <div align="center">
package/dist/cli.mjs CHANGED
@@ -7093,20 +7093,31 @@ import { Box as Box19, Text as Text21, useInput as useInput7 } from "ink";
7093
7093
  // src/hooks/useQuotas.ts
7094
7094
  import { useState as useState14, useEffect as useEffect6, useCallback as useCallback8 } from "react";
7095
7095
  function useQuotas() {
7096
- const { quotaManager } = useServices();
7096
+ const { quotaManager, trafficManager } = useServices();
7097
7097
  const [quotas, setQuotas] = useState14({});
7098
7098
  const [loading2, setLoading] = useState14(true);
7099
7099
  const refresh = useCallback8(async () => {
7100
7100
  try {
7101
7101
  setLoading(true);
7102
- const all = await quotaManager.getAllQuotas();
7103
- setQuotas(all);
7102
+ const [stored, usages] = await Promise.all([
7103
+ quotaManager.getAllQuotas(),
7104
+ trafficManager.getAllUsage().catch(() => [])
7105
+ ]);
7106
+ const merged = { ...stored };
7107
+ for (const usage of usages) {
7108
+ const existing = merged[usage.email] ?? { ...DEFAULT_QUOTA };
7109
+ merged[usage.email] = {
7110
+ ...existing,
7111
+ usedBytes: usage.total
7112
+ };
7113
+ }
7114
+ setQuotas(merged);
7104
7115
  } catch {
7105
7116
  setQuotas({});
7106
7117
  } finally {
7107
7118
  setLoading(false);
7108
7119
  }
7109
- }, [quotaManager]);
7120
+ }, [quotaManager, trafficManager]);
7110
7121
  useEffect6(() => {
7111
7122
  refresh();
7112
7123
  }, [refresh]);