devtunnel-cli 3.0.13 ā 3.0.14
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/package.json +1 -1
- package/src/core/setup-cloudflared.js +41 -63
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devtunnel-cli",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "DevTunnel - Share local dev servers worldwide. Zero configuration tunnel for any framework. Install via npm: npm install -g devtunnel-cli. Works with Vite, React, Next.js, Express, NestJS and more.",
|
|
6
6
|
"main": "src/core/start.js",
|
|
@@ -78,42 +78,17 @@ async function isAdmin() {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
const script = `
|
|
91
|
-
Start-Process -FilePath "node" -ArgumentList "${process.argv[1]}" -Verb RunAs -Wait
|
|
92
|
-
`;
|
|
93
|
-
|
|
94
|
-
const { spawn } = await import('child_process');
|
|
95
|
-
return new Promise((resolve) => {
|
|
96
|
-
const proc = spawn('powershell', [
|
|
97
|
-
'-NoProfile',
|
|
98
|
-
'-NonInteractive',
|
|
99
|
-
'-ExecutionPolicy', 'Bypass',
|
|
100
|
-
'-Command', script
|
|
101
|
-
], {
|
|
102
|
-
stdio: 'inherit',
|
|
103
|
-
shell: false
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
proc.on('close', (code) => {
|
|
107
|
-
resolve(code === 0);
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
proc.on('error', () => {
|
|
111
|
-
resolve(false);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
} catch {
|
|
115
|
-
return false;
|
|
81
|
+
function showPermissionSolutions(dirPath) {
|
|
82
|
+
console.log('\nš” Solutions:');
|
|
83
|
+
if (process.platform === 'win32') {
|
|
84
|
+
console.log(' 1. Run terminal as Administrator (Right-click ā Run as administrator)');
|
|
85
|
+
console.log(' 2. DevTunnel will automatically request admin privileges if needed');
|
|
86
|
+
} else {
|
|
87
|
+
console.log(' 1. Run with sudo: sudo npm install -g devtunnel-cli');
|
|
116
88
|
}
|
|
89
|
+
console.log(' 2. Check if antivirus is blocking file writes');
|
|
90
|
+
console.log(' 3. Check folder permissions for:', dirPath);
|
|
91
|
+
console.log(' 4. Try installing manually: https://github.com/cloudflare/cloudflared/releases\n');
|
|
117
92
|
}
|
|
118
93
|
|
|
119
94
|
function downloadFile(url, dest, retryCount = 0) {
|
|
@@ -273,30 +248,43 @@ async function downloadWithRetry(urls, dest, maxRetries = 3) {
|
|
|
273
248
|
if (err.message.includes('Permission denied') || err.message.includes('EPERM') || err.message.includes('EACCES')) {
|
|
274
249
|
console.log(`\nā Permission Error: ${err.message}`);
|
|
275
250
|
|
|
276
|
-
if (process.platform === 'win32') {
|
|
251
|
+
if (process.platform === 'win32' && retry === 0) {
|
|
277
252
|
const admin = await isAdmin();
|
|
278
253
|
if (!admin) {
|
|
279
254
|
console.log('\nš Attempting to request administrator privileges...');
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
255
|
+
console.log(' Please click "Yes" on the UAC prompt\n');
|
|
256
|
+
|
|
257
|
+
try {
|
|
258
|
+
const nodePath = process.execPath;
|
|
259
|
+
const scriptPath = process.argv[1];
|
|
260
|
+
const proc = spawn('powershell', [
|
|
261
|
+
'-NoProfile',
|
|
262
|
+
'-NonInteractive',
|
|
263
|
+
'-ExecutionPolicy', 'Bypass',
|
|
264
|
+
'-Command', `Start-Process -FilePath "${nodePath}" -ArgumentList "${scriptPath}" -Verb RunAs -Wait`
|
|
265
|
+
], {
|
|
266
|
+
stdio: 'inherit',
|
|
267
|
+
shell: false
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
proc.on('close', () => {
|
|
271
|
+
process.exit(0);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
proc.on('error', () => {
|
|
275
|
+
console.log('\nā ļø Could not elevate privileges automatically');
|
|
276
|
+
showPermissionSolutions(path.dirname(dest));
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
return false;
|
|
280
|
+
} catch {
|
|
281
|
+
showPermissionSolutions(path.dirname(dest));
|
|
282
|
+
throw err;
|
|
287
283
|
}
|
|
288
284
|
}
|
|
289
285
|
}
|
|
290
286
|
|
|
291
|
-
|
|
292
|
-
if (process.platform === 'win32') {
|
|
293
|
-
console.log(' 1. Run terminal as Administrator (Right-click ā Run as administrator)');
|
|
294
|
-
} else {
|
|
295
|
-
console.log(' 1. Run with sudo: sudo npm install -g devtunnel-cli');
|
|
296
|
-
}
|
|
297
|
-
console.log(' 2. Check if antivirus is blocking file writes');
|
|
298
|
-
console.log(' 3. Check folder permissions for:', path.dirname(dest));
|
|
299
|
-
console.log(' 4. Try installing manually: https://github.com/cloudflare/cloudflared/releases\n');
|
|
287
|
+
showPermissionSolutions(path.dirname(dest));
|
|
300
288
|
throw err;
|
|
301
289
|
} else if (err.message.includes('ENOTFOUND') || err.message.includes('ECONNREFUSED')) {
|
|
302
290
|
console.log(`\nā Network error: ${err.message}`);
|
|
@@ -417,17 +405,7 @@ export async function setupCloudflared() {
|
|
|
417
405
|
console.error(`Reason: ${err.message}\n`);
|
|
418
406
|
|
|
419
407
|
if (err.message.includes('Permission denied') || err.message.includes('EPERM') || err.message.includes('EACCES')) {
|
|
420
|
-
|
|
421
|
-
if (process.platform === 'win32') {
|
|
422
|
-
console.log(' 1. Run terminal as Administrator (Right-click ā Run as administrator)');
|
|
423
|
-
console.log(' 2. DevTunnel will automatically request admin privileges if needed');
|
|
424
|
-
} else {
|
|
425
|
-
console.log(' 1. Run with sudo: sudo npm install -g devtunnel-cli');
|
|
426
|
-
}
|
|
427
|
-
console.log(' 2. Check antivirus is not blocking file writes');
|
|
428
|
-
console.log(' 3. Check folder permissions for:', path.dirname(binaryPath));
|
|
429
|
-
console.log(' 4. Try installing Cloudflare manually:');
|
|
430
|
-
console.log(' https://github.com/cloudflare/cloudflared/releases\n');
|
|
408
|
+
showPermissionSolutions(path.dirname(binaryPath));
|
|
431
409
|
} else {
|
|
432
410
|
console.log('š” Troubleshooting:');
|
|
433
411
|
console.log(' 1. Check internet connection');
|