From c0d0eee409679b577f6636e11759c2adaa9e56e9 Mon Sep 17 00:00:00 2001 From: Rishi Panthee Date: Wed, 8 Feb 2023 20:44:13 -0600 Subject: [PATCH] Add user blocking --- src/modules/core/config.service.ts | 1 + src/modules/core/gatewayClient.service.ts | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/core/config.service.ts b/src/modules/core/config.service.ts index 991ee3f..7df15d2 100644 --- a/src/modules/core/config.service.ts +++ b/src/modules/core/config.service.ts @@ -134,6 +134,7 @@ export class Config { cryptoAccounts: { hive: null, }, + blockedHiveUsers: [] //Hive accounts you refuse to encode for }, ipfs: { apiAddr: '/ip4/127.0.0.1/tcp/5001', diff --git a/src/modules/core/gatewayClient.service.ts b/src/modules/core/gatewayClient.service.ts index aeee992..d37f4a6 100644 --- a/src/modules/core/gatewayClient.service.ts +++ b/src/modules/core/gatewayClient.service.ts @@ -160,11 +160,19 @@ export class GatewayClient { } }) + if (this.self.config.get('node.blockedHiveUsers').includes(data.data.queueJob.metadata.video_owner)) { + // Reject because creator is blocked + await this.rejectJob(data.data.queueJob.job.id); + return; + } + console.log('jobInfo', JSON.stringify(data), { node_id: this.self.identityService.identity.id }) + + - if(data.data.queueJob.job) { + if(data.data.queueJob.job) { if (this.jobQueue.size === 0 && this.jobQueue.pending === (queue_concurrency - 1)) { this.queueJob(data.data.queueJob.job) }