From 38aa428d4312bea7daadd742587d1c45151a263e Mon Sep 17 00:00:00 2001 From: OldHawk Date: Wed, 6 Dec 2017 14:46:45 +0800 Subject: [PATCH] =?UTF-8?q?feat(torrents):=20add=20=E2=80=98role=E2=80=99?= =?UTF-8?q?=20attribute=20for=20torrent=20type=20configure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit if role value of 'user' will show the type menu item in torrent submenu if role value of 'vip' do not show as menu item in torrent submenu, it is only list torrents in VIP area it can be include some movie not in TMDB(or Unsuitable for normal users, such as Adult?) and input all info manually. these resource only VIP or oper and admin can upload #20 #32 --- config/env/torrents.js | 42 +++++++++++++++---- modules/core/client/app/trans-string-en.js | 7 +++- modules/core/client/app/trans-string-zh.js | 21 ++++++---- .../client/config/torrents.client.menus.js | 2 +- .../views/uploads-torrents.client.view.html | 1 + .../admin/user.client.controller.js | 6 ++- 6 files changed, 57 insertions(+), 22 deletions(-) diff --git a/config/env/torrents.js b/config/env/torrents.js index dbaaa3a2..4e6b6053 100644 --- a/config/env/torrents.js +++ b/config/env/torrents.js @@ -167,7 +167,7 @@ module.exports = { showMenuHeaderForGuest: true, showFooterCountInfoForGuest: true, showDemoSignMessage: true, - accountIdleForTime: 60 * 60 * 1000 * 30, //30 days + accountIdleForTime: 60 * 60 * 1000 * 24 * 30, //30 days activeIdleAccountScore: 50000 }, @@ -352,6 +352,7 @@ module.exports = { name: 'MOVIE', value: 'movie', title: 'MENU_TORRENTS_SUB.MOVIE', + role: 'user', divider: false, position: 1, state: 'torrents.movie', @@ -365,6 +366,7 @@ module.exports = { name: 'TVSERIAL', value: 'tvserial', title: 'MENU_TORRENTS_SUB.TVSERIAL', + role: 'user', divider: false, position: 2, state: 'torrents.tvserial', @@ -378,6 +380,7 @@ module.exports = { name: 'MUSIC', value: 'music', title: 'MENU_TORRENTS_SUB.MUSIC', + role: 'user', divider: true, position: 3, state: 'torrents.music', @@ -391,6 +394,7 @@ module.exports = { name: 'SPORTS', value: 'sports', title: 'MENU_TORRENTS_SUB.SPORTS', + role: 'user', divider: false, position: 4, state: 'torrents.sports', @@ -404,6 +408,7 @@ module.exports = { name: 'VARIETY', value: 'variety', title: 'MENU_TORRENTS_SUB.VARIETY', + role: 'user', divider: false, position: 5, state: 'torrents.variety', @@ -417,6 +422,7 @@ module.exports = { name: 'PICTURE', value: 'picture', title: 'MENU_TORRENTS_SUB.PICTURE', + role: 'user', divider: false, position: 6, state: 'torrents.picture', @@ -430,6 +436,7 @@ module.exports = { name: 'GAME', value: 'game', title: 'MENU_TORRENTS_SUB.GAME', + role: 'user', divider: true, position: 7, state: 'torrents.game', @@ -443,6 +450,7 @@ module.exports = { name: 'SOFTWARE', value: 'software', title: 'MENU_TORRENTS_SUB.SOFTWARE', + role: 'user', divider: false, position: 8, state: 'torrents.software', @@ -456,6 +464,7 @@ module.exports = { name: 'EBOOK', value: 'ebook', title: 'MENU_TORRENTS_SUB.EBOOK', + role: 'user', divider: false, position: 9, state: 'torrents.ebook', @@ -469,6 +478,7 @@ module.exports = { name: 'OTHER', value: 'other', title: 'MENU_TORRENTS_SUB.OTHER', + role: 'user', divider: true, position: 10, state: 'torrents.other', @@ -476,6 +486,20 @@ module.exports = { pageTitle: 'OTHER_LIST', uploadTemplateID: 'default', showTopListInHome: false + }, + { + enable: true, + name: 'ADULT', + value: 'adult', + title: 'MENU_TORRENTS_SUB.ADULT', + role: 'vip', + divider: true, + position: 11, + state: 'torrents.adult', + url: '/adult', + pageTitle: 'ADULT_LIST', + uploadTemplateID: 'default', + showTopListInHome: false } ] }, @@ -811,7 +835,7 @@ module.exports = { }, { name: 'TYPE', - cats: ['movie', 'tvserial'], + cats: ['movie', 'tvserial', 'adult'], value: [ {name: 'BLU_RAY', icon: ''}, {name: 'REMUX', icon: ''}, @@ -821,7 +845,7 @@ module.exports = { }, { name: 'RESOLUTION', - cats: ['movie', 'tvserial', 'music', 'sports', 'variety'], + cats: ['movie', 'tvserial', 'music', 'sports', 'variety', 'adult'], value: [ {name: 'S4K', icon: ''}, {name: 'S1080P', icon: ''}, @@ -831,7 +855,7 @@ module.exports = { }, { name: 'VIDEO', - cats: ['movie', 'tvserial', 'music', 'sports', 'variety'], + cats: ['movie', 'tvserial', 'music', 'sports', 'variety', 'adult'], value: [ {name: 'AVC', icon: ''}, {name: 'X265', icon: ''}, @@ -840,7 +864,7 @@ module.exports = { }, { name: 'AUDIO', - cats: ['movie', 'tvserial', 'music', 'sports', 'variety'], + cats: ['movie', 'tvserial', 'music', 'sports', 'variety', 'adult'], value: [ {name: 'AAC', icon: ''}, {name: 'AC3', icon: ''}, @@ -861,7 +885,7 @@ module.exports = { }, { name: 'CHANNEL', - cats: ['movie', 'tvserial', 'music', 'sports', 'variety'], + cats: ['movie', 'tvserial', 'music', 'sports', 'variety', 'adult'], value: [ {name: 'C20', icon: ''}, {name: 'C51', icon: ''}, @@ -870,7 +894,7 @@ module.exports = { }, { name: 'THREED', - cats: ['movie'], + cats: ['movie', 'adult'], value: [ {name: 'T3D', icon: ''}, {name: 'T2D', icon: ''}, @@ -900,7 +924,7 @@ module.exports = { }, { name: 'REGION', - cats: ['movie', 'tvserial', 'music', 'sports', 'variety'], + cats: ['movie', 'tvserial', 'music', 'sports', 'variety', 'adult'], value: [ {name: 'USA', icon: ''}, {name: 'CHINA', icon: ''}, @@ -972,7 +996,7 @@ module.exports = { checkbox: [ { name: 'MODIFY', - cats: ['movie', 'tvserial', 'sports', 'variety'], + cats: ['movie', 'tvserial', 'sports', 'variety', 'adult'], value: [ {name: 'DIY', icon: ''}, {name: 'GUOPEI', icon: ''}, diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index 5e1558f7..86066c17 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -51,7 +51,8 @@ SOFTWARE: 'Software', GAME: 'Game', EBOOK: 'eBook', - OTHER: 'Other' + OTHER: 'Other', + ADULT: 'Adult' }, //client menu @@ -159,6 +160,7 @@ GAME_LIST: 'Game List', EBOOK_LIST: 'eBook List', OTHER_LIST: 'Other List', + ADULT_LIST: 'Adult List', TORRENT_INFO: 'Torrent Info', RANKING: 'Users Ranking', RULES: 'User Rules', @@ -706,7 +708,8 @@ SOFTWARE: 'Software', GAME: 'Game', EBOOK: 'eBook', - OTHER: 'Other' + OTHER: 'Other', + ADULT: 'Adult' }, TORRENT_STATUS_LABEL: { NEW: 'New', diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index 142d422d..dfa8fc7e 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -51,7 +51,8 @@ SOFTWARE: '软件', GAME: '游戏', EBOOK: '电子书', - OTHER: '其它' + OTHER: '其它', + ADULT: '成人' }, //client account menu @@ -149,16 +150,17 @@ PAGETITLE: { ACCOUNT_ACTIVE: '帐号激活', UPLOAD: '上传', - MOVIE_LIST: '电影列表', - TV_LIST: '电视剧列表', - MUSIC_LIST: '音乐列表', + MOVIE_LIST: '电影资源列表', + TV_LIST: '电视剧资源列表', + MUSIC_LIST: '音乐资源列表', SPORTS_LIST: '体育资源列表', VARIETY_LIST: '综艺资源列表', PICTURE_LIST: '图片资源列表', - SOFTWARE_LIST: '软件列表', - GAME_LIST: '游戏列表', - EBOOK_LIST: '电子书列表', - OTHER_LIST: '其它列表', + SOFTWARE_LIST: '软件资源列表', + GAME_LIST: '游戏资源列表', + EBOOK_LIST: '电子书资源列表', + OTHER_LIST: '其它资源列表', + ADULT_LIST: '成人资源列表', TORRENT_INFO: '种子信息', RANKING: '用户排行榜', RULES: '用户规则', @@ -706,7 +708,8 @@ SOFTWARE: '软件', GAME: '游戏', EBOOK: '电子书', - OTHER: '其它' + OTHER: '其它', + ADULT: '成人' }, TORRENT_STATUS_LABEL: { NEW: '未审核', diff --git a/modules/torrents/client/config/torrents.client.menus.js b/modules/torrents/client/config/torrents.client.menus.js index 37a7f578..29fabaac 100644 --- a/modules/torrents/client/config/torrents.client.menus.js +++ b/modules/torrents/client/config/torrents.client.menus.js @@ -27,7 +27,7 @@ // Add the dropdown list item angular.forEach(torrentTypeConfig.value, function (cfg) { - if (cfg.enable) { + if (cfg.enable && cfg.role === 'user') { menuService.addSubMenuItem('topbar', 'torrents', { title: cfg.title, state: cfg.state, diff --git a/modules/torrents/client/views/uploads-torrents.client.view.html b/modules/torrents/client/views/uploads-torrents.client.view.html index 2e4939bc..4f8115d7 100644 --- a/modules/torrents/client/views/uploads-torrents.client.view.html +++ b/modules/torrents/client/views/uploads-torrents.client.view.html @@ -45,6 +45,7 @@
diff --git a/modules/users/client/controllers/admin/user.client.controller.js b/modules/users/client/controllers/admin/user.client.controller.js index f00d00e7..16fed4a6 100644 --- a/modules/users/client/controllers/admin/user.client.controller.js +++ b/modules/users/client/controllers/admin/user.client.controller.js @@ -107,7 +107,11 @@ * @returns {boolean} */ function isContextUserSelf() { - return vm.user ? vm.user.username === vm.authentication.user.username : false; + if(!vm.user || !vm.authentication.user){ + return false; + }else { + return vm.user.username === vm.authentication.user.username; + } } /**