From e9cd4598d0481211511b9a501e410100da71fcc0 Mon Sep 17 00:00:00 2001 From: Kirdow Date: Sat, 30 Jan 2021 02:09:43 +0100 Subject: [PATCH 1/2] Allow cross origin access for RSS Allows browser-based code to access the RSS feed without browser interrupting the connection. --- nyaa/views/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nyaa/views/main.py b/nyaa/views/main.py index 2243578a..49028542 100644 --- a/nyaa/views/main.py +++ b/nyaa/views/main.py @@ -218,4 +218,6 @@ def render_rss(label, query, use_elastic, magnet_links=False): response.headers['Content-Type'] = 'application/xml' # Cache for an hour response.headers['Cache-Control'] = 'max-age={}'.format(1 * 5 * 60) + # Allow cross origin access + response.headers['Access-Control-Allow-Origin'] = '*' return response From 146e6298959a994ade9ded7ccde16df2d6389ba4 Mon Sep 17 00:00:00 2001 From: Cas <6506529+ThaUnknown@users.noreply.github.com> Date: Tue, 12 Oct 2021 21:04:11 +0200 Subject: [PATCH 2/2] Allow cross origin access for .torrent files --- nyaa/views/torrents.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nyaa/views/torrents.py b/nyaa/views/torrents.py index 743c7913..48a8ef50 100644 --- a/nyaa/views/torrents.py +++ b/nyaa/views/torrents.py @@ -332,6 +332,8 @@ def download_torrent(torrent_id): resp.headers['Content-Type'] = 'application/x-bittorrent' resp.headers['Content-Disposition'] = disposition resp.headers['Content-Length'] = torrent_file_size + # Allow cross origin access + resp.headers['Access-Control-Allow-Origin'] = '*' return resp