From 9e60254fd6c33a1e227ebbbcc2f7c3c5a8978aef Mon Sep 17 00:00:00 2001 From: zhangchunrui Date: Fri, 27 Sep 2019 09:33:11 +0800 Subject: [PATCH 01/46] 'test' --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 50eab29..b7fce44 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -require('./src')(); +require('./src')() From 8a765c1f1b4ebc33a57060728afe793d5cbe37cf Mon Sep 17 00:00:00 2001 From: impressioncr Date: Fri, 27 Sep 2019 09:36:40 +0800 Subject: [PATCH 02/46] 'test.' --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b7fce44..50eab29 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -require('./src')() +require('./src')(); From 02e8abe1ca61acc59b32864aa67d262b51e8b45e Mon Sep 17 00:00:00 2001 From: impressioncr Date: Fri, 27 Sep 2019 10:13:09 +0800 Subject: [PATCH 03/46] schedule --- README.md | 7 ++- example.config.json | 3 +- index.js | 8 ++- package-lock.json | 90 ---------------------------- package.json | 3 +- src/utils/index.js | 3 +- yarn.lock | 139 ++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 158 insertions(+), 95 deletions(-) delete mode 100644 package-lock.json create mode 100644 yarn.lock diff --git a/README.md b/README.md index 8a29782..5b938b8 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,11 @@ Add a `downloadPath` to `config.json` to have the torrents added to your torrent ### To run -`npm start` +Need pm2 + +`npm install pm2 -g` + +`pm2 start index.js` ### Discord notifications @@ -35,6 +39,7 @@ Configuration options with defaults shown "maxAge": -1, // Maximum time in minutes since torrent was uploaded. See below note. "downloadPath": "", // Path to download .torrent files to. Optional. "discordWebhookUrl": "" // Discord webhook URI. Optional. + "interval": 15 // Download interval. } ``` diff --git a/example.config.json b/example.config.json index 7f0526a..d38dee3 100644 --- a/example.config.json +++ b/example.config.json @@ -9,5 +9,6 @@ "maxSize": -1, "maxAge": -1, "downloadPath": "", - "discordWebhookUrl": "" + "discordWebhookUrl": "", + "interval": 10 } diff --git a/index.js b/index.js index 50eab29..66fa357 100644 --- a/index.js +++ b/index.js @@ -1 +1,7 @@ -require('./src')(); +const app = require('./src') +const schedule = require('node-schedule') +const { interval } = require('./config.json') + +const scheduleJob = async () => await app() + +const job = schedule.scheduleJob(`*/${interval} * * * *`, scheduleJob) diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 5d2330a..0000000 --- a/package-lock.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "name": "ptp", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" - }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" - }, - "directory-exists": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/directory-exists/-/directory-exists-2.0.1.tgz", - "integrity": "sha512-+CEod3IzwjvhQOMXFSU6nrqdTwrhzOiacNzzXlwBVFm7C4y2rbuEWs5WaRsI/3IZeSWORA5F1q8FBh3gm4HSsw==" - }, - "discord.js": { - "version": "11.5.1", - "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-11.5.1.tgz", - "integrity": "sha512-tGhV5xaZXE3Z+4uXJb3hYM6gQ1NmnSxp9PClcsSAYFVRzH6AJH74040mO3afPDMWEAlj8XsoPXXTJHTxesqcGw==", - "requires": { - "long": "^4.0.0", - "prism-media": "^0.0.3", - "snekfetch": "^3.6.4", - "tweetnacl": "^1.0.0", - "ws": "^6.0.0" - } - }, - "import-fresh": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", - "integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==", - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - } - }, - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "node-fetch": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", - "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" - }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "requires": { - "callsites": "^3.0.0" - } - }, - "prism-media": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-0.0.3.tgz", - "integrity": "sha512-c9KkNifSMU/iXT8FFTaBwBMr+rdVcN+H/uNv1o+CuFeTThNZNTOrQ+RgXA1yL/DeLk098duAeRPP3QNPNbhxYQ==" - }, - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" - }, - "snekfetch": { - "version": "3.6.4", - "resolved": "https://registry.npmjs.org/snekfetch/-/snekfetch-3.6.4.tgz", - "integrity": "sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw==" - }, - "tweetnacl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.1.tgz", - "integrity": "sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A==" - }, - "ws": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.1.tgz", - "integrity": "sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==", - "requires": { - "async-limiter": "~1.0.0" - } - } - } -} diff --git a/package.json b/package.json index ed0e2a6..350e171 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "directory-exists": "^2.0.1", "discord.js": "^11.5.1", "import-fresh": "^3.1.0", - "node-fetch": "^2.6.0" + "node-fetch": "^2.6.0", + "node-schedule": "^1.3.2" } } diff --git a/src/utils/index.js b/src/utils/index.js index e847350..07e735b 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -97,7 +97,8 @@ exports.fetchTorrents = async (apiUser, apiKey) => { await checkStatus(response); const json = await response.json(), - torrents = getTorrentsFromResponse(json); + torrents = getTorrentsFromResponse(json); + console.log(json) return { torrents, authKey: json.AuthKey, passKey: json.PassKey }; } catch(error) { diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..e407fab --- /dev/null +++ b/yarn.lock @@ -0,0 +1,139 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +async-limiter@~1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" + integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== + +cron-parser@^2.7.3: + version "2.13.0" + resolved "https://registry.yarnpkg.com/cron-parser/-/cron-parser-2.13.0.tgz#6f930bb6f2931790d2a9eec83b3ec276e27a6725" + integrity sha512-UWeIpnRb0eyoWPVk+pD3TDpNx3KCFQeezO224oJIkktBrcW6RoAPOx5zIKprZGfk6vcYSmA8yQXItejSaDBhbQ== + dependencies: + is-nan "^1.2.1" + moment-timezone "^0.5.25" + +define-properties@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" + integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + dependencies: + object-keys "^1.0.12" + +directory-exists@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/directory-exists/-/directory-exists-2.0.1.tgz#7c763f1c75975c088f8f74cd669e150b7cdaf030" + integrity sha512-+CEod3IzwjvhQOMXFSU6nrqdTwrhzOiacNzzXlwBVFm7C4y2rbuEWs5WaRsI/3IZeSWORA5F1q8FBh3gm4HSsw== + +discord.js@^11.5.1: + version "11.5.1" + resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-11.5.1.tgz#910fb9f6410328581093e044cafb661783a4d9e8" + integrity sha512-tGhV5xaZXE3Z+4uXJb3hYM6gQ1NmnSxp9PClcsSAYFVRzH6AJH74040mO3afPDMWEAlj8XsoPXXTJHTxesqcGw== + dependencies: + long "^4.0.0" + prism-media "^0.0.3" + snekfetch "^3.6.4" + tweetnacl "^1.0.0" + ws "^6.0.0" + +import-fresh@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.1.0.tgz#6d33fa1dcef6df930fae003446f33415af905118" + integrity sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +is-nan@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/is-nan/-/is-nan-1.2.1.tgz#9faf65b6fb6db24b7f5c0628475ea71f988401e2" + integrity sha1-n69ltvttskt/XAYoR16nH5iEAeI= + dependencies: + define-properties "^1.1.1" + +long-timeout@0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/long-timeout/-/long-timeout-0.1.1.tgz#9721d788b47e0bcb5a24c2e2bee1a0da55dab514" + integrity sha1-lyHXiLR+C8taJMLivuGg2lXatRQ= + +long@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== + +moment-timezone@^0.5.25: + version "0.5.26" + resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.26.tgz#c0267ca09ae84631aa3dc33f65bedbe6e8e0d772" + integrity sha512-sFP4cgEKTCymBBKgoxZjYzlSovC20Y6J7y3nanDc5RoBIXKlZhoYwBoZGe3flwU6A372AcRwScH8KiwV6zjy1g== + dependencies: + moment ">= 2.9.0" + +"moment@>= 2.9.0": + version "2.24.0" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" + integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== + +node-fetch@^2.6.0: + version "2.6.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" + integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== + +node-schedule@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/node-schedule/-/node-schedule-1.3.2.tgz#d774b383e2a6f6ade59eecc62254aea07cd758cb" + integrity sha512-GIND2pHMHiReSZSvS6dpZcDH7pGPGFfWBIEud6S00Q8zEIzAs9ommdyRK1ZbQt8y1LyZsJYZgPnyi7gpU2lcdw== + dependencies: + cron-parser "^2.7.3" + long-timeout "0.1.1" + sorted-array-functions "^1.0.0" + +object-keys@^1.0.12: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +prism-media@^0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/prism-media/-/prism-media-0.0.3.tgz#8842d4fae804f099d3b48a9a38e3c2bab6f4855b" + integrity sha512-c9KkNifSMU/iXT8FFTaBwBMr+rdVcN+H/uNv1o+CuFeTThNZNTOrQ+RgXA1yL/DeLk098duAeRPP3QNPNbhxYQ== + +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +snekfetch@^3.6.4: + version "3.6.4" + resolved "https://registry.yarnpkg.com/snekfetch/-/snekfetch-3.6.4.tgz#d13e80a616d892f3d38daae4289f4d258a645120" + integrity sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw== + +sorted-array-functions@^1.0.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/sorted-array-functions/-/sorted-array-functions-1.2.0.tgz#43265b21d6e985b7df31621b1c11cc68d8efc7c3" + integrity sha512-sWpjPhIZJtqO77GN+LD8dDsDKcWZ9GCOJNqKzi1tvtjGIzwfoyuRH8S0psunmc6Z5P+qfDqztSbwYR5X/e1UTg== + +tweetnacl@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.1.tgz#2594d42da73cd036bd0d2a54683dd35a6b55ca17" + integrity sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A== + +ws@^6.0.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" + integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== + dependencies: + async-limiter "~1.0.0" From d94aea5a52aae6433d1194f09314076409d3e9b7 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Fri, 27 Sep 2019 10:26:00 +0800 Subject: [PATCH 04/46] rm log --- src/utils/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index 07e735b..4c44d03 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -98,7 +98,6 @@ exports.fetchTorrents = async (apiUser, apiKey) => { const json = await response.json(), torrents = getTorrentsFromResponse(json); - console.log(json) return { torrents, authKey: json.AuthKey, passKey: json.PassKey }; } catch(error) { From c7f1ab495c9aab4a0e9c3e33ff606d1042ce4e52 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Fri, 27 Sep 2019 11:23:54 +0800 Subject: [PATCH 05/46] log --- index.js | 9 +++++++-- src/utils/index.js | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 66fa357..eb25414 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,11 @@ const app = require('./src') const schedule = require('node-schedule') const { interval } = require('./config.json') -const scheduleJob = async () => await app() +const index = 1 +const scheduleJob = async () => { + console.log(index) + index ++ + await app() +} -const job = schedule.scheduleJob(`*/${interval} * * * *`, scheduleJob) +schedule.scheduleJob(`*/${interval} * * * *`, scheduleJob) diff --git a/src/utils/index.js b/src/utils/index.js index 4c44d03..10dd72e 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -99,6 +99,8 @@ exports.fetchTorrents = async (apiUser, apiKey) => { const json = await response.json(), torrents = getTorrentsFromResponse(json); + console.log(`newest torrent ${JSON.stringify(torrents[0])}`) + return { torrents, authKey: json.AuthKey, passKey: json.PassKey }; } catch(error) { From a5616e5382c7acad8b4c98a0c104fab9ce9d585d Mon Sep 17 00:00:00 2001 From: impressioncr Date: Fri, 27 Sep 2019 11:32:40 +0800 Subject: [PATCH 06/46] fix --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index eb25414..bb5438f 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,7 @@ const app = require('./src') const schedule = require('node-schedule') const { interval } = require('./config.json') -const index = 1 +let index = 1 const scheduleJob = async () => { console.log(index) index ++ From 3e1960eb43a6469b21a9dddec1fd6b5c3b0ab83c Mon Sep 17 00:00:00 2001 From: impressioncr Date: Fri, 27 Sep 2019 12:43:04 +0800 Subject: [PATCH 07/46] fix time --- index.js | 8 ++++---- package.json | 1 + src/utils/index.js | 5 ++++- yarn.lock | 5 +++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index bb5438f..33161d8 100644 --- a/index.js +++ b/index.js @@ -2,11 +2,11 @@ const app = require('./src') const schedule = require('node-schedule') const { interval } = require('./config.json') -let index = 1 +const index = 1 const scheduleJob = async () => { console.log(index) - index ++ - await app() + index++ + await app() } -schedule.scheduleJob(`*/${interval} * * * *`, scheduleJob) +const job = schedule.scheduleJob(`*/${interval} * * * *`, scheduleJob) diff --git a/package.json b/package.json index 350e171..d523ca4 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "author": "", "license": "ISC", "dependencies": { + "dayjs": "^1.8.16", "directory-exists": "^2.0.1", "discord.js": "^11.5.1", "import-fresh": "^3.1.0", diff --git a/src/utils/index.js b/src/utils/index.js index 10dd72e..7b6da4a 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,3 +1,5 @@ +const dayjs = require('dayjs') + const path = require('path'), fs = require('fs'), fetch = require('node-fetch'), @@ -110,10 +112,11 @@ exports.fetchTorrents = async (apiUser, apiKey) => { }; const isOlderThan = (date, minutes) => { + const uploadTime = dayjs(date).add(8, 'hours') const earliest = 1000 * minutes * 60, time = Date.now() - earliest; - return new Date(date) < time; + return new Date(uploadTime) < time; }; exports.torrentMatchesFilters = (torrent, config) => { diff --git a/yarn.lock b/yarn.lock index e407fab..48ba9b7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20,6 +20,11 @@ cron-parser@^2.7.3: is-nan "^1.2.1" moment-timezone "^0.5.25" +dayjs@^1.8.16: + version "1.8.16" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.8.16.tgz#2a3771de537255191b947957af2fd90012e71e64" + integrity sha512-XPmqzWz/EJiaRHjBqSJ2s6hE/BUoCIHKgdS2QPtTQtKcS9E4/Qn0WomoH1lXanWCzri+g7zPcuNV4aTZ8PMORQ== + define-properties@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" From 6fe74258d1c047f70c762ef82326c81b5f68504c Mon Sep 17 00:00:00 2001 From: impressioncr Date: Fri, 27 Sep 2019 12:49:12 +0800 Subject: [PATCH 08/46] fix time --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 33161d8..56b4dc4 100644 --- a/index.js +++ b/index.js @@ -2,10 +2,10 @@ const app = require('./src') const schedule = require('node-schedule') const { interval } = require('./config.json') -const index = 1 +let index = 1 const scheduleJob = async () => { console.log(index) - index++ + index ++ await app() } From 16a22fac978729a2e20fd237b22d6a182db91fe7 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Sun, 29 Sep 2019 10:41:44 +0800 Subject: [PATCH 09/46] fix size --- src/utils/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 7b6da4a..5114b8b 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -124,8 +124,8 @@ exports.torrentMatchesFilters = (torrent, config) => { const cache = getCache(); - const minSize = config.minsize === -1 ? -1 : Number(config.minsize) * 1024 * 1024, - maxSize = config.maxsize === -1 ? -1 : Number(config.maxsize) * 1024 * 1024; + const minSize = config.minSize === -1 ? -1 : Number(config.minSize) * 1024 * 1024, + maxSize = config.maxSize === -1 ? -1 : Number(config.maxSize) * 1024 * 1024; if (cache.freeleech.includes(torrent.Id)) { return false; From 4973b3fec0857e6c37ea5d36edaf56ac09ec34b6 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Sun, 29 Sep 2019 10:58:02 +0800 Subject: [PATCH 10/46] add rule --- README.md | 4 ++++ src/utils/index.js | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index 5b938b8..e1f7a82 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,10 @@ Configuration options with defaults shown "downloadPath": "", // Path to download .torrent files to. Optional. "discordWebhookUrl": "" // Discord webhook URI. Optional. "interval": 15 // Download interval. + "matchByAgeAndMaxSeeders": [ + { maxAge: 600, maxSeeders: 5 }, + { maxAge: 1200, maxSeeders: 2 } + ] // For new Freeleeh which uploaded some time ago but had a few seeders. } ``` diff --git a/src/utils/index.js b/src/utils/index.js index 5114b8b..94b6086 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -159,6 +159,14 @@ exports.torrentMatchesFilters = (torrent, config) => { isMatch = false; } + for (let index = 0; index < config.matchByAgeAndMaxSeeders.length; index ++) { + let rule = config.matchByAgeAndMaxSeeders[index] + if (!isOlderThan(torrent.UploadTime, rule.maxAge) && (torrent.Seeders <= rule.maxSeeders)) { + isMatch = true; + break; + } + } + return isMatch; }; From 758212c87e488f99448488264355b3c164efd546 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Sun, 29 Sep 2019 11:03:01 +0800 Subject: [PATCH 11/46] add rule. --- README.md | 4 ++-- example.config.json | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e1f7a82..de01ba9 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,8 @@ Configuration options with defaults shown "discordWebhookUrl": "" // Discord webhook URI. Optional. "interval": 15 // Download interval. "matchByAgeAndMaxSeeders": [ - { maxAge: 600, maxSeeders: 5 }, - { maxAge: 1200, maxSeeders: 2 } + { "maxAge": 600, "maxSeeders": 5 }, + { "maxAge": 1200, "maxSeeders": 2 } ] // For new Freeleeh which uploaded some time ago but had a few seeders. } ``` diff --git a/example.config.json b/example.config.json index d38dee3..5a1333d 100644 --- a/example.config.json +++ b/example.config.json @@ -10,5 +10,9 @@ "maxAge": -1, "downloadPath": "", "discordWebhookUrl": "", - "interval": 10 + "interval": 10, + "matchByAgeAndMaxSeeders": [ + { "maxAge": 600, "maxSeeders": 5 }, + { "maxAge": 1200, "maxSeeders": 2 } + ] } From 0025ff59d5d552fda687a9647b2f37e131c5c017 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Sun, 29 Sep 2019 11:12:48 +0800 Subject: [PATCH 12/46] fix size --- src/utils/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index 94b6086..bbe2854 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -162,7 +162,9 @@ exports.torrentMatchesFilters = (torrent, config) => { for (let index = 0; index < config.matchByAgeAndMaxSeeders.length; index ++) { let rule = config.matchByAgeAndMaxSeeders[index] if (!isOlderThan(torrent.UploadTime, rule.maxAge) && (torrent.Seeders <= rule.maxSeeders)) { - isMatch = true; + if (minSize !== -1 && torrent.Size >= minSize) { + isMatch = true; + } break; } } From 06273d127336f708ff6566c19523d97c0fe0fb74 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Fri, 11 Oct 2019 15:31:30 +0800 Subject: [PATCH 13/46] readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index de01ba9..315ee30 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Add a `downloadPath` to `config.json` to have the torrents added to your torrent Need pm2 `npm install pm2 -g` - +`npm i` `pm2 start index.js` ### Discord notifications From 822793fb6647de13485f06eb0e6993f4b189fc0a Mon Sep 17 00:00:00 2001 From: impressioncr Date: Wed, 16 Oct 2019 11:15:42 +0800 Subject: [PATCH 14/46] GoldenPopcorn --- README.md | 5 +++-- example.config.json | 1 + src/utils/index.js | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 315ee30..99b76c3 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,9 @@ Configuration options with defaults shown "maxsize": -1, // Maximum size in megabytes. Set to -1 for unlimited. "maxAge": -1, // Maximum time in minutes since torrent was uploaded. See below note. "downloadPath": "", // Path to download .torrent files to. Optional. - "discordWebhookUrl": "" // Discord webhook URI. Optional. - "interval": 15 // Download interval. + "discordWebhookUrl": "", // Discord webhook URI. Optional. + "interval": 15,// Download interval. + "GoldenPopcorn": true, // Download all GoldenPopcorn. "matchByAgeAndMaxSeeders": [ { "maxAge": 600, "maxSeeders": 5 }, { "maxAge": 1200, "maxSeeders": 2 } diff --git a/example.config.json b/example.config.json index 5a1333d..c1bc87a 100644 --- a/example.config.json +++ b/example.config.json @@ -11,6 +11,7 @@ "downloadPath": "", "discordWebhookUrl": "", "interval": 10, + "GoldenPopcorn": true, "matchByAgeAndMaxSeeders": [ { "maxAge": 600, "maxSeeders": 5 }, { "maxAge": 1200, "maxSeeders": 2 } diff --git a/src/utils/index.js b/src/utils/index.js index bbe2854..e9e52bc 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -169,6 +169,10 @@ exports.torrentMatchesFilters = (torrent, config) => { } } + if (torrent.GoldenPopcorn && config.GoldenPopcorn) { + isMatch = true; + } + return isMatch; }; From 86076ec2756ddec1323a82a36f8c32c150540ee8 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Thu, 17 Oct 2019 16:48:02 +0800 Subject: [PATCH 15/46] fetch all page --- src/index.js | 10 +++++++--- src/utils/index.js | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/index.js b/src/index.js index 5c8d6b8..6a58c53 100644 --- a/src/index.js +++ b/src/index.js @@ -4,9 +4,13 @@ const { validateConfig, fetchTorrents, torrentMatchesFilters, writeTorrentCache module.exports = async function() { try { - const config = await validateConfig(), - { torrents, authKey, passKey } = await fetchTorrents(config.apiUser, config.apiKey); - + const config = await validateConfig() + const { torrents, authKey, passKey, totalResults } = await fetchTorrents(config.apiUser, config.apiKey); + const pageNum = Math.ceil(totalResults/50) + for (let index = 2; index <= pageNum; index++) { + const result = await fetchTorrents(config.apiUser, config.apiKey, index); + torrents.push(...result.torrents); + } for (const torrent of torrents) { if (torrentMatchesFilters(torrent, config)) { await downloadTorrent({ torrent, authKey, passKey }, config); diff --git a/src/utils/index.js b/src/utils/index.js index e9e52bc..7170aaa 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -82,14 +82,14 @@ const checkStatus = response => new Promise((resolve, reject) => { } }); -exports.fetchTorrents = async (apiUser, apiKey) => { +exports.fetchTorrents = async (apiUser, apiKey, page) => { if (!apiUser || !apiKey) { console.log('Please ensure you\'ve added your ApiUser and ApiKey details from your PTP profile to the config file. See the example config file for details.'); process.exit(); } try { - const response = await fetch(freeleechEndpoint, { + const response = await fetch(page ? `${freeleechEndpoint}&page=${page}` : freeleechEndpoint, { headers: { 'ApiUser': apiUser, 'ApiKey': apiKey @@ -103,7 +103,7 @@ exports.fetchTorrents = async (apiUser, apiKey) => { console.log(`newest torrent ${JSON.stringify(torrents[0])}`) - return { torrents, authKey: json.AuthKey, passKey: json.PassKey }; + return { torrents, authKey: json.AuthKey, passKey: json.PassKey, totalResults: Number(json.TotalResults) }; } catch(error) { console.log(error); From 8cc74bcccab31f74dbb46ccda586ec8ac5ac9905 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Thu, 17 Oct 2019 16:53:12 +0800 Subject: [PATCH 16/46] all torrent --- src/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 6a58c53..f68f17d 100644 --- a/src/index.js +++ b/src/index.js @@ -7,9 +7,11 @@ module.exports = async function() { const config = await validateConfig() const { torrents, authKey, passKey, totalResults } = await fetchTorrents(config.apiUser, config.apiKey); const pageNum = Math.ceil(totalResults/50) - for (let index = 2; index <= pageNum; index++) { - const result = await fetchTorrents(config.apiUser, config.apiKey, index); - torrents.push(...result.torrents); + if (pageNum >= 2) { + for (let index = 2; index <= pageNum; index++) { + const result = await fetchTorrents(config.apiUser, config.apiKey, index); + torrents.push(...result.torrents); + } } for (const torrent of torrents) { if (torrentMatchesFilters(torrent, config)) { From 1fea8a076dfe4ca6e7d843d227149cf86aa3ea04 Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Wed, 23 Oct 2019 19:03:02 +0800 Subject: [PATCH 17/46] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 99b76c3..b84bf80 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ A node.js script that automates the downloading of PassThePopcorn freeleech torr ### To install +`npm install pm2 -g` + `npm install` Copy `example.config.json` to `config.json` and fill in your apiUser and apiKey credentials from your user profile. @@ -14,8 +16,6 @@ Add a `downloadPath` to `config.json` to have the torrents added to your torrent Need pm2 -`npm install pm2 -g` -`npm i` `pm2 start index.js` ### Discord notifications From 622c1694babe1b98ba3c0bd835222d87b9773d81 Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Wed, 23 Oct 2019 19:03:42 +0800 Subject: [PATCH 18/46] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b84bf80..f18c689 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,12 @@ Add a `downloadPath` to `config.json` to have the torrents added to your torrent ### To run -Need pm2 - `pm2 start index.js` +### Log + +pm2 log index + ### Discord notifications Create a Webhook URL for a Discord channel and place it as `discordWebhookUrl` in your config file to be notified of grabbed torrents. From 0fb7607ad1b3eab35ea58da468b80f4c249d90fe Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Wed, 23 Oct 2019 19:03:56 +0800 Subject: [PATCH 19/46] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f18c689..e3c0608 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Add a `downloadPath` to `config.json` to have the torrents added to your torrent ### Log -pm2 log index +`pm2 log index` ### Discord notifications From 7fa5571794e71f68df0d96490e60e24c28b00751 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Thu, 24 Oct 2019 17:43:42 +0800 Subject: [PATCH 20/46] chinese readme --- README.zh-CN.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 README.zh-CN.md diff --git a/README.zh-CN.md b/README.zh-CN.md new file mode 100644 index 0000000..e48d2f5 --- /dev/null +++ b/README.zh-CN.md @@ -0,0 +1,63 @@ +# PTP免费种子下载 + +一个自动下载ptp免费种子的nodejs程序. + +### 安装 + +依赖nodejs环境, 推荐使用nvm安装。 + +`wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash` + +安装后重启ssh。然后安装nodejs + +`nvm install stable` + +安装pm2 + +`npm install pm2 -g` + +安装依赖 + +`npm install` + +修改配置文件: 复制`example.config.json`为`config.json`, 填上你的apiUser和apiKey(ptp网站edit-security) + +### 运行 + +`pm2 start index.js --name "freedl"` + +### 查看日志 + +`pm2 log freedl` + +### Discord 通知 + +需要在下载种子时收到通知的可以填上discordWebhookUrl, discord使用方法可以google + +### 配置说明 + +```javascript +{ + "apiUser": "", // apiUser. + "apiKey": "", // apiKey。 + "minseeders": -1, // 最少做种数. -1表示无限制. + "maxseeders": -1, // 最大做种数. -1表示无限制. + "minleechers": -1, // 最少下载数. -1表示无限制. + "maxleechers": -1, // 最大下载数. -1表示无限制. + "minsize": -1, // 种子最小大小(单位mb). -1表示无限制. + "maxsize": -1, // 种子最大大小(单位mb). -1表示无限制. + "maxAge": -1, // 种子上传最大时间(单位分钟). + "downloadPath": "", // 软件监控路径,种子文件下载到这里. + "discordWebhookUrl": "", // Discord机器人url, 可选. + "interval": 15,// 运行间隔时间. + "GoldenPopcorn": true, // 是否下载金种(会忽略所有其他条件). + "matchByAgeAndMaxSeeders": [ + { "maxAge": 600, "maxSeeders": 5 }, + { "maxAge": 1200, "maxSeeders": 2 } + ] // 根据上传时间和做种人数组合筛选,因为有很多很老的种子加为免费种,做种人数很少,也有刷的价值。例子的过滤为 上传10个小时以内,做种小于5; 上传20个小时以内, 做种小于5; 可以根据自己情况调整。 +} +``` + +#### 时间 + +设置时间有关的过滤选项时,保证服务器时间为北京时间。 From 782dece8ad527de1eff7d30c82ab5e5b601f0c91 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Thu, 24 Oct 2019 17:47:31 +0800 Subject: [PATCH 21/46] chinese readme --- README.zh-CN.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index e48d2f5..4b625fd 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -16,19 +16,23 @@ `npm install pm2 -g` -安装依赖 +下载代码 + +`git clone git@github.com:impressioncr/ptpfl.git` + +进入到ptpfl目录下, 安装依赖 `npm install` 修改配置文件: 复制`example.config.json`为`config.json`, 填上你的apiUser和apiKey(ptp网站edit-security) -### 运行 +### 运行(ptpfl目录下) -`pm2 start index.js --name "freedl"` +`pm2 start index.js --name "myapp"` ### 查看日志 -`pm2 log freedl` +`pm2 log myapp` ### Discord 通知 From 6d1cf43f350c83e28c8958a7913a73b16f96aba2 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Thu, 24 Oct 2019 17:57:06 +0800 Subject: [PATCH 22/46] edit chinese readme --- README.zh-CN.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index 4b625fd..863fe08 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -43,7 +43,7 @@ ```javascript { "apiUser": "", // apiUser. - "apiKey": "", // apiKey。 + "apiKey": "", // apiKey. "minseeders": -1, // 最少做种数. -1表示无限制. "maxseeders": -1, // 最大做种数. -1表示无限制. "minleechers": -1, // 最少下载数. -1表示无限制. @@ -51,17 +51,21 @@ "minsize": -1, // 种子最小大小(单位mb). -1表示无限制. "maxsize": -1, // 种子最大大小(单位mb). -1表示无限制. "maxAge": -1, // 种子上传最大时间(单位分钟). - "downloadPath": "", // 软件监控路径,种子文件下载到这里. + "downloadPath": "", // 下载软件的监控文件夹路径,种子文件下载到这里. "discordWebhookUrl": "", // Discord机器人url, 可选. "interval": 15,// 运行间隔时间. "GoldenPopcorn": true, // 是否下载金种(会忽略所有其他条件). "matchByAgeAndMaxSeeders": [ { "maxAge": 600, "maxSeeders": 5 }, { "maxAge": 1200, "maxSeeders": 2 } - ] // 根据上传时间和做种人数组合筛选,因为有很多很老的种子加为免费种,做种人数很少,也有刷的价值。例子的过滤为 上传10个小时以内,做种小于5; 上传20个小时以内, 做种小于5; 可以根据自己情况调整。 + ] // 见 上传时间和做种人数组合筛选 } ``` +#### 上传时间和做种人数组合筛选 + +根据上传时间和做种人数组合筛选,因为有很多很老的种子加为免费种,做种人数很少,也有刷的价值。上边例子的过滤为: 上传10个小时以内,做种小于5; 上传20个小时以内, 做种小于5; 可以根据自己情况调整。 + #### 时间 设置时间有关的过滤选项时,保证服务器时间为北京时间。 From 7fbe4e90dc75f17eb54786411a49bf5b86f3e64d Mon Sep 17 00:00:00 2001 From: impressioncr Date: Thu, 24 Oct 2019 17:59:36 +0800 Subject: [PATCH 23/46] link chinese readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e3c0608..816942d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[中文](https://github.com/impressioncr/ptpfl/blob/master/README.zh-CN.md) + # PassThePopcorn Freeleech Automator A node.js script that automates the downloading of PassThePopcorn freeleech torrents. From d526eee328fcb65d1b8b319b6afbf7fb65d52a10 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Thu, 24 Oct 2019 18:00:03 +0800 Subject: [PATCH 24/46] link chinese readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 816942d..5e1c4c8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[中文](https://github.com/impressioncr/ptpfl/blob/master/README.zh-CN.md) +## [中文](https://github.com/impressioncr/ptpfl/blob/master/README.zh-CN.md) # PassThePopcorn Freeleech Automator From 7a6ece9171ea66bc971f5e591a3f42d85889c77d Mon Sep 17 00:00:00 2001 From: impressioncr Date: Mon, 28 Oct 2019 11:22:46 +0800 Subject: [PATCH 25/46] =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.zh-CN.md | 13 +++++++++---- src/utils/index.js | 8 ++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index 863fe08..d631a31 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -18,7 +18,7 @@ 下载代码 -`git clone git@github.com:impressioncr/ptpfl.git` +`git clone https://github.com/impressioncr/ptpfl.git` 进入到ptpfl目录下, 安装依赖 @@ -34,6 +34,14 @@ `pm2 log myapp` +### 暂停 + +`pm2 stop myapp` + +### 重启 + +`pm2 restart myapp` + ### Discord 通知 需要在下载种子时收到通知的可以填上discordWebhookUrl, discord使用方法可以google @@ -66,6 +74,3 @@ 根据上传时间和做种人数组合筛选,因为有很多很老的种子加为免费种,做种人数很少,也有刷的价值。上边例子的过滤为: 上传10个小时以内,做种小于5; 上传20个小时以内, 做种小于5; 可以根据自己情况调整。 -#### 时间 - -设置时间有关的过滤选项时,保证服务器时间为北京时间。 diff --git a/src/utils/index.js b/src/utils/index.js index 7170aaa..bde1fc3 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -112,11 +112,11 @@ exports.fetchTorrents = async (apiUser, apiKey, page) => { }; const isOlderThan = (date, minutes) => { - const uploadTime = dayjs(date).add(8, 'hours') - const earliest = 1000 * minutes * 60, - time = Date.now() - earliest; + const uploadTime = dayjs(date) + const earliest = 1000 * minutes * 60 + const now = dayjs().valueOf() - dayjs().utcOffset() * 60 * 1000 - return new Date(uploadTime) < time; + return uploadTime.diff(now) + earliest > 0; }; exports.torrentMatchesFilters = (torrent, config) => { From 4c45c214f1934e49b96d5acfb4c92a293a2e957c Mon Sep 17 00:00:00 2001 From: impressioncr Date: Mon, 28 Oct 2019 18:12:39 +0800 Subject: [PATCH 26/46] fix time --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f15044b..7bfd3b6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ config.json node_modules/ data/* !data/.gitkeep +test.js From 086f85dea79ef725ee37a607929bb7a4f968e526 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Mon, 28 Oct 2019 18:18:39 +0800 Subject: [PATCH 27/46] fix --- src/utils/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index bde1fc3..2c9621f 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -116,7 +116,7 @@ const isOlderThan = (date, minutes) => { const earliest = 1000 * minutes * 60 const now = dayjs().valueOf() - dayjs().utcOffset() * 60 * 1000 - return uploadTime.diff(now) + earliest > 0; + return uploadTime.diff(now) + earliest < 0; }; exports.torrentMatchesFilters = (torrent, config) => { From 677e0529eeb3644901bbcf34c0a13d89732ac2b8 Mon Sep 17 00:00:00 2001 From: impressioncr Date: Fri, 1 Nov 2019 11:29:37 +0800 Subject: [PATCH 28/46] url --- README.md | 2 +- README.zh-CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5e1c4c8..d7d26fc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## [中文](https://github.com/impressioncr/ptpfl/blob/master/README.zh-CN.md) +## [中文](https://github.com/lushdog/ptpfl/blob/master/README.zh-CN.md) # PassThePopcorn Freeleech Automator diff --git a/README.zh-CN.md b/README.zh-CN.md index d631a31..b60a40b 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -18,7 +18,7 @@ 下载代码 -`git clone https://github.com/impressioncr/ptpfl.git` +`git clone https://github.com/lushdog/ptpfl.git` 进入到ptpfl目录下, 安装依赖 From b615438820f9423aa5c7dde97e1c69135dbee896 Mon Sep 17 00:00:00 2001 From: lushdong Date: Tue, 10 Dec 2019 09:29:03 +0800 Subject: [PATCH 29/46] =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index 2c9621f..37057d9 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -162,8 +162,12 @@ exports.torrentMatchesFilters = (torrent, config) => { for (let index = 0; index < config.matchByAgeAndMaxSeeders.length; index ++) { let rule = config.matchByAgeAndMaxSeeders[index] if (!isOlderThan(torrent.UploadTime, rule.maxAge) && (torrent.Seeders <= rule.maxSeeders)) { - if (minSize !== -1 && torrent.Size >= minSize) { + if (minSize === -1) { isMatch = true; + } else { + if (torrent.Size >= minSize) { + isMatch = true; + } } break; } From f2a60ff4af573adb1a938add17dfb148fcbd089d Mon Sep 17 00:00:00 2001 From: lushdong Date: Mon, 20 Apr 2020 09:59:38 +0800 Subject: [PATCH 30/46] =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + README.zh-CN.md | 3 ++- example.config.json | 1 + src/index.js | 6 +++++- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d7d26fc..214a731 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ Configuration options with defaults shown "discordWebhookUrl": "", // Discord webhook URI. Optional. "interval": 15,// Download interval. "GoldenPopcorn": true, // Download all GoldenPopcorn. + "page": 1, // page "matchByAgeAndMaxSeeders": [ { "maxAge": 600, "maxSeeders": 5 }, { "maxAge": 1200, "maxSeeders": 2 } diff --git a/README.zh-CN.md b/README.zh-CN.md index b60a40b..ce3aeaf 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -61,8 +61,9 @@ "maxAge": -1, // 种子上传最大时间(单位分钟). "downloadPath": "", // 下载软件的监控文件夹路径,种子文件下载到这里. "discordWebhookUrl": "", // Discord机器人url, 可选. - "interval": 15,// 运行间隔时间. + "interval": 15,// 运行间隔时间. 实测一个小时超过20次管理员有可能会发私信要求调整!!,所以不要设置低于3. "GoldenPopcorn": true, // 是否下载金种(会忽略所有其他条件). + "page": 1, // 爬的页数,50个种子为一页,有时候免费种子会超过一页。 爬取多页会重复调用ptp的api. 实测一个小时调用超过20次管理员有可能会发私信要求调整 "matchByAgeAndMaxSeeders": [ { "maxAge": 600, "maxSeeders": 5 }, { "maxAge": 1200, "maxSeeders": 2 } diff --git a/example.config.json b/example.config.json index c1bc87a..6963395 100644 --- a/example.config.json +++ b/example.config.json @@ -12,6 +12,7 @@ "discordWebhookUrl": "", "interval": 10, "GoldenPopcorn": true, + "page": 1, "matchByAgeAndMaxSeeders": [ { "maxAge": 600, "maxSeeders": 5 }, { "maxAge": 1200, "maxSeeders": 2 } diff --git a/src/index.js b/src/index.js index f68f17d..51e83c7 100644 --- a/src/index.js +++ b/src/index.js @@ -5,8 +5,12 @@ const { validateConfig, fetchTorrents, torrentMatchesFilters, writeTorrentCache module.exports = async function() { try { const config = await validateConfig() + const { page } = config const { torrents, authKey, passKey, totalResults } = await fetchTorrents(config.apiUser, config.apiKey); - const pageNum = Math.ceil(totalResults/50) + let pageNum = Math.ceil(totalResults/50) + if (page !== -1) { + pageNum = page + } if (pageNum >= 2) { for (let index = 2; index <= pageNum; index++) { const result = await fetchTorrents(config.apiUser, config.apiKey, index); From 83d2c233dd34f493244c6681adcbd918a395bcb4 Mon Sep 17 00:00:00 2001 From: lushdong Date: Fri, 21 Aug 2020 10:39:22 +0800 Subject: [PATCH 31/46] maxsize --- src/utils/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/index.js b/src/utils/index.js index 37057d9..5618ccf 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -162,10 +162,10 @@ exports.torrentMatchesFilters = (torrent, config) => { for (let index = 0; index < config.matchByAgeAndMaxSeeders.length; index ++) { let rule = config.matchByAgeAndMaxSeeders[index] if (!isOlderThan(torrent.UploadTime, rule.maxAge) && (torrent.Seeders <= rule.maxSeeders)) { - if (minSize === -1) { + if (minSize === -1 && maxSize === -1 ) { isMatch = true; } else { - if (torrent.Size >= minSize) { + if (torrent.Size >= minSize && torrent.Size <= maxSize) { isMatch = true; } } From 9a33beec95715b47280ea995195061becb205232 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 12 Sep 2020 19:36:09 +0000 Subject: [PATCH 32/46] Bump node-fetch from 2.6.0 to 2.6.1 Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1. - [Release notes](https://github.com/bitinn/node-fetch/releases) - [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md) - [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 48ba9b7..0954250 100644 --- a/yarn.lock +++ b/yarn.lock @@ -86,9 +86,9 @@ moment-timezone@^0.5.25: integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== node-fetch@^2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== + version "2.6.1" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== node-schedule@^1.3.2: version "1.3.2" From 39862c62fea065f95ac7feb956fb2d0941916f83 Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Tue, 13 Oct 2020 10:12:18 +0800 Subject: [PATCH 33/46] Update index.js --- src/utils/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index 5618ccf..ed3b031 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -107,7 +107,7 @@ exports.fetchTorrents = async (apiUser, apiKey, page) => { } catch(error) { console.log(error); - process.exit(); + return Promise.reject() } }; From 3f126bb60d25f5ec42017e3ea35cb034c59d1943 Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Wed, 14 Oct 2020 13:33:58 +0800 Subject: [PATCH 34/46] Update index.js --- src/utils/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index ed3b031..853b7e5 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -165,7 +165,8 @@ exports.torrentMatchesFilters = (torrent, config) => { if (minSize === -1 && maxSize === -1 ) { isMatch = true; } else { - if (torrent.Size >= minSize && torrent.Size <= maxSize) { + const sizeMatch = (torrent.Size >= minSize && maxSize === -1) || (torrent.Size <= maxSize && minSize === -1) || (torrent.Size >= minSize && torrent.Size <= maxSize) + if (sizeMatch) { isMatch = true; } } From 3d10907871b156c08ff64038101cdb8ae3ea562f Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Mon, 19 Oct 2020 10:44:02 +0800 Subject: [PATCH 35/46] Update index.js no Neutral Leech! --- src/utils/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index 853b7e5..f0a42e3 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -99,7 +99,7 @@ exports.fetchTorrents = async (apiUser, apiKey, page) => { await checkStatus(response); const json = await response.json(), - torrents = getTorrentsFromResponse(json); + torrents = getTorrentsFromResponse(json).map(torrent => torrent.FreeleechType === 'Freeleech'); console.log(`newest torrent ${JSON.stringify(torrents[0])}`) From 37a112b8965929a364144b1b1a4255460ba5aa52 Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Mon, 19 Oct 2020 10:49:20 +0800 Subject: [PATCH 36/46] Update index.js fix --- src/utils/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/index.js b/src/utils/index.js index f0a42e3..1033a4b 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -99,7 +99,7 @@ exports.fetchTorrents = async (apiUser, apiKey, page) => { await checkStatus(response); const json = await response.json(), - torrents = getTorrentsFromResponse(json).map(torrent => torrent.FreeleechType === 'Freeleech'); + torrents = getTorrentsFromResponse(json).filter(torrent => torrent.FreeleechType === 'Freeleech'); console.log(`newest torrent ${JSON.stringify(torrents[0])}`) From 773eaa1f6fa886ddf66b30ac2dcbd990d288c2fd Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Wed, 13 Jan 2021 17:41:34 +0800 Subject: [PATCH 37/46] =?UTF-8?q?=E9=87=91=E7=A7=8D=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E4=B8=BAfalse?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example.config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example.config.json b/example.config.json index 6963395..b8709a0 100644 --- a/example.config.json +++ b/example.config.json @@ -11,7 +11,7 @@ "downloadPath": "", "discordWebhookUrl": "", "interval": 10, - "GoldenPopcorn": true, + "GoldenPopcorn": false, "page": 1, "matchByAgeAndMaxSeeders": [ { "maxAge": 600, "maxSeeders": 5 }, From e53cb1d57c158fc81f1553b2d99b21833bc0561c Mon Sep 17 00:00:00 2001 From: lushdog Date: Tue, 26 Jan 2021 16:15:29 +0800 Subject: [PATCH 38/46] docker --- Dockerfile | 12 ++++++++++++ index.js | 7 ++++--- src/utils/index.js | 6 +++--- 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ba6489d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:14.15.4 + +ENV NODE_ENV=production +ENV RUN_ENV=docker + +WORKDIR /app + +RUN npm install + +COPY . . + +CMD ["node", "index.js"] \ No newline at end of file diff --git a/index.js b/index.js index 56b4dc4..39b35e7 100644 --- a/index.js +++ b/index.js @@ -1,12 +1,13 @@ const app = require('./src') const schedule = require('node-schedule') -const { interval } = require('./config.json') +const RUN_ENV = process.env.RUN_ENV +const interval = require(RUN_ENV === 'docker' ? '/config/config.json' : './config.json').interval let index = 1 const scheduleJob = async () => { console.log(index) index ++ - await app() + await app() } -const job = schedule.scheduleJob(`*/${interval} * * * *`, scheduleJob) +schedule.scheduleJob(`*/${interval} * * * *`, scheduleJob) diff --git a/src/utils/index.js b/src/utils/index.js index 1033a4b..ae7896e 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,15 +1,15 @@ const dayjs = require('dayjs') - +const RUN_ENV = process.env.RUN_ENV const path = require('path'), fs = require('fs'), fetch = require('node-fetch'), importFresh = require('import-fresh'), directoryExists = require('directory-exists'); -const configPath = path.join(__dirname, '../../config.json'), +const configPath = path.join(__dirname, RUN_ENV === 'docker' ? '../../../config/config.json' : '../../config.json'), cachePath = path.join(__dirname, '../../data/cache.json'), freeleechEndpoint = 'https://passthepopcorn.me/torrents.php?freetorrent=1&grouping=0&json=noredirect'; - + const getConfig = () => { try { return importFresh(configPath); From 57949d88041d68c66ffd6ce67ff0c79dc1cab029 Mon Sep 17 00:00:00 2001 From: lushdog Date: Tue, 26 Jan 2021 16:42:08 +0800 Subject: [PATCH 39/46] readme --- README.docker.md | 15 +++++++++++++++ README.md | 1 + README.zh-CN.md | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 README.docker.md diff --git a/README.docker.md b/README.docker.md new file mode 100644 index 0000000..5ababb3 --- /dev/null +++ b/README.docker.md @@ -0,0 +1,15 @@ +# 使用docker运行 + +首先新建配置文件config.json, 将example.config.json模版的配置复制进去然后修改 +### 运行 +`yourconfig`是配置文件的路径,`yourwatch`是下载软件监控文件夹 + +```bash +docker run --name ptpfl -d -v /yourconfig:/config -v /yourwatch:/watch trancelife/ptpfl +``` + +### 进入容器 + +```bash +docker exec -it ptpfl /bin/sh +``` diff --git a/README.md b/README.md index 214a731..ad5a547 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ ## [中文](https://github.com/lushdog/ptpfl/blob/master/README.zh-CN.md) +## [Docker运行](https://github.com/lushdog/ptpfl/blob/master/README.docker.md) # PassThePopcorn Freeleech Automator diff --git a/README.zh-CN.md b/README.zh-CN.md index ce3aeaf..9725047 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -59,7 +59,7 @@ "minsize": -1, // 种子最小大小(单位mb). -1表示无限制. "maxsize": -1, // 种子最大大小(单位mb). -1表示无限制. "maxAge": -1, // 种子上传最大时间(单位分钟). - "downloadPath": "", // 下载软件的监控文件夹路径,种子文件下载到这里. + "downloadPath": "/watch", // 下载软件的监控文件夹路径,种子文件下载到这里.(如果用docker启动请填'/watch') "discordWebhookUrl": "", // Discord机器人url, 可选. "interval": 15,// 运行间隔时间. 实测一个小时超过20次管理员有可能会发私信要求调整!!,所以不要设置低于3. "GoldenPopcorn": true, // 是否下载金种(会忽略所有其他条件). From 626eb2e0d103381f53136fcad04123337a20b73f Mon Sep 17 00:00:00 2001 From: lushdog Date: Tue, 26 Jan 2021 18:54:29 +0800 Subject: [PATCH 40/46] readme --- README.docker.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.docker.md b/README.docker.md index 5ababb3..348d6de 100644 --- a/README.docker.md +++ b/README.docker.md @@ -13,3 +13,8 @@ docker run --name ptpfl -d -v /yourconfig:/config -v /yourwatch:/watch trancelif ```bash docker exec -it ptpfl /bin/sh ``` +### 查看日志 + +```bash + docker logs ptpfl -f +``` From 82fba1ca4f8465d21f0603e8ecabc434bc014c7d Mon Sep 17 00:00:00 2001 From: lushdog Date: Fri, 19 Feb 2021 18:25:10 +0800 Subject: [PATCH 41/46] CACHED --- .dockerignore | 1 + Dockerfile | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..b512c09 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ba6489d..8c851c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,9 @@ ENV RUN_ENV=docker WORKDIR /app -RUN npm install +COPY package.json yarn.lock ./ + +RUN yarn install COPY . . From 131b446818fb763d72ef50b95e481b65e8bfc26e Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Thu, 1 Apr 2021 15:53:05 +0800 Subject: [PATCH 42/46] Update Dockerfile node-slim --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8c851c5..a407d5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.15.4 +FROM node:14.15.4-slim ENV NODE_ENV=production ENV RUN_ENV=docker @@ -11,4 +11,4 @@ RUN yarn install COPY . . -CMD ["node", "index.js"] \ No newline at end of file +CMD ["node", "index.js"] From cc705ff03e89ab6d27fdf1d60645ee8d0971e43f Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Wed, 21 Apr 2021 13:38:24 +0800 Subject: [PATCH 43/46] Update README.zh-CN.md --- README.zh-CN.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.zh-CN.md b/README.zh-CN.md index 9725047..dc93be3 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -7,8 +7,9 @@ 依赖nodejs环境, 推荐使用nvm安装。 `wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash` +`source .profile` -安装后重启ssh。然后安装nodejs +然后安装nodejs `nvm install stable` From 02f83a552c218480df53933012a7b4bfb599c333 Mon Sep 17 00:00:00 2001 From: HoraceZhang Date: Tue, 8 Jun 2021 14:37:32 +0800 Subject: [PATCH 44/46] Update README.zh-CN.md --- README.zh-CN.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.zh-CN.md b/README.zh-CN.md index dc93be3..a4fe3b1 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -7,6 +7,7 @@ 依赖nodejs环境, 推荐使用nvm安装。 `wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash` + `source .profile` 然后安装nodejs From 3ef4e69fc13cd970e093a783ba95bca74ca05e7f Mon Sep 17 00:00:00 2001 From: lushdog Date: Thu, 5 May 2022 14:03:25 +0800 Subject: [PATCH 45/46] upgrade node-schedule --- package.json | 2 +- yarn.lock | 180 +++++++++++++++++++++++++++++++++------------------ 2 files changed, 119 insertions(+), 63 deletions(-) diff --git a/package.json b/package.json index d523ca4..4d41311 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,6 @@ "discord.js": "^11.5.1", "import-fresh": "^3.1.0", "node-fetch": "^2.6.0", - "node-schedule": "^1.3.2" + "node-schedule": "^2.1.0" } } diff --git a/yarn.lock b/yarn.lock index 0954250..841b270 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,30 +7,39 @@ async-limiter@~1.0.0: resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== +call-bind@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + function-bind "^1.1.1" + get-intrinsic "^1.0.2" + callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -cron-parser@^2.7.3: - version "2.13.0" - resolved "https://registry.yarnpkg.com/cron-parser/-/cron-parser-2.13.0.tgz#6f930bb6f2931790d2a9eec83b3ec276e27a6725" - integrity sha512-UWeIpnRb0eyoWPVk+pD3TDpNx3KCFQeezO224oJIkktBrcW6RoAPOx5zIKprZGfk6vcYSmA8yQXItejSaDBhbQ== +cron-parser@^3.5.0: + version "3.5.0" + resolved "https://registry.yarnpkg.com/cron-parser/-/cron-parser-3.5.0.tgz#b1a9da9514c0310aa7ef99c2f3f1d0f8c235257c" + integrity sha512-wyVZtbRs6qDfFd8ap457w3XVntdvqcwBGxBoTvJQH9KGVKL/fB+h2k3C8AqiVxvUQKN1Ps/Ns46CNViOpVDhfQ== dependencies: - is-nan "^1.2.1" - moment-timezone "^0.5.25" + is-nan "^1.3.2" + luxon "^1.26.0" dayjs@^1.8.16: - version "1.8.16" - resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.8.16.tgz#2a3771de537255191b947957af2fd90012e71e64" - integrity sha512-XPmqzWz/EJiaRHjBqSJ2s6hE/BUoCIHKgdS2QPtTQtKcS9E4/Qn0WomoH1lXanWCzri+g7zPcuNV4aTZ8PMORQ== - -define-properties@^1.1.1: - version "1.1.3" - resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" - integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== + version "1.11.1" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.1.tgz#90b33a3dda3417258d48ad2771b415def6545eb0" + integrity sha512-ER7EjqVAMkRRsxNCC5YqJ9d9VQYuWdGt7aiH2qA5R5wt8ZmWaP2dLUSIK6y/kVzLMlmh1Tvu5xUf4M/wdGJ5KA== + +define-properties@^1.1.3: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.4.tgz#0b14d7bd7fbeb2f3572c3a7eda80ea5d57fb05b1" + integrity sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA== dependencies: - object-keys "^1.0.12" + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" directory-exists@^2.0.1: version "2.0.1" @@ -38,30 +47,64 @@ directory-exists@^2.0.1: integrity sha512-+CEod3IzwjvhQOMXFSU6nrqdTwrhzOiacNzzXlwBVFm7C4y2rbuEWs5WaRsI/3IZeSWORA5F1q8FBh3gm4HSsw== discord.js@^11.5.1: - version "11.5.1" - resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-11.5.1.tgz#910fb9f6410328581093e044cafb661783a4d9e8" - integrity sha512-tGhV5xaZXE3Z+4uXJb3hYM6gQ1NmnSxp9PClcsSAYFVRzH6AJH74040mO3afPDMWEAlj8XsoPXXTJHTxesqcGw== + version "11.6.4" + resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-11.6.4.tgz#76bab98de08d7586ecde44c063ef310e6b9a2700" + integrity sha512-cK6rH1PuGjSjpmEQbnpuTxq1Yv8B89SotyKUFcr4RhnsiZnfBfDOev7DD7v5vhtEyyj51NuMWFoRJzgy/m08Uw== dependencies: long "^4.0.0" - prism-media "^0.0.3" + prism-media "^0.0.4" snekfetch "^3.6.4" tweetnacl "^1.0.0" ws "^6.0.0" +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +get-intrinsic@^1.0.2, get-intrinsic@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" + integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" + +has-property-descriptors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz#610708600606d36961ed04c196193b6a607fa861" + integrity sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ== + dependencies: + get-intrinsic "^1.1.1" + +has-symbols@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + +has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + import-fresh@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.1.0.tgz#6d33fa1dcef6df930fae003446f33415af905118" - integrity sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ== + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== dependencies: parent-module "^1.0.0" resolve-from "^4.0.0" -is-nan@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-nan/-/is-nan-1.2.1.tgz#9faf65b6fb6db24b7f5c0628475ea71f988401e2" - integrity sha1-n69ltvttskt/XAYoR16nH5iEAeI= +is-nan@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/is-nan/-/is-nan-1.3.2.tgz#043a54adea31748b55b6cd4e09aadafa69bd9e1d" + integrity sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w== dependencies: - define-properties "^1.1.1" + call-bind "^1.0.0" + define-properties "^1.1.3" long-timeout@0.1.1: version "0.1.1" @@ -73,33 +116,28 @@ long@^4.0.0: resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== -moment-timezone@^0.5.25: - version "0.5.26" - resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.26.tgz#c0267ca09ae84631aa3dc33f65bedbe6e8e0d772" - integrity sha512-sFP4cgEKTCymBBKgoxZjYzlSovC20Y6J7y3nanDc5RoBIXKlZhoYwBoZGe3flwU6A372AcRwScH8KiwV6zjy1g== - dependencies: - moment ">= 2.9.0" - -"moment@>= 2.9.0": - version "2.24.0" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" - integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== +luxon@^1.26.0: + version "1.28.0" + resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.28.0.tgz#e7f96daad3938c06a62de0fb027115d251251fbf" + integrity sha512-TfTiyvZhwBYM/7QdAVDh+7dBTBA29v4ik0Ce9zda3Mnf8on1S5KJI8P2jKFZ8+5C0jhmr0KwJEO/Wdpm0VeWJQ== node-fetch@^2.6.0: - version "2.6.1" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" - integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== + version "2.6.7" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" + integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== + dependencies: + whatwg-url "^5.0.0" -node-schedule@^1.3.2: - version "1.3.2" - resolved "https://registry.yarnpkg.com/node-schedule/-/node-schedule-1.3.2.tgz#d774b383e2a6f6ade59eecc62254aea07cd758cb" - integrity sha512-GIND2pHMHiReSZSvS6dpZcDH7pGPGFfWBIEud6S00Q8zEIzAs9ommdyRK1ZbQt8y1LyZsJYZgPnyi7gpU2lcdw== +node-schedule@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/node-schedule/-/node-schedule-2.1.0.tgz#068ae38d7351c330616f7fe7cdb05036f977cbaf" + integrity sha512-nl4JTiZ7ZQDc97MmpTq9BQjYhq7gOtoh7SiPH069gBFBj0PzD8HI7zyFs6rzqL8Y5tTiEEYLxgtbx034YPrbyQ== dependencies: - cron-parser "^2.7.3" + cron-parser "^3.5.0" long-timeout "0.1.1" - sorted-array-functions "^1.0.0" + sorted-array-functions "^1.3.0" -object-keys@^1.0.12: +object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== @@ -111,10 +149,10 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" -prism-media@^0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/prism-media/-/prism-media-0.0.3.tgz#8842d4fae804f099d3b48a9a38e3c2bab6f4855b" - integrity sha512-c9KkNifSMU/iXT8FFTaBwBMr+rdVcN+H/uNv1o+CuFeTThNZNTOrQ+RgXA1yL/DeLk098duAeRPP3QNPNbhxYQ== +prism-media@^0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/prism-media/-/prism-media-0.0.4.tgz#df5ddc6463670c97ff0e9cbac3c3e0db18df326f" + integrity sha512-dG2w7WtovUa4SiYTdWn9H8Bd4JNdei2djtkP/Bk9fXq81j5Q15ZPHYSwhUVvBRbp5zMkGtu0Yk62HuMcly0pRw== resolve-from@^4.0.0: version "4.0.0" @@ -126,19 +164,37 @@ snekfetch@^3.6.4: resolved "https://registry.yarnpkg.com/snekfetch/-/snekfetch-3.6.4.tgz#d13e80a616d892f3d38daae4289f4d258a645120" integrity sha512-NjxjITIj04Ffqid5lqr7XdgwM7X61c/Dns073Ly170bPQHLm6jkmelye/eglS++1nfTWktpP6Y2bFXjdPlQqdw== -sorted-array-functions@^1.0.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/sorted-array-functions/-/sorted-array-functions-1.2.0.tgz#43265b21d6e985b7df31621b1c11cc68d8efc7c3" - integrity sha512-sWpjPhIZJtqO77GN+LD8dDsDKcWZ9GCOJNqKzi1tvtjGIzwfoyuRH8S0psunmc6Z5P+qfDqztSbwYR5X/e1UTg== +sorted-array-functions@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/sorted-array-functions/-/sorted-array-functions-1.3.0.tgz#8605695563294dffb2c9796d602bd8459f7a0dd5" + integrity sha512-2sqgzeFlid6N4Z2fUQ1cvFmTOLRi/sEDzSQ0OKYchqgoPmQBVyM3959qYx3fpS6Esef80KjmpgPeEr028dP3OA== + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o= tweetnacl@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.1.tgz#2594d42da73cd036bd0d2a54683dd35a6b55ca17" - integrity sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A== + version "1.0.3" + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" + integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE= + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0= + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0" ws@^6.0.0: - version "6.2.1" - resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" - integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA== + version "6.2.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.2.tgz#dd5cdbd57a9979916097652d78f1cc5faea0c32e" + integrity sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw== dependencies: async-limiter "~1.0.0" From 6f544bdbc6365f7aeef10550867ebb6ee01a9195 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Jan 2023 01:09:05 +0000 Subject: [PATCH 46/46] Bump luxon from 1.28.0 to 1.28.1 Bumps [luxon](https://github.com/moment/luxon) from 1.28.0 to 1.28.1. - [Release notes](https://github.com/moment/luxon/releases) - [Changelog](https://github.com/moment/luxon/blob/master/CHANGELOG.md) - [Commits](https://github.com/moment/luxon/compare/1.28.0...1.28.1) --- updated-dependencies: - dependency-name: luxon dependency-type: indirect ... Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 841b270..9aea586 100644 --- a/yarn.lock +++ b/yarn.lock @@ -117,9 +117,9 @@ long@^4.0.0: integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== luxon@^1.26.0: - version "1.28.0" - resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.28.0.tgz#e7f96daad3938c06a62de0fb027115d251251fbf" - integrity sha512-TfTiyvZhwBYM/7QdAVDh+7dBTBA29v4ik0Ce9zda3Mnf8on1S5KJI8P2jKFZ8+5C0jhmr0KwJEO/Wdpm0VeWJQ== + version "1.28.1" + resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.28.1.tgz#528cdf3624a54506d710290a2341aa8e6e6c61b0" + integrity sha512-gYHAa180mKrNIUJCbwpmD0aTu9kV0dREDrwNnuyFAsO1Wt0EVYSZelPnJlbj9HplzXX/YWXHFTL45kvZ53M0pw== node-fetch@^2.6.0: version "2.6.7"