mirror of
https://github.com/webtorrent/bittorrent-tracker.git
synced 2025-01-31 10:31:36 +00:00
fix: set correct headers
This commit is contained in:
parent
fc4a0f76a9
commit
8b8daa3d4a
@ -249,9 +249,10 @@ class Server extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (req.url === '/stats.json' || req.headers.accept === 'application/json') {
|
if (req.url === '/stats.json' || req.headers.accept === 'application/json') {
|
||||||
res.write(JSON.stringify(stats))
|
res.setHeader('Content-Type', 'application/json')
|
||||||
res.end()
|
res.end(JSON.stringify(stats))
|
||||||
} else if (req.url === '/stats') {
|
} else if (req.url === '/stats') {
|
||||||
|
res.setHeader('Content-Type', 'text/html');
|
||||||
res.end(`
|
res.end(`
|
||||||
<h1>${stats.torrents} torrents (${stats.activeTorrents} active)</h1>
|
<h1>${stats.torrents} torrents (${stats.activeTorrents} active)</h1>
|
||||||
<h2>Connected Peers: ${stats.peersAll}</h2>
|
<h2>Connected Peers: ${stats.peersAll}</h2>
|
||||||
|
Loading…
Reference in New Issue
Block a user