mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 04:47:48 +08:00
add automatic check version feature
This commit is contained in:
@@ -542,6 +542,20 @@ def check_env():
|
|||||||
check_pre()
|
check_pre()
|
||||||
|
|
||||||
|
|
||||||
|
def check_version(version):
|
||||||
|
from distutils.version import LooseVersion
|
||||||
|
try:
|
||||||
|
resp = requests.get('https://api.github.com/repos/shmilylty/OneForAll/releases/latest')
|
||||||
|
latest_version = resp.json()['tag_name']
|
||||||
|
if LooseVersion(latest_version) > LooseVersion(version):
|
||||||
|
logger.log('ALERT', f'The current OneForAll version is {version}, and the latest version is {latest_version}.')
|
||||||
|
logger.log('ALERT', f'{resp.json()["body"]}')
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
except Exception as e:
|
||||||
|
logger.log('FATAL', e.args)
|
||||||
|
|
||||||
|
|
||||||
def get_maindomain(domain):
|
def get_maindomain(domain):
|
||||||
return Domain(domain).registered()
|
return Domain(domain).registered()
|
||||||
|
|
||||||
|
|||||||
@@ -252,6 +252,7 @@ class OneForAll(object):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
utils.check_version(version)
|
||||||
fire.Fire(OneForAll)
|
fire.Fire(OneForAll)
|
||||||
# OneForAll('example.com').run()
|
# OneForAll('example.com').run()
|
||||||
# OneForAll('./domains.txt').run()
|
# OneForAll('./domains.txt').run()
|
||||||
|
|||||||
Reference in New Issue
Block a user