mirror of
https://github.com/ngfchl/ptools
synced 2023-07-10 13:41:22 +08:00
优化:适配站点进一步完善,如遇到PTOOLS支持的站点没有油猴脚本选项,请把网址发给我
优化:取消油猴脚本发送COOKIE的一小时限制
This commit is contained in:
@@ -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";
|
||||
|
||||
|
||||
|
||||
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user