Allow user specified lingva instances through csp frame-src
This commit is contained in:
parent
955fce8ec8
commit
ae4fbeca91
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user