mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-28 00:39:37 -05:00
Ensure we increment and return the history_id when throwing error404() in website mode. Add a route for /favicon.ico unless we are in website mode (website might have its own favicon)
This commit is contained in:
parent
b1aa36e805
commit
86a2b35d9d
@ -10,7 +10,7 @@ from distutils.version import LooseVersion as Version
|
|||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
from flask import Flask, request, render_template, abort, make_response, __version__ as flask_version
|
from flask import Flask, request, render_template, abort, make_response, send_file, __version__ as flask_version
|
||||||
from flask_httpauth import HTTPBasicAuth
|
from flask_httpauth import HTTPBasicAuth
|
||||||
|
|
||||||
from .. import strings
|
from .. import strings
|
||||||
@ -178,6 +178,11 @@ class Web:
|
|||||||
return ""
|
return ""
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
if self.mode != 'website':
|
||||||
|
@self.app.route("/favicon.ico")
|
||||||
|
def favicon():
|
||||||
|
return send_file('{}/img/favicon.ico'.format(self.common.get_resource_path('static')))
|
||||||
|
|
||||||
def error401(self):
|
def error401(self):
|
||||||
auth = request.authorization
|
auth = request.authorization
|
||||||
if auth:
|
if auth:
|
||||||
|
@ -70,7 +70,9 @@ class WebsiteModeWeb(SendBaseModeWeb):
|
|||||||
|
|
||||||
# If it's not a directory or file, throw a 404
|
# If it's not a directory or file, throw a 404
|
||||||
else:
|
else:
|
||||||
return self.web.error404()
|
history_id = self.cur_history_id
|
||||||
|
self.cur_history_id += 1
|
||||||
|
return self.web.error404(history_id)
|
||||||
else:
|
else:
|
||||||
# Special case loading /
|
# Special case loading /
|
||||||
|
|
||||||
@ -87,4 +89,6 @@ class WebsiteModeWeb(SendBaseModeWeb):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
# If the path isn't found, throw a 404
|
# If the path isn't found, throw a 404
|
||||||
return self.web.error404()
|
history_id = self.cur_history_id
|
||||||
|
self.cur_history_id += 1
|
||||||
|
return self.web.error404(history_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user