From 2c48c8de2e0e3e16f0e468a546b4b9d2e80b744c Mon Sep 17 00:00:00 2001 From: Safihre Date: Wed, 20 Apr 2016 17:15:00 +0200 Subject: [PATCH] Force MIME types for CSS and JS files Caused problems on Windows if external programs overwriten it in registery. See: http://forums.sabnzbd.org/viewtopic.php?f=2&t=20490 And: https://www.reddit.com/r/usenet/comments/4fkmcx/my_sab_interface_is_text_only/ --- SABnzbd.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SABnzbd.py b/SABnzbd.py index f564065..e39b065 100755 --- a/SABnzbd.py +++ b/SABnzbd.py @@ -1475,9 +1475,10 @@ def main(): 'error_page.404': sabnzbd.panic.error_page_404 }) - static = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(web_dir, 'static')} - staticcfg = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(web_dirc, 'staticcfg')} - wizard_static = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(wizard_dir, 'static')} + forced_mime_types = {'css': 'text/css', 'js': 'application/javascript'} + static = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(web_dir, 'static'), 'tools.staticdir.content_types': forced_mime_types} + staticcfg = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(web_dirc, 'staticcfg'), 'tools.staticdir.content_types': forced_mime_types} + wizard_static = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(wizard_dir, 'static'), 'tools.staticdir.content_types': forced_mime_types} appconfig = {'/sabnzbd/api': {'tools.basic_auth.on': False}, '/api': {'tools.basic_auth.on': False}, @@ -1496,7 +1497,7 @@ def main(): } if web_dir2: - static2 = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(web_dir2, 'static')} + static2 = {'tools.staticdir.on': True, 'tools.staticdir.dir': os.path.join(web_dir2, 'static'), 'tools.staticdir.content_types': forced_mime_types} appconfig['/sabnzbd/m/api'] = {'tools.basic_auth.on': False} appconfig['/sabnzbd/m/rss'] = {'tools.basic_auth.on': False} appconfig['/sabnzbd/m/shutdown'] = {'streamResponse': True}