1
0
mirror of https://github.com/dutchcoders/transfer.sh.git synced 2020-11-18 19:53:40 -08:00

added sandbox

This commit is contained in:
Remco 2016-01-14 09:33:02 +01:00
parent 04460833e4
commit 0fd93a8b01
11 changed files with 225 additions and 64 deletions

View File

@ -34,10 +34,6 @@ import (
"compress/gzip" "compress/gzip"
"errors" "errors"
"fmt" "fmt"
"github.com/dutchcoders/go-clamd"
"github.com/gorilla/mux"
"github.com/kennygrant/sanitize"
"github.com/russross/blackfriday"
html_template "html/template" html_template "html/template"
"io" "io"
"io/ioutil" "io/ioutil"
@ -51,6 +47,12 @@ import (
"strings" "strings"
text_template "text/template" text_template "text/template"
"time" "time"
clamd "github.com/dutchcoders/go-clamd"
"github.com/gorilla/mux"
"github.com/kennygrant/sanitize"
"github.com/russross/blackfriday"
) )
func healthHandler(w http.ResponseWriter, r *http.Request) { func healthHandler(w http.ResponseWriter, r *http.Request) {
@ -102,7 +104,7 @@ func previewHandler(w http.ResponseWriter, r *http.Request) {
} else if strings.HasPrefix(contentType, "text/plain") { } else if strings.HasPrefix(contentType, "text/plain") {
content = html_template.HTML(fmt.Sprintf("<pre>%s</pre>", data)) content = html_template.HTML(fmt.Sprintf("<pre>%s</pre>", data))
} else { } else {
content = html_template.HTML(data) templatePath = "download.sandbox.html"
} }
default: default:

View File

@ -85,11 +85,7 @@
<footer> <footer>
<div class="wrapper"> <div class="wrapper">
<div style="">
<a href="bitcoin:164ybRMLbg1dhhWWiUkXtiNr7jUhMKdJqH" label="Bitcoin+Donation" style="word-wrap: break-word;">
<img border="0" src=" /images/bitcoin.png" style="margin: 0 auto;;">
</a>
</div>
<br/> <br/>
<br/> <br/>
<img src="/images/Logo-orange.png" alt="Founded in Holland"> <img src="/images/Logo-orange.png" alt="Founded in Holland">

View File

@ -70,11 +70,7 @@
<footer> <footer>
<div class="wrapper"> <div class="wrapper">
<div style="">
<a href="bitcoin:164ybRMLbg1dhhWWiUkXtiNr7jUhMKdJqH" label="Bitcoin+Donation" style="word-wrap: break-word;">
<img border="0" src=" /images/bitcoin.png" style="margin: 0 auto;;">
</a>
</div>
<br/> <br/>
<br/> <br/>
<img src="/images/Logo-orange.png" alt="Founded in Holland"> <img src="/images/Logo-orange.png" alt="Founded in Holland">

View File

@ -82,11 +82,7 @@
<footer> <footer>
<div class="wrapper"> <div class="wrapper">
<div style="">
<a href="bitcoin:164ybRMLbg1dhhWWiUkXtiNr7jUhMKdJqH" label="Bitcoin+Donation" style="word-wrap: break-word;">
<img border="0" src=" /images/bitcoin.png" style="margin: 0 auto;;">
</a>
</div>
<br/> <br/>
<br/> <br/>
<img src="/images/Logo-orange.png" alt="Founded in Holland"> <img src="/images/Logo-orange.png" alt="Founded in Holland">

View File

@ -81,11 +81,7 @@
<footer> <footer>
<div class="wrapper"> <div class="wrapper">
<div style="">
<a href="bitcoin:164ybRMLbg1dhhWWiUkXtiNr7jUhMKdJqH" label="Bitcoin+Donation" style="word-wrap: break-word;">
<img border="0" src=" /images/bitcoin.png" style="margin: 0 auto;;">
</a>
</div>
<br/> <br/>
<br/> <br/>
<img src="/images/Logo-orange.png" alt="Founded in Holland"> <img src="/images/Logo-orange.png" alt="Founded in Holland">

View File

@ -0,0 +1,120 @@
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>transfer.sh - Easy and fast file sharing from the command-line.</title>
<meta name="description" content="Easy and fast file sharing from the command-line.">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="stylesheet" href="/styles/main.css">
<link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:100,200,300' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
<script src="/scripts/vendor/modernizr.js"></script>
</head>
<body id="download">
<script>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-40833733-1', 'transfer.sh');
ga('send', 'pageview');
</script>
<div id="navigation">
<div class="wrapper">
<a href="/">
<h1>transfer.sh</h1>
</a>
<ul class="hidden-xs">
<li><a href="/">home</a>
</li>
<li><a href="/#samples">sample use cases</a>
</li>
<li><a href="/#contact">contact us</a>
</li>
</ul>
</div>
</div>
<section id="home">
<div class="wrapper">
<br/>
<h2 class="page-title">{{.Filename}}</h2>
<h4>type: <b>{{.ContentType}}</b></h4>
<h4>size: <b>{{.ContentLength | format "#,###."}}</b> bytes</h4>
<a href="{{.Url}}" class="btn-cta btn"> download</i> </a> <br/><br/>
<div class="row animated fadeInDown">
<div id="from-terminal" class=" box col-md-8 col-md-offset-2 col-xs-12">
<div class="terminal-top">
</div>
<div id="terminal" class="terminal">
<iframe src="{{ .Url }}" id="md-preview" sandbox></iframe>
</div>
</div>
</div>
<br/>
</section>
<footer>
<div class="wrapper">
<br/>
<br/>
<img src="/images/Logo-orange.png" alt="Founded in Holland">
<p>Made with <i class="icon-heart"></i> by <a href="http://blog.dutchcoders.io/" title="Dutch Coders">Dutch Coders</a>
</p>
</div>
</footer>
<a href="https://github.com/dutchcoders/transfer.sh/"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
<script>
(function() {
var uv = document.createElement('script');
uv.type = 'text/javascript';
uv.async = true;
uv.src = '//widget.uservoice.com/5rkATbLIm8ClJQeOirOhFg.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(uv, s)
})()
</script>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<script src="/scripts/main.js"></script>
</body>
</html>

View File

@ -85,11 +85,7 @@
<footer> <footer>
<div class="wrapper"> <div class="wrapper">
<div style="">
<a href="bitcoin:164ybRMLbg1dhhWWiUkXtiNr7jUhMKdJqH" label="Bitcoin+Donation" style="word-wrap: break-word;">
<img border="0" src=" /images/bitcoin.png" style="margin: 0 auto;;">
</a>
</div>
<br/> <br/>
<br/> <br/>
<img src="/images/Logo-orange.png" alt="Founded in Holland"> <img src="/images/Logo-orange.png" alt="Founded in Holland">

View File

@ -1,10 +1,6 @@
<footer> <footer>
<div class="wrapper"> <div class="wrapper">
<div style="">
<a href="bitcoin:164ybRMLbg1dhhWWiUkXtiNr7jUhMKdJqH" label="Bitcoin+Donation" style="word-wrap: break-word;">
<img border="0" src=" /images/bitcoin.png" style="margin: 0 auto;;">
</a>
</div>
<br/> <br/>
<br/> <br/>
<img src="/images/Logo-orange.png" alt="Founded in Holland"> <img src="/images/Logo-orange.png" alt="Founded in Holland">

View File

@ -72,7 +72,7 @@
<br> <br>
<span class="code-title"># Using the alias</span> <span class="code-title"># Using the alias</span>
<br>$ transfer hello.txt <br>$ transfer hello.txt
<br>##################################################### 100.0% https://transfer.sh/eibhM/hello.txt <br>###################################s################## 100.0% https://transfer.sh/eibhM/hello.txt
</code> </code>
</div> </div>
<div id="web"> <div id="web">
@ -140,7 +140,12 @@
</div> </div>
</section> </section>
<section id="share">
<div class="wrapper">
<h2 class="page-title">Preview your files in the browser!</h2>
</div>
</section>
<section id="samples"> <section id="samples">
<div class="wrapper"> <div class="wrapper">
@ -165,7 +170,7 @@
</div> </div>
</div> </div>
<div class="col-md-6 "> <div class="col-md-6 ">
<h3>Create an alias and add it to .bashrc or .zshrc <a href='https://gist.github.com/nl5887/a511f172d3fb3cd0e42d'>[gist]</a></h3> <h3>Add an alias to .bashrc or .zshrc <a href='https://gist.github.com/nl5887/a511f172d3fb3cd0e42d'>[gist]</a></h3>
<div class="terminal-top"> <div class="terminal-top">
</div> </div>
<div class="terminal"> <div class="terminal">
@ -381,6 +386,8 @@
</div> </div>
</section> </section>
<section id="share"> <section id="share">
<div class="wrapper"> <div class="wrapper">
<h2 class="page-title">Share the love</h2> <h2 class="page-title">Share the love</h2>
@ -415,10 +422,35 @@
</div> </div>
</section> </section>
<section id="thank-you">
<div class="wrapper">
<h2 class="page-title">
Special thanks to </h2>
<br>
<div class="row">
<div class="col-md-4 col-md-offset-2 col-xs-12">
<a class="btn-cta" href="https://twitter.com/remco_verhoef"><i class="icon-twitter"></i> Remco Verhoef</a>
</div>
<div class="col-md-4 col-xs-12">
<a class="btn-cta" href="http://twitter.com/uvisgrinfelds"><i class="icon-twitter"></i> Uvis Grinfelds</a>
</div>
</div>
<h3>Want to be here? Support us!</h3>
<div class="donate">
<a href="bitcoin:164ybRMLbg1dhhWWiUkXtiNr7jUhMKdJqH" label="Bitcoin+Donation" style="word-wrap: break-word;">
<img border="0" src=" /images/bitcoin.png" style="margin: 0 auto;;">
</a>
</div>
</div>
</section>
<section id="tor"> <section id="tor">
<div class="wrapper"> <div class="wrapper">
<a href="https://www.torproject.org"><img src="images/tor.svg" alt=""></a><br/> <a href="https://www.torproject.org"><img src="images/tor.svg" alt="">
</a>
<br/>
<a href="http://jxm5d6emw5rknovg.onion/">http://jxm5d6emw5rknovg.onion/</a> <a href="http://jxm5d6emw5rknovg.onion/">http://jxm5d6emw5rknovg.onion/</a>
</div> </div>
</section> </section>
@ -426,11 +458,7 @@
<footer> <footer>
<div class="wrapper"> <div class="wrapper">
<div style="">
<a href="bitcoin:164ybRMLbg1dhhWWiUkXtiNr7jUhMKdJqH" label="Bitcoin+Donation" style="word-wrap: break-word;">
<img border="0" src=" /images/bitcoin.png" style="margin: 0 auto;;">
</a>
</div>
<br/> <br/>
<br/> <br/>
<img src="/images/Logo-orange.png" alt="Founded in Holland"> <img src="/images/Logo-orange.png" alt="Founded in Holland">
@ -461,15 +489,11 @@
<script src="/scripts/main.js"></script> <script src="/scripts/main.js"></script>
</body> </body>
</html> </html>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,39 @@
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
include "includes/head.html"
<body id="download">
include "includes/ga.html"
include "includes/navigation.html"
<section id="home">
<div class="wrapper">
include "includes/download-top.html"
<div class="row animated fadeInDown">
<div id="from-terminal" class=" box col-md-8 col-md-offset-2 col-xs-12">
<div class="terminal-top">
</div>
<div id="terminal" class="terminal">
<iframe src="{{ .Url }}" id="md-preview" sandbox></iframe>
</div>
</div>
</div>
<br/>
</section>
include "includes/footer.html"
include "includes/js.html"
</body>
</html>