aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-06-30 09:13:11 +0200
committerChocobozzz <me@florianbigard.com>2022-06-30 09:13:11 +0200
commita4152bed14427ef91f69e11d1a2cd9745aa74408 (patch)
tree48641df5833148fc618389d237b6c6f45cfa03a8
parent090d100cc370900a032f7379fd1287da91fa1992 (diff)
downloadPeerTube-a4152bed14427ef91f69e11d1a2cd9745aa74408.tar.gz
PeerTube-a4152bed14427ef91f69e11d1a2cd9745aa74408.tar.zst
PeerTube-a4152bed14427ef91f69e11d1a2cd9745aa74408.zip
Add ability to disable unknown infohash log
-rw-r--r--config/default.yaml1
-rw-r--r--config/production.yaml.example11
-rw-r--r--server/controllers/tracker.ts6
-rw-r--r--server/initializers/config.ts1
4 files changed, 14 insertions, 5 deletions
diff --git a/config/default.yaml b/config/default.yaml
index f7c9b620c..8e5d13355 100644
--- a/config/default.yaml
+++ b/config/default.yaml
@@ -174,6 +174,7 @@ log:
174 max_files: 20 174 max_files: 20
175 anonymize_ip: false 175 anonymize_ip: false
176 log_ping_requests: true 176 log_ping_requests: true
177 log_tracker_unknown_infohash: true
177 prettify_sql: false 178 prettify_sql: false
178 179
179trending: 180trending:
diff --git a/config/production.yaml.example b/config/production.yaml.example
index a36f4979b..ef0358221 100644
--- a/config/production.yaml.example
+++ b/config/production.yaml.example
@@ -1,5 +1,5 @@
1listen: 1listen:
2 hostname: 'localhost' 2 hostname: '127.0.0.1'
3 port: 9000 3 port: 9000
4 4
5# Correspond to your reverse proxy server_name/listen configuration (i.e., your public PeerTube instance URL) 5# Correspond to your reverse proxy server_name/listen configuration (i.e., your public PeerTube instance URL)
@@ -91,11 +91,13 @@ defaults:
91 licence: null 91 licence: null
92 92
93 p2p: 93 p2p:
94 # Enable P2P by default 94 # Enable P2P by default in PeerTube client
95 # Can be enabled/disabled by anonymous users and logged in users 95 # Can be enabled/disabled by anonymous users and logged in users
96 webapp: 96 webapp:
97 enabled: true 97 enabled: true
98 98
99 # Enable P2P by default in PeerTube embed
100 # Can be enabled/disabled by URL option
99 embed: 101 embed:
100 enabled: true 102 enabled: true
101 103
@@ -135,7 +137,7 @@ object_storage:
135 region: 'us-east-1' 137 region: 'us-east-1'
136 138
137 # Set this ACL on each uploaded object 139 # Set this ACL on each uploaded object
138 upload_acl: 'public' 140 upload_acl: 'public-read'
139 141
140 credentials: 142 credentials:
141 # You can also use AWS_ACCESS_KEY_ID env variable 143 # You can also use AWS_ACCESS_KEY_ID env variable
@@ -170,6 +172,7 @@ log:
170 max_files: 20 172 max_files: 20
171 anonymize_ip: false 173 anonymize_ip: false
172 log_ping_requests: true 174 log_ping_requests: true
175 log_tracker_unknown_infohash: true
173 prettify_sql: false 176 prettify_sql: false
174 177
175trending: 178trending:
@@ -225,7 +228,7 @@ security:
225 enabled: true 228 enabled: true
226 229
227tracker: 230tracker:
228 # If you disable the tracker, you disable the P2P aspect of PeerTube 231 # If you disable the tracker, you disable the P2P on your PeerTube instance
229 enabled: true 232 enabled: true
230 # Only handle requests on your videos 233 # Only handle requests on your videos
231 # If you set this to false it means you have a public tracker 234 # If you set this to false it means you have a public tracker
diff --git a/server/controllers/tracker.ts b/server/controllers/tracker.ts
index 6d60639b8..914d52b72 100644
--- a/server/controllers/tracker.ts
+++ b/server/controllers/tracker.ts
@@ -69,12 +69,16 @@ const trackerServer = new TrackerServer({
69}) 69})
70 70
71if (CONFIG.TRACKER.ENABLED !== false) { 71if (CONFIG.TRACKER.ENABLED !== false) {
72
73 trackerServer.on('error', function (err) { 72 trackerServer.on('error', function (err) {
74 logger.error('Error in tracker.', { err }) 73 logger.error('Error in tracker.', { err })
75 }) 74 })
76 75
77 trackerServer.on('warning', function (err) { 76 trackerServer.on('warning', function (err) {
77 if (CONFIG.LOG.LOG_TRACKER_UNKNOWN_INFOHASH) {
78 const message = err.message || ''
79 if (message.includes('Uknown infoHash')) return
80 }
81
78 logger.warn('Warning in tracker.', { err }) 82 logger.warn('Warning in tracker.', { err })
79 }) 83 })
80} 84}
diff --git a/server/initializers/config.ts b/server/initializers/config.ts
index c76a839bc..754585981 100644
--- a/server/initializers/config.ts
+++ b/server/initializers/config.ts
@@ -164,6 +164,7 @@ const CONFIG = {
164 }, 164 },
165 ANONYMIZE_IP: config.get<boolean>('log.anonymize_ip'), 165 ANONYMIZE_IP: config.get<boolean>('log.anonymize_ip'),
166 LOG_PING_REQUESTS: config.get<boolean>('log.log_ping_requests'), 166 LOG_PING_REQUESTS: config.get<boolean>('log.log_ping_requests'),
167 LOG_TRACKER_UNKNOWN_INFOHASH: config.get<boolean>('log.log_tracker_unknown_infohash'),
167 PRETTIFY_SQL: config.get<boolean>('log.prettify_sql') 168 PRETTIFY_SQL: config.get<boolean>('log.prettify_sql')
168 }, 169 },
169 TRENDING: { 170 TRENDING: {