477 lines
7.2 KiB
HTML
477 lines
7.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport"
|
|
content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Smart Share Hub</title>
|
|
|
|
<style>
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
|
|
font-family: Arial, sans-serif;
|
|
|
|
background:
|
|
linear-gradient(
|
|
135deg,
|
|
#020617,
|
|
#0f172a,
|
|
#111827
|
|
);
|
|
|
|
color: white;
|
|
|
|
min-height: 100vh;
|
|
|
|
padding: 40px 20px;
|
|
}
|
|
|
|
.container {
|
|
|
|
max-width: 1000px;
|
|
|
|
margin: auto;
|
|
}
|
|
|
|
.title {
|
|
|
|
text-align: center;
|
|
|
|
margin-bottom: 40px;
|
|
}
|
|
|
|
.title h1 {
|
|
|
|
font-size: 50px;
|
|
|
|
color: #38bdf8;
|
|
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.title p {
|
|
|
|
color: #94a3b8;
|
|
|
|
font-size: 18px;
|
|
}
|
|
|
|
.card {
|
|
|
|
background: rgba(30, 41, 59, 0.9);
|
|
|
|
border-radius: 18px;
|
|
|
|
padding: 25px;
|
|
|
|
margin-bottom: 25px;
|
|
|
|
box-shadow:
|
|
0 10px 30px rgba(0,0,0,0.3);
|
|
}
|
|
|
|
.section-title {
|
|
|
|
font-size: 26px;
|
|
|
|
margin-bottom: 20px;
|
|
|
|
color: #7dd3fc;
|
|
}
|
|
|
|
input[type="file"] {
|
|
|
|
margin-bottom: 15px;
|
|
|
|
color: white;
|
|
}
|
|
|
|
textarea {
|
|
|
|
width: 100%;
|
|
|
|
padding: 15px;
|
|
|
|
border-radius: 12px;
|
|
|
|
border: none;
|
|
|
|
resize: vertical;
|
|
|
|
min-height: 120px;
|
|
|
|
background: #334155;
|
|
|
|
color: white;
|
|
|
|
font-size: 16px;
|
|
}
|
|
|
|
textarea::placeholder {
|
|
color: #cbd5e1;
|
|
}
|
|
|
|
button {
|
|
|
|
padding: 12px 20px;
|
|
|
|
border: none;
|
|
|
|
border-radius: 10px;
|
|
|
|
background: #38bdf8;
|
|
|
|
color: black;
|
|
|
|
font-weight: bold;
|
|
|
|
cursor: pointer;
|
|
|
|
margin-top: 15px;
|
|
|
|
margin-right: 10px;
|
|
|
|
transition: 0.3s;
|
|
}
|
|
|
|
button:hover {
|
|
|
|
background: #0ea5e9;
|
|
|
|
transform: scale(1.03);
|
|
}
|
|
|
|
.file-item,
|
|
.note-item {
|
|
|
|
background: #334155;
|
|
|
|
padding: 18px;
|
|
|
|
border-radius: 12px;
|
|
|
|
margin-top: 15px;
|
|
}
|
|
|
|
.file-header {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
gap: 10px;
|
|
}
|
|
|
|
.file-name {
|
|
|
|
font-size: 16px;
|
|
|
|
word-break: break-word;
|
|
}
|
|
|
|
.footer {
|
|
|
|
text-align: center;
|
|
|
|
margin-top: 40px;
|
|
|
|
color: #64748b;
|
|
}
|
|
|
|
a {
|
|
text-decoration: none;
|
|
}
|
|
|
|
.top-grid {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: 1fr 1fr;
|
|
|
|
gap: 25px;
|
|
}
|
|
|
|
@media(max-width: 768px) {
|
|
|
|
.top-grid {
|
|
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.title h1 {
|
|
|
|
font-size: 38px;
|
|
}
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div class="container">
|
|
|
|
<div class="title">
|
|
|
|
<h1>Smart Share Hub</h1>
|
|
|
|
<p>
|
|
Secure HTTPS Cloud File & Note Sharing Platform
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div class="top-grid">
|
|
|
|
<!-- Upload -->
|
|
|
|
<div class="card">
|
|
|
|
<div class="section-title">
|
|
Upload Files
|
|
</div>
|
|
|
|
<input type="file"
|
|
id="fileInput">
|
|
|
|
<br>
|
|
|
|
<button onclick="uploadFile()">
|
|
Upload File
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<!-- Notes -->
|
|
|
|
<div class="card">
|
|
|
|
<div class="section-title">
|
|
Share Notes
|
|
</div>
|
|
|
|
<textarea
|
|
id="noteText"
|
|
placeholder="Write something to share..."></textarea>
|
|
|
|
<button onclick="shareNote()">
|
|
Share Note
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- Files -->
|
|
|
|
<div class="card">
|
|
|
|
<div class="section-title">
|
|
Uploaded Files
|
|
</div>
|
|
|
|
<div id="fileList"></div>
|
|
|
|
</div>
|
|
|
|
<!-- Notes -->
|
|
|
|
<div class="card">
|
|
|
|
<div class="section-title">
|
|
Shared Notes
|
|
</div>
|
|
|
|
<div id="notesList"></div>
|
|
|
|
</div>
|
|
|
|
<div class="footer">
|
|
|
|
Smart Share Hub • Docker • Flask • PostgreSQL • HTTPS
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
async function loadFiles() {
|
|
|
|
let response =
|
|
await fetch('/api/files');
|
|
|
|
let files =
|
|
await response.json();
|
|
|
|
let fileList =
|
|
document.getElementById('fileList');
|
|
|
|
fileList.innerHTML = '';
|
|
|
|
files.forEach(file => {
|
|
|
|
fileList.innerHTML += `
|
|
|
|
<div class="file-item">
|
|
|
|
<div class="file-header">
|
|
|
|
<div class="file-name">
|
|
${file}
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<a href="/api/download/${file}"
|
|
target="_blank">
|
|
|
|
<button>
|
|
Download
|
|
</button>
|
|
|
|
</a>
|
|
|
|
<button onclick="copyLink('${file}')">
|
|
|
|
Copy Link
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
`;
|
|
});
|
|
}
|
|
|
|
async function uploadFile() {
|
|
|
|
let fileInput =
|
|
document.getElementById('fileInput');
|
|
|
|
if(fileInput.files.length === 0) {
|
|
|
|
alert('Please choose a file');
|
|
|
|
return;
|
|
}
|
|
|
|
let formData = new FormData();
|
|
|
|
formData.append(
|
|
'file',
|
|
fileInput.files[0]
|
|
);
|
|
|
|
await fetch('/api/upload', {
|
|
|
|
method: 'POST',
|
|
|
|
body: formData
|
|
});
|
|
|
|
alert('File uploaded successfully');
|
|
|
|
fileInput.value = '';
|
|
|
|
loadFiles();
|
|
}
|
|
|
|
async function loadNotes() {
|
|
|
|
let response =
|
|
await fetch('/api/notes');
|
|
|
|
let notes =
|
|
await response.json();
|
|
|
|
let notesList =
|
|
document.getElementById('notesList');
|
|
|
|
notesList.innerHTML = '';
|
|
|
|
notes.forEach(note => {
|
|
|
|
notesList.innerHTML += `
|
|
|
|
<div class="note-item">
|
|
|
|
${note.text}
|
|
|
|
</div>
|
|
|
|
`;
|
|
});
|
|
}
|
|
|
|
async function shareNote() {
|
|
|
|
let text =
|
|
document.getElementById('noteText').value;
|
|
|
|
if(text.trim() === '') {
|
|
|
|
alert('Please write something');
|
|
|
|
return;
|
|
}
|
|
|
|
await fetch('/api/notes', {
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
|
|
body: JSON.stringify({
|
|
text: text
|
|
})
|
|
});
|
|
|
|
document.getElementById('noteText').value = '';
|
|
|
|
loadNotes();
|
|
}
|
|
|
|
function copyLink(fileName) {
|
|
|
|
const url =
|
|
window.location.origin +
|
|
'/api/download/' +
|
|
fileName;
|
|
|
|
navigator.clipboard.writeText(url);
|
|
|
|
alert('Download link copied!');
|
|
}
|
|
|
|
loadFiles();
|
|
|
|
loadNotes();
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|