initial commit with docker
This commit is contained in:
commit
164b9ab4b9
8 changed files with 460 additions and 0 deletions
200
templates/index.html
Normal file
200
templates/index.html
Normal file
|
@ -0,0 +1,200 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Modern File Upload</title>
|
||||
<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=Inter:wght@400;600&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<style>
|
||||
body {
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
background: #f2f3f7;
|
||||
font-family: "Inter", Arial, sans-serif;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.upload-container {
|
||||
background: #fff;
|
||||
padding: 2.5rem 2rem;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 8px 32px rgba(40, 40, 90, 0.08);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
min-width: 350px;
|
||||
}
|
||||
h1 {
|
||||
font-size: 1.6rem;
|
||||
font-weight: 600;
|
||||
color: #29314a;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
.upload-label {
|
||||
background: linear-gradient(90deg, #5fd2ff 0%, #2176ff 100%);
|
||||
color: #fff;
|
||||
padding: 0.875rem 2.5rem;
|
||||
border-radius: 48px;
|
||||
font-size: 1rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 2px 8px 0 rgba(70, 74, 100, 0.07);
|
||||
transition:
|
||||
background 0.15s,
|
||||
box-shadow 0.15s;
|
||||
margin-bottom: 0.75rem;
|
||||
border: none;
|
||||
display: inline-block;
|
||||
}
|
||||
.upload-label:hover {
|
||||
background: linear-gradient(90deg, #2176ff 0%, #5fd2ff 100%);
|
||||
box-shadow: 0 4px 16px 0 rgba(70, 74, 100, 0.1);
|
||||
}
|
||||
input[type="file"] {
|
||||
display: none;
|
||||
}
|
||||
.message-list {
|
||||
list-style: none;
|
||||
padding: 0.5rem;
|
||||
margin: 0.5rem 0 0 0;
|
||||
width: 100%;
|
||||
}
|
||||
.message-list li {
|
||||
color: #236a3e;
|
||||
background: #e1fbe9;
|
||||
padding: 0.55rem 0.9rem;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 1rem;
|
||||
text-align: center;
|
||||
border-left: 4px solid #2aea77;
|
||||
}
|
||||
.message-list li.error {
|
||||
color: #9e1221;
|
||||
background: #ffe4e8;
|
||||
border-left: 4px solid #e65c65;
|
||||
}
|
||||
.file-url-section {
|
||||
background: #f7fafd;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 2px 18px rgba(60, 70, 109, 0.06);
|
||||
margin-top: 1.1rem;
|
||||
padding: 1.1rem;
|
||||
width: 285px;
|
||||
text-align: center;
|
||||
border: 1px solid #e1effa;
|
||||
position: relative;
|
||||
}
|
||||
.file-url-input {
|
||||
width: 100%;
|
||||
border: none;
|
||||
background: transparent;
|
||||
font-size: 1rem;
|
||||
color: #24436b;
|
||||
text-align: center;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.copy-feedback {
|
||||
color: #2176ff;
|
||||
font-size: 0.95rem;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="upload-container">
|
||||
<h1>Upload your file</h1>
|
||||
|
||||
{% with messages = get_flashed_messages(with_categories=true) %} {%
|
||||
if messages %}
|
||||
<ul class="message-list">
|
||||
{% for category, message in messages %}
|
||||
<li class="{{ category }}">{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %} {% endwith %}
|
||||
|
||||
<form id="upload-form" method="post" enctype="multipart/form-data">
|
||||
<label for="file-upload" class="upload-label">
|
||||
Select file…
|
||||
</label>
|
||||
<input
|
||||
type="file"
|
||||
id="file-upload"
|
||||
name="file"
|
||||
onchange="autoSubmitForm()"
|
||||
/>
|
||||
</form>
|
||||
|
||||
{% if uploaded_url %}
|
||||
<div class="file-url-section">
|
||||
<input
|
||||
type="text"
|
||||
class="file-url-input"
|
||||
value="{{ uploaded_url }}"
|
||||
id="fileUrlInput"
|
||||
readonly
|
||||
onclick="copyUrlManual()"
|
||||
/>
|
||||
<span
|
||||
class="copy-feedback"
|
||||
id="copyFeedback"
|
||||
style="display: none"
|
||||
>Copied!</span
|
||||
>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<script>
|
||||
function autoSubmitForm() {
|
||||
var fileInput = document.getElementById("file-upload");
|
||||
if (fileInput && fileInput.files.length > 0) {
|
||||
document.getElementById("upload-form").submit();
|
||||
}
|
||||
}
|
||||
{% if uploaded_url %}
|
||||
window.onload = function() {
|
||||
copyUrlClipboard();
|
||||
};
|
||||
async function copyUrlClipboard() {
|
||||
var urlInput = document.getElementById('fileUrlInput');
|
||||
var feedback = document.getElementById('copyFeedback');
|
||||
try {
|
||||
await navigator.clipboard.writeText(urlInput.value);
|
||||
showCopyFeedback();
|
||||
} catch (err) {
|
||||
// fallback: select and hope user sees it
|
||||
urlInput.select();
|
||||
showCopyFeedback("Select & copy manually!");
|
||||
}
|
||||
}
|
||||
async function copyUrlManual() {
|
||||
var urlInput = document.getElementById('fileUrlInput');
|
||||
var feedback = document.getElementById('copyFeedback');
|
||||
try {
|
||||
await navigator.clipboard.writeText(urlInput.value);
|
||||
showCopyFeedback();
|
||||
} catch (err) {
|
||||
urlInput.select();
|
||||
showCopyFeedback("Select & copy manually!");
|
||||
}
|
||||
}
|
||||
function showCopyFeedback(msg) {
|
||||
var feedback = document.getElementById('copyFeedback');
|
||||
feedback.textContent = msg || "Copied!";
|
||||
feedback.style.display = '';
|
||||
setTimeout(function () {
|
||||
feedback.style.display = 'none';
|
||||
feedback.textContent = "Copied!";
|
||||
}, 1300);
|
||||
}
|
||||
{% endif %}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue