forked from maik/IPFS-portal
feat: initial IPFS Portal — Next.js frontend for remote IPFS node management
Multi-file upload with Quick Upload + Crypto Payment tabs. Dashboard with live IPFS metrics, Explorer, Peers, Pins, History, Settings pages. Docker deploy (standalone output), full test suite (16 Playwright tests). Payment integration via IPFSPortalPayment + MockUSDC contracts on zkSync.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
const http = require('http');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const PORT = 3444;
|
||||
const ROOT = path.join(__dirname, 'out');
|
||||
const MIME = { '.html':'text/html','.js':'text/javascript','.css':'text/css','.png':'image/png','.svg':'image/svg+xml','.ico':'image/x-icon','.json':'application/json' };
|
||||
|
||||
http.createServer((req, res) => {
|
||||
let fp = path.join(ROOT, req.url === '/' ? 'index.html' : req.url);
|
||||
// SPA fallback: serve index.html for non-file routes
|
||||
if (!fs.existsSync(fp) || fs.statSync(fp).isDirectory()) {
|
||||
fp = path.join(ROOT, 'index.html');
|
||||
}
|
||||
if (fs.existsSync(fp)) {
|
||||
const ext = path.extname(fp);
|
||||
res.writeHead(200, { 'Content-Type': MIME[ext] || 'text/html' });
|
||||
fs.createReadStream(fp).pipe(res);
|
||||
} else {
|
||||
res.writeHead(404);
|
||||
res.end('Not found');
|
||||
}
|
||||
}).listen(PORT, () => {
|
||||
console.log(IPFS Portal: http://localhost:);
|
||||
console.log(Network: http://100.112.2.113:);
|
||||
});
|
||||
Reference in New Issue
Block a user