From a638a7684ed8600334ce6a1f63dd1850c2e8b627 Mon Sep 17 00:00:00 2001 From: maksii <1761348+maksii@users.noreply.github.com> Date: Wed, 28 Aug 2024 19:49:21 +0300 Subject: [PATCH] docker and version --- Dockerfile | 2 +- src/utils/version.py | 2 +- upload.py | 20 +++++++++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 20107b56..142921e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,4 +38,4 @@ RUN chown -R appuser:appgroup /UTOPIA-Upload-Assistant # Switch to the non-root user USER appuser -ENTRYPOINT ["python3", "/UTOPIA-Upload-Assistant/upload.py"] +CMD ["sh"] \ No newline at end of file diff --git a/src/utils/version.py b/src/utils/version.py index 38f80f8c..68b12a3a 100644 --- a/src/utils/version.py +++ b/src/utils/version.py @@ -1 +1 @@ -__version__ = '20240828064100' \ No newline at end of file +__version__ = '20240827132009' \ No newline at end of file diff --git a/upload.py b/upload.py index a1a09499..3b34fe39 100644 --- a/upload.py +++ b/upload.py @@ -14,7 +14,7 @@ import platform import shutil import glob -from datetime import datetime +from datetime import datetime, timezone from src.console import console from rich.markdown import Markdown @@ -53,6 +53,24 @@ def check_new_version(): response = requests.get(repo_url) response.raise_for_status() # Raise an error for bad responses latest_release = response.json() + + # Check if running from a frozen executable + if getattr(sys, 'frozen', False): + release_date_str = latest_release['published_at'] + release_date = datetime.strptime(release_date_str, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc) + current_time = datetime.now(timezone.utc) + days_since_release = (current_time - release_date).days + content = ( + "[bold magenta]Welcome to UTOPIA-Upload-Assistant![/bold magenta]\n\n" + "It looks like you're running this tool from a console or docker.\n" + f"The latest release was {days_since_release} days ago.\n" + "To ensure you're using the latest features and improvements, please check the latest commits or Docker image manually.\n\n" + "[bold cyan]Visit our repository:[/bold cyan] [link=https://github.com/maksii/UTOPIA-Upload-Assistant]GitHub Repository[/link]\n" + "[bold cyan]Check Docker images:[/bold cyan] [link=https://hub.docker.com/r/maksii/utopia-upload-assistant]Docker Hub[/link]" + ) + panel = Panel(content, title="[bold magenta]Greetings![/bold magenta]", border_style="magenta") + console.print(panel) + return latest_version = latest_release['tag_name']