Return both URLs after upload

Fixes #25
This commit is contained in:
Daan Sprenkels 2019-12-15 12:42:10 +05:30
parent 728b5d9d4b
commit 41f4de43ac
6 changed files with 54 additions and 12 deletions

View File

@ -14,7 +14,12 @@ the command line.
# Shorten a URL
curl -F'shorten=http://example.com/some/long/url' <a href="//{{.Request.Host}}">https://{{.Request.Host}}</a>
# Shorten a URL with a token to delete it later
curl -F'shorten=http://example.com/some/long/url' -F'deleteToken=' <a href="//{{.Request.Host}}">https://{{.Request.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="//{{.Request.Host}}">https://{{.Request.Host}}</a> | head -n 1
</pre>
{{end}}

View File

@ -1,3 +1,16 @@
{{define "title"}}
Success - rushlink
{{end}}
{{define "body"}}
<pre>
https://{{.Request.Host}}/{{.Paste.Key}}{{.FileExt}}
---
# View metadata
curl <a href="https://{{.Request.Host}}/{{.Paste.Key}}{{.FileExt}}/meta?deleteToken={{.Paste.DeleteToken | urlquery}}">https://{{.Request.Host}}/{{.Paste.Key}}{{.FileExt}}/meta?deleteToken={{.Paste.DeleteToken | urlquery}}</a>
# Delete this object
curl --request DELETE <a href="https://{{.Request.Host}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken | urlquery}}">https://{{.Request.Host}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken | urlquery}}</a>
</pre>
{{end}}

View File

@ -1,3 +1,16 @@
{{define "title"}}
Success - rushlink
{{end}}
{{define "body"}}
<pre>
https://{{.Request.Host}}/{{.Paste.Key}}
---
# View metadata
curl <a href="https://{{.Request.Host}}/{{.Paste.Key}}/meta?deleteToken={{.Paste.DeleteToken | urlquery}}">https://{{.Request.Host}}/{{.Paste.Key}}/meta?deleteToken={{.Paste.DeleteToken | urlquery}}</a>
# Delete this object
curl --request DELETE <a href="https://{{.Request.Host}}/{{.Paste.Key}}?deleteToken={{.Paste.DeleteToken | urlquery}}">https://{{.Request.Host}}/{{.Paste.Key}}?deleteToken={{.Paste.DeleteToken | urlquery}}</a>
</pre>
{{end}}

View File

@ -12,5 +12,10 @@ the command line.
# Shorten a URL
curl -F'shorten=http://example.com/some/long/url' https://{{.Request.Host}}
# Shorten a URL with a token to delete it later
curl -F'shorten=http://example.com/some/long/url' -F'deleteToken=' https://{{.Request.Host}}
# 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' https://{{.Request.Host}} | head -n 1

View File

@ -1,5 +1,8 @@
{{if .Request.PostForm.deleteToken -}}
https://{{.Request.Host}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken | urlquery}}
{{else -}}
https://{{.Request.Host}}/{{.Paste.Key}}{{.FileExt}}
{{end -}}
---
# View metadata
curl https://{{.Request.Host}}/{{.Paste.Key}}{{.FileExt}}/meta?deleteToken={{.Paste.DeleteToken | urlquery}}
# Delete this object
curl --request DELETE https://{{.Request.Host}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken | urlquery}}

View File

@ -1,5 +1,8 @@
{{if .Request.PostForm.deleteToken -}}
https://{{.Request.Host}}/{{.Paste.Key}}?deleteToken={{.Paste.DeleteToken | urlquery}}
{{else -}}
https://{{.Request.Host}}/{{.Paste.Key}}
{{end -}}
---
# View metadata
curl https://{{.Request.Host}}/{{.Paste.Key}}/meta?deleteToken={{.Paste.DeleteToken | urlquery}}
# Delete this object
curl --request DELETE https://{{.Request.Host}}/{{.Paste.Key}}?deleteToken={{.Paste.DeleteToken | urlquery}}