mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-14 05:31:25 -05:00
Add onionshare favicon to all HTML pages
This commit is contained in:
parent
62a3b7d93c
commit
094041a4b6
@ -201,6 +201,7 @@ Section "install"
|
|||||||
File "${BINPATH}\share\html\index.html"
|
File "${BINPATH}\share\html\index.html"
|
||||||
|
|
||||||
SetOutPath "$INSTDIR\share\images"
|
SetOutPath "$INSTDIR\share\images"
|
||||||
|
File "${BINPATH}\share\images\favicon.ico"
|
||||||
File "${BINPATH}\share\images\file_delete.png"
|
File "${BINPATH}\share\images\file_delete.png"
|
||||||
File "${BINPATH}\share\images\logo.png"
|
File "${BINPATH}\share\images\logo.png"
|
||||||
File "${BINPATH}\share\images\logo_transparent.png"
|
File "${BINPATH}\share\images\logo_transparent.png"
|
||||||
@ -379,6 +380,7 @@ FunctionEnd
|
|||||||
Delete "$INSTDIR\share\html\404.html"
|
Delete "$INSTDIR\share\html\404.html"
|
||||||
Delete "$INSTDIR\share\html\denied.html"
|
Delete "$INSTDIR\share\html\denied.html"
|
||||||
Delete "$INSTDIR\share\html\index.html"
|
Delete "$INSTDIR\share\html\index.html"
|
||||||
|
Delete "$INSTDIR\share\images\favicon.ico"
|
||||||
Delete "$INSTDIR\share\images\file_delete.png"
|
Delete "$INSTDIR\share\images\file_delete.png"
|
||||||
Delete "$INSTDIR\share\images\logo.png"
|
Delete "$INSTDIR\share\images\logo.png"
|
||||||
Delete "$INSTDIR\share\images\logo_transparent.png"
|
Delete "$INSTDIR\share\images\logo_transparent.png"
|
||||||
|
@ -26,6 +26,7 @@ import queue
|
|||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import base64
|
||||||
from distutils.version import LooseVersion as Version
|
from distutils.version import LooseVersion as Version
|
||||||
from urllib.request import urlopen
|
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
|
slug = None
|
||||||
|
|
||||||
|
|
||||||
@ -206,7 +210,10 @@ def index(slug_candidate):
|
|||||||
global stay_open, download_in_progress
|
global stay_open, download_in_progress
|
||||||
deny_download = not stay_open and download_in_progress
|
deny_download = not stay_open and download_in_progress
|
||||||
if deny_download:
|
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:
|
for header, value in security_headers:
|
||||||
r.headers.set(header, value)
|
r.headers.set(header, value)
|
||||||
return r
|
return r
|
||||||
@ -215,6 +222,7 @@ def index(slug_candidate):
|
|||||||
|
|
||||||
r = make_response(render_template_string(
|
r = make_response(render_template_string(
|
||||||
open(common.get_resource_path('html/index.html')).read(),
|
open(common.get_resource_path('html/index.html')).read(),
|
||||||
|
favicon_b64=favicon_b64,
|
||||||
slug=slug,
|
slug=slug,
|
||||||
file_info=file_info,
|
file_info=file_info,
|
||||||
filename=os.path.basename(zip_filename),
|
filename=os.path.basename(zip_filename),
|
||||||
@ -243,7 +251,10 @@ def download(slug_candidate):
|
|||||||
global stay_open, download_in_progress, done
|
global stay_open, download_in_progress, done
|
||||||
deny_download = not stay_open and download_in_progress
|
deny_download = not stay_open and download_in_progress
|
||||||
if deny_download:
|
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:
|
for header,value in security_headers:
|
||||||
r.headers.set(header, value)
|
r.headers.set(header, value)
|
||||||
return r
|
return r
|
||||||
@ -355,7 +366,10 @@ def page_not_found(e):
|
|||||||
force_shutdown()
|
force_shutdown()
|
||||||
print(strings._('error_rate_limit'))
|
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:
|
for header, value in security_headers:
|
||||||
r.headers.set(header, value)
|
r.headers.set(header, value)
|
||||||
return r
|
return r
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Error 404</title>
|
<title>Error 404</title>
|
||||||
|
<link href="data:image/x-icon;base64,{{favicon_b64}}" rel="icon" type="image/x-icon" />
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
background-color: #FFC4D5;
|
background-color: #FFC4D5;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>OnionShare</title>
|
<title>OnionShare</title>
|
||||||
|
<link href="data:image/x-icon;base64,{{favicon_b64}}" rel="icon" type="image/x-icon" />
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: #222222;
|
background-color: #222222;
|
||||||
|
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…
x
Reference in New Issue
Block a user