From ee8241f05837ca459386c99cbcf24b5a472a091f Mon Sep 17 00:00:00 2001 From: Jeremiah K <17190268+jeremiah-k@users.noreply.github.com> Date: Tue, 24 Dec 2024 08:47:14 -0600 Subject: [PATCH 1/4] Download release notes --- app/downloader.py | 8 ++++++++ setup.cfg | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/downloader.py b/app/downloader.py index 6b6ab6f..5bed7b6 100644 --- a/app/downloader.py +++ b/app/downloader.py @@ -247,11 +247,19 @@ def check_and_download( for release in releases_to_download: release_tag = release["tag_name"] release_dir = os.path.join(download_dir, release_tag) + release_notes_file = os.path.join(release_dir, "release_notes.md") # Create release directory if it doesn't exist if not os.path.exists(release_dir): os.makedirs(release_dir, exist_ok=True) + # Download release notes if missing + if not os.path.exists(release_notes_file) and release.get("body"): + log_message(f"Downloading release notes for version {release_tag}.") + with open(release_notes_file, "w", encoding="utf-8") as notes_file: + notes_file.write(release["body"]) + log_message(f"Saved release notes to {release_notes_file}") + assets_to_download = [] for asset in release["assets"]: file_name = asset["name"] diff --git a/setup.cfg b/setup.cfg index 3aae056..77f8ced 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = fetchtastic -version = 0.2.4 +version = 0.2.5 author = Jeremiah K author_email = jeremiahk@gmx.com description = Meshtastic Firmware and APK Downloader From 3ec94e81af2b7d2910059afa0b0f903a2297298c Mon Sep 17 00:00:00 2001 From: Jeremiah K <17190268+jeremiah-k@users.noreply.github.com> Date: Tue, 24 Dec 2024 09:08:52 -0600 Subject: [PATCH 2/4] Strip unknown characters from release notes --- app/downloader.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/downloader.py b/app/downloader.py index 5bed7b6..645975b 100644 --- a/app/downloader.py +++ b/app/downloader.py @@ -210,6 +210,15 @@ def cleanup_old_versions(directory, releases_to_keep): os.rmdir(version_path) log_message(f"Removed directory: {version_path}") + # Function to strip out non-printable characters and emojis + def strip_unwanted_chars(text): + """ + Strips out non-printable characters and emojis from a string. + """ + # Regex for printable characters (including some extended ASCII) + printable_regex = re.compile(r"[^\x00-\x7F]+") + return printable_regex.sub("", text) + # Function to check for missing releases and download them if necessary def check_and_download( releases, @@ -247,7 +256,9 @@ def check_and_download( for release in releases_to_download: release_tag = release["tag_name"] release_dir = os.path.join(download_dir, release_tag) - release_notes_file = os.path.join(release_dir, "release_notes.md") + release_notes_file = os.path.join( + release_dir, f"release_notes-{release_tag}.md" + ) # Create release directory if it doesn't exist if not os.path.exists(release_dir): @@ -256,8 +267,9 @@ def check_and_download( # Download release notes if missing if not os.path.exists(release_notes_file) and release.get("body"): log_message(f"Downloading release notes for version {release_tag}.") + release_notes_content = strip_unwanted_chars(release["body"]) with open(release_notes_file, "w", encoding="utf-8") as notes_file: - notes_file.write(release["body"]) + notes_file.write(release_notes_content) log_message(f"Saved release notes to {release_notes_file}") assets_to_download = [] From bb02cb83beddc6665b2c5ee5f5c41d7317835657 Mon Sep 17 00:00:00 2001 From: Jeremiah K <17190268+jeremiah-k@users.noreply.github.com> Date: Tue, 24 Dec 2024 09:13:57 -0600 Subject: [PATCH 3/4] Update README.md so Linux/Mac installation instructions are shown before Termux --- README.md | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 2d6b6b8..9b729b9 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ Fetchtastic is a utility for downloading and managing the latest Meshtastic Andr ## Table of Contents - [Installation](#installation) - - [Termux Installation (Android)](#termux-installation-android) - [Linux/Mac Installation](#linuxmac-installation) + - [Termux Installation (Android)](#termux-installation-android) - [Usage](#usage) - [Setup Process](#setup-process) - [Command List](#command-list) @@ -17,6 +17,26 @@ Fetchtastic is a utility for downloading and managing the latest Meshtastic Andr ## Installation +### Linux/Mac Installation + +Fetchtastic can also be installed on Linux or macOS systems. + +#### Install with pipx (Recommended) + +It's recommended to use `pipx` to install Fetchtastic in an isolated environment. (If you prefer, you can use `pip` too.) + +1. **Install pipx**: + + Follow the installation instructions for your platform on the [pipx documentation page](https://pypa.github.io/pipx/installation/). + + Restart your terminal after installing pipx. + +2. **Install Fetchtastic with pipx**: + + ```bash + pipx install fetchtastic + ``` + ### Termux Installation (Android) Fetchtastic can be installed on your Android device using Termux. @@ -42,26 +62,6 @@ pkg install python python-pip openssl -y pip install fetchtastic ``` -### Linux/Mac Installation - -Fetchtastic can also be installed on Linux or macOS systems. - -#### Install with pipx (Recommended) - -It's recommended to use `pipx` to install Fetchtastic in an isolated environment. (If you prefer, you can use `pip` too.) - -1. **Install pipx**: - - Follow the installation instructions for your platform on the [pipx documentation page](https://pypa.github.io/pipx/installation/). - - Restart your terminal after installing pipx. - -2. **Install Fetchtastic with pipx**: - - ```bash - pipx install fetchtastic - ``` - ## Usage ### Setup Process From 8930f1e6b7107c912f4f83cbabc7052d9f2a826c Mon Sep 17 00:00:00 2001 From: Jeremiah K <17190268+jeremiah-k@users.noreply.github.com> Date: Tue, 24 Dec 2024 09:15:16 -0600 Subject: [PATCH 4/4] trunk upgrade --- .trunk/trunk.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index ce99594..78d405b 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -7,12 +7,12 @@ cli: plugins: sources: - id: trunk - ref: v1.6.5 + ref: v1.6.6 uri: https://github.com/trunk-io/plugins # Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes) runtimes: enabled: - - node@18.12.1 + - node@18.20.5 - python@3.10.8 # This is the section where you manage your linters. (https://docs.trunk.io/check/configuration) lint: @@ -20,15 +20,15 @@ lint: - actionlint@1.7.4 - bandit@1.8.0 - black@24.10.0 - - checkov@3.2.327 + - checkov@3.2.344 - git-diff-check - isort@5.13.2 - markdownlint@0.43.0 - - osv-scanner@1.9.1 - - prettier@3.4.1 - - ruff@0.8.1 + - osv-scanner@1.9.2 + - prettier@3.4.2 + - ruff@0.8.4 - taplo@0.9.3 - - trufflehog@3.84.2 + - trufflehog@3.88.0 - yamllint@1.35.1 actions: enabled: