mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-22 07:30:24 +00:00
update
This commit is contained in:
parent
937b2ef7dd
commit
46479de96c
2 changed files with 7 additions and 12 deletions
|
@ -30,14 +30,10 @@ q = Queue(connection=redis_conn,default_timeout=3600)
|
|||
|
||||
# 获取所有CHANGELOG
|
||||
def get_all_update_list():
|
||||
ret = []
|
||||
stack_hub_change = docker.get_update_list('/data/apps/stackhub/install/version.json', 'StackHub')
|
||||
if stack_hub_change != None:
|
||||
ret = []
|
||||
ret.append(stack_hub_change)
|
||||
library_change = docker.get_update_list('/data/library/install/version.json', 'docker-library')
|
||||
if library_change != None:
|
||||
ret.append(library_change)
|
||||
if ret != []:
|
||||
return ret
|
||||
else:
|
||||
return None
|
||||
|
|
|
@ -11,13 +11,12 @@ from api.service import manage
|
|||
|
||||
|
||||
# 获取github文件内容
|
||||
def get_github_content(repo, path, owner='Websoft9'):
|
||||
url = 'https://api.github.com/repos/{owner}/{repo}/contents/{path}'
|
||||
url = url.format(owner=owner, repo=repo, path=path)
|
||||
def get_github_content(repo, path):
|
||||
url = 'https://websoft9.github.io/{repo}/{path}'
|
||||
url = url.format(repo=repo, path=path)
|
||||
response = requests.get(url)
|
||||
data = json.loads(response.text)
|
||||
s = data['content']
|
||||
contents = str(base64.b64decode(s), "utf-8")
|
||||
response.encoding = 'utf-8'
|
||||
contents = response.text
|
||||
return contents
|
||||
|
||||
|
||||
|
@ -29,7 +28,7 @@ def get_update_list(local_path, repo):
|
|||
version = json.loads(version_contents)['VERSION']
|
||||
if local_version != version:
|
||||
content = []
|
||||
change_log_contents = get_github_content('StackHub', 'CHANGELOG.md')
|
||||
change_log_contents = get_github_content(repo, 'CHANGELOG.md')
|
||||
change_log = change_log_contents.split('## ')[1].split('\n')
|
||||
data = change_log[0].split()[-1]
|
||||
for change in change_log[1:]:
|
||||
|
|
Loading…
Reference in a new issue