78 lines
3.7 KiB
Text
78 lines
3.7 KiB
Text
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Embedder</title>
|
|
<link rel="stylesheet" href="/css/base.css">
|
|
<link rel="stylesheet" href="/css/index.css">
|
|
<link rel="stylesheet" href="/css/app.css">
|
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
|
<link rel="manifest" href="/site.webmanifest">
|
|
<%
|
|
function extension(string) {
|
|
return string.slice((string.lastIndexOf(".") - 2 >>> 0) + 2);
|
|
}
|
|
%>
|
|
</head>
|
|
<body>
|
|
<section class="todoapp">
|
|
<nav class="nav">
|
|
<ul>
|
|
<li class="user"><%= user.name || user.username %></li>
|
|
<li>
|
|
<form action="/logout" method="post">
|
|
<button class="logout" type="submit">Sign out</button>
|
|
</form>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
<header class="header">
|
|
<h1>Embedder</h1>
|
|
<form action="/" method="post" encType="multipart/form-data">
|
|
<!---->
|
|
<div id="dropArea">
|
|
<p class="dragregion">Upload a file, copy paste, or drag n' drop into the dashed region</p>
|
|
<div id="gallery"></div>
|
|
<p class="dragregion"><input class="" type="file" id="fileupload" name="fileupload"><input type="submit" value="Upload"></p>
|
|
<p class="dragregion">Click the file to copy the url</p>
|
|
</div>
|
|
</form>
|
|
</header>
|
|
<% if (Count > 0) { %>
|
|
<section class="main">
|
|
<ul class="todo-list">
|
|
<% files.forEach(function(file) { %>
|
|
<li>
|
|
<form action="<%= file.url %>" method="post">
|
|
<div class="view">
|
|
<% if (extension(file.path) == ".mp4" || extension(file.path) == ".mov" || extension(file.path) == "webp") { %>
|
|
<video autoplay loop muted playsinline class="image" src="/uploads/<%=file.path %>" width="100%" onclick="copyURI(event)"></video>
|
|
<% } else if (extension(file.path) == ".jpg" || extension(file.path) == ".jpeg" || extension(file.path) == ".png" || extension(file.path) == ".gif" || extension(file.path) == ".webp" ) { %>
|
|
<img class="image" src="/uploads/<%=file.path %>" width="100%" onclick="copyURI(event)">
|
|
<% } else {%> <!-- non-media file -->
|
|
<div class="nonmedia" onclick="copyPath('<%=file.path%>')">
|
|
<p><%=extension(file.path)%> file</p>
|
|
</div>
|
|
<% } %>
|
|
<label><%= file.path %></label>
|
|
<button class="destroy" form="delete-<%= file.path %>"></button>
|
|
</div>
|
|
</form>
|
|
<form name="delete-<%= file.path %>" id="delete-<%= file.path %>" action="<%= file.url %>/delete" method="post">
|
|
</form>
|
|
</li>
|
|
<% }); %>
|
|
</ul>
|
|
</section>
|
|
<% } %>
|
|
</section>
|
|
<footer class="info">
|
|
<p><a href="https://l.nekomimi.pet/project">Created by Wavering Ana</a></p>
|
|
<p><a href="https://github.com/WaveringAna/Embedder">Github</a></p>
|
|
</footer>
|
|
<script src="/js/index.js"></script>
|
|
</body>
|
|
</html>
|