pac-proxy-cli 0.1.4 → 0.1.6
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/.env +1 -1
- package/package.json +2 -1
- package/public/index.html +12 -1
- package/src/cli/start.js +2 -2
package/.env
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pac-proxy-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "HTTP 代理与隧道 CLI + Web 管理面板",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"dotenv": "^16.6.1",
|
|
23
23
|
"express": "^4.21.0",
|
|
24
24
|
"open": "^10.0.0",
|
|
25
|
+
"proxy": "^2.2.0",
|
|
25
26
|
"socks": "^2.8.0"
|
|
26
27
|
}
|
|
27
28
|
}
|
package/public/index.html
CHANGED
|
@@ -567,6 +567,17 @@
|
|
|
567
567
|
return (n / 1024 / 1024).toFixed(1) + ' MB';
|
|
568
568
|
}
|
|
569
569
|
|
|
570
|
+
function formatTrafficUrl(item) {
|
|
571
|
+
const raw = item.url || item.host || '';
|
|
572
|
+
if (!raw) return '-';
|
|
573
|
+
if (item.method === 'CONNECT' && /^[^\/]+:\d+$/.test(raw)) {
|
|
574
|
+
const [h, p] = raw.split(':');
|
|
575
|
+
const port = parseInt(p, 10);
|
|
576
|
+
return port === 443 ? `https://${h}` : `https://${h}:${port}`;
|
|
577
|
+
}
|
|
578
|
+
const s = String(raw).slice(0, 60);
|
|
579
|
+
return s + (raw.length > 60 ? '…' : '');
|
|
580
|
+
}
|
|
570
581
|
async function loadTraffic() {
|
|
571
582
|
try {
|
|
572
583
|
const r = await fetch('/api/capture');
|
|
@@ -576,7 +587,7 @@
|
|
|
576
587
|
<tr>
|
|
577
588
|
<td>${formatTime(item.time)}</td>
|
|
578
589
|
<td>${item.method}</td>
|
|
579
|
-
<td title="${(item.url || item.host || '').slice(0, 200)}">${(item
|
|
590
|
+
<td title="${(item.url || item.host || '').slice(0, 200)}">${formatTrafficUrl(item)}</td>
|
|
580
591
|
<td class="${statusClass(item.statusCode)}">${item.statusCode ?? '-'}</td>
|
|
581
592
|
<td>${item.proxyDecision ?? '代理'}</td>
|
|
582
593
|
<td>${sizeStr(item.responseBodySize)}</td>
|
package/src/cli/start.js
CHANGED
|
@@ -14,8 +14,8 @@ export async function startProxyAndPanel(options) {
|
|
|
14
14
|
const serverUrl = String(options.server === true ? (process.env.PROXY_SERVER_URL || '') : (options.server || process.env.PROXY_SERVER_URL || '')).trim();
|
|
15
15
|
const shouldOpen = options.open !== false;
|
|
16
16
|
|
|
17
|
-
if (!socks
|
|
18
|
-
console.error('请指定上游:使用 -s/--socks <host:port>、--server <url
|
|
17
|
+
if (!socks) {
|
|
18
|
+
console.error('请指定上游:使用 -s/--socks <host:port>、--server <url>');
|
|
19
19
|
process.exit(1);
|
|
20
20
|
}
|
|
21
21
|
|