orztv commited on
Commit
cbdb202
·
1 Parent(s): 9d78269
Files changed (1) hide show
  1. 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 style={{ fontFamily: 'Arial, sans-serif', maxWidth: '800px', margin: '0 auto', padding: '20px' }}>
64
- <h1 style={{ color: '#333', borderBottom: '2px solid #333', paddingBottom: '10px' }}>SSHX Control</h1>
65
- <p style={{ fontSize: '18px', fontWeight: 'bold' }}>
66
- Status: <span style={{ color: status === 'running' ? 'green' : 'red' }}>{status}</span>
67
- </p>
68
- <div style={{ display: 'flex', gap: '10px', marginBottom: '20px' }}>
69
- <Form method="post">
70
- <button type="submit" name="action" value="start" style={{ padding: '10px 20px', fontSize: '16px', backgroundColor: '#4CAF50', color: 'white', border: 'none', borderRadius: '5px', cursor: 'pointer' }} disabled={status === 'running'}>Start SSHX</button>
71
- </Form>
72
- <Form method="post">
73
- <button type="submit" name="action" value="stop" style={{ padding: '10px 20px', fontSize: '16px', backgroundColor: '#f44336', color: 'white', border: 'none', borderRadius: '5px', cursor: 'pointer' }} disabled={status === 'stopped'}>Stop SSHX</button>
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
  }