mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-15 09:17:25 -05:00
Remove method from IndividualFileHistoryItem, and only display these widgets on 200 and 404 requests, not all of the others
This commit is contained in:
parent
c2011e6915
commit
3f7c4a4e25
@ -315,9 +315,6 @@ class Common(object):
|
|||||||
color: #666666;
|
color: #666666;
|
||||||
}""",
|
}""",
|
||||||
|
|
||||||
'history_individual_file_request_label': """
|
|
||||||
QLabel { }""",
|
|
||||||
|
|
||||||
'history_individual_file_status_code_label_2xx': """
|
'history_individual_file_status_code_label_2xx': """
|
||||||
QLabel {
|
QLabel {
|
||||||
color: #008800;
|
color: #008800;
|
||||||
|
@ -147,8 +147,7 @@ class SendBaseModeWeb:
|
|||||||
self.cur_history_id += 1
|
self.cur_history_id += 1
|
||||||
self.web.add_request(self.web.REQUEST_INDIVIDUAL_FILE_STARTED, path, {
|
self.web.add_request(self.web.REQUEST_INDIVIDUAL_FILE_STARTED, path, {
|
||||||
'id': history_id,
|
'id': history_id,
|
||||||
'filesize': filesize,
|
'filesize': filesize
|
||||||
'method': request.method
|
|
||||||
})
|
})
|
||||||
|
|
||||||
# Only GET requests are allowed, any other method should fail
|
# Only GET requests are allowed, any other method should fail
|
||||||
|
@ -196,26 +196,10 @@ class Web:
|
|||||||
self.force_shutdown()
|
self.force_shutdown()
|
||||||
print("Someone has made too many wrong attempts to guess your password, so OnionShare has stopped the server. Start sharing again and send the recipient a new address to share.")
|
print("Someone has made too many wrong attempts to guess your password, so OnionShare has stopped the server. Start sharing again and send the recipient a new address to share.")
|
||||||
|
|
||||||
history_id = self.cur_history_id
|
|
||||||
self.cur_history_id += 1
|
|
||||||
self.add_request(self.REQUEST_INDIVIDUAL_FILE_STARTED, '{}'.format(request.path), {
|
|
||||||
'id': history_id,
|
|
||||||
'method': request.method,
|
|
||||||
'status_code': 401
|
|
||||||
})
|
|
||||||
|
|
||||||
r = make_response(render_template('401.html', static_url_path=self.static_url_path), 401)
|
r = make_response(render_template('401.html', static_url_path=self.static_url_path), 401)
|
||||||
return self.add_security_headers(r)
|
return self.add_security_headers(r)
|
||||||
|
|
||||||
def error403(self):
|
def error403(self):
|
||||||
history_id = self.cur_history_id
|
|
||||||
self.cur_history_id += 1
|
|
||||||
self.add_request(self.REQUEST_INDIVIDUAL_FILE_STARTED, '{}'.format(request.path), {
|
|
||||||
'id': history_id,
|
|
||||||
'method': request.method,
|
|
||||||
'status_code': 403
|
|
||||||
})
|
|
||||||
|
|
||||||
self.add_request(Web.REQUEST_OTHER, request.path)
|
self.add_request(Web.REQUEST_OTHER, request.path)
|
||||||
r = make_response(render_template('403.html', static_url_path=self.static_url_path), 403)
|
r = make_response(render_template('403.html', static_url_path=self.static_url_path), 403)
|
||||||
return self.add_security_headers(r)
|
return self.add_security_headers(r)
|
||||||
@ -234,14 +218,6 @@ class Web:
|
|||||||
return self.add_security_headers(r)
|
return self.add_security_headers(r)
|
||||||
|
|
||||||
def error405(self):
|
def error405(self):
|
||||||
history_id = self.cur_history_id
|
|
||||||
self.cur_history_id += 1
|
|
||||||
self.add_request(self.REQUEST_INDIVIDUAL_FILE_STARTED, '{}'.format(request.path), {
|
|
||||||
'id': history_id,
|
|
||||||
'method': request.method,
|
|
||||||
'status_code': 405
|
|
||||||
})
|
|
||||||
|
|
||||||
r = make_response(render_template('405.html', static_url_path=self.static_url_path), 405)
|
r = make_response(render_template('405.html', static_url_path=self.static_url_path), 405)
|
||||||
return self.add_security_headers(r)
|
return self.add_security_headers(r)
|
||||||
|
|
||||||
|
@ -354,7 +354,6 @@ class IndividualFileHistoryItem(HistoryItem):
|
|||||||
self.path = path
|
self.path = path
|
||||||
self.total_bytes = 0
|
self.total_bytes = 0
|
||||||
self.downloaded_bytes = 0
|
self.downloaded_bytes = 0
|
||||||
self.method = data['method']
|
|
||||||
self.started = time.time()
|
self.started = time.time()
|
||||||
self.started_dt = datetime.fromtimestamp(self.started)
|
self.started_dt = datetime.fromtimestamp(self.started)
|
||||||
self.status = HistoryItem.STATUS_STARTED
|
self.status = HistoryItem.STATUS_STARTED
|
||||||
@ -364,8 +363,7 @@ class IndividualFileHistoryItem(HistoryItem):
|
|||||||
# Labels
|
# Labels
|
||||||
self.timestamp_label = QtWidgets.QLabel(self.started_dt.strftime("%b %d, %I:%M%p"))
|
self.timestamp_label = QtWidgets.QLabel(self.started_dt.strftime("%b %d, %I:%M%p"))
|
||||||
self.timestamp_label.setStyleSheet(self.common.css['history_individual_file_timestamp_label'])
|
self.timestamp_label.setStyleSheet(self.common.css['history_individual_file_timestamp_label'])
|
||||||
self.request_label = QtWidgets.QLabel("{} {}".format(self.method, self.path))
|
self.path_label = QtWidgets.QLabel("{}".format(self.path))
|
||||||
self.request_label.setStyleSheet(self.common.css['history_individual_file_request_label'])
|
|
||||||
self.status_code_label = QtWidgets.QLabel()
|
self.status_code_label = QtWidgets.QLabel()
|
||||||
|
|
||||||
# Progress bar
|
# Progress bar
|
||||||
@ -379,7 +377,7 @@ class IndividualFileHistoryItem(HistoryItem):
|
|||||||
# Text layout
|
# Text layout
|
||||||
labels_layout = QtWidgets.QHBoxLayout()
|
labels_layout = QtWidgets.QHBoxLayout()
|
||||||
labels_layout.addWidget(self.timestamp_label)
|
labels_layout.addWidget(self.timestamp_label)
|
||||||
labels_layout.addWidget(self.request_label)
|
labels_layout.addWidget(self.path_label)
|
||||||
labels_layout.addWidget(self.status_code_label)
|
labels_layout.addWidget(self.status_code_label)
|
||||||
labels_layout.addStretch()
|
labels_layout.addStretch()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user