mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-04 08:13:38 +00:00
shortcuts: Fix urls for ikiwiki shortcuts
The shortcuts api is currently showing all ikiwiki urls as /ikiwiki and not like /ikiwiki/blog. This takes users on the Android app to a directory view where they have to select the name of the blog or wiki. With this patch, users will be directly taken to the appropriate blog or wiki. Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
18912f5373
commit
b9019017f0
@ -18,6 +18,7 @@
|
||||
FreedomBox app for api for android app.
|
||||
"""
|
||||
|
||||
import copy
|
||||
import json
|
||||
|
||||
from django.core.serializers.json import DjangoJSONEncoder
|
||||
@ -55,13 +56,17 @@ def shortcuts(request, **kwargs):
|
||||
def _get_shortcut_data(module_name, shortcut):
|
||||
"""Return detailed information about a shortcut."""
|
||||
module = module_loader.loaded_modules[module_name]
|
||||
return {
|
||||
shortcut_data = {
|
||||
'name': shortcut['name'],
|
||||
'short_description': shortcut['short_description'],
|
||||
'description': shortcut['details'],
|
||||
'icon_url': _get_icon_url(shortcut['icon']),
|
||||
'clients': getattr(module, 'clients', None)
|
||||
'clients': copy.deepcopy(getattr(module, 'clients', None))
|
||||
}
|
||||
if module_name == 'ikiwiki':
|
||||
shortcut_data['clients'][0]['platforms'][0]['url'] += '/{}'.format(
|
||||
shortcut['name'])
|
||||
return shortcut_data
|
||||
|
||||
|
||||
def _get_icon_url(icon_name):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user