213 lines
6.7 KiB
HTML
213 lines
6.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>{{ filename }} - sxbin</title>
|
|
<meta property="og:title" content="{{ filename }}">
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:url" content="{{ request.url }}">
|
|
<meta property="og:description" content="File size: {{ file_size|filesizeformat }} | Uploaded by: {{ username }} | Date: {{ created_at.strftime('%Y-%m-%d %H:%M:%S') }}">
|
|
{% if is_embeddable %}
|
|
<meta property="og:image" content="{{ file_url }}">
|
|
{% endif %}
|
|
<meta property="og:site_name" content="sxbin">
|
|
<meta property="theme-color" content="#4CAF50">
|
|
<style>
|
|
:root {
|
|
--bg-color: #1e1e1e;
|
|
--text-color: #e0e0e0;
|
|
--highlight-bg: #2d2d2d;
|
|
--highlight-border: #444;
|
|
--button-bg: #3a3a3a;
|
|
--button-text: #e0e0e0;
|
|
}
|
|
|
|
.light-mode {
|
|
--bg-color: #ffffff;
|
|
--text-color: #333333;
|
|
--highlight-bg: #f8f8f8;
|
|
--highlight-border: #ccc;
|
|
--button-bg: #f0f0f0;
|
|
--button-text: #333333;
|
|
}
|
|
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
line-height: 1.6;
|
|
color: var(--text-color);
|
|
background-color: var(--bg-color);
|
|
transition: background-color 0.3s, color 0.3s;
|
|
}
|
|
|
|
.container {
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
}
|
|
|
|
h1 {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.button-container {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
button {
|
|
background-color: var(--button-bg);
|
|
color: var(--button-text);
|
|
border: none;
|
|
padding: 10px 15px;
|
|
margin-right: 10px;
|
|
cursor: pointer;
|
|
border-radius: 4px;
|
|
transition: background-color 0.3s;
|
|
}
|
|
|
|
button:hover {
|
|
opacity: 0.8;
|
|
}
|
|
|
|
.highlight {
|
|
background-color: var(--highlight-bg);
|
|
border: 1px solid var(--highlight-border);
|
|
border-radius: 4px;
|
|
padding: 1em;
|
|
overflow: auto;
|
|
}
|
|
|
|
#theme-toggle {
|
|
position: fixed;
|
|
top: 20px;
|
|
right: 20px;
|
|
}
|
|
|
|
a {
|
|
color: var(--text-color);
|
|
text-decoration: none;
|
|
}
|
|
|
|
a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
.highlight pre {
|
|
color: var(--text-color);
|
|
white-space: pre-wrap;
|
|
word-wrap: break-word;
|
|
}
|
|
|
|
.btn-container {
|
|
display: flex;
|
|
gap: 10px;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.btn {
|
|
background-color: var(--button-bg);
|
|
color: var(--button-text);
|
|
border: none;
|
|
padding: 10px 15px;
|
|
cursor: pointer;
|
|
border-radius: 4px;
|
|
transition: background-color 0.3s, opacity 0.3s;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
flex: 1;
|
|
text-align: center;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.btn:hover {
|
|
opacity: 0.8;
|
|
}
|
|
|
|
form {
|
|
flex: 1;
|
|
display: flex;
|
|
}
|
|
|
|
form .btn {
|
|
width: 100%;
|
|
}
|
|
|
|
.home-button {
|
|
position: fixed;
|
|
top: 20px;
|
|
left: 20px;
|
|
font-size: 24px;
|
|
color: var(--text-color);
|
|
text-decoration: none;
|
|
z-index: 1001;
|
|
}
|
|
|
|
.home-button:hover {
|
|
color: #4CAF50;
|
|
}
|
|
|
|
{{ css|safe }}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<a href="/" class="home-button">⌂</a>
|
|
<div class="container">
|
|
<h2>{{ filename }}</h2>
|
|
<div class="info-item"><strong>File size:</strong> {{ file_size|filesizeformat }}</div>
|
|
<div class="info-item"><strong>Uploaded by:</strong> {{ username }}</div>
|
|
<div class="info-item"><strong>Date:</strong> {{ created_at.strftime('%Y-%m-%d %H:%M:%S') }}</div>
|
|
|
|
{% if is_embeddable %}
|
|
<div class="embed-container">
|
|
{% if filename.lower().endswith(('.jpg', '.jpeg', '.png', '.gif', '.svg')) %}
|
|
<img src="{{ file_url }}/raw" alt="{{ filename }}">
|
|
{% elif filename.lower().endswith('.pdf') %}
|
|
<embed src="{{ file_url }}/raw" type="application/pdf" width="100%" height="600px">
|
|
{% endif %}
|
|
</div>
|
|
{% else %}
|
|
<div class="info-item"><strong>File type:</strong> {{ filename.split('.')[-1].upper() if '.' in filename else 'Unknown' }}</div>
|
|
{% endif %}
|
|
|
|
<div class="btn-container">
|
|
<a href="{{ file_url }}/download" class="btn">Download</a>
|
|
<a href="{{ file_url }}/raw" class="btn">View Raw</a>
|
|
{% if current_user.is_authenticated and current_user.id == user_id %}
|
|
{% if filename.lower().endswith(('.txt', '.html', '.css', '.js', '.py', '.md')) or '.' not in filename %}
|
|
<a href="{{ url_for('edit_content', vanity=vanity) }}" class="btn edit-btn">Edit</a>
|
|
{% endif %}
|
|
<form action="{{ url_for('delete_content', vanity=vanity) }}" method="post" style="display: inline;">
|
|
<button type="submit" class="btn delete-btn" onclick="return confirm('Are you sure you want to delete this file?')">Delete</button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<button id="theme-toggle">Toggle Theme</button>
|
|
|
|
<footer style="text-align: center; margin-top: 20px; padding: 10px; background-color: #2a2a2a; color: #f0f0f0;">
|
|
<p>
|
|
Source code: <a href="https://git.spitkov.hu/cgcristi/aCloud" target="_blank">Spitkov's Git</a> |
|
|
<a href="https://office.bence.lol/form/#/2/form/view/z5Cf3CL6tZtPjzKsbcEPync6JE3iyMl22h6thUQg1a4/" target="_blank">Suggestions & Bugs</a> |
|
|
<a href="https://office.bence.lol/kanban/#/2/kanban/view/hx6RTcpN0pR7hc1HHkMzG4awMoMdHjR2zbHjG7Xh+wU/embed/" target="_blank">Todo List</a>
|
|
</p>
|
|
</footer>
|
|
|
|
<script>
|
|
const themeToggle = document.getElementById('theme-toggle');
|
|
const html = document.documentElement;
|
|
|
|
function toggleTheme() {
|
|
html.classList.toggle('light-mode');
|
|
localStorage.setItem('lightMode', html.classList.contains('light-mode'));
|
|
}
|
|
|
|
themeToggle.addEventListener('click', toggleTheme);
|
|
|
|
// Check for saved theme preference
|
|
if (localStorage.getItem('lightMode') === 'true') {
|
|
html.classList.add('light-mode');
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |