mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
Add client information for Matrix Synapse and Syncthing
- Add logos for desktop operating systems Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
823e06271f
commit
d403782b77
3
LICENSES
3
LICENSES
@ -65,3 +65,6 @@ otherwise.
|
||||
- static/themes/default/icons/ttrss.png :: [[https://tt-rss.org/gitlab/fox/tt-rss][GPL]]
|
||||
- static/themes/default/img/f-droid.png :: [[https://commons.wikimedia.org/wiki/File%3AGet_it_on_F-Droid_(material_design).svg][GPLv3]]
|
||||
- static/themes/default/img/google-play.png :: [[https://upload.wikimedia.org/wikipedia/commons/c/cd/Get_it_on_Google_play.svg][Public Domain]]
|
||||
- static/themes/default/img/debian.png :: [[https://commons.wikimedia.org/wiki/File:Debian_logo-black.png][GPL3+/CC-BY-SA]]
|
||||
- static/themes/default/img/apple.png :: [[https://thenounproject.com/icon/1203053/download/color/000000/png][CC BY 3.0 US]]
|
||||
- static/themes/default/img/windows.png :: [[https://thenounproject.com/icon/1206946/download/color/000000/png][CC BY 3.0 US]]
|
||||
|
||||
1
data/etc/plinth/modules-enabled/api
Normal file
1
data/etc/plinth/modules-enabled/api
Normal file
@ -0,0 +1 @@
|
||||
plinth.modules.api
|
||||
@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
"""
|
||||
URLs for the plinth api for android app.
|
||||
"""
|
||||
@ -22,9 +21,9 @@ URLs for the plinth api for android app.
|
||||
from django.conf.urls import url
|
||||
from stronghold.decorators import public
|
||||
|
||||
from plinth.modules.api.views import get_apps, get_access_info
|
||||
from plinth.modules.api.views import get_access_info, get_services
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^api/(?P<version>[0-9]+)/services/?$', public(get_apps)),
|
||||
url(r'^api/(?P<version>[0-9]+)/access-info/?$', public(get_access_info))
|
||||
]
|
||||
url(r'^api/(?P<version>[0-9]+)/services/?$', public(get_services)),
|
||||
url(r'^api/(?P<version>[0-9]+)/access-info/?$', public(get_access_info)),
|
||||
]
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
"""
|
||||
Plinth module for api for android app.
|
||||
"""
|
||||
@ -28,32 +27,42 @@ from plinth import module_loader
|
||||
import json
|
||||
|
||||
|
||||
def get_apps(request, **kwargs):
|
||||
shortcuts = frontpage.get_shortcuts()
|
||||
|
||||
response = {'services': list(map(get_app_data, shortcuts)) }
|
||||
return HttpResponse(json.dumps(response, cls=DjangoJSONEncoder),
|
||||
content_type="application/json")
|
||||
|
||||
|
||||
def get_app_data(item):
|
||||
item_id = item['id'].split('_')[0]
|
||||
shortcut_module = module_loader.loaded_modules[item_id]
|
||||
|
||||
def get_icon_url(icon):
|
||||
return 'static/theme/icons/{}.svg'.format(icon) if icon else None
|
||||
|
||||
return {key: value for key, value in dict(name=shortcut_module.name,
|
||||
short_description=getattr(shortcut_module,
|
||||
'short_description', None),
|
||||
icon_url=get_icon_url(getattr(shortcut_module, 'icon', None)),
|
||||
description=getattr(shortcut_module, 'description', None),
|
||||
usage=getattr(shortcut_module, 'usage', None),
|
||||
manual_url=getattr(shortcut_module, 'manual_url', None),
|
||||
clients=getattr(shortcut_module, 'clients', None)).items() if value }
|
||||
|
||||
|
||||
def get_access_info(request, **kwargs):
|
||||
response = {domain_type: get_domain(domain_type) for domain_type in
|
||||
get_domain_types()}
|
||||
response = {
|
||||
domain_type: get_domain(domain_type)
|
||||
for domain_type in get_domain_types()
|
||||
}
|
||||
return HttpResponse(json.dumps(response), content_type="application/json")
|
||||
|
||||
|
||||
def get_services(request, **kwargs):
|
||||
services = [shortcut['id'].split('_')[0]
|
||||
for shortcut in frontpage.get_shortcuts()]
|
||||
response = {'services': list(map(_get_service_data, services))}
|
||||
return HttpResponse(
|
||||
json.dumps(response, cls=DjangoJSONEncoder),
|
||||
content_type="application/json")
|
||||
|
||||
|
||||
def _get_service_data(service):
|
||||
module = module_loader.loaded_modules[service]
|
||||
|
||||
def _getattr(attr, not_found=None):
|
||||
"""A closure to get the enclosed module's attributes"""
|
||||
return getattr(module, attr, not_found)
|
||||
|
||||
return {
|
||||
key: value
|
||||
for key, value in dict(
|
||||
name=module.name,
|
||||
short_description=_getattr('short_description'),
|
||||
icon_url=_get_icon_url(_getattr('icon')),
|
||||
description=_getattr('description'),
|
||||
usage=_getattr('usage'),
|
||||
manual_url=_getattr('manual_url'),
|
||||
clients=_getattr('clients')).items()
|
||||
}
|
||||
|
||||
|
||||
def _get_icon_url(icon):
|
||||
return 'static/theme/icons/{}.svg'.format(icon) if icon else None
|
||||
|
||||
@ -30,7 +30,6 @@ from plinth import action_utils
|
||||
from plinth import actions
|
||||
from plinth import frontpage
|
||||
from plinth import service as service_module
|
||||
from plinth.client import desktop_client, web_client, mobile_client
|
||||
from plinth.menu import main_menu
|
||||
from .manifest import clients
|
||||
|
||||
@ -59,20 +58,6 @@ description = [
|
||||
'client is recommended.')
|
||||
]
|
||||
|
||||
web_clients = [web_client(name='Riot', url='https://riot.im/app/#/home')]
|
||||
|
||||
desktop_clients = [desktop_client(name='Riot',
|
||||
url='https://riot.im/desktop.html'),
|
||||
desktop_client(name='WeeChat CLI',
|
||||
url='https://weechat.org/')]
|
||||
|
||||
mobile_clients = [mobile_client(name='Riot',
|
||||
fully_qualified_name='im.vector.alpha',
|
||||
play_store_url='https://play.google.com/store/apps/'
|
||||
'details?id=im.vector.alpha',
|
||||
fdroid_url='https://f-droid.org/packages/'
|
||||
'im.vector.alpha/')]
|
||||
|
||||
service = None
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -24,7 +24,7 @@ clients = [
|
||||
{
|
||||
'type': 'store',
|
||||
'os': 'Android',
|
||||
'store_type': 'google_play_store',
|
||||
'store_name': 'google_play_store',
|
||||
'fully_qualified_name': 'im.vector.alpha',
|
||||
'url': 'https://play.google.com/store/apps/details?id=im'
|
||||
'.vector.alpha '
|
||||
@ -33,7 +33,7 @@ clients = [
|
||||
'type': 'store',
|
||||
'os': 'Android',
|
||||
'os_version': '>=6.0',
|
||||
'store_type': 'fdroid_store',
|
||||
'store_name': 'fdroid_store',
|
||||
'fully_qualified_name': 'im.vector.alpha',
|
||||
'url': 'https://f-droid.org/packages/im.vector.alpha/'
|
||||
},
|
||||
@ -41,30 +41,21 @@ clients = [
|
||||
'type': 'web',
|
||||
'url': 'https://riot.im/app/#/home'
|
||||
},
|
||||
{
|
||||
'type': 'download',
|
||||
'os': 'Debian',
|
||||
'url': 'https://riot.im/desktop.html'
|
||||
},
|
||||
{
|
||||
'type': 'download',
|
||||
'os': 'macOS',
|
||||
'url': 'https://riot.im/download/desktop/install/macos'
|
||||
'/Riot-0.12.4.dmg'
|
||||
'url': 'https://riot.im/desktop.html'
|
||||
},
|
||||
{
|
||||
'type': 'download',
|
||||
'os': 'Windows(32 bit)',
|
||||
'os': 'Windows',
|
||||
'os_version': '>=7',
|
||||
'url': 'https://riot.im/download/desktop/install/win32/ia32/'
|
||||
'Riot%20Setup%200.12.4-ia32.exe'
|
||||
'url': 'https://riot.im/desktop.html'
|
||||
},
|
||||
{
|
||||
'type': 'download',
|
||||
'os': 'Windows(64 bit)',
|
||||
'os_version': '>=7',
|
||||
'url': 'https://riot.im/download/desktop/install/win32/x64/Riot'
|
||||
'%20Setup%200.12.4.exe'
|
||||
},
|
||||
{
|
||||
'type': 'download',
|
||||
'os': 'Debian/Ubuntu',
|
||||
'url': 'https://riot.im/packages/debian/'
|
||||
}
|
||||
]
|
||||
}]
|
||||
|
||||
@ -28,7 +28,6 @@ from plinth import frontpage
|
||||
from plinth import service as service_module
|
||||
from plinth.menu import main_menu
|
||||
from plinth.utils import format_lazy
|
||||
from plinth.client import desktop_client, mobile_client, web_client
|
||||
from .manifest import clients
|
||||
|
||||
|
||||
@ -62,17 +61,6 @@ description = [
|
||||
|
||||
clients = clients
|
||||
|
||||
web_clients = [web_client(name='Syncthing', url='/syncthing')]
|
||||
|
||||
desktop_clients = [desktop_client(name='Syncthing',
|
||||
url='https://syncthing.net/')]
|
||||
|
||||
mobile_clients = [mobile_client(
|
||||
name='Syncthing', fully_qualified_name='com.nutomic.syncthingandroid',
|
||||
fdroid_url='https://f-droid.org/packages/com.nutomic.syncthingandroid/',
|
||||
play_store_url='https://play.google.com/store/apps/details?id=com.nutomic'
|
||||
'.syncthingandroid')]
|
||||
|
||||
service = None
|
||||
|
||||
|
||||
|
||||
@ -21,31 +21,25 @@ clients = [
|
||||
{
|
||||
'name': _('Syncthing'),
|
||||
'platforms': [
|
||||
{
|
||||
'type': 'apt',
|
||||
'os': 'Debian/Ubuntu',
|
||||
'usage': _('For more usage information refer to <a '
|
||||
'href="https://apt.syncthing.net/>Syncthing</a>'),
|
||||
'package_name': 'syncthing'
|
||||
},
|
||||
{
|
||||
'type': 'download',
|
||||
'os': 'Windows(64-bit)',
|
||||
'url': 'https://github.com/syncthing/syncthing/releases'
|
||||
'/download/v0.14.38/syncthing-windows-amd64-v0.14.38'
|
||||
'.zip '
|
||||
'os': 'Debian',
|
||||
'url': 'https://apt.syncthing.net/',
|
||||
},
|
||||
{
|
||||
'type': 'download',
|
||||
'os': 'macOS',
|
||||
'url': 'https://github.com/syncthing/syncthing/releases'
|
||||
'/download/v0.14.38/syncthing-macosx-amd64-v0.14.38'
|
||||
'.tar.gz '
|
||||
},
|
||||
{
|
||||
'type': 'download',
|
||||
'os': 'Windows',
|
||||
'url': 'https://github.com/syncthing/syncthing/releases'
|
||||
},
|
||||
{
|
||||
'type': 'store',
|
||||
'os': 'Android',
|
||||
'store_type': 'google_play_store',
|
||||
'store_name': 'google_play_store',
|
||||
'fully_qualified_name': 'com.nutomic.syncthingandroid',
|
||||
'url': 'https://play.google.com/store/apps/details?id=com'
|
||||
'.nutomic.syncthingandroid '
|
||||
|
||||
@ -23,9 +23,15 @@ import json
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from plinth import service as service_module
|
||||
<<<<<<< HEAD
|
||||
from plinth import action_utils, actions, frontpage
|
||||
from plinth.menu import main_menu
|
||||
from plinth.modules.users import add_group
|
||||
=======
|
||||
from plinth.client import web_client
|
||||
from plinth.menu import main_menu
|
||||
from .manifest import clients
|
||||
>>>>>>> Add client information for Matrix Synapse and Syncthing
|
||||
|
||||
from .manifest import clients
|
||||
|
||||
@ -48,6 +54,11 @@ description = [
|
||||
|
||||
clients = clients
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
web_clients = [web_client(name='Transmission', url='/transmission')]
|
||||
|
||||
>>>>>>> Add client information for Matrix Synapse and Syncthing
|
||||
reserved_usernames = ['debian-transmission']
|
||||
|
||||
service = None
|
||||
|
||||
@ -19,59 +19,80 @@
|
||||
|
||||
{% load i18n %}
|
||||
|
||||
{% if module.web_clients %}
|
||||
{% if module.clients %}
|
||||
<div class="clients-info">
|
||||
<p class="heading">{% trans "Web Clients" %}:
|
||||
<ul>
|
||||
{% for client in module.web_clients %}
|
||||
<li>
|
||||
<span><a href="{{ client.url }}">{{ client.name}}</a></span>
|
||||
</li>
|
||||
{% for client in module.clients %}
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'web' %}
|
||||
<li>
|
||||
<span><a href="{{ platform.relative_url }}">{{ client.name}}</a></span>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if module.desktop_clients %}
|
||||
<div class="clients-info">
|
||||
{% load static %}
|
||||
<p class="heading">{% trans "Desktop Clients" %}:
|
||||
<ul>
|
||||
{% for client in module.desktop_clients %}
|
||||
<li>
|
||||
{% for client in module.clients %}
|
||||
<li class="col-md-12 col-xs-12">
|
||||
<span>
|
||||
<a href="{{ client.url }}">{{ client.name }}</a>
|
||||
{{ client.name }}
|
||||
</span>
|
||||
</li>
|
||||
<div class ="row">
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'download' %}
|
||||
<div class="col-md-1 col-xs-2">
|
||||
<a href="{{ platform.url }}">
|
||||
{% if platform.os == 'Windows' %}
|
||||
<img class="os-icon" src="{% static 'theme/img/windows.png' %}" />
|
||||
{% elif platform.os == 'macOS' %}
|
||||
<img class="os-icon" src="{% static 'theme/img/apple.png' %}" />
|
||||
{% elif platform.os == 'Debian' %}
|
||||
<img class="os-icon" src="{% static 'theme/img/debian.png' %}" />
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if module.mobile_clients %}
|
||||
<div class="clients-info">
|
||||
{% load static %}
|
||||
<p class="heading">{% trans "Mobile Clients" %}:</p>
|
||||
<ul>
|
||||
{% for client in module.mobile_clients %}
|
||||
<li class="col-md-12 col-xs-12"><span>{{ client.name }}</span></li>
|
||||
<div class="row">
|
||||
{% if client.fdroid_url %}
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<a href="{{ client.fdroid_url }}">
|
||||
<img class="store-icon" src="{% static 'theme/img/f-Droid.png' %}"/>
|
||||
</a>
|
||||
{% for client in module.clients %}
|
||||
<li class="col-md-12 col-xs-12"><span>{{ client.name }}</span></li>
|
||||
<div class="row">
|
||||
{% for platform in client.platforms %}
|
||||
{% if platform.type == 'store' and platform.os == 'Android' %}
|
||||
{% if platform.store_name == 'fdroid_store' %}
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<a href="{{ platform.url }}">
|
||||
<img class="store-icon" src="{% static 'theme/img/f-droid.png' %}"/>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if platform.store_name == 'google_play_store' %}
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<a href="{{ platform.url }}">
|
||||
<img class="store-icon"
|
||||
src="{% static 'theme/img/google-play.png' %}"/>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if client.play_store_url %}
|
||||
<div class="col-md-2 col-xs-4">
|
||||
<a href="{{ client.play_store_url }}">
|
||||
<img class="store-icon"
|
||||
src="{% static 'theme/img/google-play.png' %}"/>
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@ -136,9 +136,15 @@ footer license-info p{
|
||||
}
|
||||
|
||||
.store-icon {
|
||||
display:block;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.os-icon {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.shortcut-label {
|
||||
|
||||
BIN
static/themes/default/img/apple.png
Normal file
BIN
static/themes/default/img/apple.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
BIN
static/themes/default/img/debian.png
Normal file
BIN
static/themes/default/img/debian.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
BIN
static/themes/default/img/windows.png
Normal file
BIN
static/themes/default/img/windows.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.3 KiB |
Loading…
x
Reference in New Issue
Block a user