feat(config): support *_MB env vars for upload size limits
- Add `applyMegabytesOrBytesEnv` to accept size settings in either bytes or MB - Prefer `*_BYTES` when set, otherwise convert `*_MB` to bytes with overflow guard - Add coverage for MB-based environment overrides - Introduce `static/js/upload-popups.js` to lazy-load and cache popup templatesfeat(config): support *_MB env vars for upload size limits - Add `applyMegabytesOrBytesEnv` to accept size settings in either bytes or MB - Prefer `*_BYTES` when set, otherwise convert `*_MB` to bytes with overflow guard - Add coverage for MB-based environment overrides - Introduce `static/js/upload-popups.js` to lazy-load and cache popup templates
This commit is contained in:
@@ -40,11 +40,8 @@
|
||||
<div class="menu-item">
|
||||
<button class="menu-button" type="button" aria-expanded="false"><u>B</u>ox</button>
|
||||
<div class="menu-popup" role="menu">
|
||||
{{ range .RetentionOptions }}
|
||||
<button class="menu-action" type="button" data-expiry="{{ .Key }}"><span class="menu-check" data-expiry-check="{{ .Key }}">{{ if eq .Key $.DefaultRetention }}✓{{ end }}</span><span>{{ .Label }}</span><span></span></button>
|
||||
{{ end }}
|
||||
<div class="menu-separator"></div>
|
||||
<button class="menu-action" type="button" data-action="toggle-delete-once"><span class="menu-check" data-delete-once-check></span><span>One-time download</span><span></span></button>
|
||||
<button class="menu-action" type="button" data-action="toggle-delete-once"><img src="/static/img/icons/recycle_bin_full_cool-5.png" alt="" aria-hidden="true"><span>One-time download</span><span></span></button>
|
||||
<button class="menu-action" type="button" data-action="copy-link"><img src="/static/img/sprites/frame_web-0.png" alt="" aria-hidden="true"><span>Copy share URL</span><span></span></button>
|
||||
<button class="menu-action" type="button" data-doc="dailyQuota"><img src="/static/img/icons/scanner_alt-3.png" alt="" aria-hidden="true"><span>Upload limits...</span><span></span></button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -53,16 +50,16 @@
|
||||
<div class="menu-popup" role="menu">
|
||||
<button class="menu-action" type="button" data-action="random-password"><img src="/static/img/sprites/file_padlock.png" alt="" aria-hidden="true"><span>Generate password</span><span></span></button>
|
||||
<button class="menu-action" type="button" data-action="random-box-name"><img src="/static/img/icons/directory_closed-2.png" alt="" aria-hidden="true"><span>Random box name</span><span></span></button>
|
||||
<button class="menu-action" type="button" data-action="clear-password"><span>○</span><span>Clear password</span><span></span></button>
|
||||
<button class="menu-action" type="button" data-action="toggle-page"><span class="menu-check" data-download-page-check>✓</span><span>Download page</span><span></span></button>
|
||||
<button class="menu-action" type="button" data-action="clear-password"><img src="/static/img/icons/x_mark_pixel.png" alt="" aria-hidden="true"><span>Clear password</span><span></span></button>
|
||||
<button class="menu-action" type="button" data-action="toggle-page"><img src="/static/img/sprites/frame_web-0.png" alt="" aria-hidden="true"><span>Download page</span><span></span></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="menu-item">
|
||||
<button class="menu-button" type="button" aria-expanded="false"><u>H</u>elp</button>
|
||||
<div class="menu-popup" role="menu">
|
||||
<button class="menu-action" type="button" data-action="help"><img src="/static/img/icons/tip.png" alt="" aria-hidden="true"><span>Show quick help</span><span>F1</span></button>
|
||||
<button class="menu-action" type="button" data-action="terminal-help"><span>></span><span>Show cURL command</span><span></span></button>
|
||||
<button class="menu-action" type="button" data-doc="about"><span>i</span><span>About WarpBox</span><span></span></button>
|
||||
<button class="menu-action" type="button" data-action="terminal-help"><img src="/static/img/icons/shell_window1.png" alt="" aria-hidden="true"><span>Show cURL command</span><span></span></button>
|
||||
<button class="menu-action" type="button" data-doc="about"><img src="/static/WarpBoxLogo.png" alt="" aria-hidden="true"><span>About WarpBox</span><span></span></button>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -81,7 +78,7 @@
|
||||
</aside>
|
||||
</header>
|
||||
|
||||
<label class="upload-dropzone" for="file-upload" tabindex="0" id="dropzone">
|
||||
<label class="upload-dropzone" for="file-upload" tabindex="1" id="dropzone" data-disabled-reason="The current box is sealed after upload. Press Clear to start a new box.">
|
||||
<img class="upload-icon-img" src="/static/img/icons/directory_open_cool-4.png" alt="" aria-hidden="true">
|
||||
<span class="upload-primary">{{ if .UploadsEnabled }}Drop files here{{ else }}Guest uploads disabled{{ end }}</span>
|
||||
<span class="upload-secondary">or <span class="upload-linklike">click to browse</span> from your computer</span>
|
||||
@@ -113,7 +110,7 @@
|
||||
|
||||
<div class="upload-actions">
|
||||
<button class="win98-button" type="button" data-action="clear">Clear</button>
|
||||
<button class="win98-button start-upload-cta" type="submit" id="start-button" {{ if not .UploadsEnabled }}disabled{{ end }} data-disabled-reason="Start upload is unavailable right now.">Start upload</button>
|
||||
<button class="win98-button start-upload-cta" type="submit" id="start-button" tabindex="4" {{ if not .UploadsEnabled }}disabled{{ end }} data-disabled-reason="Start upload is unavailable right now.">Start upload</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -136,7 +133,7 @@
|
||||
<div class="box-options-form" id="box-options-form">
|
||||
<label class="option-row">
|
||||
<span>Expires:</span>
|
||||
<select class="upload-select" id="expiry-select" name="retention_key">
|
||||
<select class="upload-select" id="expiry-select" name="retention_key" tabindex="2">
|
||||
{{ range .RetentionOptions }}
|
||||
<option value="{{ .Key }}" {{ if eq .Key $.DefaultRetention }}selected{{ end }}>{{ .Label }}</option>
|
||||
{{ end }}
|
||||
@@ -144,7 +141,7 @@
|
||||
</label>
|
||||
<label class="option-row">
|
||||
<span>Password:</span>
|
||||
<input class="upload-text-input" id="password-input" type="text" placeholder="optional" autocomplete="off">
|
||||
<input class="upload-text-input" id="password-input" type="text" placeholder="optional" autocomplete="off" tabindex="3">
|
||||
</label>
|
||||
<label class="option-row">
|
||||
<span>Max views:</span>
|
||||
@@ -152,11 +149,11 @@
|
||||
</label>
|
||||
<label class="option-row">
|
||||
<span>Box name:</span>
|
||||
<input class="upload-text-input" id="box-name" type="text" maxlength="42" placeholder="local note">
|
||||
<input class="upload-text-input" id="box-name" type="text" maxlength="42" placeholder="optional, normal text">
|
||||
</label>
|
||||
<label class="option-row">
|
||||
<span>Custom slug:</span>
|
||||
<input class="upload-text-input" id="custom-slug" type="text" maxlength="32" placeholder="local note">
|
||||
<input class="upload-text-input" id="custom-slug" type="text" maxlength="32" pattern="[a-z0-9-]*" placeholder="optional-slug">
|
||||
</label>
|
||||
<label class="option-check">
|
||||
<input type="checkbox" id="download-page" checked>
|
||||
@@ -196,7 +193,7 @@
|
||||
<section class="win98-window side-panel">
|
||||
<div class="win98-titlebar">
|
||||
<div class="win98-titlebar-label">
|
||||
<img class="win98-titlebar-icon" src="/static/img/sprites/computer_explorer-4.png" alt="" aria-hidden="true">
|
||||
<img class="win98-titlebar-icon" src="/static/img/icons/shell_window1.png" alt="" aria-hidden="true">
|
||||
<h2>Terminal Upload</h2>
|
||||
</div>
|
||||
<div class="win98-window-controls"><button class="win98-control" type="button" data-action="side-help" title="Help-ish">?</button></div>
|
||||
@@ -221,7 +218,7 @@
|
||||
<button class="folder-icon-button" type="button" data-doc="cli"><img src="/static/img/icons/directory_closed-2.png" alt="" aria-hidden="true"><span>CLI Guide</span></button>
|
||||
<button class="folder-icon-button" type="button" data-doc="faq"><img src="/static/img/icons/directory_open_cool-4.png" alt="" aria-hidden="true"><span>Help & FAQ</span></button>
|
||||
<button class="folder-icon-button" type="button" data-doc="examples"><img src="/static/img/icons/shell_window1.png" alt="" aria-hidden="true"><span>Examples</span></button>
|
||||
<button class="folder-icon-button folder-icon-button-disabled" type="button" data-action="coming-soon"><img src="/static/img/sprites/eject_pc_cool-5.png" alt="" aria-hidden="true"><span>WarpBox.exe</span></button>
|
||||
<button class="folder-icon-button folder-icon-button-disabled" type="button" data-action="coming-soon"><img src="/static/WarpBoxLogo.png" alt="" aria-hidden="true"><span>WarpBox.exe</span></button>
|
||||
</div>
|
||||
</section>
|
||||
</aside>
|
||||
@@ -241,6 +238,8 @@
|
||||
</section>
|
||||
<div class="toast" id="toast" role="status" aria-live="polite"></div>
|
||||
|
||||
<script src="/static/js/upload-utils.js"></script>
|
||||
<script src="/static/js/upload-popups.js"></script>
|
||||
<script src="/static/js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user