rushlink/assets/templates/html/index.html.tmpl
2019-12-16 16:21:41 +05:30

45 lines
1.7 KiB
Cheetah

{{define "head-append"}}
<script type="text/javascript" src="/js/dragdrop.js" defer></script>
{{end}}
{{define "body"}}
<div style="visibility:hidden; opacity:0" id="dropZone">File incoming! :D</div>
<h1>#RU paste-dump</h1>
Based on https://0x0.st/, this site allows you to easily upload files and shorten URLs using
the command line.
<h2>Web-API</h2>
<section>
<form id="fileUploadForm" action="/" method="post" enctype="multipart/form-data">
<label class="formLabel" for="fileUploadField">Upload a file:</label>
<input id="fileUploadField" class="formMain" name="file" type="file" />
<input id="fileUploadField" class="formSubmit" type="submit" value="upload!" />
</form>
</section>
<section>
<form id="shortenURLForm" action="/" method="post" enctype="multipart/form-data">
<label class="formLabel" for="shortenURLField">Upload a URL:</label>
<input id="shortenURLField" class="formMain" name="shorten" type="url" />
<input id="shortenURLSubmit" class="formSubmit" type="submit" value="shorten!" />
</form>
</section>
<h2>Command line API</h2>
<pre>
# Upload a file
curl -F'file=@yourfile.png' <a href="{{.Host}}">{{.Host}}</a>
# Shorten a URL
curl -F'shorten=http://example.com/some/long/url' <a href="{{.Host}}">{{.Host}}</a>
# The first line of the result will contain the shortened URL.
#
# In the other lines, you will find other information, including
# information on how to delete the shortened object.
# To upload a file and only extract the shortened URL (i.e. throw away the rest)
curl -F'file=@yourfile.png' <a href="{{.Host}}">{{.Host}}</a> | head -n 1
</pre>
{{end}}