diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-14 11:00:03 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-14 11:00:03 +0200 |
commit | cc43831a90ab8b1b460cd7021c100190049ec64b (patch) | |
tree | 187f3602fd8749b66d5782174ba48f8a33453d7d /server/controllers | |
parent | 08c11bec43987364e83246e4e76958f5ccf89fe8 (diff) | |
download | PeerTube-cc43831a90ab8b1b460cd7021c100190049ec64b.tar.gz PeerTube-cc43831a90ab8b1b460cd7021c100190049ec64b.tar.zst PeerTube-cc43831a90ab8b1b460cd7021c100190049ec64b.zip |
Filter tracker based on infohash
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/tracker.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/server/controllers/tracker.ts b/server/controllers/tracker.ts index 42f5aea81..9bc7586d1 100644 --- a/server/controllers/tracker.ts +++ b/server/controllers/tracker.ts | |||
@@ -5,6 +5,7 @@ import * as bitTorrentTracker from 'bittorrent-tracker' | |||
5 | import * as proxyAddr from 'proxy-addr' | 5 | import * as proxyAddr from 'proxy-addr' |
6 | import { Server as WebSocketServer } from 'ws' | 6 | import { Server as WebSocketServer } from 'ws' |
7 | import { CONFIG, TRACKER_RATE_LIMITS } from '../initializers/constants' | 7 | import { CONFIG, TRACKER_RATE_LIMITS } from '../initializers/constants' |
8 | import { VideoFileModel } from '../models/video/video-file' | ||
8 | 9 | ||
9 | const TrackerServer = bitTorrentTracker.Server | 10 | const TrackerServer = bitTorrentTracker.Server |
10 | 11 | ||
@@ -37,7 +38,12 @@ const trackerServer = new TrackerServer({ | |||
37 | return cb(new Error(`Too many requests (${peersIpInfoHash[ key ]} of ip ${ip} for torrent ${infoHash}`)) | 38 | return cb(new Error(`Too many requests (${peersIpInfoHash[ key ]} of ip ${ip} for torrent ${infoHash}`)) |
38 | } | 39 | } |
39 | 40 | ||
40 | return cb() | 41 | VideoFileModel.isInfohashExists(infoHash) |
42 | .then(exists => { | ||
43 | if (exists === false) return cb(new Error(`Unknown infoHash ${infoHash}`)) | ||
44 | |||
45 | return cb() | ||
46 | }) | ||
41 | } | 47 | } |
42 | }) | 48 | }) |
43 | 49 | ||