Removed no-cache enforcement, minor styling/formatting improvements
parent
4324fcd8f8
commit
f86a44b637
|
@ -22,7 +22,7 @@ def gen_user_agent(is_mobile):
|
|||
|
||||
if is_mobile:
|
||||
return MOBILE_UA.format(mozilla, firefox)
|
||||
else:
|
||||
|
||||
return DESKTOP_UA.format(mozilla, linux, firefox)
|
||||
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
from app import app
|
||||
from app.models.config import Config
|
||||
from app.request import Request
|
||||
from app.utils.misc import generate_user_keys, valid_user_session
|
||||
from app.utils.routing_utils import *
|
||||
import argparse
|
||||
import base64
|
||||
from bs4 import BeautifulSoup
|
||||
from cryptography.fernet import Fernet
|
||||
from flask import g, jsonify, make_response, request, redirect, render_template, send_file, session
|
||||
from functools import wraps
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import pickle
|
||||
import urllib.parse as urlparse
|
||||
from requests import exceptions
|
||||
import uuid
|
||||
from functools import wraps
|
||||
|
||||
import waitress
|
||||
from flask import jsonify, make_response, request, redirect, render_template, send_file, session
|
||||
from requests import exceptions
|
||||
|
||||
from app import app
|
||||
from app.models.config import Config
|
||||
from app.request import Request
|
||||
from app.utils.misc import valid_user_session
|
||||
from app.utils.routing_utils import *
|
||||
|
||||
|
||||
def auth_required(f):
|
||||
|
@ -87,7 +87,6 @@ def after_request_func(response):
|
|||
for key in session_list:
|
||||
session.pop(key)
|
||||
|
||||
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
||||
return response
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from cryptography.fernet import Fernet
|
||||
from flask import current_app as app
|
||||
|
||||
SESSION_VALS = ['uuid', 'config', 'fernet_keys']
|
||||
REQUIRED_SESSION_VALUES = ['uuid', 'config', 'fernet_keys']
|
||||
|
||||
|
||||
def generate_user_keys(cookies_disabled=False) -> dict:
|
||||
|
@ -17,7 +17,7 @@ def generate_user_keys(cookies_disabled=False) -> dict:
|
|||
|
||||
def valid_user_session(session):
|
||||
# Generate secret key for user if unavailable
|
||||
for value in SESSION_VALS:
|
||||
for value in REQUIRED_SESSION_VALUES:
|
||||
if value not in session:
|
||||
return False
|
||||
|
||||
|
|
|
@ -32,7 +32,8 @@ class RoutingUtils:
|
|||
|
||||
def new_search_query(self) -> str:
|
||||
# Generate a new element key each time a new search is performed
|
||||
self.session['fernet_keys']['element_key'] = generate_user_keys(cookies_disabled=self.cookies_disabled)['element_key']
|
||||
self.session['fernet_keys']['element_key'] = generate_user_keys(
|
||||
cookies_disabled=self.cookies_disabled)['element_key']
|
||||
|
||||
q = self.request_params.get('q')
|
||||
|
||||
|
@ -46,7 +47,8 @@ class RoutingUtils:
|
|||
pass
|
||||
|
||||
# Reset text key
|
||||
self.session['fernet_keys']['text_key'] = generate_user_keys(cookies_disabled=self.cookies_disabled)['text_key']
|
||||
self.session['fernet_keys']['text_key'] = generate_user_keys(
|
||||
cookies_disabled=self.cookies_disabled)['text_key']
|
||||
|
||||
# Format depending on whether or not the query is a "feeling lucky" query
|
||||
self.feeling_lucky = q.startswith('! ')
|
||||
|
|
Loading…
Reference in New Issue