forked from 0x2620/pandora
- add update external data api
- add /url= redirect gateway
This commit is contained in:
parent
64e7a534a7
commit
d6e27be0cd
3 changed files with 29 additions and 8 deletions
|
@ -1,10 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response, redirect
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
from ox.django.shortcuts import json_response, render_to_json_response, get_object_or_404_json
|
from ox.django.shortcuts import json_response, render_to_json_response
|
||||||
from ox.django.decorators import login_required_json
|
from ox.django.decorators import login_required_json
|
||||||
|
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
|
@ -29,11 +29,6 @@ def embed(request):
|
||||||
return render_to_response('embed.html', context)
|
return render_to_response('embed.html', context)
|
||||||
|
|
||||||
|
|
||||||
def timeline(request):
|
|
||||||
context = RequestContext(request, {'settings': settings})
|
|
||||||
return render_to_response('timeline.html', context)
|
|
||||||
|
|
||||||
|
|
||||||
def getPage(request):
|
def getPage(request):
|
||||||
'''
|
'''
|
||||||
param data {
|
param data {
|
||||||
|
@ -87,3 +82,7 @@ def editPage(request):
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(getPage)
|
actions.register(getPage)
|
||||||
|
|
||||||
|
def redirect_url(request, url):
|
||||||
|
if request.META['QUERY_STRING']:
|
||||||
|
url += "?" + request.META['QUERY_STRING']
|
||||||
|
return redirect(url, permanent=True)
|
||||||
|
|
|
@ -493,6 +493,28 @@ def setPoster(request): #parse path and return info
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(setPoster, cache=False)
|
actions.register(setPoster, cache=False)
|
||||||
|
|
||||||
|
def updateExternalData(request):
|
||||||
|
'''
|
||||||
|
param data {
|
||||||
|
id: itemId,
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
status: {'code': int, 'text': string},
|
||||||
|
data: {
|
||||||
|
poster: {url,width,height}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
data = json.loads(request.POST['data'])
|
||||||
|
item = get_object_or_404_json(models.Item, itemId=data['id'])
|
||||||
|
response = json_response()
|
||||||
|
if item.editable(request.user):
|
||||||
|
item.update_external()
|
||||||
|
else:
|
||||||
|
response = json_response(status=403, text='permission denied')
|
||||||
|
return render_to_json_response(response)
|
||||||
|
actions.register(updateExternalData, cache=False)
|
||||||
|
|
||||||
def lookup(request):
|
def lookup(request):
|
||||||
'''
|
'''
|
||||||
param data {
|
param data {
|
||||||
|
|
|
@ -24,7 +24,7 @@ urlpatterns = patterns('',
|
||||||
(r'^admin/', include(admin.site.urls)),
|
(r'^admin/', include(admin.site.urls)),
|
||||||
(r'^ajax_filtered_fields/', include('ajax_filtered_fields.urls')),
|
(r'^ajax_filtered_fields/', include('ajax_filtered_fields.urls')),
|
||||||
(r'^api/upload/$', 'archive.views.firefogg_upload'),
|
(r'^api/upload/$', 'archive.views.firefogg_upload'),
|
||||||
(r'^timeline$', 'app.views.timeline'),
|
(r'^url=(?P<url>.*)$', 'app.views.redirect_url'),
|
||||||
(r'^file/(?P<oshash>.*)$', 'archive.views.lookup_file'),
|
(r'^file/(?P<oshash>.*)$', 'archive.views.lookup_file'),
|
||||||
(r'^api/$', include('api.urls')),
|
(r'^api/$', include('api.urls')),
|
||||||
(r'', include('item.urls')),
|
(r'', include('item.urls')),
|
||||||
|
|
Loading…
Reference in a new issue