Upload 4 files
Browse files
README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
-
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Woook Base
|
| 3 |
+
emoji: 💻
|
| 4 |
colorFrom: blue
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
+
app_port: 3000
|
| 9 |
---
|
| 10 |
|
| 11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
index.js
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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_process');
|
| 5 |
+
|
| 6 |
+
const hostname = '0.0.0.0';
|
| 7 |
+
const port = process.env.PORT || 3000;
|
| 8 |
+
|
| 9 |
+
// Helper function to format uptime in "1m54.343292881s" format
|
| 10 |
+
function formatUptime(seconds) {
|
| 11 |
+
const totalMs = seconds * 1000;
|
| 12 |
+
const ms = totalMs % 1000;
|
| 13 |
+
const totalSeconds = Math.floor(totalMs / 1000);
|
| 14 |
+
const s = totalSeconds % 60;
|
| 15 |
+
const m = Math.floor(totalSeconds / 60) % 60;
|
| 16 |
+
const h = Math.floor(totalSeconds / 3600) % 24;
|
| 17 |
+
const d = Math.floor(totalSeconds / 86400);
|
| 18 |
+
|
| 19 |
+
let result = '';
|
| 20 |
+
if (d > 0) result += `${d}d`;
|
| 21 |
+
if (h > 0) result += `${h}h`;
|
| 22 |
+
if (m > 0) result += `${m}m`;
|
| 23 |
+
result += `${s}.${ms.toString().padStart(3, '0')}s`;
|
| 24 |
+
|
| 25 |
+
return result;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
// Generate beautiful HTML time page
|
| 29 |
+
function generateTimeHTML() {
|
| 30 |
+
return `<!DOCTYPE html>
|
| 31 |
+
<html lang="zh-CN">
|
| 32 |
+
<head>
|
| 33 |
+
<meta charset="UTF-8">
|
| 34 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 35 |
+
<title>Woook Base - 时间显示</title>
|
| 36 |
+
<style>
|
| 37 |
+
* {
|
| 38 |
+
margin: 0;
|
| 39 |
+
padding: 0;
|
| 40 |
+
box-sizing: border-box;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
body {
|
| 44 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 45 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 46 |
+
min-height: 100vh;
|
| 47 |
+
display: flex;
|
| 48 |
+
justify-content: center;
|
| 49 |
+
align-items: center;
|
| 50 |
+
color: white;
|
| 51 |
+
overflow: hidden;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.time-container {
|
| 55 |
+
text-align: center;
|
| 56 |
+
background: rgba(255, 255, 255, 0.1);
|
| 57 |
+
backdrop-filter: blur(10px);
|
| 58 |
+
border-radius: 20px;
|
| 59 |
+
padding: 3rem 2rem;
|
| 60 |
+
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
| 61 |
+
border: 1px solid rgba(255, 255, 255, 0.2);
|
| 62 |
+
max-width: 90vw;
|
| 63 |
+
animation: fadeIn 1s ease-out;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
@keyframes fadeIn {
|
| 67 |
+
from { opacity: 0; transform: translateY(30px); }
|
| 68 |
+
to { opacity: 1; transform: translateY(0); }
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
.title {
|
| 72 |
+
font-size: 2rem;
|
| 73 |
+
font-weight: 300;
|
| 74 |
+
margin-bottom: 2rem;
|
| 75 |
+
opacity: 0.9;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
.time-display {
|
| 79 |
+
font-size: 4rem;
|
| 80 |
+
font-weight: 700;
|
| 81 |
+
margin-bottom: 1rem;
|
| 82 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
| 83 |
+
letter-spacing: 2px;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.date-display {
|
| 87 |
+
font-size: 1.5rem;
|
| 88 |
+
font-weight: 300;
|
| 89 |
+
margin-bottom: 2rem;
|
| 90 |
+
opacity: 0.8;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
.timezone-info {
|
| 94 |
+
display: grid;
|
| 95 |
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 96 |
+
gap: 1rem;
|
| 97 |
+
margin-top: 2rem;
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
.timezone-card {
|
| 101 |
+
background: rgba(255, 255, 255, 0.1);
|
| 102 |
+
padding: 1rem;
|
| 103 |
+
border-radius: 10px;
|
| 104 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
.timezone-label {
|
| 108 |
+
font-size: 0.9rem;
|
| 109 |
+
opacity: 0.7;
|
| 110 |
+
margin-bottom: 0.5rem;
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
.timezone-time {
|
| 114 |
+
font-size: 1.2rem;
|
| 115 |
+
font-weight: 600;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
@media (max-width: 768px) {
|
| 119 |
+
.time-container {
|
| 120 |
+
padding: 2rem 1rem;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
.title {
|
| 124 |
+
font-size: 1.5rem;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
.time-display {
|
| 128 |
+
font-size: 2.5rem;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
.date-display {
|
| 132 |
+
font-size: 1.2rem;
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
.timezone-info {
|
| 136 |
+
grid-template-columns: 1fr;
|
| 137 |
+
}
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
@media (max-width: 480px) {
|
| 141 |
+
.time-display {
|
| 142 |
+
font-size: 2rem;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
.title {
|
| 146 |
+
font-size: 1.2rem;
|
| 147 |
+
}
|
| 148 |
+
}
|
| 149 |
+
</style>
|
| 150 |
+
</head>
|
| 151 |
+
<body>
|
| 152 |
+
<div class="time-container">
|
| 153 |
+
<h1 class="title">🕐 当前时间</h1>
|
| 154 |
+
<div class="time-display" id="current-time">--:--:--</div>
|
| 155 |
+
<div class="date-display" id="current-date">---- 年 -- 月 -- 日 星期-</div>
|
| 156 |
+
|
| 157 |
+
<div class="timezone-info">
|
| 158 |
+
<div class="timezone-card">
|
| 159 |
+
<div class="timezone-label">本地时间</div>
|
| 160 |
+
<div class="timezone-time" id="local-time">--:--:--</div>
|
| 161 |
+
</div>
|
| 162 |
+
<div class="timezone-card">
|
| 163 |
+
<div class="timezone-label">UTC 时间</div>
|
| 164 |
+
<div class="timezone-time" id="utc-time">--:--:--</div>
|
| 165 |
+
</div>
|
| 166 |
+
<div class="timezone-card">
|
| 167 |
+
<div class="timezone-label">服务器运行时间</div>
|
| 168 |
+
<div class="timezone-time" id="server-uptime">-- 秒</div>
|
| 169 |
+
</div>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
|
| 173 |
+
<script>
|
| 174 |
+
const serverStartTime = Date.now();
|
| 175 |
+
|
| 176 |
+
function updateTime() {
|
| 177 |
+
const now = new Date();
|
| 178 |
+
|
| 179 |
+
// 主要时间显示
|
| 180 |
+
const timeString = now.toLocaleTimeString('zh-CN', {
|
| 181 |
+
hour12: false,
|
| 182 |
+
hour: '2-digit',
|
| 183 |
+
minute: '2-digit',
|
| 184 |
+
second: '2-digit'
|
| 185 |
+
});
|
| 186 |
+
document.getElementById('current-time').textContent = timeString;
|
| 187 |
+
|
| 188 |
+
// 日期显示
|
| 189 |
+
const weekdays = ['日', '一', '二', '三', '四', '五', '六'];
|
| 190 |
+
const dateString = \`\${now.getFullYear()} 年 \${(now.getMonth() + 1).toString().padStart(2, '0')} 月 \${now.getDate().toString().padStart(2, '0')} 日 星期\${weekdays[now.getDay()]}\`;
|
| 191 |
+
document.getElementById('current-date').textContent = dateString;
|
| 192 |
+
|
| 193 |
+
// 本地时间
|
| 194 |
+
document.getElementById('local-time').textContent = timeString;
|
| 195 |
+
|
| 196 |
+
// UTC 时间
|
| 197 |
+
const utcString = now.toLocaleTimeString('en-US', {
|
| 198 |
+
timeZone: 'UTC',
|
| 199 |
+
hour12: false,
|
| 200 |
+
hour: '2-digit',
|
| 201 |
+
minute: '2-digit',
|
| 202 |
+
second: '2-digit'
|
| 203 |
+
});
|
| 204 |
+
document.getElementById('utc-time').textContent = utcString;
|
| 205 |
+
|
| 206 |
+
// 服务器运行时间(模拟)
|
| 207 |
+
const uptime = Math.floor((Date.now() - serverStartTime) / 1000);
|
| 208 |
+
const hours = Math.floor(uptime / 3600);
|
| 209 |
+
const minutes = Math.floor((uptime % 3600) / 60);
|
| 210 |
+
const seconds = uptime % 60;
|
| 211 |
+
document.getElementById('server-uptime').textContent = \`\${hours}h \${minutes}m \${seconds}s\`;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
// 立即更新一次
|
| 215 |
+
updateTime();
|
| 216 |
+
|
| 217 |
+
// 每秒更新
|
| 218 |
+
setInterval(updateTime, 1000);
|
| 219 |
+
</script>
|
| 220 |
+
</body>
|
| 221 |
+
</html>`;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
const server = http.createServer((req, res) => {
|
| 225 |
+
if (req.url === '/') {
|
| 226 |
+
// Beautiful HTML time page
|
| 227 |
+
res.statusCode = 200;
|
| 228 |
+
res.setHeader('Content-Type', 'text/html; charset=utf-8');
|
| 229 |
+
res.end(generateTimeHTML());
|
| 230 |
+
} else if (req.url === '/info') {
|
| 231 |
+
// System information (moved from original /)
|
| 232 |
+
exec('df -h', (err, stdout, stderr) => {
|
| 233 |
+
if (err) {
|
| 234 |
+
console.error(`exec error: ${err}`);
|
| 235 |
+
res.statusCode = 500;
|
| 236 |
+
res.setHeader('Content-Type', 'text/plain');
|
| 237 |
+
res.end('Error getting disk info');
|
| 238 |
+
return;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
const totalMemory = (os.totalmem() / (1024 ** 3)).toFixed(2);
|
| 242 |
+
const freeMemory = (os.freemem() / (1024 ** 3)).toFixed(2);
|
| 243 |
+
|
| 244 |
+
const cpus = os.cpus();
|
| 245 |
+
const cpuModel = cpus[0].model;
|
| 246 |
+
const cpuCores = cpus.length;
|
| 247 |
+
|
| 248 |
+
const networkInterfaces = os.networkInterfaces();
|
| 249 |
+
let ipAddress = 'N/A';
|
| 250 |
+
for (const devName in networkInterfaces) {
|
| 251 |
+
const iface = networkInterfaces[devName];
|
| 252 |
+
for (let i = 0; i < iface.length; i++) {
|
| 253 |
+
const alias = iface[i];
|
| 254 |
+
if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
|
| 255 |
+
ipAddress = alias.address;
|
| 256 |
+
break;
|
| 257 |
+
}
|
| 258 |
+
}
|
| 259 |
+
if (ipAddress !== 'N/A') break;
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
exec('curl -s ipinfo.io', (errPublicIp, stdoutPublicIp, stderrPublicIp) => {
|
| 263 |
+
let publicIpInfo = {};
|
| 264 |
+
if (!errPublicIp && stdoutPublicIp) {
|
| 265 |
+
try {
|
| 266 |
+
publicIpInfo = JSON.parse(stdoutPublicIp.trim());
|
| 267 |
+
} catch (e) {
|
| 268 |
+
console.error(`Error parsing public IP info: ${e}`);
|
| 269 |
+
}
|
| 270 |
+
} else {
|
| 271 |
+
console.error(`Error getting public IP info: ${errPublicIp || stderrPublicIp}`);
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
res.statusCode = 200;
|
| 275 |
+
res.setHeader('Content-Type', 'text/plain');
|
| 276 |
+
res.end(`
|
| 277 |
+
Hello World!
|
| 278 |
+
|
| 279 |
+
Container Info:
|
| 280 |
+
Hostname: ${os.hostname()}
|
| 281 |
+
Platform: ${os.platform()}
|
| 282 |
+
Arch: ${os.arch()}
|
| 283 |
+
Uptime: ${os.uptime()} seconds
|
| 284 |
+
UUID: ${process.env.UUID || 'Not Set'}
|
| 285 |
+
|
| 286 |
+
IP Info:
|
| 287 |
+
Local IP Address: ${ipAddress}
|
| 288 |
+
Public IP Address: ${publicIpInfo.ip || 'N/A'}
|
| 289 |
+
Hostname: ${publicIpInfo.hostname || 'N/A'}
|
| 290 |
+
City: ${publicIpInfo.city || 'N/A'}
|
| 291 |
+
Region: ${publicIpInfo.region || 'N/A'}
|
| 292 |
+
Country: ${publicIpInfo.country || 'N/A'}
|
| 293 |
+
Location: ${publicIpInfo.loc || 'N/A'}
|
| 294 |
+
Organization: ${publicIpInfo.org || 'N/A'}
|
| 295 |
+
Postal: ${publicIpInfo.postal || 'N/A'}
|
| 296 |
+
Timezone: ${publicIpInfo.timezone || 'N/A'}
|
| 297 |
+
|
| 298 |
+
CPU:
|
| 299 |
+
Model: ${cpuModel}
|
| 300 |
+
Cores: ${cpuCores}
|
| 301 |
+
|
| 302 |
+
Memory:
|
| 303 |
+
Total: ${totalMemory} GB
|
| 304 |
+
Free: ${freeMemory} GB
|
| 305 |
+
|
| 306 |
+
Disk Usage:
|
| 307 |
+
${stdout}
|
| 308 |
+
`);
|
| 309 |
+
});
|
| 310 |
+
});
|
| 311 |
+
} else if (req.url === '/health') {
|
| 312 |
+
// Health check endpoint
|
| 313 |
+
const healthData = {
|
| 314 |
+
status: "healthy",
|
| 315 |
+
timestamp: new Date().toISOString(),
|
| 316 |
+
uptime: formatUptime(process.uptime())
|
| 317 |
+
};
|
| 318 |
+
|
| 319 |
+
res.statusCode = 200;
|
| 320 |
+
res.setHeader('Content-Type', 'application/json');
|
| 321 |
+
res.end(JSON.stringify(healthData));
|
| 322 |
+
} else if (req.url === '/ssh') {
|
| 323 |
+
// SSH info (unchanged)
|
| 324 |
+
fs.readFile('/tmp/.sshinfo', 'utf8', (err, data) => {
|
| 325 |
+
if (err) {
|
| 326 |
+
console.error('Error reading .sshinfo:', err);
|
| 327 |
+
res.statusCode = 500;
|
| 328 |
+
res.setHeader('Content-Type', 'text/plain');
|
| 329 |
+
res.end('Error: Could not read .sshinfo');
|
| 330 |
+
return;
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
res.statusCode = 200;
|
| 334 |
+
res.setHeader('Content-Type', 'text/plain');
|
| 335 |
+
res.end(data);
|
| 336 |
+
});
|
| 337 |
+
} else {
|
| 338 |
+
res.statusCode = 404;
|
| 339 |
+
res.setHeader('Content-Type', 'text/plain');
|
| 340 |
+
res.end('Not Found');
|
| 341 |
+
}
|
| 342 |
+
});
|
| 343 |
+
|
| 344 |
+
server.listen(port, hostname, () => {
|
| 345 |
+
console.log(`Server running at http://${hostname}:${port}/`);
|
| 346 |
+
});
|
start.sh
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# --- Start of original start.sh content ---
|
| 3 |
+
# Execute the original start.sh logic
|
| 4 |
+
# This script is already running as the correct user (root or user)
|
| 5 |
+
nohup node index.js > /tmp/node.log 2>&1 &
|
| 6 |
+
set -x
|
| 7 |
+
/usr/local/bin/sshx -q > /tmp/.sshinfo 2>&1 &
|
| 8 |
+
sleep 7
|
| 9 |
+
cat /tmp/.sshinfo
|
| 10 |
+
cat /tmp/node.log
|
| 11 |
+
sleep 10
|
| 12 |
+
tail -f /dev/null
|
| 13 |
+
# --- End of original start.sh content ---
|