From 44b92f12ebc0b39a376d3298525041392d51b9a7 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 6 Dec 2017 16:07:37 +0530 Subject: [PATCH] clients: Update all manifest due to use updated framework - Validate all the client data using the validation function. - No need for enums anymore. Easier to read. - Use the combined store URL method. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/deluge/manifest.py | 10 ++-- plinth/modules/diaspora/manifest.py | 16 +++--- plinth/modules/ejabberd/manifest.py | 40 ++++++-------- plinth/modules/ikiwiki/manifest.py | 6 +- plinth/modules/infinoted/manifest.py | 12 ++-- plinth/modules/jsxc/manifest.py | 10 +--- plinth/modules/matrixsynapse/manifest.py | 70 +++++++++++------------- plinth/modules/minetest/manifest.py | 25 ++++----- plinth/modules/mumble/manifest.py | 36 ++++++------ plinth/modules/quassel/manifest.py | 25 ++++----- plinth/modules/radicale/manifest.py | 19 +++---- plinth/modules/repro/manifest.py | 44 +++++++-------- plinth/modules/restore/manifest.py | 6 +- plinth/modules/roundcube/manifest.py | 6 +- plinth/modules/shaarli/manifest.py | 6 +- plinth/modules/syncthing/manifest.py | 40 +++++++------- plinth/modules/tor/manifest.py | 36 ++++++------ plinth/modules/transmission/manifest.py | 6 +- plinth/modules/ttrss/manifest.py | 21 +++---- 19 files changed, 204 insertions(+), 230 deletions(-) diff --git a/plinth/modules/deluge/manifest.py b/plinth/modules/deluge/manifest.py index 87e2669b3..440682153 100644 --- a/plinth/modules/deluge/manifest.py +++ b/plinth/modules/deluge/manifest.py @@ -17,19 +17,19 @@ from django.utils.translation import ugettext_lazy as _ -from plinth.templatetags.plinth_extras import Package +from plinth.clients import validate -clients = [{ +clients = validate([{ 'name': _('Deluge'), 'description': - _('Bittorrent client written in Python/PyGTK '), + _('Bittorrent client written in Python/PyGTK'), 'platforms': [{ 'type': 'web', 'url': '/deluge' }, { 'type': 'package', - 'format': Package.DEB.value, + 'format': 'deb', 'name': 'deluge', }] -}] +}]) diff --git a/plinth/modules/diaspora/manifest.py b/plinth/modules/diaspora/manifest.py index 6696563af..fe9cacd7e 100644 --- a/plinth/modules/diaspora/manifest.py +++ b/plinth/modules/diaspora/manifest.py @@ -17,13 +17,11 @@ from django.utils.translation import ugettext_lazy as _ +from plinth.clients import store_url, validate from plinth.modules import diaspora -from plinth.templatetags.plinth_extras import Mobile_OS, Store -from plinth.utils import f_droid_url, format_lazy +from plinth.utils import format_lazy -dandelion_package_id = 'com.github.dfa.diaspora_android' - -clients = [{ +clients = validate([{ 'name': _('dandelion*'), 'description': @@ -31,9 +29,9 @@ clients = [{ 'community-run, distributed social network diaspora*'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.F_DROID.value, - 'url': f_droid_url(dandelion_package_id), + 'os': 'android', + 'store_name': 'f-droid', + 'url': store_url('f-droid', 'com.github.dfa.diaspora_android'), }] }, { 'name': @@ -46,4 +44,4 @@ clients = [{ host=diaspora.get_configured_domain_name() if diaspora.is_setup() else "") }] -}] +}]) diff --git a/plinth/modules/ejabberd/manifest.py b/plinth/modules/ejabberd/manifest.py index 12d222b32..a0796abdc 100644 --- a/plinth/modules/ejabberd/manifest.py +++ b/plinth/modules/ejabberd/manifest.py @@ -18,22 +18,16 @@ from django.utils.translation import ugettext_lazy as _ from plinth.modules.jsxc import manifest as jsxc_manifest -from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package, - Store) -from plinth.utils import play_store_url +from plinth.clients import store_url, validate -yaxim_package_id = 'org.yaxim.androidclient' -bruno_package_id = 'org.yaxim.bruno' -conversations_package_id = 'eu.siacs.conversations' - -_clients = [{ +_clients = validate([{ 'name': _('yaxim'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': play_store_url(yaxim_package_id), + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', 'org.yaxim.androidclient'), }] }, { 'name': @@ -43,9 +37,9 @@ _clients = [{ 'yaxim app.'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': play_store_url(bruno_package_id) + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', 'org.yaxim.bruno') }] }, { 'name': @@ -60,8 +54,8 @@ _clients = [{ 'extra security.'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.IOS.value, - 'store_name': Store.APP_STORE.value, + 'os': 'ios', + 'store_name': 'app-store', 'url': 'https://itunes.apple.com/us/app/chatsecure' '/id464200063 ' }] @@ -70,16 +64,16 @@ _clients = [{ _('Conversations'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': play_store_url(conversations_package_id) + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', 'eu.siacs.conversations') }] }, { 'name': _('Dino'), 'platforms': [{ 'type': 'download', - 'os': Desktop_OS.GNU_LINUX, + 'os': 'gnu-linux', 'url': 'https://github.com/dino/dino/wiki/Distribution-Packages', }] }, { @@ -87,14 +81,14 @@ _clients = [{ _('Gajim'), 'platforms': [{ 'type': 'package', - 'format': Package.DEB.value, + 'format': 'deb', 'name': 'gajim' }, { 'type': 'download', - 'os': Desktop_OS.WINDOWS.value, + 'os': 'windows', 'url': 'https://gajim.org/downloads.php' }] -}] +}]) _clients.extend(jsxc_manifest.clients) diff --git a/plinth/modules/ikiwiki/manifest.py b/plinth/modules/ikiwiki/manifest.py index f0f4d4c04..f1b100bb4 100644 --- a/plinth/modules/ikiwiki/manifest.py +++ b/plinth/modules/ikiwiki/manifest.py @@ -17,10 +17,12 @@ from django.utils.translation import ugettext_lazy as _ -clients = [{ +from plinth.clients import validate + +clients = validate([{ 'name': _('ikiwiki'), 'platforms': [{ 'type': 'web', 'url': '/ikiwiki' }] -}] +}]) diff --git a/plinth/modules/infinoted/manifest.py b/plinth/modules/infinoted/manifest.py index 46575399c..00bc354f5 100644 --- a/plinth/modules/infinoted/manifest.py +++ b/plinth/modules/infinoted/manifest.py @@ -18,26 +18,26 @@ from django.utils.translation import ugettext_lazy as _ from plinth import cfg -from plinth.templatetags.plinth_extras import Desktop_OS, Package +from plinth.clients import validate from plinth.utils import format_lazy -clients = [{ +clients = validate([{ 'name': _('Gobby'), 'description': _('Gobby is a collaborative text editor'), 'usage': format_lazy( - _('start Gobby and select "Connect to Server" and ' + _('Start Gobby and select "Connect to Server" and ' 'enter your {box_name}\'s domain name.'), box_name=_(cfg.box_name)), 'platforms': [{ 'type': 'download', - 'os': Desktop_OS.WINDOWS.value, + 'os': 'windows', 'url': 'https://github.com/gobby/gobby/wiki/Download' }, { 'type': 'package', - 'format': Package.DEB.value, + 'format': 'deb', 'name': 'gobby' }] -}] +}]) diff --git a/plinth/modules/jsxc/manifest.py b/plinth/modules/jsxc/manifest.py index 6486c977f..30c2bf56d 100644 --- a/plinth/modules/jsxc/manifest.py +++ b/plinth/modules/jsxc/manifest.py @@ -17,17 +17,13 @@ from django.utils.translation import ugettext_lazy as _ -from plinth.templatetags.plinth_extras import Package +from plinth.clients import validate -clients = [{ +clients = validate([{ 'name': _('JSXC'), 'platforms': [{ - 'type': 'package', - 'format': Package.DEB.value, - 'name': 'libjs-jsxc' - }, { 'type': 'web', 'url': '/jsxc' }] -}] +}]) diff --git a/plinth/modules/matrixsynapse/manifest.py b/plinth/modules/matrixsynapse/manifest.py index 9023f192e..0e95334d5 100644 --- a/plinth/modules/matrixsynapse/manifest.py +++ b/plinth/modules/matrixsynapse/manifest.py @@ -17,46 +17,38 @@ from django.utils.translation import ugettext_lazy as _ -from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store -from plinth.utils import f_droid_url, play_store_url +from plinth.clients import store_url, validate -android_package_id = 'im.vector.alpha' -riot_desktop_download_url = 'https://riot.im/desktop.html' +_android_package_id = 'im.vector.alpha' +_riot_desktop_download_url = 'https://riot.im/desktop.html' -clients = [{ +clients = validate([{ 'name': _('Riot'), - 'platforms': [ - { - 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': play_store_url(android_package_id) - }, - { - 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.F_DROID.value, - 'url': f_droid_url(android_package_id) - }, - { - 'type': 'web', - 'url': 'https://riot.im/app/#/home' - }, - { - 'type': 'download', - 'os': Desktop_OS.GNU_LINUX.value, - 'url': riot_desktop_download_url, - }, - { - 'type': 'download', - 'os': Desktop_OS.MAC_OS.value, - 'url': riot_desktop_download_url, - }, - { - 'type': 'download', - 'os': Desktop_OS.WINDOWS.value, - 'url': riot_desktop_download_url, - }, - ] -}] + 'platforms': [{ + 'type': 'store', + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', _android_package_id) + }, { + 'type': 'store', + 'os': 'android', + 'store_name': 'f-droid', + 'url': store_url('f-droid', _android_package_id) + }, { + 'type': 'web', + 'url': 'https://riot.im/app/#/home' + }, { + 'type': 'download', + 'os': 'gnu-linux', + 'url': _riot_desktop_download_url, + }, { + 'type': 'download', + 'os': 'macos', + 'url': _riot_desktop_download_url, + }, { + 'type': 'download', + 'os': 'windows', + 'url': _riot_desktop_download_url, + }] +}]) diff --git a/plinth/modules/minetest/manifest.py b/plinth/modules/minetest/manifest.py index 4ed019710..b16b9d7a3 100644 --- a/plinth/modules/minetest/manifest.py +++ b/plinth/modules/minetest/manifest.py @@ -17,31 +17,28 @@ from django.utils.translation import ugettext_lazy as _ -from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package, - Store) +from plinth.clients import store_url, validate -clients = [{ +clients = validate([{ 'name': _('Minetest'), 'platforms': [{ 'type': 'download', - 'os': Desktop_OS.WINDOWS.value, + 'os': 'windows', 'url': 'https://github.com/minetest/minetest/releases' - '/download/0.4.16/minetest-0.4.16-win64.zip ' }, { 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': 'https://play.google.com/store/apps/details?id=net' - '.minetest.minetest ' + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', 'net.minetest.minetest') }, { 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.F_DROID.value, - 'url': 'https://f-droid.org/packages/net.minetest.minetest/ ' + 'os': 'android', + 'store_name': 'f-droid', + 'url': store_url('f-droid', 'net.minetest.minetest') }, { 'type': 'package', - 'format': Package.DEB.value, + 'format': 'deb', 'name': 'minetest' }] -}] +}]) diff --git a/plinth/modules/mumble/manifest.py b/plinth/modules/mumble/manifest.py index 5bd22f39c..149d74258 100644 --- a/plinth/modules/mumble/manifest.py +++ b/plinth/modules/mumble/manifest.py @@ -17,31 +17,29 @@ from django.utils.translation import ugettext_lazy as _ -from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package, - Store) -from plinth.utils import f_droid_url, play_store_url +from plinth.clients import store_url, validate -plumble_package_id = 'com.morlunk.mumbleclient.free' +_plumble_package_id = 'com.morlunk.mumbleclient.free' -clients = [{ +clients = validate([{ 'name': _('Mumble'), 'platforms': [{ 'type': 'download', - 'os': Desktop_OS.WINDOWS.value, + 'os': 'windows', 'url': 'https://wiki.mumble.info/wiki/Main_Page' }, { 'type': 'download', - 'os': Desktop_OS.MAC_OS.value, + 'os': 'macos', 'url': 'https://wiki.mumble.info/wiki/Main_Page' }, { 'type': 'package', - 'format': Package.DEB.value, + 'format': 'deb', 'name': 'mumble' }, { 'type': 'store', - 'os': Mobile_OS.IOS.value, - 'store_name': Store.APP_STORE.value, + 'os': 'ios', + 'store_name': 'app-store', 'url': 'https://itunes.apple.com/us/app/mumble/id443472808' }] }, { @@ -49,22 +47,22 @@ clients = [{ _('Plumble'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': play_store_url(plumble_package_id) + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', _plumble_package_id) }, { 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.F_DROID.value, - 'url': f_droid_url(plumble_package_id) + 'os': 'android', + 'store_name': 'f-droid', + 'url': store_url('f-droid', _plumble_package_id) }] }, { 'name': _('Mumblefly'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.IOS.value, - 'store_name': Store.APP_STORE.value, + 'os': 'ios', + 'store_name': 'app-store', 'url': 'https://itunes.apple.com/dk/app/mumblefy/id858752232' }] -}] +}]) diff --git a/plinth/modules/quassel/manifest.py b/plinth/modules/quassel/manifest.py index 37a2e90ec..6aae13609 100644 --- a/plinth/modules/quassel/manifest.py +++ b/plinth/modules/quassel/manifest.py @@ -17,32 +17,27 @@ from django.utils.translation import ugettext_lazy as _ -from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package, - Store) -from plinth.utils import play_store_url +from plinth.clients import store_url, validate -quasseldroid_package_id = 'com.iskrembilen.quasseldroid', -quassel_download_url = 'http://quassel-irc.org/downloads' - -clients = [{ +clients = validate([{ 'name': _('Quassel'), 'platforms': [{ 'type': 'download', - 'os': Desktop_OS.MAC_OS.value, - 'url': quassel_download_url, + 'os': 'macos', + 'url': 'http://quassel-irc.org/downloads' }, { 'type': 'package', - 'format': Package.DEB.value, + 'format': 'deb', 'name': 'quassel-client', }] }, { 'name': - _('Quassseldroid'), + _('Quasseldroid'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': play_store_url(quasseldroid_package_id), + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', 'com.iskrembilen.quasseldroid'), }] -}] +}]) diff --git a/plinth/modules/radicale/manifest.py b/plinth/modules/radicale/manifest.py index 6f173e4c3..bb32af673 100644 --- a/plinth/modules/radicale/manifest.py +++ b/plinth/modules/radicale/manifest.py @@ -17,12 +17,9 @@ from django.utils.translation import ugettext_lazy as _ -from plinth.templatetags.plinth_extras import Mobile_OS, Package, Store -from plinth.utils import play_store_url +from plinth.clients import store_url, validate -davdroid_package_id = 'at.bitfire.davdroid' - -clients = [{ +clients = validate([{ 'name': _('DAVDroid'), 'usage': @@ -32,16 +29,16 @@ clients = [{ 'create new.'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': play_store_url(davdroid_package_id), + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', 'at.bitfire.davdroid'), }] }, { 'name': _('GNOME Calendar'), 'platforms': [{ 'type': 'package', - 'format': Package.DEB.value, + 'format': 'deb', 'name': 'gnome-calendar' }] }, { @@ -59,7 +56,7 @@ clients = [{ 'calendars and address books.'), 'platforms': [{ 'type': 'package', - 'format': Package.DEB.value, + 'format': 'deb', 'name': 'evolution' }] -}] +}]) diff --git a/plinth/modules/repro/manifest.py b/plinth/modules/repro/manifest.py index 6eb5b8760..b09ef08fe 100644 --- a/plinth/modules/repro/manifest.py +++ b/plinth/modules/repro/manifest.py @@ -17,16 +17,14 @@ from django.utils.translation import ugettext_lazy as _ -from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package, - Store) -from plinth.utils import play_store_url +from plinth.clients import store_url, validate -jitsi_package_id = 'org.jitsi.meet' -csipsimple_package_id = 'com.csipsimple' +_jitsi_package_id = 'org.jitsi.meet' +_csipsimple_package_id = 'com.csipsimple' -jitsi_download_url = 'https://download.jitsi.org/jitsi/' +_jitsi_download_url = 'https://download.jitsi.org/jitsi/' -clients = [{ +clients = validate([{ 'name': _('Jitsi Meet'), 'description': @@ -40,38 +38,38 @@ clients = [{ 'and simulcasting.'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': play_store_url(jitsi_package_id) + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', _jitsi_package_id) }, { 'type': 'store', - 'os': Mobile_OS.IOS.value, - 'store_name': Store.APP_STORE.value, + 'os': 'ios', + 'store_name': 'app-store', 'url': 'https://itunes.apple.com/in/app/jitsi-meet/id1165103905' }, { 'type': 'download', - 'os': Desktop_OS.GNU_LINUX.value, - 'url': jitsi_download_url + 'os': 'gnu-linux', + 'url': _jitsi_download_url }, { 'type': 'package', - 'format': Package.DEB.value, + 'format': 'deb', 'name': 'jitsi' }, { 'type': 'download', - 'os': Desktop_OS.MAC_OS.value, - 'url': jitsi_download_url + 'os': 'macos', + 'url': _jitsi_download_url }, { 'type': 'download', - 'os': Desktop_OS.WINDOWS.value, - 'url': jitsi_download_url + 'os': 'windows', + 'url': _jitsi_download_url }] }, { 'name': _('CSipSimple'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': play_store_url(csipsimple_package_id) + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', _csipsimple_package_id) }] -}] +}]) diff --git a/plinth/modules/restore/manifest.py b/plinth/modules/restore/manifest.py index fdfb5902f..e0405a43a 100644 --- a/plinth/modules/restore/manifest.py +++ b/plinth/modules/restore/manifest.py @@ -17,10 +17,12 @@ from django.utils.translation import ugettext_lazy as _ -clients = [{ +from plinth.clients import validate + +clients = validate([{ 'name': _('reStore'), 'platforms': [{ 'type': 'web', 'url': '/restore' }] -}] +}]) diff --git a/plinth/modules/roundcube/manifest.py b/plinth/modules/roundcube/manifest.py index ba3c2c03b..42f6c8f2b 100644 --- a/plinth/modules/roundcube/manifest.py +++ b/plinth/modules/roundcube/manifest.py @@ -17,10 +17,12 @@ from django.utils.translation import ugettext_lazy as _ -clients = [{ +from plinth.clients import validate + +clients = validate([{ 'name': _('Roundcube'), 'platforms': [{ 'type': 'web', 'url': '/roundcube' }] -}] +}]) diff --git a/plinth/modules/shaarli/manifest.py b/plinth/modules/shaarli/manifest.py index ef2b6ab07..0b68486e7 100644 --- a/plinth/modules/shaarli/manifest.py +++ b/plinth/modules/shaarli/manifest.py @@ -17,10 +17,12 @@ from django.utils.translation import ugettext_lazy as _ -clients = [{ +from plinth.clients import validate + +clients = validate([{ 'name': _('Shaarli'), 'platforms': [{ 'type': 'web', 'url': '/shaarli' }] -}] +}]) diff --git a/plinth/modules/syncthing/manifest.py b/plinth/modules/syncthing/manifest.py index ccb4d1753..494126fad 100644 --- a/plinth/modules/syncthing/manifest.py +++ b/plinth/modules/syncthing/manifest.py @@ -17,48 +17,46 @@ from django.utils.translation import ugettext_lazy as _ -from plinth.templatetags.plinth_extras import (Desktop_OS, Mobile_OS, Package, - Store) -from plinth.utils import f_droid_url, play_store_url +from plinth.clients import store_url, validate -syncthing_package_id = 'com.nutomic.syncthingandroid' -syncthing_download_url = 'https://syncthing.net/' +_package_id = 'com.nutomic.syncthingandroid' +_download_url = 'https://syncthing.net/' -clients = [{ +clients = validate([{ 'name': _('Syncthing'), 'platforms': [{ 'type': 'package', - 'format': Package.DEB.value, + 'format': 'deb', 'name': 'syncthing', }, { 'type': 'package', - 'format': Package.HOMEBREW.value, + 'format': 'brew', 'name': 'syncthing', }, { 'type': 'download', - 'os': Desktop_OS.GNU_LINUX.value, - 'url': syncthing_download_url, + 'os': 'gnu-linux', + 'url': _download_url, }, { 'type': 'download', - 'os': Desktop_OS.MAC_OS.value, - 'url': syncthing_download_url, + 'os': 'macos', + 'url': _download_url, }, { 'type': 'download', - 'os': Desktop_OS.WINDOWS.value, - 'url': syncthing_download_url, + 'os': 'windows', + 'url': _download_url, }, { 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': play_store_url(syncthing_package_id) + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', _package_id) }, { 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.F_DROID.value, - 'url': f_droid_url(syncthing_package_id) + 'os': 'android', + 'store_name': 'f-droid', + 'url': store_url('f-droid', _package_id) }, { 'type': 'web', 'url': '/syncthing' }] -}] +}]) diff --git a/plinth/modules/tor/manifest.py b/plinth/modules/tor/manifest.py index fff134bf2..ad44071d2 100644 --- a/plinth/modules/tor/manifest.py +++ b/plinth/modules/tor/manifest.py @@ -17,40 +17,40 @@ from django.utils.translation import ugettext_lazy as _ -from plinth.templatetags.plinth_extras import Desktop_OS, Mobile_OS, Store -from plinth.utils import f_droid_url, play_store_url +from plinth.clients import store_url, validate -orbot_package_id = 'org.torproject.android' -tor_browser_download_url = 'https://www.torproject.org/download/download-easy.html' +_orbot_package_id = 'org.torproject.android' +_tor_browser_download_url = \ + 'https://www.torproject.org/download/download-easy.html' -clients = [{ +clients = validate([{ 'name': _('Tor Browser'), 'platforms': [{ 'type': 'download', - 'os': Desktop_OS.WINDOWS.value, - 'url': tor_browser_download_url, + 'os': 'windows', + 'url': _tor_browser_download_url, }, { 'type': 'download', - 'os': Desktop_OS.GNU_LINUX.value, - 'url': tor_browser_download_url, + 'os': 'gnu-linux', + 'url': _tor_browser_download_url, }, { 'type': 'download', - 'os': Desktop_OS.MAC_OS.value, - 'url': tor_browser_download_url, + 'os': 'macos', + 'url': _tor_browser_download_url, }] }, { 'name': _('Orbot: Proxy with Tor'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': play_store_url(orbot_package_id) + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', _orbot_package_id) }, { 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.F_DROID.value, - 'url': f_droid_url(orbot_package_id) + 'os': 'android', + 'store_name': 'f-droid', + 'url': store_url('f-droid', _orbot_package_id) }] -}] +}]) diff --git a/plinth/modules/transmission/manifest.py b/plinth/modules/transmission/manifest.py index 319ae4ca7..96284ff38 100644 --- a/plinth/modules/transmission/manifest.py +++ b/plinth/modules/transmission/manifest.py @@ -17,10 +17,12 @@ from django.utils.translation import ugettext_lazy as _ -clients = [{ +from plinth.clients import validate + +clients = validate([{ 'name': _('Transmission'), 'platforms': [{ 'type': 'web', 'url': '/transmission' }] -}] +}]) diff --git a/plinth/modules/ttrss/manifest.py b/plinth/modules/ttrss/manifest.py index d4ee2cb6b..4bcb94a74 100644 --- a/plinth/modules/ttrss/manifest.py +++ b/plinth/modules/ttrss/manifest.py @@ -17,24 +17,25 @@ from django.utils.translation import ugettext_lazy as _ -from plinth.templatetags.plinth_extras import Mobile_OS, Store +from plinth.clients import store_url, validate -clients = [{ +_package_id = 'org.ttrssreader' + +clients = validate([{ 'name': _('TT-RSS Reader'), 'platforms': [{ 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.GOOGLE_PLAY.value, - 'url': 'https://play.google.com/store/apps/details?id=org' - '.ttrssreader', + 'os': 'android', + 'store_name': 'google-play', + 'url': store_url('google-play', _package_id), }, { 'type': 'store', - 'os': Mobile_OS.ANDROID.value, - 'store_name': Store.F_DROID.value, - 'url': 'https://f-droid.org/packages/org.ttrssreader/', + 'os': 'android', + 'store_name': 'f-droid', + 'url': store_url('f-droid', _package_id), }, { 'type': 'web', 'url': '/tt-rss' }] -}] +}])