summaryrefslogtreecommitdiff
path: root/view.go
blob: 005be2c922b43730e3000603aa981cbf2cece4b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package main

func getTemplate() string {
	return `<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>{{.URL}}</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<style>/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background-color:transparent}a:active,a:hover{outline:0}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}.container{position:relative;width:100%;max-width:960px;margin:0 auto;padding:0 20px;box-sizing:border-box}.column{width:100%;float:left;box-sizing:border-box}@media (min-width:400px){.container{width:85%;padding:0}}@media (min-width:550px){.container{width:80%}.column{margin-left:4%}.column:first-child{margin-left:0}}html{font-size:62.5%}body{font-size:1.5em;line-height:1.6;font-weight:400;font-family:Raleway,HelveticaNeue,"Helvetica Neue",Helvetica,Arial,sans-serif;color:#222}h4{margin-top:0;margin-bottom:2rem;font-weight:300;font-size:2.4rem;line-height:1.35;letter-spacing:-.08rem}@media (min-width:550px){h4{font-size:3rem}}a{color:#1EAEDB}a:hover{color:#0FA0CE}blockquote{margin-bottom:2.5rem}.container:after,.row:after{content:"";display:table;clear:both}.margin-top{margin-top:20px}.dir,.dir:hover{color:#1EAEDB}.dir:hover{text-decoration:none}span.icono-folder{color: #1EAEDB}.file,span.icono-caretUp,span.icono-home,span.icono-file{color:#000}span.icono-home:hover{color:#1EAEDB}
/*git.io/icono*/ .icono-file,.icono-folder,.icono-home,.icono-home:after,.icono-home:before{border:2px solid}.icono-home{width:22px;height:16px;border-top:none;margin:15px 6px 3px}.icono-home:before{width:18px;height:18px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg);position:absolute;left:-2px;top:-7px;border-right-color:transparent;border-bottom-color:transparent}.icono-home:after{width:6px;height:10px;bottom:0;position:absolute;left:50%;-webkit-transform:translateX(-50%);-ms-transform:translateX(-50%);transform:translateX(-50%);border-width:1px;border-bottom:none}.icono-file{width:26px;height:32px;border-radius:0 12px 0 0;margin:1px 4px}.icono-file:before{position:absolute;top:-2px;right:-2px;border-style:solid;width:0;height:0;border-width:5px;border-top-color:transparent;border-right-color:transparent}.icono-folder{width:18px;height:22px;border-left-width:0;border-radius:0 3px 3px 0;margin:8px 2px 4px 14px}.icono-folder:before{position:absolute;width:12px;height:20px;left:-12px;bottom:-2px;border-width:0 0 2px 2px;border-style:solid;border-radius:0 0 0 3px}.icono-folder:after{position:absolute;width:10px;height:5px;left:-12px;top:-7px;border-width:2px 2px 0;border-style:solid;border-radius:3px 3px 0 0}.icono-caretUp{width:12px;height:20px;margin:7px 11px}.icono-caretUp:after,.icono-caretUp:before{width:14px;height:2px;position:absolute;bottom:0;margin:auto 0;right:2px;box-shadow:inset 0 0 0 32px;-webkit-transform-origin:right;-ms-transform-origin:right;transform-origin:right}.icono-caretUp:before{top:2px;-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.icono-caretUp:after{top:0;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.icono-caretUp{-webkit-transform:rotate(-90deg);-ms-transform:rotate(-90deg);transform:rotate(-90deg)}[class*=icono-]{display:inline-block;vertical-align:middle;position:relative;font-style:normal;color:#ddd;text-align:left;text-indent:-9999px;direction:ltr}[class*=icono-]:after,[class*=icono-]:before{content:'';pointer-events:none}[class*=icono-]{box-sizing:border-box}</style>
	{{.Favicon}}
</head>
<body>
	<div class="container">
		<div class="row">
			<div class="column margin-top">
				<h4><a href="/" title="Go back to root" class="file"><span class="icono-home"></span></a> - {{.URL}}</h4>
				{{if .AllowUpload}}<p>To upload please click <a href="/upload" title="Upload" class="dir">here</a>.</p>{{end}}
				<blockquote>
					{{if ne .URL "/"}}
					<a class="dir" href=".."><span class="icono-caretUp"></span> .. (up a dir)</a><br><br>
					{{end}}
					{{range .Links}}
					<a href="{{.Url}}" class="{{if .IsDir}}dir" title="Directory: {{.Text}}"><span class="icono-folder"></span>{{else}}file" title="File: {{.Text}}"><span class="icono-file"></span>{{end}} {{.Text}}</a><br>
					{{end}}
				</blockquote>
			</div>
		</div>
	</div>
</body>
</html>`
}

func get404() string {
	return `<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>Not Found - {{.URL}}</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<style>/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background-color:transparent}a:active,a:hover{outline:0}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}.container{position:relative;width:100%;max-width:960px;margin:0 auto;padding:0 20px;box-sizing:border-box}@media (min-width:400px){.container{width:85%;padding:0}}@media (min-width:550px){.container{width:80%}}html{font-size:62.5%}body{font-size:1.5em;line-height:1.6;font-weight:400;font-family:Raleway,HelveticaNeue,"Helvetica Neue",Helvetica,Arial,sans-serif;color:#222}h3{margin-top:0;margin-bottom:2rem;font-weight:300;font-size:3rem;line-height:1.3;letter-spacing:-.1rem}@media (min-width:550px){h3{font-size:3.6rem}}p{margin-top:0}a{color:#1EAEDB}a:hover{color:#0FA0CE}.button{display:inline-block;height:38px;padding:0 30px;color:#555;text-align:center;font-size:11px;font-weight:600;line-height:38px;letter-spacing:.1rem;text-transform:uppercase;text-decoration:none;white-space:nowrap;background-color:transparent;border-radius:4px;border:1px solid #bbb;cursor:pointer;box-sizing:border-box}.button:focus,.button:hover{color:#333;border-color:#888;outline:0}.button.button-primary{color:#FFF;background-color:#33C3F0;border-color:#33C3F0}.button.button-primary:focus,.button.button-primary:hover{color:#FFF;background-color:#1EAEDB;border-color:#1EAEDB}.button{margin-bottom:1rem}p{margin-bottom:2.5rem}.container:after{content:"";display:table;clear:both}.section{padding:8rem 0 7rem;text-align:center}.section-description,.section-heading{margin-bottom:1.2rem}</style>
	{{.Favicon}}
</head>
<body>
<div class="section">
	<div class="container">
		<h3 class="section-heading">Not Found - {{.URL}}</h3>
		<p class="section-description">
		Please check for typos in your url. </p>
		<p class="section-description">
		<a href="/" class="button button-primary">Go back to root</a>
		</p>
	</div>
</div>
</body>
</html>`
}

func getUpload() string {
	return `<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>Upload Form</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
<style>/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}input{color:inherit;font:inherit;margin:0}input[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}.container{position:relative;width:100%;max-width:960px;margin:0 auto;padding:0 20px;box-sizing:border-box}@media (min-width:400px){.container{width:85%;padding:0}}@media (min-width:550px){.container{width:80%}}html{font-size:62.5%}body{font-size:1.5em;line-height:1.6;font-weight:400;font-family:Raleway,HelveticaNeue,"Helvetica Neue",Helvetica,Arial,sans-serif;color:#222}h3{margin-top:0;margin-bottom:2rem;font-weight:300;font-size:3rem;line-height:1.3;letter-spacing:-.1rem}@media (min-width:550px){h3{font-size:3.6rem}}p{margin-top:0}input[type=submit]{display:inline-block;height:38px;padding:0 30px;color:#555;text-align:center;font-size:11px;font-weight:600;line-height:38px;letter-spacing:.1rem;text-transform:uppercase;text-decoration:none;white-space:nowrap;background-color:transparent;border-radius:4px;border:1px solid #bbb;cursor:pointer;box-sizing:border-box}input[type=submit]:focus,input[type=submit]:hover{color:#333;border-color:#888;outline:0}input[type=submit].button-primary{color:#FFF;background-color:#33C3F0;border-color:#33C3F0}input[type=submit].button-primary:focus,input[type=submit].button-primary:hover{color:#FFF;background-color:#1EAEDB;border-color:#1EAEDB}input{margin-bottom:1.5rem}form,p{margin-bottom:2.5rem}.container:after{content:"";display:table;clear:both}.section{padding:8rem 0 7rem;text-align:center}.section-description,.section-heading{margin-bottom:1.2rem}.section-description{max-width:60%;margin-left:auto;margin-right:auto}</style>
	{{.Favicon}}
</head>
<body>
<div class="section">
	<div class="container">
		<h3 class="section-heading">Upload Form</h3>
		<form class="section-description" method="POST" action="/upload?html=1" enctype="multipart/form-data">
			<p class="section-description" for="file">You are going to upload a file. Here you can search to add it.</p>
			<input type="file" value="Search for your file" id="file" name="file">
			<br>
			<input class="button button-primary" type="submit" value="Submit">
		</form>
	</div>
</div>
</body>
</html>
`
}

func getUploaded() string {
	return `<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>Uploaded {{.File}}</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<style>/*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}a{background-color:transparent}a:active,a:hover{outline:0}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}.container{position:relative;width:100%;max-width:960px;margin:0 auto;padding:0 20px;box-sizing:border-box}@media (min-width:400px){.container{width:85%;padding:0}}@media (min-width:550px){.container{width:80%}}html{font-size:62.5%}body{font-size:1.5em;line-height:1.6;font-weight:400;font-family:Raleway,HelveticaNeue,"Helvetica Neue",Helvetica,Arial,sans-serif;color:#222}h3{margin-top:0;margin-bottom:2rem;font-weight:300;font-size:3rem;line-height:1.3;letter-spacing:-.1rem}@media (min-width:550px){h3{font-size:3.6rem}}p{margin-top:0}a{color:#1EAEDB}a:hover{color:#0FA0CE}.button{display:inline-block;height:38px;padding:0 30px;color:#555;text-align:center;font-size:11px;font-weight:600;line-height:38px;letter-spacing:.1rem;text-transform:uppercase;text-decoration:none;white-space:nowrap;background-color:transparent;border-radius:4px;border:1px solid #bbb;cursor:pointer;box-sizing:border-box}.button:focus,.button:hover{color:#333;border-color:#888;outline:0}.button.button-primary{color:#FFF;background-color:#33C3F0;border-color:#33C3F0}.button.button-primary:focus,.button.button-primary:hover{color:#FFF;background-color:#1EAEDB;border-color:#1EAEDB}.button{margin-bottom:1rem}p{margin-bottom:2.5rem}.container:after{content:"";display:table;clear:both}.section{padding:8rem 0 8rem;text-align:center}.section-description,.section-heading{margin-bottom:1.2rem}</style>
	{{.Favicon}}
</head>
<body>
<div class="section">
	<div class="container">
		<h3 class="section-heading">Uploaded!</h3>
		<p class="section-description">
			<strong>{{.File}}</strong> was successfull uploaded.
		</p>
		<p class="section-description">
		<a href="/" class="button button-primary">Back to root</a>
		</p>
	</div>
</div>
</body>
</html>`
}