Add gitea link
This commit is contained in:
1 parent
019267cc34
commit
4323a8b774
4 files changed
+41
-1
No files matched your search
@@ -27,7 +27,7 @@ const server = createServer(async (req, res) => {
|
||||
const base = join(root, 'dist');
|
||||
const path = resolve(base, '.' + (pathname === '/' ? '/index.html' : pathname));
|
||||
if (!path.startsWith(base + '/')) throw new Error('Invalid path');
|
||||
const types: Record<string, string> = { '.js': 'text/javascript', '.css': 'text/css', '.html': 'text/html', '.png': 'image/png' };
|
||||
const types: Record<string, string> = { '.js': 'text/javascript', '.css': 'text/css', '.html': 'text/html', '.png': 'image/png', '.svg': 'image/svg+xml' };
|
||||
res.setHeader('Content-Type', types[extname(path)] || 'application/octet-stream');
|
||||
res.end(await readFile(path));
|
||||
} catch { res.statusCode = 404; res.end(); }
|
||||
|
||||
Reference in new issue
Block a user