diff --git a/app/libs/push/webhook.js b/app/libs/push/webhook.js index 76748f5b..bb113882 100644 --- a/app/libs/push/webhook.js +++ b/app/libs/push/webhook.js @@ -8,6 +8,13 @@ class Webhook { }; async pushWebhook (event, payload) { + if (payload.client && typeof payload.client === 'object') { + payload.client = { + id: payload.client.id, + alias: payload.client.alias, + clientUrl: payload.client.clientUrl + }; + } const option = { url: this.webhookurl, method: 'POST', diff --git a/app/libs/site/MTeam.js b/app/libs/site/MTeam.js index 1e4b004b..9f28868d 100644 --- a/app/libs/site/MTeam.js +++ b/app/libs/site/MTeam.js @@ -1,7 +1,10 @@ +const logger = require('../logger'); const util = require('../util'); const moment = require('moment'); const _api = async function (cookie, path, data, type = 'form') { + logger.debug('M-Team, Wait 2.5s.'); + await util.sleep(2500); if (type === 'form') { const { body } = await util.requestPromise({ url: `https://api.m-team.cc${path}`, @@ -62,8 +65,9 @@ class Site { // 做种体积 const seedinglist = []; let page = 1; + const pageSize = 100; while (true) { - const _seedinglist = await _api(this.cookie, '/api/member/getUserTorrentList', { userid: info.uid, type: 'SEEDING', pageNumber: page, pageSize: 100 }, 'json'); + const _seedinglist = await _api(this.cookie, '/api/member/getUserTorrentList', { userid: info.uid, type: 'SEEDING', pageNumber: page, pageSize }, 'json'); if (!_seedinglist) { throw new Error('疑似登录状态失效, 请检查 Api Key'); } @@ -71,7 +75,7 @@ class Site { seedinglist.push(seeding); } page += 1; - if (!_seedinglist.data.length) { + if (_seedinglist.data.length < pageSize) { break; } }