diff --git a/app/__init__.py b/app/__init__.py index e4070d4..0110966 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -52,8 +52,17 @@ app.config['BANG_PATH'] = os.getenv( app.config['BANG_FILE'] = os.path.join( app.config['BANG_PATH'], 'bangs.json') + +# The alternative to Google Translate is treated a bit differently than other +# social media site alternatives, in that it is used for any translation +# related searches. +translate_url = os.getenv('WHOOGLE_ALT_TL', 'https://lingva.ml') +if not translate_url.startswith('http'): + translate_url = 'https://' + translate_url +app.config['TRANSLATE_URL'] = translate_url + app.config['CSP'] = 'default-src \'none\';' \ - 'frame-src lingva.ml;' \ + 'frame-src ' + translate_url + ';' \ 'manifest-src \'self\';' \ 'img-src \'self\' data:;' \ 'style-src \'self\' \'unsafe-inline\';' \ @@ -77,14 +86,6 @@ if not os.path.exists(app.config['BANG_PATH']): if not os.path.exists(app.config['BANG_FILE']): gen_bangs_json(app.config['BANG_FILE']) -# The alternative to Google Translate is treated a bit differently than other -# social media site alternatives, in that it is used for any translation -# related searches. -translate_url = os.getenv('WHOOGLE_ALT_TL', 'https://lingva.ml') -if not translate_url.startswith('http'): - translate_url = 'https://' + translate_url -app.config['TRANSLATE_URL'] = translate_url - Session(app) # Attempt to acquire tor identity, to determine if Tor config is available