Rename --host => --root-url

This commit is contained in:
Daan Sprenkels
2019-12-17 15:43:32 +05:30
parent 3d07acb222
commit ffeb9a3362
7 changed files with 53 additions and 36 deletions

View File

@@ -28,10 +28,10 @@ the command line.
<h2>Command line API</h2>
<pre>
# Upload a file
curl -F'file=@yourfile.png' <a href="{{.Host}}">{{.Host}}</a>
curl -F'file=@yourfile.png' <a href="{{.RootURL}}">{{.RootURL}}</a>
# Shorten a URL
curl -F'shorten=http://example.com/some/long/url' <a href="{{.Host}}">{{.Host}}</a>
curl -F'shorten=http://example.com/some/long/url' <a href="{{.RootURL}}">{{.RootURL}}</a>
# The first line of the result will contain the shortened URL.
#
@@ -39,6 +39,6 @@ the command line.
# 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
curl -F'file=@yourfile.png' <a href="{{.RootURL}}">{{.RootURL}}</a> | head -n 1
</pre>
{{end}}

View File

@@ -4,10 +4,10 @@
{{define "body"}}
<pre>
<a href="{{.Host}}/{{.Paste.Key}}{{.FileExt}}">{{.Host}}/{{.Paste.Key}}{{.FileExt}}</a>
<a href="{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}">{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}</a>
---
{{if and (ne .Paste.State.String "deleted") .CanDeleteBool}}
with delete token: <a href="{{.Host}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}">{{.Host}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}</a>
with delete token: <a href="{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}">{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}</a>
{{else -}}
with delete token: &lt;unknown&gt;
{{end -}}
@@ -22,7 +22,7 @@ delete token: {{.CanDelete}}
{{if and (ne .Paste.State.String "deleted") .CanDeleteBool}}
```
curl --request "DELETE" "<a href="{{.Host}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}">{{.Host}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}"</a>
curl --request "DELETE" "<a href="{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}">{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}"</a>
```
</pre>
{{end}}

View File

@@ -7,10 +7,10 @@ the command line.
## USAGE
# Upload a file
curl -F'file=@yourfile.png' {{.Host}}
curl -F'file=@yourfile.png' {{.RootURL}}
# Shorten a URL
curl -F'shorten=http://example.com/some/long/url' {{.Host}}
curl -F'shorten=http://example.com/some/long/url' {{.RootURL}}
# The first line of the result will contain the shortened URL.
#
@@ -18,4 +18,4 @@ the command line.
# 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' {{.Host}} | head -n 1
curl -F'file=@yourfile.png' {{.RootURL}} | head -n 1

View File

@@ -1,7 +1,7 @@
{{.Host}}/{{.Paste.Key}}{{.FileExt}}
{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}
---
{{if and (ne .Paste.State.String "deleted") .CanDeleteBool}}
with delete token: {{.Host}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Request.URL.Query.Get "deleteToken"}}
with delete token: {{.RootURL}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}
{{else -}}
with delete token: <unknown>
{{end -}}type: {{.Paste.Type}}
@@ -16,6 +16,6 @@ delete token: {{.CanDelete}}
{{if and (ne .Paste.State.String "deleted") .CanDeleteBool}}
```
# To delete this {{.Paste.Type}}, execute:
curl --request "DELETE" "{{.Host}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}"
curl --request "DELETE" "{{.RootURL}}/{{.Paste.Key}}{{.FileExt}}?deleteToken={{.Paste.DeleteToken}}"
```
{{end}}