- Updated dark theme (#121) - Dark theme is no longer the previous high contrast "white on black" color scheme - New configuration settings - Split interface and result language config (#89) - Added option for using privacy respecting result alternatives (#106) - `youtube.com` -> `invidiou.site` - `twitter.com` -> `nitter.net` - `instagram.com` -> `bibliogram.art` - Improved search suggestion arrow key navigation behavior (#115) - Added repl.it deployment (#114) - Improved ad filtering for non-English results (f7380ae15d
) - Split interface and result language config (#89) - New config option: privacy respecting result alternatives (#106) - Updated search suggestion behavior (#115) - Minor project improvements and refactoring: - Added footer to results UI - Updated opensearch template - Various bug fixes, including: - Fixed pipx run command (#118) - Fixed browser autocomplete (#128) - Fixed missing autofocus on search field in Firefox (dfb1e81fa1
)
25 lines
611 B
Python
25 lines
611 B
Python
from cryptography.fernet import Fernet
|
|
from flask import current_app as app
|
|
|
|
REQUIRED_SESSION_VALUES = ['uuid', 'config', 'fernet_keys']
|
|
|
|
|
|
def generate_user_keys(cookies_disabled=False) -> dict:
|
|
if cookies_disabled:
|
|
return app.default_key_set
|
|
|
|
# Generate/regenerate unique key per user
|
|
return {
|
|
'element_key': Fernet.generate_key(),
|
|
'text_key': Fernet.generate_key()
|
|
}
|
|
|
|
|
|
def valid_user_session(session):
|
|
# Generate secret key for user if unavailable
|
|
for value in REQUIRED_SESSION_VALUES:
|
|
if value not in session:
|
|
return False
|
|
|
|
return True
|