mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Move the 'supports_file_requests' attribute into the actual modes rather than the Web class
This commit is contained in:
parent
3394571fad
commit
d4d6eea500
@ -39,6 +39,12 @@ class ChatModeWeb:
|
||||
# This tracks the history id
|
||||
self.cur_history_id = 0
|
||||
|
||||
# Whether or not we can send REQUEST_INDIVIDUAL_FILE_STARTED
|
||||
# and maybe other events when requests come in to this mode
|
||||
# Chat mode has no concept of individual file requests that
|
||||
# turn into history widgets in the GUI, so set it to False
|
||||
self.supports_file_requests = False
|
||||
|
||||
self.define_routes()
|
||||
|
||||
def define_routes(self):
|
||||
|
@ -64,6 +64,10 @@ class ReceiveModeWeb:
|
||||
# This tracks the history id
|
||||
self.cur_history_id = 0
|
||||
|
||||
# Whether or not we can send REQUEST_INDIVIDUAL_FILE_STARTED
|
||||
# and maybe other events when requests come in to this mode
|
||||
self.supports_file_requests = True
|
||||
|
||||
self.define_routes()
|
||||
|
||||
def define_routes(self):
|
||||
|
@ -52,6 +52,10 @@ class SendBaseModeWeb:
|
||||
# This tracks the history id
|
||||
self.cur_history_id = 0
|
||||
|
||||
# Whether or not we can send REQUEST_INDIVIDUAL_FILE_STARTED
|
||||
# and maybe other events when requests come in to this mode
|
||||
self.supports_file_requests = True
|
||||
|
||||
self.define_routes()
|
||||
self.init()
|
||||
|
||||
|
@ -152,7 +152,6 @@ class Web:
|
||||
self.receive_mode = None
|
||||
self.website_mode = None
|
||||
self.chat_mode = None
|
||||
self.mode_supports_file_requests = True
|
||||
if self.mode == "share":
|
||||
self.share_mode = ShareModeWeb(self.common, self)
|
||||
elif self.mode == "receive":
|
||||
@ -163,9 +162,6 @@ class Web:
|
||||
self.socketio = SocketIO()
|
||||
self.socketio.init_app(self.app)
|
||||
self.chat_mode = ChatModeWeb(self.common, self)
|
||||
# Chat mode has no concept of individual file requests that
|
||||
# turn into history widgets in the GUI
|
||||
self.mode_supports_file_requests = False
|
||||
|
||||
self.cleanup_filenames = []
|
||||
|
||||
@ -298,7 +294,8 @@ class Web:
|
||||
return self.add_security_headers(r)
|
||||
|
||||
def error404(self, history_id):
|
||||
if self.mode_supports_file_requests:
|
||||
mode = self.get_mode()
|
||||
if mode.supports_file_requests:
|
||||
self.add_request(
|
||||
self.REQUEST_INDIVIDUAL_FILE_STARTED,
|
||||
request.path,
|
||||
@ -312,7 +309,8 @@ class Web:
|
||||
return self.add_security_headers(r)
|
||||
|
||||
def error405(self, history_id):
|
||||
if self.mode_supports_file_requests:
|
||||
mode = self.get_mode()
|
||||
if mode.supports_file_requests:
|
||||
self.add_request(
|
||||
self.REQUEST_INDIVIDUAL_FILE_STARTED,
|
||||
request.path,
|
||||
@ -326,7 +324,8 @@ class Web:
|
||||
return self.add_security_headers(r)
|
||||
|
||||
def error500(self, history_id):
|
||||
if self.mode_supports_file_requests:
|
||||
mode = self.get_mode()
|
||||
if mode.supports_file_requests:
|
||||
self.add_request(
|
||||
self.REQUEST_INDIVIDUAL_FILE_STARTED,
|
||||
request.path,
|
||||
|
Loading…
Reference in New Issue
Block a user