1cattunnel 0.1.2-b.1 → 0.1.2-b.2
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/bin/1cattunnel.js +17 -0
- package/package.json +29 -25
- package/scripts/postinstall.js +19 -0
package/bin/1cattunnel.js
CHANGED
|
@@ -37,6 +37,21 @@ if (!fs.existsSync(templatePath)) {
|
|
|
37
37
|
fail(`bundled default config not found: ${templatePath}`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
function ensureExecutable(filePath) {
|
|
41
|
+
if (isWindows) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
fs.accessSync(filePath, fs.constants.X_OK);
|
|
46
|
+
} catch (_) {
|
|
47
|
+
try {
|
|
48
|
+
fs.chmodSync(filePath, 0o755);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
fail(`bundled client binary is not executable and chmod failed: ${err.message}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
40
55
|
function configRoot() {
|
|
41
56
|
if (isWindows) {
|
|
42
57
|
return path.join(process.env.APPDATA || path.join(os.homedir(), 'AppData', 'Roaming'), '1cat-tunnel');
|
|
@@ -78,6 +93,8 @@ function ensureUserConfig() {
|
|
|
78
93
|
return target;
|
|
79
94
|
}
|
|
80
95
|
|
|
96
|
+
ensureExecutable(binaryPath);
|
|
97
|
+
|
|
81
98
|
const args = process.argv.slice(2);
|
|
82
99
|
if (!hasConfigArg(args)) {
|
|
83
100
|
args.push('-config', ensureUserConfig());
|
package/package.json
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "1cattunnel",
|
|
3
|
+
"version": "0.1.2-b.2",
|
|
4
|
+
"description": "1Cat Tunnel client with bundled Windows/Linux amd64 binaries",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"private": false,
|
|
7
|
+
"bin": {
|
|
8
|
+
"1cattunnel": "bin/1cattunnel.js",
|
|
9
|
+
"1cat-tunnel": "bin/1cattunnel.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"scripts/",
|
|
14
|
+
"dist/",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"os": [
|
|
18
|
+
"win32",
|
|
19
|
+
"linux"
|
|
20
|
+
],
|
|
21
|
+
"cpu": [
|
|
22
|
+
"x64"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": "\u003e=14"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"postinstall": "node scripts/postinstall.js"
|
|
29
|
+
}
|
|
26
30
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const path = require('path');
|
|
6
|
+
|
|
7
|
+
if (process.platform === 'win32') {
|
|
8
|
+
process.exit(0);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const binaryPath = path.resolve(__dirname, '..', 'dist', 'tunnel-client-linux-amd64');
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
if (fs.existsSync(binaryPath)) {
|
|
15
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
16
|
+
}
|
|
17
|
+
} catch (err) {
|
|
18
|
+
console.warn(`1cattunnel postinstall: chmod failed for ${binaryPath}: ${err.message}`);
|
|
19
|
+
}
|