235 lines
7.7 KiB
HTML
235 lines
7.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>aCloud</title>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background-color: #121212;
|
|
color: #e0e0e0;
|
|
margin: 0;
|
|
padding: 0;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
}
|
|
.container {
|
|
background: #1e1e1e;
|
|
border-radius: 8px;
|
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
|
|
padding: 20px;
|
|
width: 400px;
|
|
text-align: center;
|
|
}
|
|
h1 {
|
|
margin-bottom: 20px;
|
|
color: #f5f5f5;
|
|
}
|
|
.upload-options {
|
|
display: flex;
|
|
justify-content: center;
|
|
margin-bottom: 20px;
|
|
}
|
|
.upload-options button {
|
|
background-color: #007bff;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 4px;
|
|
padding: 10px 20px;
|
|
margin: 0 10px;
|
|
cursor: pointer;
|
|
}
|
|
.upload-options button.active {
|
|
background-color: #0056b3;
|
|
}
|
|
.upload-form {
|
|
display: none;
|
|
}
|
|
.upload-form.active {
|
|
display: block;
|
|
}
|
|
textarea, input[type="file"], input[type="text"] {
|
|
width: calc(100% - 20px);
|
|
margin-top: 10px;
|
|
padding: 10px;
|
|
border-radius: 4px;
|
|
border: 1px solid #333;
|
|
box-sizing: border-box;
|
|
background-color: #2e2e2e;
|
|
color: #e0e0e0;
|
|
}
|
|
button[type="button"] {
|
|
background-color: #28a745;
|
|
color: #fff;
|
|
border: none;
|
|
border-radius: 4px;
|
|
padding: 10px 20px;
|
|
margin-top: 10px;
|
|
cursor: pointer;
|
|
}
|
|
.result {
|
|
margin-top: 20px;
|
|
color: #f5f5f5;
|
|
}
|
|
|
|
.footer {
|
|
background-color: #2c2f33;
|
|
color: #99aab5;
|
|
padding: 10px 0;
|
|
position: fixed;
|
|
bottom: 0;
|
|
width: 100%;
|
|
text-align: center;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.footer a {
|
|
color: #61afef;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.footer a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.footer .container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 0 15px;
|
|
}
|
|
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>aCloud</h1>
|
|
<div class="upload-options">
|
|
<button id="textUploadBtn" onclick="showForm('text')">Upload Text</button>
|
|
<button id="fileUploadBtn" onclick="showForm('file')">Upload File</button>
|
|
<button id="folderUploadBtn" onclick="showForm('folder')">Upload Folder</button>
|
|
<button id="urlShortenerBtn" onclick="showForm('url')">Shorten URL</button>
|
|
</div>
|
|
<div id="uploadFormContainer">
|
|
<div id="textForm" class="upload-form">
|
|
<h2>Upload Text</h2>
|
|
<form>
|
|
<textarea name="content" rows="4" placeholder="Enter text here..."></textarea>
|
|
<button type="button" onclick="uploadText()">Upload Text</button>
|
|
</form>
|
|
<div id="textResult" class="result"></div>
|
|
</div>
|
|
<div id="fileForm" class="upload-form">
|
|
<h2>Upload File</h2>
|
|
<form enctype="multipart/form-data">
|
|
<input type="file" name="file" />
|
|
<button type="button" onclick="uploadFile()">Upload File</button>
|
|
</form>
|
|
<div id="fileResult" class="result"></div>
|
|
</div>
|
|
<div id="folderForm" class="upload-form">
|
|
<h2>Upload Folder</h2>
|
|
<form enctype="multipart/form-data">
|
|
<input type="file" name="file" webkitdirectory directory />
|
|
<button type="button" onclick="uploadFolder()">Upload Folder</button>
|
|
</form>
|
|
<div id="folderResult" class="result"></div>
|
|
</div>
|
|
<div id="urlForm" class="upload-form">
|
|
<h2>Shorten URL</h2>
|
|
<form>
|
|
<input type="text" name="url" placeholder="Enter URL here..." />
|
|
<button type="button" onclick="shortenUrl()">Shorten URL</button>
|
|
</form>
|
|
<div id="urlResult" class="result"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
function showForm(type) {
|
|
document.querySelectorAll('.upload-form').forEach(form => {
|
|
form.classList.remove('active');
|
|
});
|
|
document.getElementById(type + 'Form').classList.add('active');
|
|
}
|
|
|
|
function uploadText() {
|
|
const content = document.querySelector('#textForm textarea').value;
|
|
fetch('/upload/pastebin', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
},
|
|
body: new URLSearchParams({ content }),
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
document.getElementById('textResult').innerHTML = `Text uploaded. Access it <a href="/${data.vanity}">here</a>.`;
|
|
});
|
|
}
|
|
|
|
function uploadFile() {
|
|
const formData = new FormData();
|
|
formData.append('file', document.querySelector('#fileForm input[type="file"]').files[0]);
|
|
fetch('/upload/file', {
|
|
method: 'POST',
|
|
body: formData,
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
document.getElementById('fileResult').innerHTML = `File uploaded. Download it <a href="/download/${data.vanity}">here</a>.`;
|
|
});
|
|
}
|
|
|
|
function uploadFolder() {
|
|
const files = document.querySelector('#folderForm input[type="file"]').files;
|
|
if (files.length === 0) {
|
|
alert('Please select a folder.');
|
|
return;
|
|
}
|
|
|
|
const formData = new FormData();
|
|
for (const file of files) {
|
|
formData.append('file', file);
|
|
}
|
|
|
|
fetch('/upload/folder', {
|
|
method: 'POST',
|
|
body: formData,
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
document.getElementById('folderResult').innerHTML = `Folder uploaded. View its contents <a href="/${data.vanity}">here</a>.`;
|
|
});
|
|
}
|
|
|
|
function shortenUrl() {
|
|
const url = document.querySelector('#urlForm input[name="url"]').value;
|
|
fetch('/shorten', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/x-www-form-urlencoded',
|
|
},
|
|
body: new URLSearchParams({ url }),
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
document.getElementById('urlResult').innerHTML = `URL shortened. Access it <a href="/${data.vanity}">here</a>.`;
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
|
|
<footer class="footer">
|
|
<div class="container">
|
|
<p class="footer-text">Source code available on:
|
|
<a href="https://github.com/realcgcristi/order" target="_blank">GitHub</a> |
|
|
<a href="https://git.spitkov.hu/cgcristi/aCloud" target="_blank">Spitkov's Git</a>
|
|
</p>
|
|
</div>
|
|
</footer>
|
|
|
|
</html>
|