From a4152bed14427ef91f69e11d1a2cd9745aa74408 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 30 Jun 2022 09:13:11 +0200 Subject: Add ability to disable unknown infohash log --- config/default.yaml | 1 + config/production.yaml.example | 11 +++++++---- server/controllers/tracker.ts | 6 +++++- server/initializers/config.ts | 1 + 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: max_files: 20 anonymize_ip: false log_ping_requests: true + log_tracker_unknown_infohash: true prettify_sql: false trending: 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 @@ listen: - hostname: 'localhost' + hostname: '127.0.0.1' port: 9000 # Correspond to your reverse proxy server_name/listen configuration (i.e., your public PeerTube instance URL) @@ -91,11 +91,13 @@ defaults: licence: null p2p: - # Enable P2P by default + # Enable P2P by default in PeerTube client # Can be enabled/disabled by anonymous users and logged in users webapp: enabled: true + # Enable P2P by default in PeerTube embed + # Can be enabled/disabled by URL option embed: enabled: true @@ -135,7 +137,7 @@ object_storage: region: 'us-east-1' # Set this ACL on each uploaded object - upload_acl: 'public' + upload_acl: 'public-read' credentials: # You can also use AWS_ACCESS_KEY_ID env variable @@ -170,6 +172,7 @@ log: max_files: 20 anonymize_ip: false log_ping_requests: true + log_tracker_unknown_infohash: true prettify_sql: false trending: @@ -225,7 +228,7 @@ security: enabled: true tracker: - # If you disable the tracker, you disable the P2P aspect of PeerTube + # If you disable the tracker, you disable the P2P on your PeerTube instance enabled: true # Only handle requests on your videos # 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({ }) if (CONFIG.TRACKER.ENABLED !== false) { - trackerServer.on('error', function (err) { logger.error('Error in tracker.', { err }) }) trackerServer.on('warning', function (err) { + if (CONFIG.LOG.LOG_TRACKER_UNKNOWN_INFOHASH) { + const message = err.message || '' + if (message.includes('Uknown infoHash')) return + } + logger.warn('Warning in tracker.', { err }) }) } 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 = { }, ANONYMIZE_IP: config.get('log.anonymize_ip'), LOG_PING_REQUESTS: config.get('log.log_ping_requests'), + LOG_TRACKER_UNKNOWN_INFOHASH: config.get('log.log_tracker_unknown_infohash'), PRETTIFY_SQL: config.get('log.prettify_sql') }, TRENDING: { -- cgit v1.2.3