Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions saas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ async def add_security_headers(request: Request, call_next):
</p>
<p>
<label for="target_bytes">Target Bytes: <span class="required-star" aria-hidden="true">*</span></label><br>
<input type="number" id="target_bytes" name="target_bytes" value="2000000000" min="1" aria-describedby="target_bytes_help target_bytes_preview" required>
<input type="number" id="target_bytes" name="target_bytes" value="2000000000" min="1" max="5368709120" aria-describedby="target_bytes_help target_bytes_preview" required>
<br><span id="target_bytes_help" class="help-text">Maximum allowed file size in bytes (e.g., 2000000000 for ~1.86 GiB)</span>
<br><span id="target_bytes_preview" class="help-text" aria-live="polite" style="font-weight: bold; color: #1e7e34;">1.86 GiB</span>
<div id="preset_buttons_container" class="preset-container" role="group" aria-label="Preset target sizes">
Expand Down Expand Up @@ -268,6 +268,12 @@ async def add_security_headers(request: Request, call_next):
preview.style.color = '#dc3545';
this.setCustomValidity('Must be greater than 0.');
this.setAttribute('aria-invalid', 'true');
} else if (val > MAX_UPLOAD_BYTES) {
const limitText = formatBinaryBytes(MAX_UPLOAD_BYTES);
preview.innerText = 'Exceeds maximum allowed size of ' + limitText + '.';
preview.style.color = '#dc3545';
this.setCustomValidity('Exceeds maximum allowed size.');
this.setAttribute('aria-invalid', 'true');
} else {
preview.innerText = formatBinaryBytes(val);
}
Expand Down Expand Up @@ -302,6 +308,12 @@ async def add_security_headers(request: Request, call_next):
preview.style.color = '#dc3545';
this.setCustomValidity('Must be greater than 0.');
this.setAttribute('aria-invalid', 'true');
} else if (val > MAX_UPLOAD_BYTES) {
const limitText = formatBinaryBytes(MAX_UPLOAD_BYTES);
preview.innerText = 'Exceeds maximum allowed size of ' + limitText + '.';
preview.style.color = '#dc3545';
this.setCustomValidity('Exceeds maximum allowed size.');
this.setAttribute('aria-invalid', 'true');
} else {
preview.innerText = formatBinaryBytes(val);
}
Expand Down Expand Up @@ -416,7 +428,7 @@ async def add_security_headers(request: Request, call_next):
</p>
<p>
<label for="batch_target_bytes">Target Bytes (per file): <span class="required-star" aria-hidden="true">*</span></label><br>
<input type="number" id="batch_target_bytes" name="target_bytes" value="2000000000" min="1" aria-describedby="batch_target_bytes_help batch_target_bytes_preview" required>
<input type="number" id="batch_target_bytes" name="target_bytes" value="2000000000" min="1" max="5368709120" aria-describedby="batch_target_bytes_help batch_target_bytes_preview" required>
<br><span id="batch_target_bytes_help" class="help-text">Maximum allowed size in bytes for each output file</span>
<br><span id="batch_target_bytes_preview" class="help-text" aria-live="polite" style="font-weight: bold; color: #1e7e34;">1.86 GiB</span>
<div id="batch_preset_buttons_container" class="preset-container" role="group" aria-label="Preset target sizes for batch">
Expand Down
Loading