You've already forked minishortener
142 lines
4.0 KiB
HTML
142 lines
4.0 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;700&display=swap" rel="stylesheet">
|
|
<style>
|
|
body {
|
|
font-family: 'Fira Sans', sans-serif;
|
|
margin: auto;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background-color: #000;
|
|
color: #fff;
|
|
width: 600px;
|
|
height: 300px;
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 50%;
|
|
-ms-transform: translate(-50%, -50%);
|
|
transform: translate(-50%, -50%);
|
|
}
|
|
@media only screen and (max-width: 600px) {
|
|
body {
|
|
width: 100%;
|
|
}
|
|
}
|
|
.container {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.input {
|
|
text-align: center;
|
|
display: block;
|
|
margin: 0;
|
|
}
|
|
.input input {
|
|
border-radius: 10px;
|
|
width: 100%;
|
|
padding: 20px;
|
|
margin-bottom: 20px;
|
|
background-color: #000;
|
|
color: #fff;
|
|
border: 1px solid #fff;
|
|
-webkit-box-sizing: border-box;
|
|
-moz-box-sizing: border-box;
|
|
box-sizing: border-box;
|
|
resize: none;
|
|
}
|
|
.input button {
|
|
border: 1px solid #fff;
|
|
border-radius: 5px;
|
|
padding: 5px;
|
|
background-color: #000;
|
|
color: #fff;
|
|
}
|
|
.input button:hover {
|
|
background-color: #fff;
|
|
color: #000;
|
|
}
|
|
.input a {
|
|
text-decoration: none;
|
|
}
|
|
a {
|
|
color: #fff;
|
|
text-decoration: none;
|
|
}
|
|
a:hover {
|
|
color: #F012BE;
|
|
}
|
|
table {
|
|
width: 100%;
|
|
margin: 20px;
|
|
margin-left: 10%;
|
|
border-collapse: collapse;
|
|
justify-content: center;
|
|
}
|
|
th, td {
|
|
padding: 8px;
|
|
text-align: left;
|
|
overflow : hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
</style>
|
|
<title>MiniShortener</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
</head>
|
|
|
|
<body>
|
|
<header class="page-header">
|
|
<div class="container">
|
|
<h1 class="text-center"><a href="{{ host }}">MiniShortener</a></h1>
|
|
</div>
|
|
</header>
|
|
<div class="input">
|
|
<form action="/shorten" method="POST">
|
|
{% if short is defined %}
|
|
<input type="text" name="url" value="{{ host }}{{ short }}" autocomplete="off">
|
|
{% else %}
|
|
<input type="text" name="url" placeholder="URL you want to shorten" autocomplete="off">
|
|
{% endif %}
|
|
<br>
|
|
<button type="submit" name="submit">Shorten</button>
|
|
<button onclick="copyurl()" type="button" name="copy">Copy</button>
|
|
</form>
|
|
</div>
|
|
<script>
|
|
function copyurl() {
|
|
navigator.clipboard.writeText("{{ host }}{{ short }}");
|
|
}
|
|
</script>
|
|
|
|
{% if data is defined %}
|
|
<div class="container">
|
|
<table>
|
|
<tr>
|
|
<th>Code</th>
|
|
<th>Date</th>
|
|
<th>Clicks</th>
|
|
{% if admin is defined %}
|
|
<th>Action</th>
|
|
{% endif %}
|
|
</tr>
|
|
{% for row in data %}
|
|
<tr>
|
|
<td><a href="{{ host }}{{ row[2] }}">{{ row[2] }}</a></td>
|
|
<td>{{ row[4][:10] }}</td>
|
|
<td>{{ row[3] }}</td>
|
|
{% if admin is defined %}
|
|
<th><a href="delete/{{ row[0] }}">Delete</a></th>
|
|
{% endif %}
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
</body>
|
|
</html>
|