From 989910711d5ef78294e524e971f49881a4505b27 Mon Sep 17 00:00:00 2001 From: Remco Date: Thu, 13 Nov 2014 00:16:21 +0100 Subject: [PATCH] added preview for video and audio, updated alias example --- transfersh-server/handlers.go | 6 +- transfersh-server/static/download.audio.html | 142 ++++++++++++++++++ ...ownload.md.html => download.markdown.html} | 0 transfersh-server/static/download.video.html | 142 ++++++++++++++++++ transfersh-server/static/index.html | 3 +- transfersh-web/download.audio.html | 67 +++++++++ ...ownload.md.html => download.markdown.html} | 0 transfersh-web/download.video.html | 67 +++++++++ 8 files changed, 425 insertions(+), 2 deletions(-) create mode 100644 transfersh-server/static/download.audio.html rename transfersh-server/static/{download.md.html => download.markdown.html} (100%) create mode 100644 transfersh-server/static/download.video.html create mode 100644 transfersh-web/download.audio.html rename transfersh-web/{download.md.html => download.markdown.html} (100%) create mode 100644 transfersh-web/download.video.html diff --git a/transfersh-server/handlers.go b/transfersh-server/handlers.go index 878e0d7..9f28c5b 100644 --- a/transfersh-server/handlers.go +++ b/transfersh-server/handlers.go @@ -77,8 +77,12 @@ func previewHandler(w http.ResponseWriter, r *http.Request) { switch { case strings.HasPrefix(contentType, "image/"): templatePath = "download.image.html" + case strings.HasPrefix(contentType, "video/"): + templatePath = "download.video.html" + case strings.HasPrefix(contentType, "audio/"): + templatePath = "download.audio.html" case strings.HasPrefix(contentType, "text/"): - templatePath = "download.md.html" + templatePath = "download.markdown.html" var reader io.ReadCloser if reader, _, _, err = storage.Get(token, filename); err != nil { diff --git a/transfersh-server/static/download.audio.html b/transfersh-server/static/download.audio.html new file mode 100644 index 0000000..6bf8bff --- /dev/null +++ b/transfersh-server/static/download.audio.html @@ -0,0 +1,142 @@ + + + + + + + + + + + + transfer.sh - Easy and fast file sharing from the command-line. + + + + + + + + + + + + + + + +
+
+
+

{{.Filename}}

+

type: {{.ContentType}}

+

size: {{.ContentLength | format "#,###."}} bytes

+
+
+
+ +
+
+ +
+
+
+
+
+ +
+ copy link    + download + +
+
+
+ + + + + + Fork me on GitHub + + + + + + + + + + + + + + + + + + diff --git a/transfersh-server/static/download.md.html b/transfersh-server/static/download.markdown.html similarity index 100% rename from transfersh-server/static/download.md.html rename to transfersh-server/static/download.markdown.html diff --git a/transfersh-server/static/download.video.html b/transfersh-server/static/download.video.html new file mode 100644 index 0000000..b3c5701 --- /dev/null +++ b/transfersh-server/static/download.video.html @@ -0,0 +1,142 @@ + + + + + + + + + + + + transfer.sh - Easy and fast file sharing from the command-line. + + + + + + + + + + + + + + + +
+
+
+

{{.Filename}}

+

type: {{.ContentType}}

+

size: {{.ContentLength | format "#,###."}} bytes

+
+
+
+ +
+
+ +
+
+
+
+
+ +
+ copy link    + download + +
+
+
+ + + + + + Fork me on GitHub + + + + + + + + + + + + + + + + + + diff --git a/transfersh-server/static/index.html b/transfersh-server/static/index.html index b121767..932c10a 100644 --- a/transfersh-server/static/index.html +++ b/transfersh-server/static/index.html @@ -173,7 +173,8 @@ # Add this to .bashrc or its equivalent
transfer() {
# write to output to tmpfile because of progress bar -
tmpfile=$( mktemp -t transferXXX ); curl --progress-bar --upload-file $1 https://transfer.sh/$(basename $1) >> $tmpfile; cat $tmpfile; rm -f $tmpfile; } +
tmpfile=$( mktemp -t transferXXX ); basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; cat $tmpfile; rm -f $tmpfile; +
}

alias transfer=transfer
diff --git a/transfersh-web/download.audio.html b/transfersh-web/download.audio.html new file mode 100644 index 0000000..2c8bda7 --- /dev/null +++ b/transfersh-web/download.audio.html @@ -0,0 +1,67 @@ + + + + + + + + +include "includes/head.html" + + + + + include "includes/navigation.html" + +
+
+
+

{{.Filename}}

+

type: {{.ContentType}}

+

size: {{.ContentLength | format "#,###."}} bytes

+
+
+
+ +
+
+ +
+
+
+
+
+ +
+ copy link    + download + +
+
+
+ + include "includes/footer.html" + include "includes/js.html" + + + + diff --git a/transfersh-web/download.md.html b/transfersh-web/download.markdown.html similarity index 100% rename from transfersh-web/download.md.html rename to transfersh-web/download.markdown.html diff --git a/transfersh-web/download.video.html b/transfersh-web/download.video.html new file mode 100644 index 0000000..209a7d4 --- /dev/null +++ b/transfersh-web/download.video.html @@ -0,0 +1,67 @@ + + + + + + + + +include "includes/head.html" + + + + + include "includes/navigation.html" + +
+
+
+

{{.Filename}}

+

type: {{.ContentType}}

+

size: {{.ContentLength | format "#,###."}} bytes

+
+
+
+ +
+
+ +
+
+
+
+
+ +
+ copy link    + download + +
+
+
+ + include "includes/footer.html" + include "includes/js.html" + + + +