Display audio controls, refactor site icon placement
Audio controls are now always shown by default (mostly found in searches that contain word pronunciation guides). Site icons were moved to the left side of the results.main
parent
f7513bab69
commit
c2873190c9
|
@ -172,6 +172,7 @@ class Filter:
|
||||||
|
|
||||||
for audio in [_ for _ in self.soup.find_all('audio') if 'src' in _.attrs]:
|
for audio in [_ for _ in self.soup.find_all('audio') if 'src' in _.attrs]:
|
||||||
self.update_element_src(audio, 'audio/mpeg')
|
self.update_element_src(audio, 'audio/mpeg')
|
||||||
|
audio['controls'] = ''
|
||||||
|
|
||||||
for link in self.soup.find_all('a', href=True):
|
for link in self.soup.find_all('a', href=True):
|
||||||
self.update_link(link)
|
self.update_link(link)
|
||||||
|
|
|
@ -17,7 +17,7 @@ from app.models.config import Config
|
||||||
from app.models.endpoint import Endpoint
|
from app.models.endpoint import Endpoint
|
||||||
from app.request import Request, TorError
|
from app.request import Request, TorError
|
||||||
from app.utils.bangs import resolve_bang
|
from app.utils.bangs import resolve_bang
|
||||||
from app.utils.misc import get_proxy_host_url
|
from app.utils.misc import empty_gif, placeholder_img, get_proxy_host_url
|
||||||
from app.filter import Filter
|
from app.filter import Filter
|
||||||
from app.utils.misc import read_config_bool, get_client_ip, get_request_url, \
|
from app.utils.misc import read_config_bool, get_client_ip, get_request_url, \
|
||||||
check_for_update
|
check_for_update
|
||||||
|
@ -470,8 +470,6 @@ def imgres():
|
||||||
@session_required
|
@session_required
|
||||||
@auth_required
|
@auth_required
|
||||||
def element():
|
def element():
|
||||||
empty_gif = base64.b64decode(
|
|
||||||
'R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==')
|
|
||||||
element_url = src_url = request.args.get('url')
|
element_url = src_url = request.args.get('url')
|
||||||
if element_url.startswith('gAAAAA'):
|
if element_url.startswith('gAAAAA'):
|
||||||
try:
|
try:
|
||||||
|
@ -493,8 +491,11 @@ def element():
|
||||||
response = g.user_request.send(base_url=src_url)
|
response = g.user_request.send(base_url=src_url)
|
||||||
|
|
||||||
# Display an empty gif if the requested element couldn't be retrieved
|
# Display an empty gif if the requested element couldn't be retrieved
|
||||||
if response.status_code != 200:
|
if response.status_code != 200 or len(response.content) == 0:
|
||||||
return send_file(io.BytesIO(empty_gif), mimetype='image/gif')
|
if 'favicon' in src_url:
|
||||||
|
return send_file(io.BytesIO(placeholder_img), mimetype='image/png')
|
||||||
|
else:
|
||||||
|
return send_file(io.BytesIO(empty_gif), mimetype='image/gif')
|
||||||
|
|
||||||
file_data = response.content
|
file_data = response.content
|
||||||
tmp_mem = io.BytesIO()
|
tmp_mem = io.BytesIO()
|
||||||
|
|
|
@ -59,8 +59,23 @@ details summary span {
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-favicon {
|
.site-favicon {
|
||||||
float: right;
|
float: left;
|
||||||
width: 25px;
|
width: 25px;
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sCuL3 {
|
||||||
|
padding-left: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#flex_text_audio_icon_chunk {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
audio {
|
||||||
|
display: block;
|
||||||
|
margin-right: auto;
|
||||||
|
padding-bottom: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 801px) {
|
@media (min-width: 801px) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import base64
|
||||||
from bs4 import BeautifulSoup as bsoup
|
from bs4 import BeautifulSoup as bsoup
|
||||||
from flask import Request
|
from flask import Request
|
||||||
import hashlib
|
import hashlib
|
||||||
|
@ -6,6 +7,19 @@ import re
|
||||||
from requests import exceptions, get
|
from requests import exceptions, get
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
empty_gif = base64.b64decode(
|
||||||
|
'R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==')
|
||||||
|
|
||||||
|
placeholder_img = base64.b64decode(
|
||||||
|
'iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAABF0lEQVRIS8XWPw9EMBQA8Eok' \
|
||||||
|
'JBKrMFqMBt//GzAYLTZ/VomExPDu6uLiaPteqVynBn0/75W2Vp7nEIYhe6p1XcespmmAd7Is' \
|
||||||
|
'M+4URcGiKPogvMMvmIS2eN9MOMKbKWgf54SYgI4vKkTuQKJKSJErkKzUSkQHUs0lilAg7GMh' \
|
||||||
|
'ISoIA/hYMiKCKIA2soeowCWEMkfHtUmrXLcyGYYBfN9HF8djiaglWzNZlgVs21YisoAUaEXG' \
|
||||||
|
'cQTP86QIFgi7vyLzPIPjOEIEC7ANQv/4aZrAdd0TUtc1i+MYnSsMWjPp+x6CIPgJVlUVS5KE' \
|
||||||
|
'DKig/+wnVzM4pnzaGeHd+ENlWbI0TbVLJBtw2uMfP63wc9d2kDCWxi5Q27bsBerSJ9afJbeL' \
|
||||||
|
'AAAAAElFTkSuQmCC'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def gen_file_hash(path: str, static_file: str) -> str:
|
def gen_file_hash(path: str, static_file: str) -> str:
|
||||||
file_contents = open(os.path.join(path, static_file), 'rb').read()
|
file_contents = open(os.path.join(path, static_file), 'rb').read()
|
||||||
|
|
Loading…
Reference in New Issue