mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-03-05 19:51:08 +01:00
feat(torrents): irc announce message when torrent reviewed by oper/admin
This commit is contained in:
3
config/env/torrents.js
vendored
3
config/env/torrents.js
vendored
@@ -29,7 +29,8 @@ module.exports = {
|
||||
userName: 'meanTorrent',
|
||||
realName: 'IRC announce client',
|
||||
channel: '#chdAnnounce',
|
||||
msg_format: '%s upload torrent %s at %s',
|
||||
default_msg_format: '%s upload - torrent: %s, type: %s, size: %d, sale: %s, at %s',
|
||||
tvserial_msg_format: '%s upload - torrent: %s, type: %s, size: %d, seasons: %d, episodes: %s, sale: %s, at %s',
|
||||
showErrors: true,
|
||||
autoRejoin: true,
|
||||
autoConnect: true,
|
||||
|
||||
@@ -570,11 +570,6 @@ exports.setRecommendLevel = function (req, res) {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
var client = req.app.get('ircClient');
|
||||
var msg = vsprintf(ircConfig.msg_format, [torrent.user.displayName, torrent.torrent_filename, moment().format('YYYY-MM-DD HH:mm:ss')]);
|
||||
client.notice(ircConfig.channel, msg);
|
||||
|
||||
} else {
|
||||
return res.status(422).send({
|
||||
message: 'params rlevel error'
|
||||
@@ -601,6 +596,33 @@ exports.setReviewedStatus = function (req, res) {
|
||||
} else {
|
||||
res.json(torrent);
|
||||
|
||||
//irc announce
|
||||
var msg = '';
|
||||
var client = req.app.get('ircClient');
|
||||
|
||||
if (torrent.torrent_type === 'tvserial') {
|
||||
msg = vsprintf(ircConfig.tvserial_msg_format, [
|
||||
torrent.user.displayName,
|
||||
torrent.torrent_filename,
|
||||
torrent.torrent_type,
|
||||
torrent.torrent_size,
|
||||
torrent.torrent_seasons,
|
||||
torrent.torrent_episodes,
|
||||
torrent.torrent_sale_status,
|
||||
moment().format('YYYY-MM-DD HH:mm:ss')
|
||||
]);
|
||||
} else {
|
||||
msg = vsprintf(ircConfig.default_msg_format, [
|
||||
torrent.user.displayName,
|
||||
torrent.torrent_filename,
|
||||
torrent.torrent_type,
|
||||
torrent.torrent_size,
|
||||
torrent.torrent_sale_status,
|
||||
moment().format('YYYY-MM-DD HH:mm:ss')
|
||||
]);
|
||||
}
|
||||
client.notice(ircConfig.channel, msg);
|
||||
|
||||
//create trace log
|
||||
traceLogCreate(req, traceConfig.action.AdminTorrentSetReviewedStatus, {
|
||||
torrent: torrent._id,
|
||||
|
||||
Reference in New Issue
Block a user