qiaofeng1227 2 rokov pred
rodič
commit
d3bb3a8212

+ 0 - 20
.github/workflows/build_appmanage.yml

@@ -35,23 +35,3 @@ jobs:
           directory: appmanage
           username: ${{ secrets.DOCKER_USERNAME }}
           password: ${{ secrets.DOCKER_PASSWORD }}
-
-      - name: add readme file
-        run: |
-          echo ${{ secrets.DOCKER_USERNAME }}
-          echo ${{ secrets.DOCKER_PASSWORD }}
-          cd appmanage
-          touch myread.md
-          echo "This repository is the easiest appmanage deployment on GitHub and DockerHub  "' 
-          ```  
-             git clone https://github.com/Websoft9/websoft9.git  
-             sudo docker network create websoft9 && cd websoft9/appmanage &&  sudo docker compose up -d  
-          ```' > myread.md
-
-      - name: Docker Hub Description
-        uses: peter-evans/dockerhub-description@v3
-        with:
-          username: ${{ secrets.DOCKER_USERNAME }}
-          password: ${{ secrets.DOCKER_PASSWORD }}
-          repository: websoft9dev/appmanage
-          readme-filepath: appmanage/myread.md

+ 1 - 0
.github/workflows/upload_artifact.yml

@@ -39,6 +39,7 @@ jobs:
           zip -r websoft9-$version.zip websoft9
           cp websoft9-$version.zip artifacts
           cp version.json artifacts
+          cp CHANGELOG.md artifacts
           cp artifacts/websoft9-$version.zip artifacts/websoft9-latest.zip
 
       - name: Upload To Azure Blob

+ 1 - 1
appmanage/Dockerfile

@@ -11,7 +11,7 @@ COPY static ./static
 COPY requirements.txt main.py database.sqlite  ./
 RUN apt update
 
-# Install supervisords
+# Install supervisord
 RUN apt install -y supervisor
 COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
 COPY config/cmd.sh /cmd.sh

+ 53 - 40
appmanage/api/service/manage.py

@@ -76,16 +76,31 @@ def AppAutoUpdate(auto_update):
         else:
           return "false"
 
-# 更新软件商店
-def AppStoreUpdate():
+def AppStoreCore():
+
     version_cmd = "curl" + const.ARTIFACT_URL + "/plugin/appstore/appstore.json"
     latest = shell_execute.execute_command_output_all(version_cmd)['result']
     most_version = json.loads(latest)['Requires at most']
     least_version = json.loads(latest)['Requires at least']
     now = shell_execute.execute_command_output_all("cat /data/apps/websoft9/version.json")['result']
     now_version = json.loads(now)['VERSION']
-    if now_version < least_version or least_version > most_version:
+    if now_version >= least_version and now_version <= most_version:
+        return "0"
+    elif now_version < least_version:
+        return "-1"
+    elif now_version > most_version:
+        return "1"
+    return "0"
+
+# 更新软件商店
+def AppStoreUpdate():
+
+    core_support = AppStoreCore()
+
+    if core_support == "-1":
         raise CommandException(const.ERRORMESSAGE_SERVER_VERSION_NOTSUPPORT, "You must upgrade websoft9 core", "You must upgrade websoft9 core")
+    elif core_support == "1":
+        raise CommandException(const.ERRORMESSAGE_SERVER_VERSION_NOTSUPPORT, "core not support,can not upgrade", "core not support,can not upgrade")
     appstore_update()
 
 # 获取 update info
@@ -101,26 +116,25 @@ def get_update_list():
     latest = shell_execute.execute_command_output_all(version_cmd)['result']
     version = json.loads(latest)['VERSION']
     ret = {}
-    ret['current_version'] = local_version
+    ret['local_version'] = local_version
+    ret['target_version'] = version
+    content = []
+    cmd = "curl" + const.ARTIFACT_URL + "/CHANGELOG.md" 
+    change_log_contents = shell_execute.execute_command_output_all(cmd)['result']
+    change_log = change_log_contents.split('## ')[1].split('\n')
+    date = change_log[0].split()[-1]
+    for change in change_log[1:]:
+        if change != '':
+            content.append(change)
+    
     if compared_version(local_version, version) == -1:
-        content = []
-        cmd = "curl" + const.ARTIFACT_URL + "/CHANGELOG.md" 
-        change_log_contents = shell_execute.execute_command_output_all(cmd)['result']
-        change_log = change_log_contents.split('## ')[1].split('\n')
-        date = change_log[0].split()[-1]
-        for change in change_log[1:]:
-            if change != '':
-                content.append(change)
-        
-        ret2= {}
-        ret2['latest_version'] = version
-        ret2['date'] = date
-        ret2['content'] = content
-        ret['Update_content']=ret2
-        return ret
+        ret['update'] = True
     else:
-        ret['Update_content']=None
-        return ret
+        ret['update'] = False
+    ret['date'] = date
+    ret['content'] = content
+    return ret
+  
 
 # 获取 appstore update info
 def get_appstore_update_list():
@@ -135,28 +149,27 @@ def get_appstore_update_list():
     version_cmd = "curl" + const.ARTIFACT_URL + "/plugin/appstore/appstore.json"
     latest = shell_execute.execute_command_output_all(version_cmd)
     version = json.loads(latest)['Version']
-    
     ret = {}
-    ret['current_version'] = local_version
+    ret['local_version'] = local_version
+    ret['target_version'] = version
+    content = []
+    cmd = "curl" + const.ARTIFACT_URL + "/plugin/appstore/CHANGELOG.md" 
+    change_log_contents = shell_execute.execute_command_output_all(cmd)['result']
+    change_log = change_log_contents.split('## ')[1].split('\n')
+    date = change_log[0].split()[-1]
+    for change in change_log[1:]:
+        if change != '':
+            content.append(change)
+
     if compared_version(local_version, version) == -1:
-        content = []
-        cmd = "curl" + const.ARTIFACT_URL + "/plugin/appstore/CHANGELOG.md" 
-        change_log_contents = shell_execute.execute_command_output_all(cmd)['result']
-        change_log = change_log_contents.split('## ')[1].split('\n')
-        date = change_log[0].split()[-1]
-        for change in change_log[1:]:
-            if change != '':
-                content.append(change)
-        
-        ret2= {}
-        ret2['latest_version'] = version
-        ret2['date'] = date
-        ret2['content'] = content
-        ret['Update_content']=ret2
-        return ret
+        ret['update'] = True
     else:
-        ret['Update_content']=None
-        return ret
+        ret['update'] = False
+
+    ret['date'] = date
+    ret['content'] = content
+    ret['core_compare'] = AppStoreCore()
+    return ret
 
 def conbine_list(installing_list, installed_list):
     app_list = installing_list + installed_list

+ 1 - 1
version.json

@@ -39,5 +39,5 @@
             "18.04"
         ]
     },
-    "VERSION": "0.8.4"
+    "VERSION": "0.8.5"
 }