Skip to content

Commit

Permalink
feat: 新增真实 hash rss 记录,fix: keepfriends
Browse files Browse the repository at this point in the history
  • Loading branch information
vertex-app committed Nov 28, 2024
1 parent 70cd0e2 commit a136371
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/common/Rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,11 @@ class Rss {
const category = fitRule.category || this.category;
const client = fitRule.client ? global.runningClient[fitRule.client] : _client;
try {
let truehash = '';
this.addCount += 1;
if (this.pushTorrentFile) {
const { filepath, hash } = await this._downloadTorrent(torrent.url, torrent.hash);
truehash = hash;
await client.addTorrentByTorrentFile(filepath, hash, false, this.uploadLimit, this.downloadLimit, savePath, category, this.autoTMM, this.paused);
} else {
if (this.useCustomRegex) {
Expand All @@ -368,6 +370,10 @@ class Rss {
}
await util.runRecord('INSERT INTO torrents (hash, name, size, rss_id, link, category, record_time, add_time, record_type, record_note) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
[torrent.hash, torrent.name, torrent.size, this.id, torrent.link, category, moment().unix(), moment().unix(), 1, '添加种子']);
if (truehash && torrent.hash !== truehash) {
await util.runRecord('INSERT INTO torrents (hash, name, size, rss_id, link, category, record_time, add_time, record_type, record_note) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
[truehash, torrent.name, torrent.size, this.id, torrent.link, category, moment().unix(), moment().unix(), 1, '添加种子']);
}
} catch (error) {
logger.error(this.alias, '下载器', client.alias, '添加种子失败:', error.message);
await util.runRecord('INSERT INTO torrents (hash, name, size, rss_id, link, record_time, record_type, record_note) values (?, ?, ?, ?, ?, ?, ?, ?)',
Expand Down
4 changes: 2 additions & 2 deletions app/libs/site/KeepFriends.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class Site {
// uid
info.uid = +document.querySelector('a[href*=userdetails]').href.match(/id=(\d+)/)[1];
// 上传
info.upload = document.querySelector('font[class=color_uploaded]').nextSibling.nodeValue.trim().replace(/(\w)B/, '$1iB');
info.upload = document.querySelector('span[class=color_uploaded]').nextSibling.nodeValue.trim().replace(/(\w)B/, '$1iB');
info.upload = util.calSize(...info.upload.split(' '));
// 下载
info.download = document.querySelector('font[class=color_downloaded]').nextSibling.nodeValue.trim().replace(/(\w)B/, '$1iB');
info.download = document.querySelector('span[class=color_downloaded]').nextSibling.nodeValue.trim().replace(/(\w)B/, '$1iB');
info.download = util.calSize(...info.download.split(' '));
// 做种
info.seeding = +document.querySelector('img[class=arrowup]').nextSibling.nodeValue.trim();
Expand Down

0 comments on commit a136371

Please sign in to comment.