move meta tags to template, begin of user portal

This commit is contained in:
2018-06-25 23:05:18 +02:00
parent 24b74a1b60
commit 12d2560133
20 changed files with 136 additions and 423 deletions

View File

@@ -2,6 +2,7 @@ package pixelapi
import ( import (
"io" "io"
"time"
) )
// GetFile makes a file download request and returns a readcloser. Don't forget // GetFile makes a file download request and returns a readcloser. Don't forget
@@ -14,8 +15,8 @@ func (p *PixelAPI) GetFile(id string) (io.ReadCloser, error) {
type FileInfo struct { type FileInfo struct {
ID string `json:"id"` ID string `json:"id"`
FileName string `json:"file_name"` FileName string `json:"file_name"`
DateUpload int64 `json:"date_upload"` DateUpload time.Time `json:"date_upload"`
DateLastview int64 `json:"date_last_view"` DateLastview time.Time `json:"date_last_view"`
DaysValid uint16 `json:"days_valid"` DaysValid uint16 `json:"days_valid"`
FileSize uint64 `json:"file_size"` FileSize uint64 `json:"file_size"`
Views uint `json:"views"` Views uint `json:"views"`

View File

@@ -26,7 +26,7 @@ var UploadProgressBar = /** @class */ (function () {
this.uploadDiv.setAttribute('style', 'background: #111'); this.uploadDiv.setAttribute('style', 'background: #111');
this.uploadDiv.setAttribute('href', '/u/' + id); this.uploadDiv.setAttribute('href', '/u/' + id);
this.uploadDiv.setAttribute("target", "_blank"); this.uploadDiv.setAttribute("target", "_blank");
this.uploadDivJQ.html('<img src="/api/file/' + id + '/thumbnail" alt="' + this.file.name + '"/>' this.uploadDivJQ.html('<img src="' + apiEndpoint + '/file/' + id + '/thumbnail" alt="' + this.file.name + '"/>'
+ this.file.name + '<br/>' + this.file.name + '<br/>'
+ '<span style="color: var(--highlight_color);">' + window.location.hostname + '/u/' + id + '</span>'); + '<span style="color: var(--highlight_color);">' + window.location.hostname + '/u/' + id + '</span>');
}; };
@@ -161,7 +161,7 @@ var UploadWorker = /** @class */ (function () {
var that = this; // jquery changes the definiton of "this" var that = this; // jquery changes the definiton of "this"
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: "/api/file", url: apiEndpoint + "/file",
data: formData, data: formData,
timeout: 7200000, timeout: 7200000,
cache: false, cache: false,

View File

@@ -1,6 +1,3 @@
/* global API_URL */
var uploads; var uploads;
$(document).ready(function () { $(document).ready(function () {
@@ -17,7 +14,7 @@ $(document).ready(function () {
$.ajax({ $.ajax({
type: "GET", type: "GET",
dataType: "json", dataType: "json",
url: APIURL + "/file/" + id + "/info", url: apiEndpoint + "/file/" + id + "/info",
async: true, async: true,
success: function(data) { success: function(data) {
historyAddItem(data); historyAddItem(data);
@@ -49,14 +46,16 @@ function historyAddItem(json) {
return; return;
} }
var date = new Date(json.date_upload * 1000); var date = new Date(json.date_upload);
var uploadItem = '<a href="/u/'+ json.id +'" target="_blank" class="file_button">' var uploadItem = '<a href="/u/'+ json.id +'" target="_blank" class="file_button">'
+ '<img src="'+ APIURL + json.thumbnail_href + '"' + '<img src="'+ apiEndpoint + json.thumbnail_href + '"'
+ "alt=\"" + json.file_name + "\" />" + "alt=\"" + json.file_name + "\" />"
+ '<span style="color: var(--highlight_color);">'+json.file_name+'</span>' + '<span style="color: var(--highlight_color);">'+json.file_name+'</span>'
+ "<br/>" + "<br/>"
+ date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + date.getFullYear() + "-"
+ ("00" + (date.getMonth() + 1)).slice(-2) + "-"
+ ("00" + date.getDate()).slice(-2)
+ "</a>"; + "</a>";
$("#uploadedFiles").append($(uploadItem).hide().fadeIn(400)); $("#uploadedFiles").append($(uploadItem).hide().fadeIn(400));

View File

@@ -1,3 +1,4 @@
declare var apiEndpoint: string;
var uploader: UploadManager|null = null; var uploader: UploadManager|null = null;
var finishedUploads: Array<string> = new Array() var finishedUploads: Array<string> = new Array()
var totalUploads: number = 0 var totalUploads: number = 0
@@ -44,7 +45,7 @@ class UploadProgressBar implements FileUpload {
this.uploadDiv.setAttribute('href', '/u/'+id) this.uploadDiv.setAttribute('href', '/u/'+id)
this.uploadDiv.setAttribute("target", "_blank"); this.uploadDiv.setAttribute("target", "_blank");
this.uploadDivJQ.html( this.uploadDivJQ.html(
'<img src="/api/file/'+id+'/thumbnail" alt="'+this.file.name+'"/>' '<img src="'+apiEndpoint+'/file/'+id+'/thumbnail" alt="'+this.file.name+'"/>'
+ this.file.name+'<br/>' + this.file.name+'<br/>'
+ '<span style="color: var(--highlight_color);">'+window.location.hostname+'/u/'+id+'</span>' + '<span style="color: var(--highlight_color);">'+window.location.hostname+'/u/'+id+'</span>'
) )

View File

@@ -1,3 +1,5 @@
declare var apiEndpoint: string;
interface FileUpload { interface FileUpload {
file: Blob file: Blob
name: string name: string
@@ -73,7 +75,7 @@ class UploadWorker {
$.ajax({ $.ajax({
type: 'POST', type: 'POST',
url: "/api/file", url: apiEndpoint+"/file",
data: formData, data: formData,
timeout: 7200000, // 2 hours timeout: 7200000, // 2 hours
cache: false, cache: false,

View File

@@ -0,0 +1,20 @@
{{define "file_manager"}}<!DOCTYPE html>
<html>
<head>
{{template "meta_tags" "File Manager"}}
<script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script>
</head>
<body>
{{template "menu" .}}
<div class="highlight_dark border_bottom">
These files were uploaded while logged in to your pixeldrain account,
<a href="/history">click here</a> to view files uploaded anonymously
in this browser.
</div>
{{template "analytics"}}
</body>
</html>
{{end}}

View File

@@ -1,75 +0,0 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>File Browser ~ PixelDrain</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/res/style/home.css"/>
<link rel="stylesheet" href="/res/style/season.css"/>
<link rel="stylesheet" href="/res/style/history.css"/>
<link rel="stylesheet" href="/res/style/menu.css"/>
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<meta name="theme-color" content="#9FCF6C"/>
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="/res/img/pixeldrain_big.png"/>
<style th:include="fragments :: background-pattern" th:inline="text"></style>
<meta name="description" content="PixelDrain is a free file sharing service, you
can upload any file and you will be given a shareable link right away.
PixelDrain also supports previews for images, videos, audio, PDFs and much more.
Uncensored, unmonitored and unmoderated."/>
</head>
<body>
<div id='body' class="body">
<div th:replace="fragments :: menu"></div>
<br/>
<div style="margin-left: 0; margin-right: 0; text-align: center; font-size: 22px;">
<a th:href="'/account/files?pageid=' + ${pageid - 1}">Previous</a>
&nbsp;&nbsp;&#60;--&nbsp;&nbsp;<span th:text="${pageid}">0</span>&nbsp;&nbsp;--&#62;&nbsp;&nbsp;
<a th:href="'/account/files?pageid=' + ${pageid + 1}">Nextious</a>
</div>
<div id="uploadedFiles" class="uploadedFiles">
<div class="uploadItem" th:each="file,interation : ${files}">
<a th:href="'/u/' + ${file.getId()}" th:inline="text" target="_blank">
<img th:src="'/api/thumbnail/' + ${file.getId()}" th:alt="${file.getFileName()}" class="uploadItemImage"/>
</a>
<a th:href="'/u/' + ${file.getId()}" th:inline="text" target="_blank" class="uploadItemText">
[[${file.getFileName()}]]
<br/>
<span th:text="${file.getDateUpload().toString()}"></span>
</a>
</div>
</div>
<div style="margin-left: 0; margin-right: 0; text-align: center; font-size: 22px;">
<a th:href="'/account/files?pageid=' + ${pageid - 1}">Previous</a>
&nbsp;&nbsp;&#60;--&nbsp;&nbsp;<span th:text="${pageid}">0</span>&nbsp;&nbsp;--&#62;&nbsp;&nbsp;
<a th:href="'/account/files?pageid=' + ${pageid + 1}">Nextious</a>
</div>
</div>
<!-- Google Analytics Tracking Code -->
<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-24463738-4', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>

View File

@@ -2,34 +2,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Login ~ PixelDrain</title> {{template "meta_tags" "Login"}}
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/global.css"/>
<link rel="stylesheet" href="/res/style/layout.css"/>
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<meta name="theme-color" content="#9FCF6C"/>
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="/res/img/pixeldrain_big.png"/>
{{template "bgpattern"}}
<meta name="description" content="PixelDrain is a free file sharing service, you
can upload any file and you will be given a shareable link right away.
PixelDrain also supports previews for images, videos, audio, PDFs and much more.
Uncensored, unmonitored and unmoderated."/>
<meta property="og:type" content="website" />
<meta property="og:title" content="Login ~ PixelDrain" />
<meta property="og:site_name" content="PixelDrain" />
<meta property="og:description" content="Instant file and screenshot sharing." />
<meta property="og:url" content="http://pixeldra.in/" />
<meta property="og:image" content="/res/img/pixeldrain_big.png" />
<meta property="og:image:type" content="image/png" />
<script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script> <script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script>
</head> </head>
<body> <body>
<div id='body' class="body"> <div id='body' class="body">
{{template "menu" .}} {{template "menu" .}}

View File

@@ -1,30 +1,7 @@
{{define "logout"}}<!DOCTYPE html> {{define "logout"}}<!DOCTYPE html>
<html> <html>
<head> <head>
<title>Logging out... ~ Pixeldrain</title> {{template "meta_tags" "Logging out..."}}
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/global.css"/>
<link rel="stylesheet" href="/res/style/layout.css"/>
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<meta name="theme-color" content="#9FCF6C"/>
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="/res/img/pixeldrain_big.png"/>
{{template "bgpattern"}}
<meta name="description" content="PixelDrain is a free file sharing service, you
can upload any file and you will be given a shareable link right away.
PixelDrain also supports previews for images, videos, audio, PDFs and much more.
Uncensored, unmonitored and unmoderated."/>
<meta property="og:type" content="website" />
<meta property="og:title" content="Logging out... ~ Pixeldrain" />
<meta property="og:site_name" content="Pixeldrain" />
<meta property="og:description" content="Instant file and screenshot sharing." />
<meta property="og:url" content="http://pixeldra.in/" />
<meta property="og:image" content="/res/img/pixeldrain_big.png" />
<meta property="og:image:type" content="image/png" />
</head> </head>
<body> <body>
<div id='body' class="body"> <div id='body' class="body">
@@ -39,15 +16,15 @@
<p> <p>
We need you to confirm your action here so we can be sure that We need you to confirm your action here so we can be sure that
you really requested a logout. If we didn't do this, anyone (or you really requested a logout. If we didn't do this, anyone (or
any website) would be able to send you to the page any website) would be able to send you to this page and you
pixeldrain.com/logout and you would automatically get logged would automatically get logged out of Pixeldrain, which would be
out of Pixeldrain, which would be very annoying. very annoying.
</p> </p>
<p> <p>
To prevent this from happening we're verifying that you actually To prevent this from happening we're verifying that you actually
want to log out by making you submit this form. Because this want to log out by making you click this button. Because this
logout button triggers a different request type than normal logout button triggers a different request type than normal
page vitis we can confirm that you really want to log out. page visit we can confirm that you really want to log out.
</p> </p>
{{template "footer"}} {{template "footer"}}

View File

@@ -1,34 +1,7 @@
{{define "register"}} {{define "register"}}<!DOCTYPE html>
<!DOCTYPE html>
<html> <html>
<head> <head>
<title>Register ~ PixelDrain</title> {{template "meta_tags" "Register"}}
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="theme-color" content="#82C13E"/>
<meta name="description" content="PixelDrain is a free file sharing service, you
can upload any file and you will be given a shareable link right away.
PixelDrain also supports previews for images, videos, audio, PDFs and much more.
Uncensored, unmonitored and unmoderated."/>
<meta property="og:type" content="website" />
<meta property="og:title" content="Register ~ PixelDrain" />
<meta property="og:site_name" content="PixelDrain" />
<meta property="og:description" content="Instant file and screenshot sharing." />
<meta property="og:url" content="http://pixeldra.in/" />
<meta property="og:image" content="/res/img/pixeldrain_big.png" />
<meta property="og:image:type" content="image/png" />
<link rel="stylesheet" href="/global.css"/>
<link rel="stylesheet" href="/res/style/layout.css"/>
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="/res/img/pixeldrain_big.png"/>
<script src="https://www.google.com/recaptcha/api.js"></script>
{{template "bgpattern"}}
<script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script> <script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script>
</head> </head>

View File

@@ -1,99 +1,18 @@
<!DOCTYPE html> {{define "user_home"}}<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"> <html>
<head> <head>
<title>File Overview ~ PixelDrain</title> {{template "meta_tags" .Username}}
<meta charset="UTF-8"/> <script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/res/style/home.css"/>
<link rel="stylesheet" href="/res/style/season.css"/>
<link rel="stylesheet" href="/res/style/global.css"/>
<link rel="stylesheet" href="/res/style/history.css"/>
<link rel="stylesheet" href="/res/style/menu.css"/>
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<meta name="theme-color" content="#9FCF6C"/>
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="/res/img/pixeldrain_big.png"/>
<style th:include="fragments :: background-pattern" th:inline="text"></style>
<meta name="description" content="PixelDrain is a free file sharing service, you
can upload any file and you will be given a shareable link right away.
PixelDrain also supports previews for images, videos, audio, PDFs and much more.
Uncensored, unmonitored and unmoderated."/>
</head> </head>
<body> <body>
<div id='body' class="body"> <div id='body' class="body">
<div th:replace="fragments :: menu"></div> {{template "menu" .}}
<br/> <h1>Welcome home, {{.Username}}!</h1>
Logged in as <span th:text="${user.getUsername()}"></span>. <a href="/logout">Log out</a>.
<br/><br/>
Bandwidth used past 24 hours:<br/>
<div id="bandwidth-progress-bar" class="progress-bar">
<span th:text="${bandwidth_used} + ' / ' + ${bandwidth_available}"></span>
<div id="bandwidth-progress" th:style="'width: ' + ${bandwidth_percentage} + '%;'">
<span th:text="${bandwidth_used} + ' / ' + ${bandwidth_available}"></span>
</div>
</div>
<br/>
Total size of your files: <span th:text="${account_total_size}"></span>.
<br/><br/>
Your 20 most recently uploaded files:
<div id="uploadedFiles" class="uploadedFiles">
<div class="uploadItem" th:each="file,interation : ${files}">
<a th:href="'/u/' + ${file.getId()}" th:inline="text" target="_blank">
<img th:src="'/api/thumbnail/' + ${file.getId()}" th:alt="${file.getFileName()}" class="uploadItemImage"/>
</a>
<a th:href="'/u/' + ${file.getId()}" th:inline="text" target="_blank" class="uploadItemText">
[[${file.getFileName()}]]
<br/>
<span th:text="${file.getDateUpload().toString()}"></span>
</a>
</div>
</div>
<br/>
<div style="margin-left: 0; margin-right: 0; text-align: center; font-size: 20px;">
<a href="/account/files">Click here to view all your files</a>
</div>
<br/>
Your 20 most recently created lists:
<div id="uploadedFiles" class="uploadedFiles">
<div class="uploadItem" th:each="list,interation : ${lists}" th:inline="text">
<a th:href="'/l/' + ${list.getId()}" target="_blank">
<img th:src="'/api/thumbnail/' + ${list_db.getListItem(list.getId(), 0).getFileId()}" alt="" class="uploadItemImage"/>
</a>
<a th:href="'/l/' + ${list.getId()}" target="_blank" class="uploadItemText">
[[${list.getTitle()}]]
<br/>
<span th:text="${list.getSize()} + ' Items'"></span>
<br/>
<span th:text="${list.getDateCreated().toString()}"></span>
</a>
</div>
</div>
<div style="margin-left: 0; margin-right: 0; text-align: center; font-size: 20px;">
<a href="/account/lists">Click here to view all your lists</a>
</div>
</div>
<!-- Google Analytics Tracking Code --> {{template "footer"}}
<script> </div>
(function (i, s, o, g, r, a, m) { {{template "analytics"}}
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-24463738-4', 'auto');
ga('send', 'pageview');
</script>
</body> </body>
</html> </html>
{{end}}

View File

@@ -1,33 +1,7 @@
{{define "apidoc"}} {{define "apidoc"}}<!DOCTYPE html>
<!DOCTYPE html> <html>
<html xmlns:th="http://www.thymeleaf.org">
<head> <head>
<title>PixelDrain ~ API Documentation</title> {{template "meta_tags" "API Documentation"}}
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/global.css"/>
<link rel="stylesheet" href="/res/style/layout.css"/>
<link rel="stylesheet" href="/res/style/apidoc.css"/>
<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<meta name="theme-color" content="#9FCF6C"/>
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="/res/img/pixeldrain_big.png"/>
{{template "bgpattern"}}
<meta name="description" content="PixelDrain is a free file sharing service, you
can upload any file and you will be given a shareable link right away.
PixelDrain also supports previews for images, videos, audio, PDFs and much more.
Uncensored, unmonitored and unmoderated."/>
<meta property="og:type" content="website" />
<meta property="og:title" content="API Documentation ~ PixelDrain" />
<meta property="og:site_name" content="PixelDrain" />
<meta property="og:description" content="Instant file and screenshot sharing." />
<meta property="og:url" content="http://pixeldra.in/" />
<meta property="og:image" content="/res/img/pixeldrain_big.png" />
<meta property="og:image:type" content="image/png" />
</head> </head>
<body> <body>

View File

@@ -1,39 +1,17 @@
{{define "error"}} {{define "error"}}<!DOCTYPE html>
<!DOCTYPE html> <html>
<html xmlns:th="http://www.thymeleaf.org">
<head> <head>
<title>PixelDrain ~ Error</title> {{template "meta_tags" "Error"}}
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/global.css"/>
<link rel="stylesheet" href="/res/style/layout.css"/>
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<meta name="theme-color" content="#9FCF6C"/>
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="/res/img/pixeldrain_big.png"/>
{{template "bgpattern"}}
<meta name="description" content="PixelDrain is a free file sharing service, you can upload any file and you will be given a shareable link right away. PixelDrain also supports previews for images, videos, audio, PDFs and much more. Uncensored, unmonitored and unmoderated."/>
<meta property="og:type" content="website" />
<meta property="og:title" content="PixelDrain ~ Error" />
<meta property="og:site_name" content="PixelDrain" />
<meta property="og:description" content="Instant file and screenshot sharing." />
<meta property="og:url" content="http://pixeldra.in/" />
<meta property="og:image" content="/res/img/pixeldrain_big.png" />
<meta property="og:image:type" content="image/png" />
</head> </head>
<body> <body>
<div id='body' class="body"> <div id='body' class="body">
{{template "menu" .}} {{template "menu" .}}
<br/> <br/>
<h1>Some Error occured</h1> <h1>Some Error occurred</h1>
Either you made a mistake, or I made a mistake. Either you made a mistake, or I made a mistake.
<br/><br/> <br/><br/>
Anyway, there's nothing to see here, so you'll have to <a href='/'>head over to the index page</a>. Either way, there's nothing to see here, so you'll have to <a href='/'>head over to the home page</a>.
<br/> <br/>
<br/> <br/>
Bye! Bye!

View File

@@ -1,26 +1,20 @@
{{define "file_not_found"}} {{define "file_not_found"}}<!DOCTYPE html>
<!DOCTYPE html>
<html> <html>
<head> <head>
<title>File not found ~ PixelDrain</title> {{template "meta_tags" "File Not Found"}}
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/res/style/viewer.css"/>
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<meta name="theme-color" content="#9FCF6C"/>
<link rel="icon" sizes="180x180" href="res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="res/img/pixeldrain_big.png"/>
</head> </head>
<body> <body>
<div id="body">
{{template "menu"}}
<h1>File not Found</h1> <h1>File not Found</h1>
I'm sorry, but this file does not exist!<br/> I'm sorry, but this file does not exist!<br/>
It may have expired, or taken down by the owner.<br/> It may have expired, or taken down by the owner.<br/>
You can <a href='/'>Visit the homepage to upload your own files</a>. You can <a href='/'>Visit the homepage to upload your own files</a>.
<br/><br/> <br/><br/>
It was fun having you, bye for now! It was fun having you, bye for now!
<br/>
{{template "footer"}}
</div>
{{template "analytics"}} {{template "analytics"}}
</body> </body>
</html> </html>

View File

@@ -1,9 +1,10 @@
{{define "menu"}} {{define "menu"}}
<div id="navigation" class="highlight_light border_top border_bottom navigation"> <div id="navigation" class="highlight_light border_top border_bottom navigation">
<a href="/">Home</a> <a href="/">Home</a>
<a href="/history">My&nbsp;Files</a> <a href="{{if .Authenticated}}/files{{else}}/history{{end}}">My&nbsp;Files</a>
<a href="/api">API</a> <a href="/api">API</a>
{{if .Authenticated}}<a href="/user">{{.Username}}</a>{{else}} {{if .Authenticated}}<a href="/user">{{.Username}}</a>
<a href="/logout" style="vertical-align: 0.6em; font-size: 0.9em; padding: 1px;">(Log out)</a>{{else}}
<a href="/login">Login</a> <a href="/login">Login</a>
<a href="/register">Register</a> <a href="/register">Register</a>
{{end}} {{end}}

View File

@@ -0,0 +1,26 @@
{{define "meta_tags"}}
<title>{{.}} ~ PixelDrain</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/global.css"/>
<link rel="stylesheet" href="/res/style/layout.css"/>
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<meta name="theme-color" content="#9FCF6C"/>
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="/res/img/pixeldrain_big.png"/>
{{template "bgpattern"}}
<meta name="description" content="PixelDrain is a free file sharing service, you
can upload any file and you will be given a shareable link right away.
PixelDrain also supports previews for images, videos, audio, PDFs and much more.
Uncensored, unmonitored and unmoderated."/>
<meta property="og:type" content="website" />
<meta property="og:title" content="{{.}} ~ PixelDrain" />
<meta property="og:site_name" content="PixelDrain" />
<meta property="og:description" content="Instant file and screenshot sharing." />
<meta property="og:url" content="http://pixeldra.in/" />
<meta property="og:image" content="/res/img/pixeldrain_big.png" />
<meta property="og:image:type" content="image/png" />
{{end}}

View File

@@ -1,39 +1,13 @@
{{define "history-cookies"}}<!DOCTYPE html> {{define "history_cookies"}}<!DOCTYPE html>
<html> <html>
<head> <head>
<title>Upload History ~ PixelDrain</title> {{template "meta_tags" "Upload History"}}
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/global.css"/>
<link rel="stylesheet" href="/res/style/layout.css"/>
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<meta name="theme-color" content="#9FCF6C"/>
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="/res/img/pixeldrain_big.png"/>
{{template "bgpattern"}}
<script src="res/script/jquery.js"></script> <script src="res/script/jquery.js"></script>
<script src="res/script/jquery-cookie.js"></script> <script src="res/script/jquery-cookie.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css"/> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script>var APIURL = "{{apiUrl}}";</script> <script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script>
<meta name="description" content="PixelDrain is a free file sharing service, you
can upload any file and you will be given a shareable link right away.
PixelDrain also supports previews for images, videos, audio, PDFs and much more.
Uncensored, unmonitored and unmoderated."/>
<meta property="og:type" content="website" />
<meta property="og:title" content="File Upload History ~ PixelDrain" />
<meta property="og:site_name" content="PixelDrain" />
<meta property="og:description" content="Instant file and screenshot sharing." />
<meta property="og:url" content="http://pixeldra.in/" />
<meta property="og:image" content="/res/img/pixeldrain_big.png" />
<meta property="og:image:type" content="image/png" />
</head> </head>
<body> <body>
<div id='body' class="body"> <div id='body' class="body">
{{template "menu" .}} {{template "menu" .}}

View File

@@ -2,33 +2,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>PixelDrain ~ Free file sharing service</title> {{template "meta_tags" "Free file sharing service"}}
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/global.css"/>
<link rel="stylesheet" href="/res/style/layout.css"/>
<link href='https://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/res/img/tray32.png"/>
<meta name="theme-color" content="#9FCF6C"/>
<link rel="icon" sizes="180x180" href="/res/img/pixeldrain.png"/>
<link rel="icon" sizes="256x256" href="/res/img/pixeldrain_big.png"/>
{{template "bgpattern"}}
<script src="/res/script/jquery-2.1.4.min.js"></script> <script src="/res/script/jquery-2.1.4.min.js"></script>
<script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script>
<meta name="description" content="PixelDrain is a free file sharing service, you
can upload any file and you will be given a shareable link right away.
PixelDrain also supports previews for images, videos, audio, PDFs and much more.
Uncensored, unmonitored and unmoderated."/>
<meta property="og:type" content="website" />
<meta property="og:title" content="Home ~ PixelDrain" />
<meta property="og:site_name" content="PixelDrain" />
<meta property="og:description" content="Instant file and screenshot sharing." />
<meta property="og:url" content="http://pixeldra.in/" />
<meta property="og:image" content="/res/img/pixeldrain_big.png" />
<meta property="og:image:type" content="image/png" />
</head> </head>
<body> <body>

View File

@@ -16,12 +16,8 @@ type TemplateData struct {
Username string Username string
APIEndpoint template.URL APIEndpoint template.URL
Recaptcha struct {
Enabled bool
PubKey string
}
Other interface{} Other interface{}
Title string
} }
func (wc *WebController) newTemplateData(w http.ResponseWriter, r *http.Request) *TemplateData { func (wc *WebController) newTemplateData(w http.ResponseWriter, r *http.Request) *TemplateData {

View File

@@ -40,7 +40,7 @@ func New(r *httprouter.Router, prefix string, conf *conf.PixelWebConfig) *WebCon
r.GET(prefix+"/favicon.ico" /* */, wc.serveFile("/favicon.ico")) r.GET(prefix+"/favicon.ico" /* */, wc.serveFile("/favicon.ico"))
r.GET(prefix+"/global.css" /* */, wc.globalCSSHandler) r.GET(prefix+"/global.css" /* */, wc.globalCSSHandler)
r.GET(prefix+"/api" /* */, wc.serveTemplate("apidoc")) r.GET(prefix+"/api" /* */, wc.serveTemplate("apidoc"))
r.GET(prefix+"/history" /* */, wc.serveTemplate("history-cookies")) r.GET(prefix+"/history" /* */, wc.serveTemplate("history_cookies"))
r.GET(prefix+"/u/:id" /* */, wc.serveFileViewer) r.GET(prefix+"/u/:id" /* */, wc.serveFileViewer)
r.GET(prefix+"/u/:id/preview" /**/, wc.serveFilePreview) r.GET(prefix+"/u/:id/preview" /**/, wc.serveFilePreview)
r.GET(prefix+"/l/:id" /* */, wc.serveListViewer) r.GET(prefix+"/l/:id" /* */, wc.serveListViewer)
@@ -50,6 +50,8 @@ func New(r *httprouter.Router, prefix string, conf *conf.PixelWebConfig) *WebCon
r.GET(prefix+"/login" /* */, wc.serveTemplate("login")) r.GET(prefix+"/login" /* */, wc.serveTemplate("login"))
r.GET(prefix+"/logout" /* */, wc.serveTemplate("logout")) r.GET(prefix+"/logout" /* */, wc.serveTemplate("logout"))
r.POST(prefix+"/logout" /* */, wc.serveLogout) r.POST(prefix+"/logout" /* */, wc.serveLogout)
r.GET(prefix+"/user" /* */, wc.serveTemplate("user_home"))
r.GET(prefix+"/files" /* */, wc.serveTemplate("file_manager"))
r.NotFound = http.HandlerFunc(wc.serveNotFound) r.NotFound = http.HandlerFunc(wc.serveNotFound)