mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-08-05 01:50:47 +02:00
32
config/env/torrents.js
vendored
32
config/env/torrents.js
vendored
@@ -938,6 +938,8 @@ module.exports = {
|
||||
* @isVip: set whether is only for VIP user
|
||||
* @showThumbsUpUserList: if true, will show thumbs up users list at eof of topic content or reply content
|
||||
* @showUserSignature: if true, will show user signature info in forum
|
||||
*
|
||||
* @rulesForumID: if you create a forum for user rules and helpers, here is the forumID, it will link to from home help items more
|
||||
*/
|
||||
forumsConfig: {
|
||||
category: [
|
||||
@@ -948,7 +950,9 @@ module.exports = {
|
||||
{name: 'ADMINISTRATION', value: 'Administration', index: 4, isOper: true, isVip: false}
|
||||
],
|
||||
showThumbsUpUserList: true,
|
||||
showUserSignature: true
|
||||
showUserSignature: true,
|
||||
|
||||
rulesForumID: '595b0c31235c3405a290d737'
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -962,11 +966,25 @@ module.exports = {
|
||||
* @topicsSearchPerPage: forum topic search list page settings
|
||||
* @torrentsPerPage: torrents list page settings
|
||||
* @torrentsCommentsPerPage: torrent comments list settings
|
||||
* @makeGroupTorrentsPerPage: torrent of make group list page settings
|
||||
* @tracesPerPage: system traces log list page settings
|
||||
* @adminUserListPerPage: admin manage users list page settings
|
||||
* @collectionsListPerPage: movie collections list page settings
|
||||
* @backupFilesListPerPage: system backup files list page settings
|
||||
* @torrentPeersListPerPage: torrent detail seeder & leecher users list page settings
|
||||
*
|
||||
* @uploaderUserListPerPage: admin management uploader access list page settings
|
||||
* @messageBoxListPerPage: message box list page settings
|
||||
* @followListPerPage: users follow list page settings
|
||||
*
|
||||
* @requestListPerPage: request list page settings
|
||||
* @requestCommentsPerPage: request comments list settings
|
||||
*
|
||||
* @homeOrderTorrentListPerType: every type of torrent showed in home settings
|
||||
* @homeNewestTorrentListPerType: every type of torrent of newest showed in home settings
|
||||
* @homeHelpListLimit: help items number of home settings
|
||||
* @homeNoticeListLimit: notice items number of home settings
|
||||
* @homeNewTopicListLimit: new topic items number of home settings
|
||||
*/
|
||||
itemsPerPage: {
|
||||
topicsPerPage: 10,
|
||||
@@ -980,13 +998,19 @@ module.exports = {
|
||||
collectionsListPerPage: 6,
|
||||
backupFilesListPerPage: 15,
|
||||
torrentPeersListPerPage: 15,
|
||||
homeOrderTorrentListPerType: 9,
|
||||
homeNewestTorrentListPerType: 14,
|
||||
|
||||
uploaderUserListPerPage: 15,
|
||||
messageBoxListPerPage: 10,
|
||||
followListPerPage: 30,
|
||||
|
||||
requestListPerPage: 15,
|
||||
requestCommentsPerPage: 10
|
||||
requestCommentsPerPage: 10,
|
||||
|
||||
homeOrderTorrentListPerType: 9,
|
||||
homeNewestTorrentListPerType: 14,
|
||||
homeHelpListLimit: 8,
|
||||
homeNoticeListLimit: 8,
|
||||
homeNewTopicListLimit: 8
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -94,6 +94,13 @@
|
||||
NEWEST_MORE: 'more...',
|
||||
BTN_DOWNLOAD: 'Download',
|
||||
|
||||
HOME: {
|
||||
TITLE_HELP: 'Rules And Helper',
|
||||
TITLE_NOTICE: 'System Broadcast',
|
||||
TITLE_NEW_TOPIC: 'Forum New Topics',
|
||||
MORE_HELP_RULES: 'More rules and help contents'
|
||||
},
|
||||
|
||||
//element title/alt
|
||||
TITLE_ALT: {
|
||||
SEEDS: 'Seeds users',
|
||||
|
||||
@@ -94,6 +94,13 @@
|
||||
NEWEST_MORE: '更多...',
|
||||
BTN_DOWNLOAD: '下载',
|
||||
|
||||
HOME: {
|
||||
TITLE_HELP: '用户规则与帮助',
|
||||
TITLE_NOTICE: '系统动态与通知',
|
||||
TITLE_NEW_TOPIC: '论坛最新话题',
|
||||
MORE_HELP_RULES: '更多规则以及帮助内容'
|
||||
},
|
||||
|
||||
//element title/alt
|
||||
TITLE_ALT: {
|
||||
SEEDS: '做种用户数',
|
||||
|
||||
@@ -6,15 +6,16 @@
|
||||
.controller('HomeController', HomeController);
|
||||
|
||||
HomeController.$inject = ['$scope', '$state', '$translate', 'Authentication', 'TorrentsService', 'Notification', 'MeanTorrentConfig',
|
||||
'getStorageLangService', 'DownloadService', '$timeout', 'localStorageService', 'ScrapeService', 'TorrentGetInfoServices', 'DebugConsoleService',
|
||||
'getStorageLangService', 'DownloadService', '$timeout', 'localStorageService', 'TopicsService', 'TorrentGetInfoServices', 'DebugConsoleService',
|
||||
'marked'];
|
||||
|
||||
function HomeController($scope, $state, $translate, Authentication, TorrentsService, Notification, MeanTorrentConfig, getStorageLangService,
|
||||
DownloadService, $timeout, localStorageService, ScrapeService, TorrentGetInfoServices, mtDebug,
|
||||
DownloadService, $timeout, localStorageService, TopicsService, TorrentGetInfoServices, mtDebug,
|
||||
marked) {
|
||||
var vm = this;
|
||||
vm.appConfig = MeanTorrentConfig.meanTorrentConfig.app;
|
||||
vm.globalSalesConfig = MeanTorrentConfig.meanTorrentConfig.torrentGlobalSales;
|
||||
vm.forumsConfig = MeanTorrentConfig.meanTorrentConfig.forumsConfig;
|
||||
|
||||
/**
|
||||
* getSaleNoticeMessage
|
||||
@@ -75,5 +76,35 @@
|
||||
e.addClass('panel-collapsed');
|
||||
}, 100);
|
||||
};
|
||||
|
||||
/**
|
||||
* getHomeHelp
|
||||
*/
|
||||
vm.getHomeHelp = function () {
|
||||
TopicsService.getHomeHelp(function (topics) {
|
||||
console.log(topics);
|
||||
vm.homeHelpTopics = topics;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* getHomeNotice
|
||||
*/
|
||||
vm.getHomeNotice = function () {
|
||||
TopicsService.getHomeNotice(function (topics) {
|
||||
console.log(topics);
|
||||
vm.homeNoticeTopics = topics;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* getForumNewTopic
|
||||
*/
|
||||
vm.getForumNewTopic = function () {
|
||||
TopicsService.getHomeNewTopic(function (topics) {
|
||||
console.log(topics);
|
||||
vm.homeNewTopics = topics;
|
||||
});
|
||||
};
|
||||
}
|
||||
}());
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
body {
|
||||
font-family: 'ProximaNova', 'Helvetica Neue', 'Arial', 'Helvetica', 'sans-serif'
|
||||
}
|
||||
|
||||
.content {
|
||||
margin-top: 50px;
|
||||
}
|
||||
@@ -83,7 +87,7 @@ a:hover .header-profile-image {
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
.view-footer{
|
||||
.view-footer {
|
||||
color: #aaa;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
65
modules/core/client/less/home.less
Normal file
65
modules/core/client/less/home.less
Normal file
@@ -0,0 +1,65 @@
|
||||
@import (reference) "../../../core/client/less/mt-var.less";
|
||||
|
||||
.home-help, .home-notice, .home-new-topic {
|
||||
margin: 20px 0;
|
||||
color: #4d4e53;
|
||||
.list-items {
|
||||
background-color: #fafbfc;
|
||||
box-shadow: 2px 2px 2px rgba(0, 0, 0, .075);
|
||||
margin-top: -25px;
|
||||
padding: 20px 10px;
|
||||
border-top: solid 2px @mt-base-color;
|
||||
p {
|
||||
&:before {
|
||||
content: '+';
|
||||
display: inline-block;
|
||||
color: #ff6600;
|
||||
margin-right: 2px;
|
||||
}
|
||||
&:last-child {
|
||||
margin-bottom: 1px !important;
|
||||
}
|
||||
}
|
||||
.item-date {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
.list-title {
|
||||
margin-bottom: 10px;
|
||||
position: relative;
|
||||
.fa-stack {
|
||||
font-size: 30px;
|
||||
color: @mt-base-color;
|
||||
.fa:first-child {
|
||||
text-shadow: 0 1px 1px #fff, 0 1px 1px #fff;
|
||||
}
|
||||
}
|
||||
.fa-more {
|
||||
position: absolute;
|
||||
top: 22px;
|
||||
right: 10px;
|
||||
font-size: 20px;
|
||||
&:hover {
|
||||
color: @mt-base-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.home-new-topic {
|
||||
@media (max-width: @screen-md-max) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.home_vip_info {
|
||||
padding: 20px;
|
||||
min-height: 300px;
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
.home_global_search {
|
||||
padding: 20px;
|
||||
min-height: 300px;
|
||||
background-color: #9d9e9f;
|
||||
}
|
||||
@@ -9,5 +9,62 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--<div class="home_vip_info">-->
|
||||
<!--<div class="container text-center">-->
|
||||
<!--<h4>Join as VIP</h4>-->
|
||||
<!--<div class="">-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="home-help" ng-init="vm.getHomeHelp()">
|
||||
<div class="list-title">
|
||||
<span class="fa-stack">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-question-circle-o fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
<span class="h4" translate="HOME.TITLE_HELP"></span>
|
||||
<a ui-sref="forums.view({ forumId: vm.forumsConfig.rulesForumID})" title="{{'HOME.MORE_HELP_RULES' | translate}}">
|
||||
<i class="fa fa-ellipsis-h fa-more"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="list-items">
|
||||
<p class="text-long" ng-repeat="t in vm.homeHelpTopics">
|
||||
<span class="item-date">{{t.pushHomeAt | date: 'MM-dd HH:mm'}} - </span>
|
||||
<a ui-sref="forums.topic({ forumId: t.forum, topicId: t._id })" title="{{t.title}}">{{t.title}}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="home-notice" ng-init="vm.getHomeNotice()">
|
||||
<div class="list-title">
|
||||
<span class="fa-stack">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-podcast fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
<span class="h4" translate="HOME.TITLE_NOTICE"></span>
|
||||
</div>
|
||||
<div class="list-items">
|
||||
<p class="text-long" ng-repeat="t in vm.homeNoticeTopics">
|
||||
<span class="item-date">{{t.pushHomeAt | date: 'MM-dd HH:mm'}} - </span>
|
||||
<a ui-sref="forums.topic({ forumId: t.forum, topicId: t._id })" title="{{t.title}}">{{t.title}}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--<div class="home_global_search">-->
|
||||
<!--<div class="container text-center">-->
|
||||
<!--<div class="">-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div ng-include="'/modules/core/client/views/home_torrents.client.view.html'"></div>
|
||||
</section>
|
||||
@@ -71,15 +71,18 @@
|
||||
},
|
||||
getHomeHelp: {
|
||||
method: 'GET',
|
||||
url: '/api/topics/getHomeHelpTopic'
|
||||
url: '/api/topics/getHomeHelpTopic',
|
||||
isArray: true
|
||||
},
|
||||
getHomeNotice: {
|
||||
method: 'GET',
|
||||
url: '/api/topics/getHomeNoticeTopic'
|
||||
url: '/api/topics/getHomeNoticeTopic',
|
||||
isArray: true
|
||||
},
|
||||
getHomeNewTopic: {
|
||||
method: 'GET',
|
||||
url: '/api/topics/getHomeNewTopic'
|
||||
url: '/api/topics/getHomeNewTopic',
|
||||
isArray: true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ var traceConfig = config.meanTorrentConfig.trace;
|
||||
var thumbsUpScore = config.meanTorrentConfig.score.thumbsUpScore;
|
||||
var serverMessage = require(path.resolve('./config/lib/server-message'));
|
||||
var serverNoticeConfig = config.meanTorrentConfig.serverNotice;
|
||||
var itemsPerPageConfig = config.meanTorrentConfig.itemsPerPage;
|
||||
|
||||
var mtDebug = require(path.resolve('./config/lib/debug'));
|
||||
|
||||
@@ -289,6 +290,79 @@ exports.listTopics = function (req, res) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* getHomeHelpTopic
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
exports.getHomeHelpTopic = function (req, res) {
|
||||
var skip = 0;
|
||||
var limit = itemsPerPageConfig.homeHelpListLimit;
|
||||
|
||||
Topic.find({
|
||||
isHomeHelp: true
|
||||
})
|
||||
.sort('-pushHomeAt')
|
||||
.populate('user', 'username displayName profileImageURL isVip uploaded downloaded')
|
||||
.skip(skip)
|
||||
.limit(limit)
|
||||
.exec(function (err, topics) {
|
||||
if (err) {
|
||||
return res.status(422).send(err);
|
||||
} else {
|
||||
res.json(topics);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* getHomeNoticeTopic
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
exports.getHomeNoticeTopic = function (req, res) {
|
||||
var skip = 0;
|
||||
var limit = itemsPerPageConfig.homeNoticeListLimit;
|
||||
|
||||
Topic.find({
|
||||
isHomeNotice: true
|
||||
})
|
||||
.sort('-pushHomeAt')
|
||||
.populate('user', 'username displayName profileImageURL isVip uploaded downloaded')
|
||||
.skip(skip)
|
||||
.limit(limit)
|
||||
.exec(function (err, topics) {
|
||||
if (err) {
|
||||
return res.status(422).send(err);
|
||||
} else {
|
||||
res.json(topics);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* getHomeNewTopic
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
exports.getHomeNewTopic = function (req, res) {
|
||||
var skip = 0;
|
||||
var limit = itemsPerPageConfig.homeNewTopicListLimit;
|
||||
|
||||
Topic.find()
|
||||
.sort('-pushHomeAt')
|
||||
.populate('user', 'username displayName profileImageURL isVip uploaded downloaded')
|
||||
.skip(skip)
|
||||
.limit(limit)
|
||||
.exec(function (err, topics) {
|
||||
if (err) {
|
||||
return res.status(422).send(err);
|
||||
} else {
|
||||
res.json(topics);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* globalTopics
|
||||
* @param req
|
||||
@@ -572,6 +646,7 @@ exports.toggleTopicHomeHelpStatus = function (req, res) {
|
||||
}
|
||||
|
||||
topic.isHomeHelp = !topic.isHomeHelp;
|
||||
topic.pushHomeAt = Date.now();
|
||||
|
||||
topic.save(function (err) {
|
||||
if (err) {
|
||||
@@ -599,6 +674,7 @@ exports.toggleTopicHomeNoticeStatus = function (req, res) {
|
||||
}
|
||||
|
||||
topic.isHomeNotice = !topic.isHomeNotice;
|
||||
topic.pushHomeAt = Date.now();
|
||||
|
||||
topic.save(function (err) {
|
||||
if (err) {
|
||||
|
||||
@@ -132,6 +132,9 @@ var TopicSchema = new Schema({
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'User'
|
||||
},
|
||||
pushHomeAt: {
|
||||
type: Date
|
||||
},
|
||||
createdAt: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
@@ -140,6 +143,7 @@ var TopicSchema = new Schema({
|
||||
|
||||
TopicSchema.index({forum: 1, isTop: -1, lastReplyAt: -1, createdAt: -1});
|
||||
TopicSchema.index({createdAt: -1, isGlobal: 1, forum: -1});
|
||||
TopicSchema.index({pushHomeAt: -1});
|
||||
|
||||
mongoose.model('Topic', TopicSchema);
|
||||
mongoose.model('Attach', AttachSchema);
|
||||
|
||||
@@ -32,7 +32,10 @@ exports.invokeRolesPolicies = function () {
|
||||
{resources: '/api/topics/:forumId/:topicId/toggleTopicGlobalStatus', permissions: '*'},
|
||||
{resources: '/api/topics/:forumId/:topicId/toggleTopicHomeHelpStatus', permissions: '*'},
|
||||
{resources: '/api/topics/:forumId/:topicId/toggleTopicHomeNoticeStatus', permissions: '*'},
|
||||
{resources: '/api/topics/:forumId/:topicId/thumbsUp', permissions: '*'}
|
||||
{resources: '/api/topics/:forumId/:topicId/thumbsUp', permissions: '*'},
|
||||
{resources: '/api/topics/getHomeHelpTopic', permissions: '*'},
|
||||
{resources: '/api/topics/getHomeNoticeTopic', permissions: '*'},
|
||||
{resources: '/api/topics/getHomeNewTopic', permissions: '*'}
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -42,7 +45,10 @@ exports.invokeRolesPolicies = function () {
|
||||
{resources: '/api/forums/:forumId', permissions: ['get']},
|
||||
{resources: '/api/topics/:forumId', permissions: ['get']},
|
||||
{resources: '/api/topics/:forumId/:topicId', permissions: ['get']},
|
||||
{resources: '/api/topics/:forumId/:topicId/:replyId', permissions: ['get']}
|
||||
{resources: '/api/topics/:forumId/:topicId/:replyId', permissions: ['get']},
|
||||
{resources: '/api/topics/getHomeHelpTopic', permissions: ['get']},
|
||||
{resources: '/api/topics/getHomeNoticeTopic', permissions: ['get']},
|
||||
{resources: '/api/topics/getHomeNewTopic', permissions: ['get']}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -27,6 +27,15 @@ module.exports = function (app) {
|
||||
app.route('/api/forums/:forumId').all(forumsPolicy.isAllowed)
|
||||
.get(forums.read);
|
||||
|
||||
app.route('/api/topics/getHomeHelpTopic').all(forumsPolicy.isAllowed)
|
||||
.get(forums.getHomeHelpTopic);
|
||||
|
||||
app.route('/api/topics/getHomeNoticeTopic').all(forumsPolicy.isAllowed)
|
||||
.get(forums.getHomeNoticeTopic);
|
||||
|
||||
app.route('/api/topics/getHomeNewTopic').all(forumsPolicy.isAllowed)
|
||||
.get(forums.getHomeNewTopic);
|
||||
|
||||
app.route('/api/topics/:forumId').all(forumsPolicy.isAllowed)
|
||||
.post(forums.postNewTopic)
|
||||
.get(forums.listTopics);
|
||||
|
||||
Reference in New Issue
Block a user