summaryrefslogtreecommitdiff
path: root/src/templates
diff options
context:
space:
mode:
authorJulien Dessaux2021-10-22 17:59:44 +0200
committerJulien Dessaux2021-10-25 15:22:24 +0200
commitad9b9c0f7bd4d95ddc54462970d33d92bab9392c (patch)
treeb8d130d728fda49c64b6e021da31afb2418b78a0 /src/templates
parentInitial import (diff)
downloadshort-ad9b9c0f7bd4d95ddc54462970d33d92bab9392c.tar.gz
short-ad9b9c0f7bd4d95ddc54462970d33d92bab9392c.tar.bz2
short-ad9b9c0f7bd4d95ddc54462970d33d92bab9392c.zip
Added a functionning url shortening service
Diffstat (limited to 'src/templates')
-rw-r--r--src/templates/error.html7
-rw-r--r--src/templates/index.html25
-rw-r--r--src/templates/noshort.html10
-rw-r--r--src/templates/partials/footer.html5
-rw-r--r--src/templates/partials/master.html17
-rw-r--r--src/templates/short.html9
6 files changed, 73 insertions, 0 deletions
diff --git a/src/templates/error.html b/src/templates/error.html
new file mode 100644
index 0000000..5de1923
--- /dev/null
+++ b/src/templates/error.html
@@ -0,0 +1,7 @@
+{% extends "templates/partials/master.html" %}
+{% block content %}
+<h1>{{ $code }} - {{ $msg }}</h1>
+<p>
+ <a href="/">Go back</a>
+</p>
+{% endblock %}
diff --git a/src/templates/index.html b/src/templates/index.html
new file mode 100644
index 0000000..b89e381
--- /dev/null
+++ b/src/templates/index.html
@@ -0,0 +1,25 @@
+{% extends "templates/partials/master.html" %}
+{% block content %}
+<h1>URL shortener</h1>
+<p>
+The simple, open source and privacy friendly URL shortener : anonymous usage, no tracking.<br>
+This is a personal sharing service: Data may be deleted anytime. Don't share illegal, unethical or morally reprehensible content.
+</p>
+<form action="/" method="post">
+ <label for="title">Title:</label><input class="fullwidth" type="text" placeholder="Enter a title here" name="title" value="{{ $req.Title }}" minlength="3" maxlength="64" required autofocus><br>
+ <label for="url">URL:</label><input class="fullwidth" type="url" placeholder="Enter the URL to shorten here" name="url" value="{{ $req.Url }}" minlength="3" maxlength="512" required><br>
+ <label for="expires">Expires in:</label>
+ <select id="expires" name="expires">
+ <option value="5">5 minutes</option>
+ <option value="10">10 minutes</option>
+ <option value="60">1 hour</option>
+ <option value="1440">1 day</option>
+ <option value="10080" selected>1 week</option>
+ <option value="44640">1 month</option>
+ <option value="527040">1 year</option>
+ </select>
+ <input type="submit" value="shorten">
+</form>
+<ul>
+</ul>
+{% endblock %}
diff --git a/src/templates/noshort.html b/src/templates/noshort.html
new file mode 100644
index 0000000..e0be436
--- /dev/null
+++ b/src/templates/noshort.html
@@ -0,0 +1,10 @@
+{% extends "templates/partials/master.html" %}
+{% block content %}
+<h1>URL not found!</h1>
+<p>
+ This url does not exist or has expired, sorry!
+</p>
+<p>
+ <a href="/">Go back</a>
+</p>
+{% endblock %}
diff --git a/src/templates/partials/footer.html b/src/templates/partials/footer.html
new file mode 100644
index 0000000..6ae4459
--- /dev/null
+++ b/src/templates/partials/footer.html
@@ -0,0 +1,5 @@
+<footer>
+ <p>
+ &copy; 2021 | Julien (Adyxax) Dessaux | <a href="https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12" title="EUPL 1.2">Some rights reserved</a>
+ </p>
+</footer>
diff --git a/src/templates/partials/master.html b/src/templates/partials/master.html
new file mode 100644
index 0000000..82cedac
--- /dev/null
+++ b/src/templates/partials/master.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<html class="no-js" lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="icon" href="/static/favicon.ico">
+ <link rel="stylesheet" href="{{ $cssRoute }}">
+
+ <title>short.adyxax.org</title>
+ </head>
+ <body>
+ <main id="main">
+ {% block content %}{% endblock %}
+ </main>
+ {% importnwt "templates/partials/footer.html" %}
+ </body>
+</html>
diff --git a/src/templates/short.html b/src/templates/short.html
new file mode 100644
index 0000000..1f36fdf
--- /dev/null
+++ b/src/templates/short.html
@@ -0,0 +1,9 @@
+{% extends "templates/partials/master.html" %}
+{% block content %}
+<h1>{{ $req.Title }}</h1>
+<p><a href="{{ $req.Url }}">{{ $req.Url }}</a></p>
+<p>
+Created on : {{ $req.Created }}<br>
+Expires on : {{ $req.Expires }}
+</p>
+{% endblock %}