opennaslab / kubespider

A global resource download orchestration system, build your home download center.
https://kubespider.netlify.app/
Apache License 2.0
2.01k stars 114 forks source link

自动获取迅雷的token,判断版本有问题,version_parser.py里 #522

Closed manduted closed 3 months ago

manduted commented 3 months ago

在那写slack通知的时候发现,手机上slack都收到通知了,迅雷没反应,一看docker,Get xunlei token from html error,就看了下代码

\xunlei_download_provider\provider.py,231行if check_version_at_lest(server_version, "3.21.0") 根据提交作者写的,要自动获取,要基于迅雷3.21.0,但在version_parser.py对比判断版本有个问题,我觉得朋友应该是想分段对比,大>中>小 版本。可能朋友想复杂了或者没注意,

1

2

(迅雷docker只有3.11.2)

实际版本current_version 3.11.2,目标target_version 3.12.0 index =1 , current_version 3 = target_version 3 ,14、16行 if 均不成立,再循环 index =2 , current_version 11 < target_version 12,14、16行 if 均不成立,再循环 index =3 , current_version 2 > target_version 0,14行不成立,16行if 成立,return true

实际版本current_version 3.11.0,目标target_version 3.12.0 index =1 , current_version 3 = target_version 3 ,14、16行 if 均不成立,再循环 index =2 , current_version 11 < target_version 12,14、16行 if 均不成立,再循环 index =3 , current_version 0 = target_version 0,14、16行 if 均不成立,再循环 index =4 14行成立,return false

就误判成了,实际版本 > 目标版本。就很尴尬 我感觉简单点就行了,好像也没什么问题, if current_version >= target_version: return True if current_version < target_version: return False

顺手试了下 c1 c2 c3 c4

miRemid commented 3 months ago

感谢指出错误!不过提供的写法并不严谨和规范(直接return current_version >= target_versionimage 该方式在遇到前缀存在0值会判断失效 image

manduted commented 3 months ago

感谢指出错误!不过提供的写法并不严谨和规范(直接return current_version >= target_versionimage 该方式在遇到前缀存在0值会判断失效 image

恩。确实会这样。我是随便写的,没去细化。只是想到py好像可以支持这样运算,再加上是根据我现有的版本获取是以非0为起手。就顺带试试,。要是更新到双位数,确实会出现这种问题。。hhhhhhhh

miRemid commented 3 months ago

已更新相关函数(#523),可以切换到该pr进行测试

@manduted

manduted commented 3 months ago

已更新相关函数(#523),可以切换到该pr进行测试

@manduted

好。等会回家再测试,要出门一趟,刚才晃了一眼代码,应该问题不大

manduted commented 3 months ago

@miRemid 可以了,能成功判断为False,接着去读取js里的token