diff --git a/config/env/torrents.js b/config/env/torrents.js
index 8c29793d..25ca83be 100644
--- a/config/env/torrents.js
+++ b/config/env/torrents.js
@@ -964,6 +964,7 @@ module.exports = {
* when admin/oper to delete a h&r torrent, system will auto remove all warning and number of user
* NOTE: you can change these value at anytime if you understand it
*
+ * @enable: setting whether enable the H&R function
* @condition: the condition of HnR warning, user must meet one of them before you receive the warning
* @seedTime: torrent seed time, unit of day, default to 7 days
* @seedTime_str: string desc of @seedTime
@@ -975,6 +976,7 @@ module.exports = {
* @checkWaringInterval_str: string desc of @checkWaringInterval
*/
hitAndRun: {
+ enable: true,
condition: {
seedTime: 60 * 60 * 1000 * 24 * 7,
seedTime_str: '7d',
diff --git a/config/lib/cron-job.js b/config/lib/cron-job.js
index c6849034..fff31d05 100644
--- a/config/lib/cron-job.js
+++ b/config/lib/cron-job.js
@@ -22,6 +22,8 @@ var supportConfig = config.meanTorrentConfig.support;
var backupConfig = config.meanTorrentConfig.backup;
var announceConfig = config.meanTorrentConfig.announce;
var signConfig = config.meanTorrentConfig.sign;
+var hnrConfig = config.meanTorrentConfig.hitAndRun;
+
var inbox = require('inbox');
var simpleParser = require('mailparser').simpleParser;
@@ -71,7 +73,10 @@ module.exports = function (app) {
cronJobs.push(removeGhostPeers());
cronJobs.push(checkUserAccountIdleStatus());
- cronJobs.push(countUsersHnrWarning());
+
+ if (hnrConfig.enable) {
+ cronJobs.push(countUsersHnrWarning());
+ }
if (supportConfig.mailTicketSupportService) {
cronJobs.push(listenServiceEmail());
diff --git a/modules/about/client/views/maker-view.client.view.html b/modules/about/client/views/maker-view.client.view.html
index bfd369e7..79393973 100644
--- a/modules/about/client/views/maker-view.client.view.html
+++ b/modules/about/client/views/maker-view.client.view.html
@@ -200,7 +200,7 @@
{{ 'CA_TORRENT_ATTR' | translate}}:
-
+
{{ 'CA_TORRENT_HNR' | translate}}
diff --git a/modules/announce/server/controllers/announces.server.controller.js b/modules/announce/server/controllers/announces.server.controller.js
index cef8db32..f3495bcd 100644
--- a/modules/announce/server/controllers/announces.server.controller.js
+++ b/modules/announce/server/controllers/announces.server.controller.js
@@ -365,7 +365,7 @@ exports.announce = function (req, res) {
if not find and torrent is h&r and user isn`t vip, then create complete record
---------------------------------------------------------------*/
function (done) {
- if (req.torrent.torrent_hnr && !req.passkeyuser.isVip) {
+ if (hnrConfig.enable && req.torrent.torrent_hnr && !req.passkeyuser.isVip) {
Complete.findOne({
torrent: req.torrent._id,
user: req.passkeyuser._id
@@ -429,19 +429,23 @@ exports.announce = function (req, res) {
---------------------------------------------------------------*/
function (done) {
if (!req.seeder && !req.passkeyuser.isVip && event(query.event) === EVENT_STARTED) {
- if (req.passkeyuser.hnr_warning >= hnrConfig.forbiddenDownloadMinWarningNumber) {
- if (!req.torrent.torrent_hnr) {
- done(190);
- } else {
- if (!req.completeTorrent) {
- done(191);
+ if (hnrConfig.enable) {
+ if (req.passkeyuser.hnr_warning >= hnrConfig.forbiddenDownloadMinWarningNumber) {
+ if (!req.torrent.torrent_hnr) {
+ done(190);
} else {
- if (!req.completeTorrent.hnr_warning) {
- done(190);
+ if (!req.completeTorrent) {
+ done(191);
} else {
- done(null);
+ if (!req.completeTorrent.hnr_warning) {
+ done(190);
+ } else {
+ done(null);
+ }
}
}
+ } else {
+ done(null);
}
} else {
done(null);
@@ -711,7 +715,7 @@ exports.announce = function (req, res) {
---------------------------------------------------------------*/
function (curru, currd, done) {
if (curru > 0 || currd > 0) {
- if (req.completeTorrent) {
+ if (hnrConfig.enable && req.completeTorrent) {
mtDebug.debugGreen('---------------WRITE COMPLETE DATA----------------', 'ANNOUNCE', true, req.passkeyuser);
req.completeTorrent.update({
$inc: {
@@ -735,7 +739,7 @@ exports.announce = function (req, res) {
---------------------------------------------------------------*/
function (done) {
if (!req.currentPeer.isNewCreated) {
- if (req.completeTorrent && req.completeTorrent.complete && event(query.event) !== EVENT_COMPLETED) {
+ if (hnrConfig.enable && req.completeTorrent && req.completeTorrent.complete && event(query.event) !== EVENT_COMPLETED) {
mtDebug.debugGreen('---------------UPDATE H&R COMPLETE TOTAL_SEED_TIME----------------', 'ANNOUNCE', true, req.passkeyuser);
req.completeTorrent.update({
$inc: {
@@ -847,7 +851,7 @@ exports.announce = function (req, res) {
---------------------------------------------------------------*/
function (done) {
if (!req.currentPeer.isNewCreated) {
- if (req.completeTorrent && event(query.event) !== EVENT_COMPLETED) {
+ if (hnrConfig.enable && req.completeTorrent && event(query.event) !== EVENT_COMPLETED) {
mtDebug.debugGreen('---------------COUNT H&R WARNING FOR USER----------------', 'ANNOUNCE', true, req.passkeyuser);
req.completeTorrent.countHnRWarning(false, true);
}
@@ -864,7 +868,7 @@ exports.announce = function (req, res) {
if (event(query.event) === EVENT_STOPPED) {
mtDebug.debugGreen('---------------EVENT_STOPPED----------------', 'ANNOUNCE', true, req.passkeyuser);
- if (req.completeTorrent) {
+ if (hnrConfig.enable && req.completeTorrent) {
req.completeTorrent.countHnRWarning(true, false);
}
removeCurrPeer(function () {
@@ -937,7 +941,7 @@ exports.announce = function (req, res) {
req.currentPeer.globalUpdateMethod(true);
}
- if (req.completeTorrent) {
+ if (hnrConfig.enable && req.completeTorrent) {
req.completeTorrent.globalUpdateMethod(true);
}
@@ -1033,7 +1037,7 @@ exports.announce = function (req, res) {
}).exec();
//update completeTorrent complete status
- if (req.completeTorrent) {
+ if (hnrConfig.enable && req.completeTorrent) {
req.completeTorrent.update({
$set: {
complete: true
diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js
index b5fc5b81..fcf7528d 100644
--- a/modules/core/client/app/trans-string-en.js
+++ b/modules/core/client/app/trans-string-en.js
@@ -1614,7 +1614,7 @@
VIDEO: {
SELF: 'Video Info',
FORMAT: 'Format',
- Duration: 'Duration',
+ DURATION: 'Duration',
BITRATE: 'Bit Rate',
WIDTH: 'Width',
HEIGHT: 'Height',
diff --git a/modules/core/client/controllers/header.client.controller.js b/modules/core/client/controllers/header.client.controller.js
index 3c993e14..0bbc629e 100644
--- a/modules/core/client/controllers/header.client.controller.js
+++ b/modules/core/client/controllers/header.client.controller.js
@@ -181,12 +181,14 @@
* checkHnRWarning
*/
vm.checkHnRWarning = function () {
- vm.getWarning();
- $interval(vm.getWarning, vm.hnrConfig.checkWaringInterval);
+ if(vm.hnrConfig.enable) {
+ vm.getWarning();
+ $interval(vm.getWarning, vm.hnrConfig.checkWaringInterval);
+ }
};
vm.getWarning = function () {
- if (Authentication.user) {
+ if (Authentication.user && vm.hnrConfig.enable) {
UsersService.getUserWarningNumber()
.then(function (data) {
vm.user.hnr_warning = Authentication.user.hnr_warning = data.hnr_warning;
diff --git a/modules/core/client/directives/torrent-list-item.client.directive.js b/modules/core/client/directives/torrent-list-item.client.directive.js
index 2f271d0f..664c6fad 100644
--- a/modules/core/client/directives/torrent-list-item.client.directive.js
+++ b/modules/core/client/directives/torrent-list-item.client.directive.js
@@ -19,6 +19,7 @@
vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType;
vm.torrentRLevels = MeanTorrentConfig.meanTorrentConfig.torrentRecommendLevel;
vm.salesGlobalConfig = MeanTorrentConfig.meanTorrentConfig.torrentGlobalSales;
+ vm.hnrConfig = MeanTorrentConfig.meanTorrentConfig.hitAndRun;
/**
* buildPager
diff --git a/modules/core/client/views/header.client.view.html b/modules/core/client/views/header.client.view.html
index 27fc391d..a003953e 100644
--- a/modules/core/client/views/header.client.view.html
+++ b/modules/core/client/views/header.client.view.html
@@ -78,7 +78,7 @@
-
+
-
+
{{ (item.torrent_hnr ? 'ADMIN_BASIC_UNSET_HNR' : 'ADMIN_BASIC_SET_HNR') | translate}}
diff --git a/modules/torrents/client/views/admin/admin-list.client.view.html b/modules/torrents/client/views/admin/admin-list.client.view.html
index bc17658d..e2c3cef1 100644
--- a/modules/torrents/client/views/admin/admin-list.client.view.html
+++ b/modules/torrents/client/views/admin/admin-list.client.view.html
@@ -105,7 +105,7 @@
{{ 'CA_TORRENT_ATTR' | translate}}:
-
+
{{ 'CA_TORRENT_HNR' | translate}}
diff --git a/modules/torrents/client/views/list-torrents.client.view.html b/modules/torrents/client/views/list-torrents.client.view.html
index 28f88e3d..73fc1a25 100644
--- a/modules/torrents/client/views/list-torrents.client.view.html
+++ b/modules/torrents/client/views/list-torrents.client.view.html
@@ -171,7 +171,7 @@
{{ 'CA_TORRENT_ATTR' | translate}}:
-
+
{{ 'CA_TORRENT_HNR' | translate}}
diff --git a/modules/users/client/controllers/status/status.client.controller.js b/modules/users/client/controllers/status/status.client.controller.js
index b8fcb794..69034dbc 100644
--- a/modules/users/client/controllers/status/status.client.controller.js
+++ b/modules/users/client/controllers/status/status.client.controller.js
@@ -15,6 +15,7 @@
vm.scoreLevelData = ScoreLevelService.getScoreLevelJson(vm.user.score);
vm.announce = MeanTorrentConfig.meanTorrentConfig.announce;
vm.signConfig = MeanTorrentConfig.meanTorrentConfig.sign;
+ vm.hnrConfig = MeanTorrentConfig.meanTorrentConfig.hitAndRun;
/**
* unIdle
diff --git a/modules/users/client/controllers/userinfo/userinfo.client.controller.js b/modules/users/client/controllers/userinfo/userinfo.client.controller.js
index 728c2eb3..749a0eea 100644
--- a/modules/users/client/controllers/userinfo/userinfo.client.controller.js
+++ b/modules/users/client/controllers/userinfo/userinfo.client.controller.js
@@ -19,6 +19,7 @@
vm.messageTo = messageTo;
vm.isContextUserSelf = isContextUserSelf;
vm.scoreLevelData = ScoreLevelService.getScoreLevelJson(vm.user.score);
+ vm.hnrConfig = MeanTorrentConfig.meanTorrentConfig.hitAndRun;
mtDebug.info(user);
diff --git a/modules/users/client/views/admin/view-user.client.view.html b/modules/users/client/views/admin/view-user.client.view.html
index e84e157e..29a495f4 100644
--- a/modules/users/client/views/admin/view-user.client.view.html
+++ b/modules/users/client/views/admin/view-user.client.view.html
@@ -254,7 +254,7 @@
{{ 'STATUS_FIELD.FINISHED' | translate}}:
{{ vm.user.finished }}
-
+
{{ 'STATUS_FIELD.HNR_WARNING' | translate}}:
{{vm.user.hnr_warning}}
diff --git a/modules/users/client/views/status/account.client.view.html b/modules/users/client/views/status/account.client.view.html
index af2ed71a..3ceaf548 100644
--- a/modules/users/client/views/status/account.client.view.html
+++ b/modules/users/client/views/status/account.client.view.html
@@ -7,7 +7,7 @@
-
+
@@ -184,7 +184,7 @@
{{ 'STATUS_FIELD.FINISHED' | translate}}:
{{ vm.user.finished }}
-
+
{{ 'STATUS_FIELD.HNR_WARNING' | translate}}:
{{vm.user.hnr_warning}}
diff --git a/modules/users/client/views/status/status.client.view.html b/modules/users/client/views/status/status.client.view.html
index 46ff4d8f..77c78e9e 100644
--- a/modules/users/client/views/status/status.client.view.html
+++ b/modules/users/client/views/status/status.client.view.html
@@ -17,7 +17,7 @@
{{'STATUS_DOWNLOADING' | translate}}
-
+
{{'STATUS_WARNING' | translate}}
diff --git a/modules/users/client/views/userinfo/userinfo.client.view.html b/modules/users/client/views/userinfo/userinfo.client.view.html
index 6bd29baa..6d93ab0c 100644
--- a/modules/users/client/views/userinfo/userinfo.client.view.html
+++ b/modules/users/client/views/userinfo/userinfo.client.view.html
@@ -168,7 +168,7 @@
{{ 'STATUS_FIELD.FINISHED' | translate}}:
{{ vm.user.finished }}
-
+
{{ 'STATUS_FIELD.HNR_WARNING' | translate}}:
{{vm.user.hnr_warning}}
diff --git a/modules/vip/client/views/vip.client.view.html b/modules/vip/client/views/vip.client.view.html
index 508cb996..1b221c8c 100644
--- a/modules/vip/client/views/vip.client.view.html
+++ b/modules/vip/client/views/vip.client.view.html
@@ -125,7 +125,7 @@
{{ 'CA_TORRENT_ATTR' | translate}}:
-
+
{{ 'CA_TORRENT_HNR' | translate}}