From b3357185f4277d38ac22a4cc9a537bd8fb937f76 Mon Sep 17 00:00:00 2001 From: Gerdriaan Mulder Date: Fri, 29 Nov 2019 18:36:27 +0100 Subject: [PATCH] Use https links. Use iota for pasteType and pasteState to preserve type --- assets/templates/html/index.html.tmpl | 4 ++-- assets/templates/txt/index.txt.tmpl | 2 +- paste.go | 19 ++++++++++++------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/assets/templates/html/index.html.tmpl b/assets/templates/html/index.html.tmpl index 37f1f7f..e763a98 100644 --- a/assets/templates/html/index.html.tmpl +++ b/assets/templates/html/index.html.tmpl @@ -9,7 +9,7 @@ the command line. ## USAGE # Upload a file - curl -F'file=@yourfile.png' {{.Request.Host}} + curl -F'file=@yourfile.png' https://{{.Request.Host}} # Shorten a URL curl -F'shorten=http://example.com/some/long/url' https://{{.Request.Host}} @@ -17,4 +17,4 @@ the command line. # Shorten a URL with a token to delete it later curl -F'shorten=http://example.com/some/long/url' -F'deleteToken=' https://{{.Request.Host}} -{{end}} \ No newline at end of file +{{end}} diff --git a/assets/templates/txt/index.txt.tmpl b/assets/templates/txt/index.txt.tmpl index eb8b0f2..7b331b0 100644 --- a/assets/templates/txt/index.txt.tmpl +++ b/assets/templates/txt/index.txt.tmpl @@ -7,7 +7,7 @@ the command line. ## USAGE # Upload a file - curl -F'file=@yourfile.png' {{.Request.Host}} + curl -F'file=@yourfile.png' https://{{.Request.Host}} # Shorten a URL curl -F'shorten=http://example.com/some/long/url' https://{{.Request.Host}} diff --git a/paste.go b/paste.go index 7455cbe..cf441f4 100644 --- a/paste.go +++ b/paste.go @@ -24,17 +24,22 @@ type paste struct { TimeCreated time.Time } +// Note: we use iota here. That means removals of pasteType* are not allowed, +// because this changes the value of the constant. Please add the comment +// "// deprecated" if you want to remove the constant. Additions are only +// allowed at the bottom of this block, for the same reason. const ( - pasteTypeUndef pasteType = 0 - pasteTypePaste = 1 - pasteTypeRedirect = 2 - pasteTypeFileUpload = 3 + pasteTypeUndef pasteType = iota + pasteTypePaste + pasteTypeRedirect + pasteTypeFileUpload ) +// Note: we use iota here. See the comment above pasteType* const ( - pasteStateUndef pasteState = 0 - pasteStatePresent = 1 - pasteStateDeleted = 2 + pasteStateUndef pasteState = iota + pasteStatePresent + pasteStateDeleted ) func (t pasteType) String() string {