summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2017-04-09 09:02:09 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2017-04-09 09:02:09 +0200
commitb36f9c05071ea549ed59e703270fcf223b60df03 (patch)
tree8992c6bcaa5b0d64cbd589588b2539523125548c /templates
parentaf750a6598d53b8a5cb58092dd5b523ea7e967ca (diff)
Major rewrite to use jab/oauth.
Highlights: - Uses the oauth branch of jab. - Changed design to use bootstrap. - Some minor changes to functionality in file uploading and listing. - API is currently disabled and incomplete.
Diffstat (limited to 'templates')
-rw-r--r--templates/__init__.py9
-rw-r--r--templates/base.tmpl48
-rw-r--r--templates/changepass.tmpl16
-rw-r--r--templates/delete.tmpl9
-rw-r--r--templates/help.tmpl20
-rw-r--r--templates/images.tmpl28
-rw-r--r--templates/login.tmpl24
-rw-r--r--templates/my.tmpl14
-rw-r--r--templates/register.tmpl16
-rw-r--r--templates/upload.tmpl23
-rw-r--r--templates/uploaded.tmpl16
11 files changed, 0 insertions, 223 deletions
diff --git a/templates/__init__.py b/templates/__init__.py
deleted file mode 100644
index a8a47b8..0000000
--- a/templates/__init__.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from upload import upload
-from uploaded import uploaded
-from help import help
-from login import login
-from my import my
-from images import images
-from register import register
-from changepass import changepass
-from delete import delete
diff --git a/templates/base.tmpl b/templates/base.tmpl
deleted file mode 100644
index 76d9c99..0000000
--- a/templates/base.tmpl
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <title>$title</title>
- <link rel="StyleSheet" href="${settings.virtual_root}s/style.css" type="text/css" />
- <meta name="viewport" content="initial-scale=1.0, width=device-width" />
-#block head
-#end block
- </head>
- <body>
- <div id="page">
- <div id="page-header">
- <h1><a href="$settings.virtual_root">$header</a></h1>
- <div id="page-menu">
- <ul>
-#if $user or $settings.allow_anonymous_uploads
- <li><a href="${settings.virtual_root}u">upload</a></li>
-#end if
-#if $user
- <li><a href="${settings.virtual_root}o">logout</a></li>
- <li><a href="${settings.virtual_root}m">myfiles</a></li>
- <li><a href="${settings.virtual_root}i">images</a></li>
-#else
- <li><a href="${settings.virtual_root}l">login</a></li>
-#if $settings.allow_registration
- <li><a href="${settings.virtual_root}r">register</a></li>
-#end if
-#end if
- <li><a href="${settings.virtual_root}h">help</a></li>
- </ul>
- </div>
- </div>
- <p class="login">#slurp
-#if $user
-Logged in as $user.username. <a href="${settings.virtual_root}c">Change password</a>#slurp
-#else
-Not logged in.#slurp
-#end if
-</p>
- <div id="page-content">
-#block content
-#end block
- </div>
- </div>
- </body>
-</html>
diff --git a/templates/changepass.tmpl b/templates/changepass.tmpl
deleted file mode 100644
index a66c7f3..0000000
--- a/templates/changepass.tmpl
+++ /dev/null
@@ -1,16 +0,0 @@
-#def title: changepass
-#def header: changepass
-#extends templates.base
-#def content
-#set error = $error or ''
- <div class="error">$error</div>
- <form method="post" action="${settings.virtual_root}c">
- <p>current password</p>
- <p><input type="password" id="oldpass" name="oldpass" /></p>
- <p>new password</p>
- <p><input type="password" id="password" name="password" /></p>
- <p>repeat new password</p>
- <p><input type="password" id="password2" name="password2" /></p>
- <p><input type="submit" value="Login" /></p>
- </form>
-#end def
diff --git a/templates/delete.tmpl b/templates/delete.tmpl
deleted file mode 100644
index a3ed7be..0000000
--- a/templates/delete.tmpl
+++ /dev/null
@@ -1,9 +0,0 @@
-#def title: delete
-#def header: delete
-#extends templates.base
-#def content
- <form method="post" action="${settings.virtual_root}d/$hash">
- <p>Are you sure you want to delete the file $filename?</p>
- <p><input type="submit" value="Yes" /> <input type="button" value="No" onclick="document.location = '${settings.virtual_root}u'" /></p>
- </form>
-#end def
diff --git a/templates/help.tmpl b/templates/help.tmpl
deleted file mode 100644
index d33ca77..0000000
--- a/templates/help.tmpl
+++ /dev/null
@@ -1,20 +0,0 @@
-#def title: help
-#def header: help
-#extends templates.base
-#def content
- <p>Usage: POST to <a href="$scheme://${host}${settings.virtual_root}u">$scheme://${host}${settings.virtual_root}u</a> with filedata given to "file" and original filename to "filename". Login is done by generating a login token and sending it as the cookie "token".</p>
- <p>cURL examples, <code>get_token</code>:
- <blockquote><pre><code>$ curl $scheme://${host}${settings.virtual_root}a?method=get_token -F username=foo -F password=bar
-{"status": true, "message": null, "method": "get_token", "token": "cb42eb38eb516d9dfcaaa742d1da0b3ad454b2bd05a8b4daa6d01e9587d7c759"}</code></pre></blockquote>
- Upload using the token:
- <blockquote><pre><code>$ curl -b 'token=cb42eb38eb516d9dfcaaa742d1da0b3ad454b2bd05a8b4daa6d01e9587d7c759' -F 'file=@image.png' -F 'filename=image.png' -F 'api=1' $scheme://${host}${settings.virtual_root}u
-OK sjLUD</code></pre></blockquote>
- To expire the current token:
- <blockquote><pre><code>$ curl $scheme://${host}${settings.virtual_root}a?method=expire_token -F token=cb42eb38eb516d9dfcaaa742d1da0b3ad454b2bd05a8b4daa6d01e9587d7c759
-{"status": true, "message": null, "method": "expire_token"}</code></pre></blockquote>
- If you get HTTP 417 responses, try adding:<code>-H 'Expect:'</code>.</p>
- <p>By adding the key-value pair "api=1" you will get machine-readable responses in the form: <code>response result</code> where <code>response</code> is either <code>ERROR</code> or <code>OK</code>,
- and <code>result</code> is the file hash in the case of <code>OK</code>, or an error message in the case of <code>ERROR</code> (see example above).
- The hash can be used to construct URLs in which the paths begin with <code>/f/hash</code> where <code>hash</code> is the hash received.</p>
- <p>Any file extension an be appended to the hash, and for convenience the original filename (or whatever filename you prefer) can be appended after an additional slash after the hash.</p>
-#end def
diff --git a/templates/images.tmpl b/templates/images.tmpl
deleted file mode 100644
index 4dee28f..0000000
--- a/templates/images.tmpl
+++ /dev/null
@@ -1,28 +0,0 @@
-#def title: images
-#def header: images
-#extends templates.base
-#def head
-<script type="text/javascript" src="${settings.virtual_root}s/jquery-2.1.0.min.js"></script>
-<script type="text/javascript" src="${settings.virtual_root}s/jquery.lazy.min.js"></script>
-<script type="text/javascript">
- \$(function() {
- \$('img.lazy').Lazy({
- onError: function(element) {
- element.attr('src', '${settings.virtual_root}s/no-thumbnail.png');
- }
- });
- });
-</script>
-#end def
-#def content
-<p>You have $len($files) uploaded images totaling $total_size.</p>
-#if len($files)
-<div class="image-list">
-#for file in $files
- <div class="image"><a href="${settings.virtual_root}f/${file.hash}${file.ext}" title="$file.filename"><img class="lazy" data-src="${settings.virtual_root}t/$file.hash" alt="$file.filename" /><noscript><img src="${settings.virtual_root}t/$file.hash" alt="$file.filename" /></noscript></a></div>
-#end for
-</div>
-#else
-<div><em>(No image uploads yet.)</em></div>
-#end if
-#end def
diff --git a/templates/login.tmpl b/templates/login.tmpl
deleted file mode 100644
index 505a885..0000000
--- a/templates/login.tmpl
+++ /dev/null
@@ -1,24 +0,0 @@
-#def title: login
-#def header: login
-#extends templates.base
-#def content
-#set error = $error or ''
- <div class="error">$error</div>
-#if $loggedin
- <p>You are now logged in as $user.username.
- To change your session settings, please use the form below.
- Or <a href="${settings.virtual_root}u">return to the upload page</a>.
- </p>
-#end if
-#if $user
- <form method="post" action="${settings.virtual_root}l">
-#if next
- <input type="hidden" name="next" value="$next" />
-#end if
- <p><input type="checkbox" id="rememberme" name="rememberme" />
- <label for="rememberme"> remember me</label></p>
- <p><input type="checkbox" id="forever" name="forever" /><label for="forever"> .. forever</label></p>
- <p><input type="submit" value="Update" /></p>
- </form>
-#end if
-#end def
diff --git a/templates/my.tmpl b/templates/my.tmpl
deleted file mode 100644
index 7e6e242..0000000
--- a/templates/my.tmpl
+++ /dev/null
@@ -1,14 +0,0 @@
-#def title: myfiles
-#def header: myfiles
-#extends templates.base
-#def content
-<p>You have $len($files) uploaded files totaling $total_size.</p>
-<ul>
-#for file in $files
- <li>$file.html</li>
-#end for
-#if not len($files)
- <li><em>(No file uploads yet.)</em></li>
-#end if
-</ul>
-#end def
diff --git a/templates/register.tmpl b/templates/register.tmpl
deleted file mode 100644
index 4d2bc2a..0000000
--- a/templates/register.tmpl
+++ /dev/null
@@ -1,16 +0,0 @@
-#def title: register
-#def header: register
-#extends templates.base
-#def content
-#set error = $error or ''
- <div class="error">$error</div>
- <form method="post" action="${settings.virtual_root}r">
- <p>username</p>
- <p><input type="text" id="username" name="username" /></p>
- <p>password</p>
- <p><input type="password" id="password" name="password" /></p>
- <p>repeat password</p>
- <p><input type="password" id="password2" name="password2" /></p>
- <p><input type="submit" value="Register" /></p>
- </form>
-#end def
diff --git a/templates/upload.tmpl b/templates/upload.tmpl
deleted file mode 100644
index 87f50ea..0000000
--- a/templates/upload.tmpl
+++ /dev/null
@@ -1,23 +0,0 @@
-#def title: upload
-#def header: upload
-#extends templates.base
-#def head
- <script type="text/javascript">
- function file_changed() {
- s = document.getElementById('file').value;
- i = s.lastIndexOf('/');
- if(i < 0)
- i = s.lastIndexOf('\\');
- if(i >= 0)
- s = s.substr(i+1);
- document.getElementById('filename').value = s;
- }
- </script>
-#end def
-#def content
- <form method="post" action="${settings.virtual_root}u" enctype="multipart/form-data">
- <input type="hidden" id="filename" name="filename" />
- <p><input type="file" id="file" name="file" onchange="file_changed()" /></p>
- <p><input type="submit" value="Upload" /></p>
- </form>
-#end def
diff --git a/templates/uploaded.tmpl b/templates/uploaded.tmpl
deleted file mode 100644
index 019160f..0000000
--- a/templates/uploaded.tmpl
+++ /dev/null
@@ -1,16 +0,0 @@
-#def title: upload
-#def header: upload
-#extends templates.base
-#def content
- <p>Your file has been uploaded:
- <ul>
- <li><a href="/f/$hash/$filename">$scheme://$host/f/$hash/$filename</a></li>
- <li><a href="/f/$hash">$scheme://$host/f/$hash</a></li>
- <li><a href="/f/$hash$ext">$scheme://$host/f/$hash$ext</a></li>
- </ul></p>
-#if $user
- <p>Your file will also appear in <a href="/m">your file list</a>.</p>
-#else
- <p>If you were <a href="/r">registered</a> and <a href="/l">logged in</a>, your file would also appear in <a href="/m">your file list</a>.</p>
-#end if
-#end def