Spaces:
Running
Running
orztv
commited on
Commit
·
6507fab
1
Parent(s):
584434c
update
Browse files- src/sshx.tsx +28 -128
src/sshx.tsx
CHANGED
@@ -87,33 +87,43 @@ export default function Sshx() {
|
|
87 |
};
|
88 |
|
89 |
return (
|
90 |
-
<div className="container">
|
91 |
-
<h1 className="
|
92 |
-
<
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
<button
|
97 |
onClick={() => handleAction('start')}
|
98 |
-
className={`
|
|
|
|
|
|
|
99 |
disabled={status === 'running' || isLoading}
|
100 |
>
|
101 |
启动SSHX
|
102 |
</button>
|
103 |
<button
|
104 |
onClick={() => handleAction('stop')}
|
105 |
-
className={`
|
|
|
|
|
|
|
106 |
disabled={status === 'stopped' || isLoading}
|
107 |
>
|
108 |
停止SSHX
|
109 |
</button>
|
110 |
</div>
|
111 |
{status === 'running' && (
|
112 |
-
<div className="
|
113 |
-
<p>
|
114 |
-
<strong>链接:</strong>{' '}
|
115 |
{link ? (
|
116 |
-
<a href={link} target="_blank" rel="noopener noreferrer" className="
|
117 |
{link}
|
118 |
</a>
|
119 |
) : (
|
@@ -121,124 +131,14 @@ export default function Sshx() {
|
|
121 |
)}
|
122 |
</p>
|
123 |
<p>
|
124 |
-
<strong>Shell:</strong> {shell || '暂不可用'}
|
125 |
</p>
|
126 |
</div>
|
127 |
)}
|
128 |
-
<h2 className="
|
129 |
-
<pre className="
|
130 |
-
|
131 |
-
|
132 |
-
:root {
|
133 |
-
--primary-color: #4a90e2;
|
134 |
-
--secondary-color: #f5a623;
|
135 |
-
--background-color: #f9f9f9;
|
136 |
-
--text-color: #333;
|
137 |
-
--border-color: #e0e0e0;
|
138 |
-
}
|
139 |
-
|
140 |
-
body {
|
141 |
-
font-family: 'Arial', sans-serif;
|
142 |
-
line-height: 1.6;
|
143 |
-
color: var(--text-color);
|
144 |
-
background-color: var(--background-color);
|
145 |
-
margin: 0;
|
146 |
-
padding: 0;
|
147 |
-
}
|
148 |
-
|
149 |
-
.container {
|
150 |
-
max-width: 800px;
|
151 |
-
margin: 0 auto;
|
152 |
-
padding: 20px;
|
153 |
-
}
|
154 |
-
|
155 |
-
.title {
|
156 |
-
color: var(--primary-color);
|
157 |
-
border-bottom: 2px solid var(--primary-color);
|
158 |
-
padding-bottom: 10px;
|
159 |
-
margin-bottom: 20px;
|
160 |
-
}
|
161 |
-
|
162 |
-
.subtitle {
|
163 |
-
color: var(--secondary-color);
|
164 |
-
border-bottom: 1px solid var(--secondary-color);
|
165 |
-
padding-bottom: 5px;
|
166 |
-
margin-top: 20px;
|
167 |
-
}
|
168 |
-
|
169 |
-
.status {
|
170 |
-
font-size: 18px;
|
171 |
-
font-weight: bold;
|
172 |
-
margin-bottom: 20px;
|
173 |
-
}
|
174 |
-
|
175 |
-
.status-running {
|
176 |
-
color: #4CAF50;
|
177 |
-
}
|
178 |
-
|
179 |
-
.status-stopped {
|
180 |
-
color: #f44336;
|
181 |
-
}
|
182 |
-
|
183 |
-
.button-group {
|
184 |
-
display: flex;
|
185 |
-
gap: 10px;
|
186 |
-
margin-bottom: 20px;
|
187 |
-
}
|
188 |
-
|
189 |
-
.button {
|
190 |
-
padding: 10px 20px;
|
191 |
-
font-size: 16px;
|
192 |
-
color: white;
|
193 |
-
border: none;
|
194 |
-
border-radius: 5px;
|
195 |
-
cursor: pointer;
|
196 |
-
transition: background-color 0.3s ease;
|
197 |
-
}
|
198 |
-
|
199 |
-
.button-start {
|
200 |
-
background-color: #4CAF50;
|
201 |
-
}
|
202 |
-
|
203 |
-
.button-stop {
|
204 |
-
background-color: #f44336;
|
205 |
-
}
|
206 |
-
|
207 |
-
.button-disabled {
|
208 |
-
opacity: 0.5;
|
209 |
-
cursor: not-allowed;
|
210 |
-
}
|
211 |
-
|
212 |
-
.info-box {
|
213 |
-
background-color: #e8f4fd;
|
214 |
-
padding: 15px;
|
215 |
-
border-radius: 5px;
|
216 |
-
margin-bottom: 20px;
|
217 |
-
border: 1px solid var(--border-color);
|
218 |
-
}
|
219 |
-
|
220 |
-
.link {
|
221 |
-
color: var(--primary-color);
|
222 |
-
text-decoration: none;
|
223 |
-
}
|
224 |
-
|
225 |
-
.link:hover {
|
226 |
-
text-decoration: underline;
|
227 |
-
}
|
228 |
-
|
229 |
-
.output {
|
230 |
-
background-color: #f0f0f0;
|
231 |
-
padding: 15px;
|
232 |
-
border-radius: 5px;
|
233 |
-
white-space: pre-wrap;
|
234 |
-
word-wrap: break-word;
|
235 |
-
border: 1px solid var(--border-color);
|
236 |
-
font-family: 'Courier New', monospace;
|
237 |
-
font-size: 14px;
|
238 |
-
max-height: 400px;
|
239 |
-
overflow-y: auto;
|
240 |
-
}
|
241 |
-
`}</style>
|
242 |
</div>
|
243 |
);
|
244 |
-
}
|
|
|
87 |
};
|
88 |
|
89 |
return (
|
90 |
+
<div className="container mx-auto px-4 py-8 max-w-3xl">
|
91 |
+
<h1 className="text-3xl font-bold text-primary mb-6 pb-2 border-b-2 border-primary">SSHX控制面板</h1>
|
92 |
+
<div className="mb-6">
|
93 |
+
<p className="text-lg font-semibold">
|
94 |
+
状态: <span className={`${status === 'running' ? 'text-green-600' : 'text-red-600'}`}>
|
95 |
+
{status === 'running' ? '运行中' : '已停止'}
|
96 |
+
</span>
|
97 |
+
</p>
|
98 |
+
</div>
|
99 |
+
<div className="flex space-x-4 mb-6">
|
100 |
<button
|
101 |
onClick={() => handleAction('start')}
|
102 |
+
className={`px-4 py-2 rounded-md text-white transition-colors duration-300 ${status === 'running' || isLoading
|
103 |
+
? 'bg-gray-400 cursor-not-allowed'
|
104 |
+
: 'bg-green-500 hover:bg-green-600'
|
105 |
+
}`}
|
106 |
disabled={status === 'running' || isLoading}
|
107 |
>
|
108 |
启动SSHX
|
109 |
</button>
|
110 |
<button
|
111 |
onClick={() => handleAction('stop')}
|
112 |
+
className={`px-4 py-2 rounded-md text-white transition-colors duration-300 ${status === 'stopped' || isLoading
|
113 |
+
? 'bg-gray-400 cursor-not-allowed'
|
114 |
+
: 'bg-red-500 hover:bg-red-600'
|
115 |
+
}`}
|
116 |
disabled={status === 'stopped' || isLoading}
|
117 |
>
|
118 |
停止SSHX
|
119 |
</button>
|
120 |
</div>
|
121 |
{status === 'running' && (
|
122 |
+
<div className="bg-blue-50 border border-blue-200 rounded-md p-4 mb-6">
|
123 |
+
<p className="mb-2">
|
124 |
+
<strong className="font-semibold">链接:</strong>{' '}
|
125 |
{link ? (
|
126 |
+
<a href={link} target="_blank" rel="noopener noreferrer" className="text-blue-600 hover:underline">
|
127 |
{link}
|
128 |
</a>
|
129 |
) : (
|
|
|
131 |
)}
|
132 |
</p>
|
133 |
<p>
|
134 |
+
<strong className="font-semibold">Shell:</strong> {shell || '暂不可用'}
|
135 |
</p>
|
136 |
</div>
|
137 |
)}
|
138 |
+
<h2 className="text-2xl font-semibold text-secondary mb-4">输出:</h2>
|
139 |
+
<pre className="bg-gray-100 p-4 rounded-md border border-gray-300 font-mono text-sm whitespace-pre-wrap overflow-x-auto max-h-96 overflow-y-auto">
|
140 |
+
{localOutput}
|
141 |
+
</pre>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
</div>
|
143 |
);
|
144 |
+
}
|