forked from CGM_Public/pretix_original
Widget: Don't set CSP header on non-HTML resources
This commit is contained in:
@@ -105,6 +105,7 @@ def widget_css(request, **kwargs):
|
|||||||
et = html.fromstring(tpl.render({})).xpath('/html/head/link')[0].attrib['href'].replace(settings.STATIC_URL, '')
|
et = html.fromstring(tpl.render({})).xpath('/html/head/link')[0].attrib['href'].replace(settings.STATIC_URL, '')
|
||||||
f = finders.find(et)
|
f = finders.find(et)
|
||||||
resp = FileResponse(open(f, 'rb'), content_type='text/css')
|
resp = FileResponse(open(f, 'rb'), content_type='text/css')
|
||||||
|
resp._csp_ignore = True
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
|
||||||
@@ -196,6 +197,7 @@ def widget_js(request, lang, **kwargs):
|
|||||||
gs.settings.set('widget_checksum_{}'.format(lang), checksum)
|
gs.settings.set('widget_checksum_{}'.format(lang), checksum)
|
||||||
cache.set('widget_js_data_{}'.format(lang), data, 3600 * 4)
|
cache.set('widget_js_data_{}'.format(lang), data, 3600 * 4)
|
||||||
resp = HttpResponse(data, content_type='text/javascript')
|
resp = HttpResponse(data, content_type='text/javascript')
|
||||||
|
resp._csp_ignore = True
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
|
||||||
@@ -323,6 +325,7 @@ class WidgetAPIProductList(EventListMixin, View):
|
|||||||
self.post_process(data)
|
self.post_process(data)
|
||||||
resp = JsonResponse(data)
|
resp = JsonResponse(data)
|
||||||
resp['Access-Control-Allow-Origin'] = '*'
|
resp['Access-Control-Allow-Origin'] = '*'
|
||||||
|
resp._csp_ignore = True
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user