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

@@ -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}}