Skip to content

Commit b823fbe

Browse files
authored
RC 0.5.0 Prepair (#475)
* Enhances documentation and UI/UX Adds support for release branches to documentation deployment. Improves the UI by updating the logo, adjusting the layout, adding a footer with version information and links to documentation and GitHub, and enhancing the backend status widget and help button. Changes the backend to use `granian` instead of `gunicorn` for improved performance. Adds a script to generate the `latest-version.json` file for checking for updates in the UI. * Generates JSON for the latest release version Updates the script to generate JSON data specifically for the latest release version based on the release notes. This ensures that only the information relevant to the most current version is exposed through the API, improving clarity and relevance for users. * Improves update banner and version check reliability Refactors the version check logic to fetch the current version from local release notes and improve the reliability of the update banner. Updates the end-to-end tests to use more robust locators and improve the stability of the update banner tests. Also handles potential API errors during version checks more gracefully. * Updates release notes for v0.4.1 Updates the release notes to include the features, bug fixes, and improvements included in the v0.4.1 release. Includes automatic update notifications, a fix for storage calculation, and performance improvements. * Adds granian dependency Adds granian as a production dependency to improve application performance. Removes the release branch from the deploy-docs workflow as it is no longer needed. * Improves update banner and release notes Refactors the update banner tests to improve readability and maintainability. Adds new tests to cover different scenarios, including error handling. Updates release notes to reflect UI changes. * Updates documentation URL in e2e test Updates the documentation URL in the "How to Use" button's e2e test to reflect the new domain. This ensures that the test verifies the correct link. * Updates release notes structure Refactors the release notes documentation for better organization and clarity. It introduces a version verification logic section, explaining how the application checks for new releases, emphasizing privacy and transparency. This change prepares the release notes for the upcoming v0.4.1 release. * Refactors release notes documentation Updates the release notes documentation to improve clarity and maintainability. This commit refactors the `release-notes.md` file. It clarifies the version verification logic, emphasizing privacy standards. The update streamlines the maintenance and upgrade instructions for users. The URL for fetching the latest version is also updated. * Fetches latest version from GitHub Releases API Updates the version check mechanism to use the GitHub Releases API instead of a custom endpoint. This simplifies the process and leverages GitHub's infrastructure for release information. It also removes the need for a custom script to generate the release information. The release notes documentation and update banner component are updated to reflect this change. * Improves version check and update banner logic Updates the version check logic to use semantic versioning for more accurate comparisons. It extracts the highest semantic version from release notes for current version detection. Enhances update banner tests to dynamically generate test data based on current and bumped versions. * Improves version check and UI Improves the version check logic by normalizing version strings before comparison. This ensures accurate comparisons even with varying version formats. Also, prevents images from being draggable. * Improves update banner and footer link Updates the "Issues" link in the footer to "Report a Bug" for clarity. Enhances the update banner test to handle version tags and display version correctly. Normalizes version strings in update banner logic to ensure correct version matching. * Refactors supported formats dialog Improves the supported formats dialog to display verified and experimental formats separately. Includes a link to GitHub issues for reporting unsupported or problematic formats. The dialog now clearly distinguishes between verified and experimental formats, offering users more clarity on the level of support for each format. * Updates release notes documentation Refreshes the release notes documentation to improve clarity and accuracy regarding update checks and privacy standards. Simplifies language and emphasizes user privacy to ensure users understand how the application interacts with the internet for updates. * Updates release notes for v0.5.0 Updates the release notes to reflect the v0.5.0 release, including features, improvements, and a corrected version string example. * Updates installation documentation Refactors the maintenance and updates section of the installation documentation. Provides clearer, step-by-step instructions for updating the service using both Docker Compose and Docker Run methods, improving user experience. * Removes latest version file Removes the latest version file in preparation for the 0.5.0 release. The file will be updated with the new version details. * Adds `@types/semver` and improves input enabling. Adds `@types/semver` as a dependency. Improves the logic for enabling the input field, to ensure it's enabled before attempting to fill it. * Improves air-gapped deployment and UI feedback Enhances documentation for air-gapped deployments, noting the impact on update notifications and linking to relevant documentation. Adds a manual "Check Internet Connection" button to the Web UI with a lightweight reachability test to provide connectivity feedback. The test attempts to connect to Cloudflare DNS without sending any data. * Adds support and sponsorship information Introduces a support and sponsorship page detailing professional services and ways to contribute to the project's development. This allows users to find options for enterprise deployment, custom development, security & compliance reviews, and performance tuning. It also offers a direct sponsorship link to support ongoing maintenance, bug fixes, and new feature development. * Updates support and sponsorship information Refreshes the support and sponsorship documentation with updated information about professional services and sponsorship options. Includes a visual update with a logo.
1 parent 713db80 commit b823fbe

30 files changed

+647
-274
lines changed

.devcontainer/requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ colorama==0.4.6
1414
flask==3.1.2
1515
jsonify==0.5
1616
apscheduler==3.11.2
17-
gunicorn==23.0.0
1817
pillow_heif==1.1.1
1918
pypdfium2==5.3.0
2019
psd-tools==1.12.1
2120
rembg==2.0.72
2221
onnxruntime==1.23.2
22+
granian==2.6.1

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
with:
3434
key: ${{ github.ref }}
3535
path: .cache
36-
36+
3737
- run: pip install -r docs/requirements.txt
3838

3939
- run: zensical build

backend/image_converter/bootstraper.py

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import multiprocessing
1+
import os
22
import subprocess
33
import traceback
44
import pillow_heif
@@ -7,46 +7,23 @@
77
from backend.image_converter.presentation.cli.app import main as cli_main
88
from backend.image_converter.presentation.web.server import start_scheduler
99

10-
11-
12-
def get_workers_count(cpu_multiplier: int = 2, extra_workers: int = 1, min_workers: int = 1) -> int:
13-
"""
14-
Calculate the recommended number of Gunicorn workers based on CPU count.
15-
16-
The default formula is:
17-
workers = (cpu_multiplier * cpu_count) + extra_workers
18-
which defaults to:
19-
workers = (2 * cpu_count) + 1
20-
21-
This formula is a common starting point for many applications. However, for
22-
CPU-bound tasks (like image processing), you might want to adjust the multiplier
23-
or even use a simpler strategy (e.g., one worker per CPU core).
24-
25-
Parameters:
26-
cpu_multiplier (int): The factor to multiply the CPU count by. Default is 2.
27-
extra_workers (int): An extra number of workers to add after the multiplication. Default is 1.
28-
min_workers (int): Ensures that at least this many workers are returned. Default is 1.
29-
30-
Returns:
31-
int: The recommended number of workers.
32-
"""
33-
try:
34-
cpu_count = multiprocessing.cpu_count()
35-
except NotImplementedError:
36-
cpu_count = 1
37-
38-
workers = (cpu_multiplier * cpu_count) + extra_workers
39-
return max(workers, min_workers)
40-
41-
4210
def launch_web_prod():
4311
start_scheduler()
12+
workers_setting = os.environ.get("GRANIAN_WORKERS", "auto").strip().lower()
13+
if workers_setting == "auto":
14+
workers = os.cpu_count() or 1
15+
else:
16+
try:
17+
workers = max(int(workers_setting), 1)
18+
except ValueError:
19+
workers = os.cpu_count() or 1
4420
subprocess.run([
45-
"gunicorn",
46-
"-w", str(get_workers_count()),
47-
"--timeout", "1800",
48-
"-b", "0.0.0.0:5000",
49-
"backend.image_converter.presentation.web.server:app"
21+
"granian",
22+
"--interface", "wsgi",
23+
"--workers", str(workers),
24+
"--host", "0.0.0.0",
25+
"--port", "5000",
26+
"backend.image_converter.presentation.web.server:app"
5027
], check=True)
5128

5229

backend/image_converter/presentation/web/routes.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,14 @@ def storage_info():
9696
if not storage_management_service.is_storage_management_enabled():
9797
return _storage_management_disabled_response()
9898

99-
return jsonify(storage_management_service.get_disk_usage()), 200
99+
container_files = temp_folder_service.get_container_files()
100+
total_used_mb = container_files.get("total_size_mb", 0)
101+
_, _, free = shutil.disk_usage(TEMP_DIR)
102+
mib = 1024 * 1024
103+
return jsonify({
104+
"used_storage_mb": total_used_mb,
105+
"available_storage_mb": round(free / mib, 2),
106+
}), 200
100107

101108

102109
@api_blueprint.route("/force_cleanup", methods=["POST"])

docs/installation.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,40 @@ No local dependencies, no configuration clutter. Just a high-performance image o
5555

5656

5757

58-
## Maintenance & Updates
58+
### Maintenance & Updates
59+
60+
Keep your instance secure and benefit from the latest features.
61+
62+
=== "Docker Compose (Recommended)"
63+
64+
1. **Pull the latest version**
65+
```bash
66+
docker compose pull
67+
```
68+
2. **Restart the service**
69+
```bash
70+
docker compose up -d
71+
```
72+
73+
=== "Docker Run"
74+
75+
1. **Download the image**
76+
```bash
77+
docker pull karimz1/imgcompress:latest
78+
```
79+
2. **Replace the container**
80+
```bash
81+
docker rm -f imgcompress
82+
docker run -d \
83+
--name imgcompress \
84+
-p 3001:5000 \
85+
--restart \
86+
unless-stopped \
87+
karimz1/imgcompress:latest
88+
```
89+
3. Once the container is running, open your web browser & navigate to: http://localhost:3001
5990

60-
Keep your instance secure and up-to-date.
61-
62-
| Method | Command |
63-
| :--- |:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
64-
| **Docker Compose** | `docker compose pull && docker compose up -d` |
65-
| **Docker Run** | `docker pull karimz1/imgcompress:latest && docker rm -f imgcompress && docker run -d --name imgcompress -p 3001:5000 --restart unless-stopped karimz1/imgcompress:latest` |
91+
---
6692

6793
## Choosing Your Version
6894

@@ -110,11 +136,11 @@ ___
110136
For organizations requiring extreme data isolation (e.g., **HIPAA, GDPR, or SOC2**), `imgcompress` supports a fully air-gapped configuration. This workflow severs the container's ability to communicate with the public internet.
111137

112138
!!! danger "Advanced Implementation Only"
113-
This reference architecture introduces significant infrastructure complexity. It requires manual maintenance of Docker networking and typically a pre-configured reverse proxy. Use this only if your security model mandates total network isolation.
139+
This architecture mandates total network isolation. **By choosing this method, the Web UI cannot notify you of new releases.** You will need to manually monitor the [GitHub Releases](https://github.com/karimz1/imgcompress/releases) to stay current. See [How Updates Notification Work](release-notes.md#transparent-update-checks) for more details.
114140

115141
### Technical Implementation
116142

117-
To deploy in a zero-egress environment, use the provided hardened configuration, I created as a sample for you:
143+
To deploy in a zero-egress environment, use the provided hardened configuration I created as a sample for you:
118144

119145
```yaml
120146
--8<-- "docker-compose-no-internet.yml"

docs/release-notes.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,41 @@
11
---
2-
title: "Release Notes & Updates: ImgCompress"
3-
description: Stay up to date with the latest features, bug fixes, and performance improvements in ImgCompress. Check out my version history.
2+
title: "Release Notes & Updates | ImgCompress"
3+
description: Transparent version history and update process for ImgCompress.
44
---
55

66
# Release Notes
77

8-
All notable changes to this project will be documented in this file.
8+
This document tracks all notable changes I've made to **ImgCompress**, including new features, bug fixes, and performance optimizations.
99

10-
--8<-- "frontend/public/release-notes.md"
10+
---
11+
12+
## Maintenance and Upgrades
13+
14+
To ensure you have the latest features and security patches, I recommend keeping your installation up to date.
15+
16+
* **Current History:** Review the [Change Log](#change-log) below.
17+
* **How to Update:** Follow my [**Update Guide**](installation.md#maintenance-updates) to pull the latest Docker image.
18+
19+
---
20+
21+
## Transparent Update Checks
22+
23+
ImgCompress is **100% open source**. I believe in complete transparency regarding how this software interacts with the internet. To ensure you never miss an important fix, I included a privacy-safe update check in the Web UI:
24+
25+
### How it works
26+
1. **Local Version:** The app identifies its current version from the local `release-notes.md`.
27+
2. **GitHub Check:** The UI makes a single, secure request to the [GitHub Releases API](https://api.github.com/repos/karimz1/imgcompress/releases/latest).
28+
3. **Comparison:** If the GitHub version is newer than your local version, an update banner appears in your dashboard.
29+
30+
!!! success "Privacy First"
31+
- This process is **anonymous and read-only**.
32+
- **Pure Comparison:** The check only compares two version strings (e.g., `v0.4.0` vs `v0.5.0`).
33+
34+
---
35+
36+
## Change Log
37+
38+
!!! tip "Transparency"
39+
You can verify every code change I make directly on the [GitHub Repository](https://github.com/karimz1/imgcompress).
40+
41+
--8<-- "frontend/public/release-notes.md"

docs/support.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: "Support & Sponsorship"
3+
description: Professional support options and sponsorship for ImgCompress.
4+
---
5+
6+
# Support & Sponsorship
7+
8+
<p align="center">
9+
<img src="/images/logo_transparent.png" width="300" alt="ImgCompress Mascot">
10+
</p>
11+
12+
ImgCompress is a personal project licensed under **GPL-3.0**. **The core tool will always remain open source and free.** I offer professional services for teams that require dedicated expertise or modifications beyond the standard feature set.
13+
14+
---
15+
16+
## Professional Services
17+
*Need custom work or features that aren't there yet? I can help.*
18+
19+
| Service | Goal |
20+
| :--- | :--- |
21+
| **Custom Workflows** | Assistance in extending the feature set to your specific workflow. |
22+
| **Specialized Setup** | Help with hardened, air-gapped, or complex Docker environments. |
23+
| **Optimization** | Tuning the backend for high-volume or specific performance needs. |
24+
25+
!!! quote ""
26+
**Business Inquiries:** [karimzouine.com](https://www.karimzouine.com)
27+
28+
---
29+
30+
## 💖 Sponsorship
31+
*Help fuel the ongoing development and maintenance of this project.*
32+
33+
If ImgCompress provides value to you or your team, consider supporting the project. Your sponsorship directly funds my time for security maintenance, bug fixes, and new feature development.
34+
35+
[Sponsor on GitHub :octicons-heart-fill-16:](https://github.com/sponsors/karimz1){ .md-button .md-button--primary }

docs/web-ui.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,19 @@ The interface provides clear visual cues regarding your current network environm
9999
| :--- | :--- |
100100
| ![No internet](images/status/no-internet.png) | ![Internet access](images/status/internet-available.png) |
101101

102+
## Network & Connectivity
103+
104+
The Web UI includes a manual **"Check Internet Connection"** button. I've designed this to be as lightweight and transparent as possible.
105+
106+
### How it works
107+
When you click the button, the tool performs a basic reachability test:
108+
1. **Target:** It attempts to open a socket connection to `1.1.1.1:53` (Cloudflare DNS).
109+
2. **Action:** It simply checks if the connection can be established.
110+
3. **Privacy:** No DNS queries are sent, and no data is transmitted. This is a pure "heartbeat" check to verify outbound access from within the Docker container.
111+
112+
!!! tip "Manual Reachability Only"
113+
This check is purely user-initiated. ImgCompress does not perform background pings for connectivity; the request only occurs when you manually click the button.
114+
102115
### How to Access the Connection Status
103116

104117
1. Navigate to the **Storage Management** section:

frontend/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"react-dom": "^19.2.0",
3636
"react-dropzone": "^14.3.8",
3737
"react-toastify": "^11.0.5",
38+
"semver": "^7.7.2",
3839
"sharp": "^0.34.5",
3940
"tailwind-merge": "^3.4.0",
4041
"tailwindcss-animate": "^1.0.7",
@@ -45,6 +46,7 @@
4546
"@playwright/test": "^1.57.0",
4647
"@tailwindcss/postcss": "^4.1.18",
4748
"@types/adm-zip": "^0.5.7",
49+
"@types/semver": "^7.7.1",
4850
"@types/node": "^25",
4951
"@types/react": "^19",
5052
"@types/react-dom": "^19",

frontend/pnpm-lock.yaml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)