Files
WarpBox/static/popups/cli.html

63 lines
2.0 KiB
HTML
Raw Normal View History

2026-04-29 02:35:23 +03:00
<h3>Upload from a terminal</h3>
<p>WarpBox accepts normal multipart uploads at <code>/upload</code>. The server returns JSON with a <code>box_url</code> you can open or share.</p>
<pre class="code-block"><code>curl \
-F 'files=@./my-file.zip' \
-F 'retention=1h' \
{{ origin }}/upload
2026-04-29 02:35:23 +03:00
</code></pre>
<h4>Reusable shell wrapper</h4>
<p>This version is small, portable, and works well as a personal <code>warpbox</code> command.</p>
<pre class="code-block"><code>#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -lt 1 ]; then
echo "Usage: warpbox FILE [FILE ...]" >&amp;2
exit 64
fi
endpoint="${WARPBOX_URL:-{{ origin }}}/upload"
retention="${WARPBOX_RETENTION:-1h}"
args=(-F "retention=${retention}")
for file in "$@"; do
args+=(-F "files=@${file}")
done
2026-04-29 02:35:23 +03:00
curl --fail-with-body "${args[@]}" "${endpoint}"
</code></pre>
<h4>Install it</h4>
<p>Put the wrapper somewhere on your <code>PATH</code>, then call it with one or more files.</p>
<pre class="code-block"><code>chmod +x ./warpbox
sudo install -m 755 ./warpbox /usr/local/bin/warpbox
2026-04-29 02:35:23 +03:00
warpbox ./photo.png ./archive.zip
</code></pre>
<h4>Print only the share URL</h4>
<p>If <code>jq</code> is installed, this variant extracts the returned link and expands it to a full URL.</p>
<pre class="code-block"><code>warpbox() {
local endpoint="${WARPBOX_URL:-{{ origin }}}/upload"
local retention="${WARPBOX_RETENTION:-1h}"
local args=(-F "retention=${retention}")
for file in "$@"; do
args+=(-F "files=@${file}")
done
curl --fail-with-body -sS "${args[@]}" "${endpoint}" |
jq -r --arg origin "${WARPBOX_URL:-{{ origin }}}" '"\($origin)\(.box_url)"'
}
</code></pre>
<h4>Add password or retention</h4>
<p>You can keep the wrapper simple and pass fixed options through environment variables or extra form fields.</p>
<pre class="code-block"><code>WARPBOX_RETENTION=24h warpbox ./release.tar.gz
curl \
-F 'files=@./private.zip' \
-F 'retention=1h' \
-F 'password=correct-horse-battery-staple' \
{{ origin }}/upload
</code></pre>