mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-27 00:09:50 -05:00
Add onionshare favicon to all HTML pages
This commit is contained in:
parent
0d40d7c3b2
commit
a7ab1d7e6e
@ -201,6 +201,7 @@ Section "install"
|
||||
File "${BINPATH}\share\html\index.html"
|
||||
|
||||
SetOutPath "$INSTDIR\share\images"
|
||||
File "${BINPATH}\share\images\favicon.ico"
|
||||
File "${BINPATH}\share\images\file_delete.png"
|
||||
File "${BINPATH}\share\images\logo.png"
|
||||
File "${BINPATH}\share\images\logo_transparent.png"
|
||||
@ -379,6 +380,7 @@ FunctionEnd
|
||||
Delete "$INSTDIR\share\html\404.html"
|
||||
Delete "$INSTDIR\share\html\denied.html"
|
||||
Delete "$INSTDIR\share\html\index.html"
|
||||
Delete "$INSTDIR\share\images\favicon.ico"
|
||||
Delete "$INSTDIR\share\images\file_delete.png"
|
||||
Delete "$INSTDIR\share\images\logo.png"
|
||||
Delete "$INSTDIR\share\images\logo_transparent.png"
|
||||
|
@ -26,6 +26,7 @@ import queue
|
||||
import socket
|
||||
import sys
|
||||
import tempfile
|
||||
import base64
|
||||
from distutils.version import LooseVersion as Version
|
||||
from urllib.request import urlopen
|
||||
|
||||
@ -125,6 +126,9 @@ def add_request(request_type, path, data=None):
|
||||
})
|
||||
|
||||
|
||||
# Load favicon.ico and base64 encode it, to pass into templates
|
||||
favicon_b64 = base64.b64encode(open(common.get_resource_path('images/favicon.ico'), 'rb').read()).decode()
|
||||
|
||||
slug = None
|
||||
|
||||
|
||||
@ -206,7 +210,10 @@ def index(slug_candidate):
|
||||
global stay_open, download_in_progress
|
||||
deny_download = not stay_open and download_in_progress
|
||||
if deny_download:
|
||||
r = make_response(render_template_string(open(common.get_resource_path('html/denied.html')).read()))
|
||||
r = make_response(render_template_string(
|
||||
open(common.get_resource_path('html/denied.html')).read(),
|
||||
favicon_b64=favicon_b64
|
||||
))
|
||||
for header, value in security_headers:
|
||||
r.headers.set(header, value)
|
||||
return r
|
||||
@ -215,6 +222,7 @@ def index(slug_candidate):
|
||||
|
||||
r = make_response(render_template_string(
|
||||
open(common.get_resource_path('html/index.html')).read(),
|
||||
favicon_b64=favicon_b64,
|
||||
slug=slug,
|
||||
file_info=file_info,
|
||||
filename=os.path.basename(zip_filename),
|
||||
@ -243,7 +251,10 @@ def download(slug_candidate):
|
||||
global stay_open, download_in_progress, done
|
||||
deny_download = not stay_open and download_in_progress
|
||||
if deny_download:
|
||||
r = make_response(render_template_string(open(common.get_resource_path('html/denied.html')).read()))
|
||||
r = make_response(render_template_string(
|
||||
open(common.get_resource_path('html/denied.html')).read(),
|
||||
favicon_b64=favicon_b64
|
||||
))
|
||||
for header,value in security_headers:
|
||||
r.headers.set(header, value)
|
||||
return r
|
||||
@ -355,7 +366,10 @@ def page_not_found(e):
|
||||
force_shutdown()
|
||||
print(strings._('error_rate_limit'))
|
||||
|
||||
r = make_response(render_template_string(open(common.get_resource_path('html/404.html')).read()), 404)
|
||||
r = make_response(render_template_string(
|
||||
open(common.get_resource_path('html/404.html')).read(),
|
||||
favicon_b64=favicon_b64
|
||||
), 404)
|
||||
for header, value in security_headers:
|
||||
r.headers.set(header, value)
|
||||
return r
|
||||
|
@ -2,6 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Error 404</title>
|
||||
<link href="data:image/x-icon;base64,{{favicon_b64}}" rel="icon" type="image/x-icon" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
background-color: #FFC4D5;
|
||||
|
@ -2,6 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>OnionShare</title>
|
||||
<link href="data:image/x-icon;base64,{{favicon_b64}}" rel="icon" type="image/x-icon" />
|
||||
<style>
|
||||
body {
|
||||
background-color: #222222;
|
||||
@ -15,4 +16,4 @@
|
||||
<body>
|
||||
<p>OnionShare download in progress</p>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
File diff suppressed because one or more lines are too long
BIN
share/images/favicon.ico
Normal file
BIN
share/images/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
Loading…
Reference in New Issue
Block a user