Skip to content

Commit

Permalink
fix: 修复更新逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
am-abudu committed Dec 21, 2024
1 parent 9cd1ff0 commit d7fc0a7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 50 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.vercel
.git
.github
*.py[cod]
.idea
tmp
venv
configs.py
*.sqlite3
*.db
.env
docker-compose.yaml
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
IMAGE_NAME=Qexo
WORKERS=4
THREADS=4
TIMEOUT=600
24 changes: 13 additions & 11 deletions hexoweb/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,14 +560,15 @@ def VercelOnekeyUpdate(url):
def copy_all_files(src_dir, dst_dir):
if not os.path.exists(dst_dir):
os.makedirs(dst_dir)
if os.path.exists(src_dir):
for file in os.listdir(src_dir):
file_path = os.path.join(src_dir, file)
dst_path = os.path.join(dst_dir, file)
if os.path.isfile(os.path.join(src_dir, file)):
shutil.copyfile(file_path, dst_path)
else:
shutil.copytree(file_path, dst_path)
for file in os.listdir(src_dir):
file_path = os.path.join(src_dir, file)
dst_path = os.path.join(dst_dir, file)
if os.path.exists(dst_path):
continue
if os.path.isfile(os.path.join(src_dir, file)):
shutil.copyfile(file_path, dst_path)
else:
shutil.copytree(file_path, dst_path)


def pip_main(args):
Expand All @@ -584,11 +585,13 @@ def pip_main(args):


def LocalOnekeyUpdate(url):
import threading
logging.info(gettext("START_LOCAL_UPDATE"))
Path = os.path.abspath("")
tmpPath = os.path.abspath("./_tmp")
if not os.path.exists(tmpPath):
os.mkdir(tmpPath)
if os.path.exists(tmpPath):
shutil.rmtree(tmpPath)
os.mkdir(tmpPath)
_tarfile = tmpPath + '/github.tar.gz'
with open(_tarfile, "wb") as file:
file.write(requests.get(url).content)
Expand Down Expand Up @@ -622,7 +625,6 @@ def LocalOnekeyUpdate(url):
execute_from_command_line(['manage.py', 'makemigrations'])
execute_from_command_line(['manage.py', 'migrate'])
logging.info(gettext("LOCAL_UPDATE_SUCCESS"))
import threading
t = threading.Thread(target=lambda: rerun(5))
t.start()
return {"status": True, "msg": gettext("UPDATE_SUCCESS")}
Expand Down
38 changes: 0 additions & 38 deletions update_tag.sh

This file was deleted.

0 comments on commit d7fc0a7

Please sign in to comment.