Spaces:
Running
Running
Aisnsio
Claude Opus 4.8
Synthia Arsenal: security tooling directory (180+ tools, 21 categories)
2e54131 Download server.js from AisnsioDev/search: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/spaces/AisnsioDev/search/resolve/main/server.js
- Command line
-
hf download hf://spaces/AisnsioDev/search/server.js
-
curl -L -o server.js https://huggingface.co/spaces/AisnsioDev/search/resolve/main/server.js
1.44 kB
| // Zero-dependency static server for the Synthia Arsenal directory (HF Docker Space). | |
| const http = require('http'); | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const PORT = process.env.PORT || 7860; | |
| const ROOT = path.join(__dirname, 'public'); | |
| const TYPES = { | |
| '.html':'text/html; charset=utf-8', '.js':'text/javascript; charset=utf-8', | |
| '.css':'text/css; charset=utf-8', '.json':'application/json; charset=utf-8', | |
| '.svg':'image/svg+xml', '.png':'image/png', '.ico':'image/x-icon', '.txt':'text/plain; charset=utf-8' | |
| }; | |
| http.createServer((req, res) => { | |
| if (req.url === '/healthz') { res.writeHead(200, {'Content-Type':'text/plain'}); return res.end('ok'); } | |
| let p = decodeURIComponent(req.url.split('?')[0]); | |
| if (p === '/' || p === '') p = '/index.html'; | |
| const file = path.normalize(path.join(ROOT, p)); | |
| if (!file.startsWith(ROOT)) { res.writeHead(403); return res.end('forbidden'); } | |
| fs.readFile(file, (err, buf) => { | |
| if (err) { res.writeHead(404, {'Content-Type':'text/html'}); return res.end('<h1>404</h1>'); } | |
| const ext = path.extname(file).toLowerCase(); | |
| const headers = {'Content-Type': TYPES[ext] || 'application/octet-stream'}; | |
| if (ext === '.html') headers['Cache-Control'] = 'no-cache'; | |
| else headers['Cache-Control'] = 'public, max-age=3600'; | |
| res.writeHead(200, headers); | |
| res.end(buf); | |
| }); | |
| }).listen(PORT, '0.0.0.0', () => console.log('Synthia Arsenal on :' + PORT)); | |