mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Set a maximum length of 524288 characters for text messages in Receive mode
This commit is contained in:
parent
ad69fa55db
commit
35670533d8
@ -53,7 +53,7 @@
|
|||||||
<p><input type="file" id="file-select" name="file[]" multiple /></p>
|
<p><input type="file" id="file-select" name="file[]" multiple /></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if not disable_text %}
|
{% if not disable_text %}
|
||||||
<p><textarea id="text" name="text" placeholder="Write a message"></textarea></p>
|
<p><textarea id="text" name="text" placeholder="Write a message (max length 524288 characters)" maxlength="524288"></textarea></p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<p><button type="submit" id="send-button" class="button">Submit</button></p>
|
<p><button type="submit" id="send-button" class="button">Submit</button></p>
|
||||||
</form>
|
</form>
|
||||||
|
@ -194,7 +194,10 @@ class ReceiveModeWeb:
|
|||||||
if files_received > 0:
|
if files_received > 0:
|
||||||
msg = f"Uploaded {files_msg}"
|
msg = f"Uploaded {files_msg}"
|
||||||
else:
|
else:
|
||||||
msg = "Nothing submitted"
|
if not self.web.settings.get("receive", "disable_text"):
|
||||||
|
msg = "Nothing submitted or message was too long (> 524288 characters)"
|
||||||
|
else:
|
||||||
|
msg = "Nothing submitted"
|
||||||
|
|
||||||
if ajax:
|
if ajax:
|
||||||
info_flashes.append(msg)
|
info_flashes.append(msg)
|
||||||
@ -462,7 +465,7 @@ class ReceiveModeRequest(Request):
|
|||||||
self.includes_message = False
|
self.includes_message = False
|
||||||
if not self.web.settings.get("receive", "disable_text"):
|
if not self.web.settings.get("receive", "disable_text"):
|
||||||
text_message = self.form.get("text")
|
text_message = self.form.get("text")
|
||||||
if text_message:
|
if text_message and len(text_message) <= 524288:
|
||||||
if text_message.strip() != "":
|
if text_message.strip() != "":
|
||||||
self.includes_message = True
|
self.includes_message = True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user