jointhis.proxy 0.2.2 → 0.2.5
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 +1 -1
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +31 -9
- package/dist/main.js +12 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -7,15 +7,35 @@ import UI from './ui.js';
|
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import { Spawn } from 'ink-spawn';
|
|
9
9
|
import { exec } from 'node:child_process';
|
|
10
|
-
export const version = `0.2.
|
|
10
|
+
export const version = `0.2.4`;
|
|
11
|
+
export var rtun;
|
|
11
12
|
// Get backend executable
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exec('
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
13
|
+
if (process.platform == 'linux') {
|
|
14
|
+
fs.open('./rtun-linux-amd64', 'r', (err, fd) => {
|
|
15
|
+
if (err) {
|
|
16
|
+
exec('wget https://github.com/snsinfu/reverse-tunnel/releases/download/v1.3.2/rtun-linux-amd64').on('exit', function () {
|
|
17
|
+
exec('chmod +x ./rtun-linux-amd64');
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
rtun = './rtun-linux-amd64';
|
|
22
|
+
}
|
|
23
|
+
else if (process.platform == 'win32') {
|
|
24
|
+
console.log('Windows support is experimental.');
|
|
25
|
+
fs.open('./rtun-windows-amd64.exe', 'r', (err, fd) => {
|
|
26
|
+
if (err) {
|
|
27
|
+
exec('curl -O https://github.com/snsinfu/reverse-tunnel/releases/download/v1.3.2/rtun-windows-amd64.exe');
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
rtun = './rtun-windows-amd64.exe';
|
|
31
|
+
}
|
|
32
|
+
else if (process.platform == 'darwin') {
|
|
33
|
+
console.log('Mac support is not yet implemented.');
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.error('Unsupported Operating System.');
|
|
38
|
+
}
|
|
19
39
|
const cli = meow(`
|
|
20
40
|
Usage
|
|
21
41
|
$ jointhis.proxy
|
|
@@ -97,8 +117,10 @@ if (cli.flags.udp ||
|
|
|
97
117
|
console.log('Unable to write configuration file.');
|
|
98
118
|
process.exit(1);
|
|
99
119
|
}
|
|
120
|
+
else {
|
|
121
|
+
render(React.createElement(Spawn, { maxOutputLines: 4, runningText: "", command: rtun, args: ['-f ./rtun.yml'], shell: true }));
|
|
122
|
+
}
|
|
100
123
|
});
|
|
101
|
-
render(React.createElement(Spawn, { maxOutputLines: 4, runningText: "", command: "./rtun-linux-amd64", args: ['-f ./rtun.yml'], shell: true }));
|
|
102
124
|
}
|
|
103
125
|
else {
|
|
104
126
|
// Start automated guide-through
|
package/dist/main.js
CHANGED
|
@@ -6,11 +6,13 @@ import SelectInput from 'ink-select-input';
|
|
|
6
6
|
import { Box } from 'ink';
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import { Spawn } from 'ink-spawn';
|
|
9
|
+
import { rtun } from './cli.js';
|
|
9
10
|
export default function Main({ view }) {
|
|
10
11
|
const [key, Setkey] = useState('');
|
|
11
12
|
const [sub, Setsub] = useState('');
|
|
12
13
|
const [service, Setservice] = useState('');
|
|
13
14
|
const [fetchSuccess, Setsuccess] = useState(false);
|
|
15
|
+
const [downloaded, Setdownloaded] = useState(false);
|
|
14
16
|
const services = [
|
|
15
17
|
{
|
|
16
18
|
label: 'MC',
|
|
@@ -27,7 +29,7 @@ export default function Main({ view }) {
|
|
|
27
29
|
];
|
|
28
30
|
const handleSelect = (item) => {
|
|
29
31
|
Setservice(item.value);
|
|
30
|
-
getConfig(key, item.value);
|
|
32
|
+
getConfig(key, item.value, Setdownloaded);
|
|
31
33
|
};
|
|
32
34
|
switch (view) {
|
|
33
35
|
case '1': {
|
|
@@ -39,8 +41,12 @@ export default function Main({ view }) {
|
|
|
39
41
|
React.createElement(Text, null, "Select a service:"),
|
|
40
42
|
React.createElement(SelectInput, { onSelect: handleSelect, items: services }),
|
|
41
43
|
React.createElement(Text, null, "For custom, use the CLI flags.")),
|
|
44
|
+
React.createElement(Step, { canProceed: downloaded },
|
|
45
|
+
React.createElement(Text, null, downloaded
|
|
46
|
+
? 'Press enter to continue.'
|
|
47
|
+
: 'Please wait until everything is set up.')),
|
|
42
48
|
React.createElement(Step, { name: "last" },
|
|
43
|
-
React.createElement(Spawn, { maxOutputLines: 4, runningText: "", command:
|
|
49
|
+
React.createElement(Spawn, { maxOutputLines: 4, runningText: "", command: rtun, args: ['-f ./rtun.yml'], shell: true }),
|
|
44
50
|
React.createElement(Box, { marginTop: 1 },
|
|
45
51
|
React.createElement(Text, { dimColor: true }, "Press enter to quit")))));
|
|
46
52
|
}
|
|
@@ -52,7 +58,7 @@ export default function Main({ view }) {
|
|
|
52
58
|
}
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
|
-
async function getConfig(token, service) {
|
|
61
|
+
async function getConfig(token, service, Setdownloaded) {
|
|
56
62
|
var tcp;
|
|
57
63
|
var udp;
|
|
58
64
|
if (service == '1') {
|
|
@@ -84,5 +90,8 @@ async function getConfig(token, service) {
|
|
|
84
90
|
console.log('Unable to write configuration file.');
|
|
85
91
|
process.exit(1);
|
|
86
92
|
}
|
|
93
|
+
else if (!err) {
|
|
94
|
+
Setdownloaded(true);
|
|
95
|
+
}
|
|
87
96
|
});
|
|
88
97
|
}
|