import json
+@cache(hours=4)
+def listinfo(request):
+ if not settings.PUBLIC_ARCHIVES:
+ return HttpResponseForbidden('No API access on private archives for now')
+
+ if not request.META['REMOTE_ADDR'] in settings.API_CLIENTS:
+ return HttpResponseForbidden('Invalid host')
+
+ resp = HttpResponse(content_type='application/json')
+ json.dump([{
+ 'name': l.listname,
+ 'shortdesc': l.shortdesc,
+ 'description': l.description,
+ 'active': l.active,
+ 'group': l.group.groupname,
+ } for l in List.objects.select_related('group').all()], resp)
+
+ return resp
+
@cache(hours=4)
def latest(request, listname):
if not settings.PUBLIC_ARCHIVES:
# API calls
url(r'^list/([\w-]+)/latest.json$', archives.mailarchives.api.latest),
url(r'^message-id.json/(.+)$', archives.mailarchives.api.thread),
+ url(r'^listinfo/$', archives.mailarchives.api.listinfo),
# url(r'^thread/(.+)/subscribe/$', archives.mailarchives.api.thread_subscribe),
# Legacy forwarding from old archives site