mirror of
https://github.com/onionshare/onionshare.git
synced 2025-08-03 11:56:06 -04:00
Add an error 401 handler, and make it start counting invalid password guesses instead of 404 errors for rate limiting
This commit is contained in:
parent
e0e7250244
commit
c39705f978
7 changed files with 56 additions and 28 deletions
|
@ -113,7 +113,7 @@ class ReceiveMode(Mode):
|
|||
"""
|
||||
# Reset web counters
|
||||
self.web.receive_mode.upload_count = 0
|
||||
self.web.error404_count = 0
|
||||
self.web.reset_invalid_slugs()
|
||||
|
||||
# Hide and reset the uploads if we have previously shared
|
||||
self.reset_info_counters()
|
||||
|
|
|
@ -147,7 +147,7 @@ class ShareMode(Mode):
|
|||
"""
|
||||
# Reset web counters
|
||||
self.web.share_mode.download_count = 0
|
||||
self.web.error404_count = 0
|
||||
self.web.reset_invalid_slugs()
|
||||
|
||||
# Hide and reset the downloads if we have previously shared
|
||||
self.reset_info_counters()
|
||||
|
|
|
@ -143,7 +143,7 @@ class WebsiteMode(Mode):
|
|||
"""
|
||||
# Reset web counters
|
||||
self.web.website_mode.visit_count = 0
|
||||
self.web.error404_count = 0
|
||||
self.web.reset_invalid_slugs()
|
||||
|
||||
# Hide and reset the downloads if we have previously shared
|
||||
self.reset_info_counters()
|
||||
|
|
|
@ -472,7 +472,10 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||
|
||||
if event["type"] == Web.REQUEST_OTHER:
|
||||
if event["path"] != '/favicon.ico' and event["path"] != "/{}/shutdown".format(mode.web.shutdown_slug):
|
||||
self.status_bar.showMessage('[#{0:d}] {1:s}: {2:s}'.format(mode.web.error404_count, strings._('other_page_loaded'), event["path"]))
|
||||
self.status_bar.showMessage('{0:s}: {1:s}'.format(strings._('other_page_loaded'), event["path"]))
|
||||
|
||||
if event["type"] == Web.REQUEST_INVALID_SLUG:
|
||||
self.status_bar.showMessage('[#{0:d}] {1:s}: {2:s}'.format(mode.web.invalid_slugs_count, strings._('invalid_slug_guess'), event["data"]))
|
||||
|
||||
mode.timer_callback()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue