From 0ba4cbe2594d903633466942959b4b019f65dc6b Mon Sep 17 00:00:00 2001 From: Frederico Gomes Date: Mon, 9 Mar 2026 10:58:35 +0000 Subject: [PATCH] wireguard: Add button for direct APK download **clients.py** - allow download type for mobile os **manifest.py** - add entry for apk download **plinth/templates/clients.html** - add logic to show button for apk download **themes > icons** - add icon for android source: https://www.wireguard.com/install/ Signed-off-by: Frederico Gomes [sunil: Minor indentation] [sunil: Refactor logic to eliminate packages from Desktop clients list] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- plinth/clients.py | 2 +- plinth/modules/wireguard/manifest.py | 5 +++ plinth/templates/clients.html | 40 +++++++++++++++--------- static/themes/default/icons/android.png | Bin 0 -> 500 bytes 4 files changed, 32 insertions(+), 15 deletions(-) create mode 100644 static/themes/default/icons/android.png diff --git a/plinth/clients.py b/plinth/clients.py index 01da5cb63..9cd9a4ffb 100644 --- a/plinth/clients.py +++ b/plinth/clients.py @@ -116,7 +116,7 @@ def _validate_platform_package(platform): def _validate_platform_download(platform): """Validate a platform of type download.""" - assert platform['os'] in enum_values(Desktop_OS) + assert platform['os'] in enum_values(Desktop_OS) + enum_values(Mobile_OS) assert isinstance(platform['url'], (str, Promise)) diff --git a/plinth/modules/wireguard/manifest.py b/plinth/modules/wireguard/manifest.py index 97fb9c05f..2fa8dfb6d 100644 --- a/plinth/modules/wireguard/manifest.py +++ b/plinth/modules/wireguard/manifest.py @@ -25,6 +25,11 @@ clients = [{ 'type': 'package', 'format': 'deb', 'name': 'wireguard' + }, { + 'type': 'download', + 'os': 'android', + 'url': ('https://www.wireguard.com/' + 'install/#android-play-store-direct-apk-file') }, { 'type': 'store', 'os': 'android', diff --git a/plinth/templates/clients.html b/plinth/templates/clients.html index ccd280880..b4466d70f 100644 --- a/plinth/templates/clients.html +++ b/plinth/templates/clients.html @@ -45,20 +45,22 @@ {% for platform in client.platforms %} {% if platform.type == 'download' %} - - - {% with 'theme/icons/'|add:platform.os|add:'.png' as icon %} - - {% if platform.os == 'gnu-linux' %} - {% trans 'GNU/Linux' %} - {% elif platform.os == 'windows' %} - {% trans 'Windows' %} - {% elif platform.os == 'macos' %} - {% trans 'macOS' %} - {% endif %} - {% endwith %} - - + {% if platform.os == 'gnu-linux' or platform.os == 'macos' or platform.os == 'windows' %} + + + {% with 'theme/icons/'|add:platform.os|add:'.png' as icon %} + + {% if platform.os == 'gnu-linux' %} + {% trans 'GNU/Linux' %} + {% elif platform.os == 'windows' %} + {% trans 'Windows' %} + {% elif platform.os == 'macos' %} + {% trans 'macOS' %} + {% endif %} + {% endwith %} + + + {% endif %} {% endif %} {% endfor %} @@ -75,6 +77,16 @@ {{ client.name }} {% for platform in client.platforms %} + {% if platform.type == 'download' and platform.os == 'android' %} + + + {% with 'theme/icons/'|add:platform.os|add:'.png' as icon %} + + {% trans 'Android APK' %} + {% endwith %} + + + {% endif %} {% if platform.type == 'store' and platform.os == 'android' or platform.os == 'ios' %} diff --git a/static/themes/default/icons/android.png b/static/themes/default/icons/android.png new file mode 100644 index 0000000000000000000000000000000000000000..c64703ec70a91d16e9275104744362e001122030 GIT binary patch literal 500 zcmVc9!dmbl5>#Sdz%pQGAwGeHh_Ut+w9!Hf z3oR@nf(c3G3T`4K$HG}y$=sdnChj(K;46lE&V2uS@0mL{GSf6;#+0K4XaR}<5wRQ* zE5|j6h}DQ#DkfxRt#A=LI9tkT66UduOQoC`b`C_uBb>?1J7doNDYi57K{2NRU>2Wo zD>FYt#A)2XVzolERcaSs@E)%-vlkIp@CuhRvpez@3@qa^-r_lW$OiqwGrYr6f!280Lco6Gg82&sR%*r`4|>iFeDfD@zvfHb%*=zTA&(lH`FBR&YsOY1 z;@qKg01peZ>EaCzMp%LUs^({5eC^N{;M0F-yplft1Ay}rH1Df3*aHhwxC$)5sp??^ q_a+SRt?_Tz-U(ZP7N7-~MEn5{)m7oVs#kyj0000