From 96ac394e588f676a5cc8341d47d89c258ad7a922 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Thu, 26 Jan 2023 20:07:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E9=80=82=E9=85=8D?= =?UTF-8?q?=E7=AB=99=E7=82=B9=E8=BF=9B=E4=B8=80=E6=AD=A5=E5=AE=8C=E5=96=84?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E9=81=87=E5=88=B0PTOOLS=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9A=84=E7=AB=99=E7=82=B9=E6=B2=A1=E6=9C=89=E6=B2=B9=E7=8C=B4?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E9=80=89=E9=A1=B9=EF=BC=8C=E8=AF=B7=E6=8A=8A?= =?UTF-8?q?=E7=BD=91=E5=9D=80=E5=8F=91=E7=BB=99=E6=88=91=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=9A=E5=8F=96=E6=B6=88=E6=B2=B9=E7=8C=B4=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E5=8F=91=E9=80=81COOKIE=E7=9A=84=E4=B8=80=E5=B0=8F?= =?UTF-8?q?=E6=97=B6=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PtToPtools.js | 51 +++++++++++++++++++++++++++++++++++++++++------- auto_pt/views.py | 15 +++++++------- 2 files changed, 52 insertions(+), 14 deletions(-) diff --git a/PtToPtools.js b/PtToPtools.js index 5da2b52..f298eb3 100644 --- a/PtToPtools.js +++ b/PtToPtools.js @@ -51,23 +51,51 @@ // @match https://hhanclub.top/* // @match https://www.hdpt.xyz/* // @match https://ptchina.org/* -// @match https://www.oshen.win/* +// @match http://www.oshen.win/* // @match https://www.hd.ai/* // @match http://ihdbits.me/* // @match https://zmpt.cc/* // @match https://leaves.red/* // @match https://piggo.me/* +// @match https://pt.2xfree.org/* +// @match https://sharkpt.net/* +// @match https://www.dragonhd.xyz/* +// @match https://oldtoons.world/* +// @match http://hdmayi.com/* +// @match https://www.3wmg.com/* +// @match https://carpt.net/* +// @match https://pt.0ff.cc/* +// @match https://hdpt.xyz/* +// @match https://azusa.wiki/* +// @match https://pt.itzmx.com/* +// @match https://gamegamept.cn/* +// @match https://srvfi.top/* +// @match https://www.icc2022.com/* +// @match http://leaves.red/* +// @match https://xinglin.one/* +// @match http://uploads.ltd/* +// @match https://cyanbug.net/* +// @match https://ptsbao.club/* +// @match https://greatposterwall.com/* +// @match https://gainbound.net/* +// @match http://hdzone.me/* +// @match https://www.pttime.org/* +// @match https://pt.msg.vg/* +// @match https://pt.soulvoice.club/* +// @match https://www.hitpt.com/* +// @match https://hdfans.org/* +// @match https://www.joyhd.net/* // @run-at context-menu -// @version 0.0.2 +// @version 0.0.3 // @grant GM_xmlhttpRequest -// @grant none // @license GPL-3.0 License // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.3/jquery.min.js // ==/UserScript== /* 日志: + 2023.01.26 优化:适配站点进一步完善,如遇到PTOOLS支持的站点没有油猴脚本选项,请把网址发给我;优化:取消油猴脚本发送COOKIE的一小时限制 2023.01.26 修复bug,调整为右键菜单启动 2023.01.26 更新逻辑,一小时内不会重复更新 2023.01.25 完成第一版0.0.1 @@ -75,12 +103,21 @@ */ this.$ = this.jQuery = jQuery.noConflict(true); - -// 设置ptools的访问地址,如http://192.168.1.2:8000 +/** + * 小白白们请看这里 + * 需要修改的项目 + * ptools:ptools本地服务端地址,请在此修改设置ptools的访问地址,如http://192.168.1.2:8000 + * token:ptools.toml中设置的token,获取安全密钥token,可以在ptools.toml中自定义,格式 [token] token="ptools" + * @type {string} + */ let ptools = "http://127.0.0.1:8000/"; -// 获取安全密钥token,可以在ptools.toml中自定义, -// 格式 [token] token="ptools" +/** + * 以下内容无需修改 + * @type {string} + */ var token = "ptools"; + +//一下选项无需配置 var path = "tasks/monkey_to_ptools"; diff --git a/auto_pt/views.py b/auto_pt/views.py index 6b97677..b0564e0 100644 --- a/auto_pt/views.py +++ b/auto_pt/views.py @@ -1236,13 +1236,13 @@ def monkey_to_ptools(request): site_list = Site.objects.filter(url=url) if len(site_list) == 1: site = site_list.first() - logger.info(f'{(datetime.now() - site.mysite.updated_at).seconds / 3600}') - if (datetime.now() - site.mysite.updated_at).seconds <= 3600: - return JsonResponse(data=CommonResponse.error( - status=StatusCodeEnum.THROTTLING_ERR, - msg=f'更新cookie还不到一个小时啦,下次再更吧!' - f'{3600 - (datetime.now() - site.mysite.updated_at).seconds}后可以更新!' - ).to_dict(), safe=False) + # logger.info(f'{(datetime.now() - site.mysite.updated_at).seconds / 3600}') + # if (datetime.now() - site.mysite.updated_at).seconds <= 3600: + # return JsonResponse(data=CommonResponse.error( + # status=StatusCodeEnum.THROTTLING_ERR, + # msg=f'更新cookie还不到一个小时啦,下次再更吧!' + # f'{3600 - (datetime.now() - site.mysite.updated_at).seconds}后可以更新!' + # ).to_dict(), safe=False) data = {'site_id': site.id, 'uid_xpath': site.my_uid_rule} # if len(my_site_list) == 1: # data.update({ @@ -1264,6 +1264,7 @@ def monkey_to_ptools(request): ).to_dict(), safe=False) site_id = my_site_params.get('site_id') logger.info(site_id) + del my_site_params['token'] try: res_my_site = MySite.objects.update_or_create(site_id=site_id, defaults=my_site_params) logger.info(res_my_site[1])