Spaces:
Running
Running
orztv
commited on
Commit
·
cbdb202
1
Parent(s):
9d78269
update
Browse files- src/sshx.tsx +11 -32
src/sshx.tsx
CHANGED
@@ -26,7 +26,6 @@ export const action: ActionFunction = async ({ request }) => {
|
|
26 |
} else if (action === 'stop' && sshxProcess) {
|
27 |
sshxProcess.kill();
|
28 |
sshxProcess = null;
|
29 |
-
sshxOutput = '';
|
30 |
return json({ status: 'stopped' });
|
31 |
}
|
32 |
|
@@ -49,38 +48,18 @@ export default function Sshx() {
|
|
49 |
setLocalOutput(output);
|
50 |
}, [output]);
|
51 |
|
52 |
-
const getLink = () => {
|
53 |
-
const match = localOutput.match(/Link:\s+(https:\/\/sshx\.io\/s\/[^\s]+)/);
|
54 |
-
return match ? match[1] : null;
|
55 |
-
};
|
56 |
-
|
57 |
-
const getShell = () => {
|
58 |
-
const match = localOutput.match(/Shell:\s+([^\n]+)/);
|
59 |
-
return match ? match[1] : null;
|
60 |
-
};
|
61 |
-
|
62 |
return (
|
63 |
-
<div
|
64 |
-
<h1
|
65 |
-
<p
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
</Form>
|
75 |
-
</div>
|
76 |
-
{status === 'running' && (
|
77 |
-
<div style={{ backgroundColor: '#f0f0f0', padding: '15px', borderRadius: '5px', marginBottom: '20px' }}>
|
78 |
-
<p style={{ margin: '5px 0' }}><strong>Link:</strong> <a href={getLink() || '#'} target="_blank" rel="noopener noreferrer" style={{ color: '#1a0dab' }}>{getLink()}</a></p>
|
79 |
-
<p style={{ margin: '5px 0' }}><strong>Shell:</strong> {getShell()}</p>
|
80 |
-
</div>
|
81 |
-
)}
|
82 |
-
<h2 style={{ color: '#333', borderBottom: '1px solid #333', paddingBottom: '5px' }}>Output:</h2>
|
83 |
-
<pre style={{ backgroundColor: '#f0f0f0', padding: '15px', borderRadius: '5px', whiteSpace: 'pre-wrap', wordWrap: 'break-word' }}>{localOutput}</pre>
|
84 |
</div>
|
85 |
);
|
86 |
}
|
|
|
26 |
} else if (action === 'stop' && sshxProcess) {
|
27 |
sshxProcess.kill();
|
28 |
sshxProcess = null;
|
|
|
29 |
return json({ status: 'stopped' });
|
30 |
}
|
31 |
|
|
|
48 |
setLocalOutput(output);
|
49 |
}, [output]);
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
return (
|
52 |
+
<div>
|
53 |
+
<h1>SSHX Control</h1>
|
54 |
+
<p>Status: {status}</p>
|
55 |
+
<Form method="post">
|
56 |
+
<button type="submit" name="action" value="start">Start SSHX</button>
|
57 |
+
</Form>
|
58 |
+
<Form method="post">
|
59 |
+
<button type="submit" name="action" value="stop">Stop SSHX</button>
|
60 |
+
</Form>
|
61 |
+
<h2>Output:</h2>
|
62 |
+
<pre>{localOutput}</pre>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
</div>
|
64 |
);
|
65 |
}
|