This commit is contained in:
klein panic
2024-10-01 20:14:14 -04:00
parent b3e876bd4c
commit da9156aaa3
2243 changed files with 384830 additions and 148 deletions

30
templates/index.html Normal file
View File

@@ -0,0 +1,30 @@
<!-- templates/index.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>iPhone-Linux Transfer</title>
</head>
<body>
<h1>iPhone-Linux Transfer Service</h1>
<!-- Upload HTML link form -->
<h2>Upload HTML Link</h2>
<form id="linkForm" action="/upload/link" method="POST">
<input type="text" name="link" placeholder="Enter your link here" required>
<button type="submit">Submit Link</button>
</form>
<!-- Upload file form -->
<h2>Upload Image/File</h2>
<form id="fileForm" action="/upload/file" method="POST" enctype="multipart/form-data">
<input type="file" name="file" required>
<button type="submit">Upload File</button>
</form>
<!-- Button to view uploaded content -->
<h2>View Uploaded Links and Images</h2>
<button onclick="window.location.href='/uploads';">View Uploaded Content</button>
</body>
</html>

21
templates/login.html Normal file
View File

@@ -0,0 +1,21 @@
<!-- templates/login.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
</head>
<body>
<h1>Login</h1>
<form method="POST" action="/login">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<br><br>
<button type="submit">Login</button>
</form>
</body>
</html>

107
templates/uploads.html Normal file
View File

@@ -0,0 +1,107 @@
<!-- templates/uploads.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Uploaded Data</title>
<script>
function downloadItem(url) {
fetch(url)
.then(response => {
if (!response.ok) throw new Error('Network response was not ok');
return response.blob();
})
.then(blob => {
const downloadUrl = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = downloadUrl;
a.download = url.split('/').pop(); // This sets the downloaded file name
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(downloadUrl); // Clean up URL object
})
.catch(error => {
console.error('Download failed:', error);
});
}
function confirmDelete(url) {
if (confirm("Are you sure you want to delete this item?")) {
window.location.href = url;
}
}
</script>
</head>
<body>
<h1>Uploaded Data</h1>
<!-- Links Section -->
<h2>Links</h2>
{% if links %}
<ul>
{% for link in links %}
<li>
<a href="{{ link[3] }}" target="_blank">{{ link[3] }}</a>
(Uploaded by: {{ link[1] }})
<button onclick="downloadItem('/download_link/{{ link[0] }}');">Download</button>
<button onclick="confirmDelete('/delete_link/{{ link[0] }}');">Delete</button>
</li>
{% endfor %}
</ul>
{% else %}
<p>No links uploaded.</p>
{% endif %}
<!-- Videos Section -->
<h2>Videos</h2>
{% if videos %}
<ul>
{% for video in videos %}
<li>
{{ video[3] }} (Uploaded by: {{ video[1] }})
<button onclick="downloadItem('/download/{{ video[0] }}');">Download</button>
<button onclick="confirmDelete('/delete_file/{{ video[0] }}');">Delete</button>
</li>
{% endfor %}
</ul>
{% else %}
<p>No videos uploaded.</p>
{% endif %}
<!-- Photos Section -->
<h2>Photos</h2>
{% if photos %}
<ul>
{% for photo in photos %}
<li>
{{ photo[3] }} (Uploaded by: {{ photo[1] }})
<button onclick="downloadItem('/download/{{ photo[0] }}');">Download</button>
<button onclick="confirmDelete('/delete_file/{{ photo[0] }}');">Delete</button>
</li>
{% endfor %}
</ul>
{% else %}
<p>No photos uploaded.</p>
{% endif %}
<!-- Miscellaneous Files Section -->
<h2>Miscellaneous Files</h2>
{% if misc %}
<ul>
{% for item in misc %}
<li>
{{ item[3] }} (Uploaded by: {{ item[1] }})
<button onclick="downloadItem('/download/{{ item[0] }}');">Download</button>
<button onclick="confirmDelete('/delete_file/{{ item[0] }}');">Delete</button>
</li>
{% endfor %}
</ul>
{% else %}
<p>No miscellaneous files uploaded.</p>
{% endif %}
<a href="/">Back to Upload Page</a>
</body>
</html>

View File

@@ -0,0 +1,78 @@
<!-- templates/uploads.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Uploaded Data</title>
</head>
<body>
<h1>Uploaded Data</h1>
<!-- Links Section -->
<h2>Links</h2>
{% if links %}
{% if links|length > 1 %}
<button onclick="window.location.href='/download_all_links';">Download All Links</button>
{% endif %}
<ul>
{% for link in links %}
<li>
<a href="{{ link[3] }}" target="_blank">{{ link[3] }}</a>
(Uploaded by: {{ link[1] }})
<button onclick="window.location.href='/download_link/{{ link[0] }}';">Download</button>
</li>
{% endfor %}
</ul>
{% else %}
<p>No links uploaded.</p>
{% endif %}
<!-- Videos Section -->
<h2>Videos</h2>
{% if videos %}
<ul>
{% for video in videos %}
<li>
{{ video[3] }} (Uploaded by: {{ video[1] }})
<button onclick="window.location.href='/download/{{ video[0] }}';">Download</button>
</li>
{% endfor %}
</ul>
{% else %}
<p>No videos uploaded.</p>
{% endif %}
<!-- Photos Section -->
<h2>Photos</h2>
{% if photos %}
<ul>
{% for photo in photos %}
<li>
{{ photo[3] }} (Uploaded by: {{ photo[1] }})
<button onclick="window.location.href='/download/{{ photo[0] }}';">Download</button>
</li>
{% endfor %}
</ul>
{% else %}
<p>No photos uploaded.</p>
{% endif %}
<!-- Miscellaneous Files Section -->
<h2>Miscellaneous Files</h2>
{% if misc %}
<ul>
{% for item in misc %}
<li>
{{ item[3] }} (Uploaded by: {{ item[1] }})
<button onclick="window.location.href='/download/{{ item[0] }}';">Download</button>
</li>
{% endfor %}
</ul>
{% else %}
<p>No miscellaneous files uploaded.</p>
{% endif %}
<a href="/">Back to Upload Page</a>
</body>
</html>