2024-09-09 21:47:21 +02:00
|
|
|
<!DOCTYPE html>
|
2024-09-14 16:53:26 +02:00
|
|
|
<html lang="en" class="dark-mode">
|
2024-09-09 21:47:21 +02:00
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2024-09-14 16:53:26 +02:00
|
|
|
<title>Content</title>
|
2024-09-09 21:47:21 +02:00
|
|
|
<style>
|
2024-09-14 16:53:26 +02:00
|
|
|
: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;
|
|
|
|
}
|
|
|
|
|
2024-09-09 21:47:21 +02:00
|
|
|
.button-container {
|
2024-09-14 16:53:26 +02:00
|
|
|
margin-bottom: 20px;
|
2024-09-09 21:47:21 +02:00
|
|
|
}
|
2024-09-14 16:53:26 +02:00
|
|
|
|
|
|
|
button {
|
|
|
|
background-color: var(--button-bg);
|
|
|
|
color: var(--button-text);
|
|
|
|
border: none;
|
|
|
|
padding: 10px 15px;
|
2024-09-09 21:47:21 +02:00
|
|
|
margin-right: 10px;
|
2024-09-14 16:53:26 +02:00
|
|
|
cursor: pointer;
|
|
|
|
border-radius: 4px;
|
|
|
|
transition: background-color 0.3s;
|
|
|
|
}
|
|
|
|
|
|
|
|
button:hover {
|
|
|
|
opacity: 0.8;
|
2024-09-09 21:47:21 +02:00
|
|
|
}
|
2024-09-14 16:53:26 +02:00
|
|
|
|
2024-09-09 21:47:21 +02:00
|
|
|
.highlight {
|
2024-09-14 16:53:26 +02:00
|
|
|
background-color: var(--highlight-bg);
|
|
|
|
border: 1px solid var(--highlight-border);
|
2024-09-09 21:47:21 +02:00
|
|
|
border-radius: 4px;
|
|
|
|
padding: 1em;
|
|
|
|
overflow: auto;
|
|
|
|
}
|
2024-09-14 16:53:26 +02:00
|
|
|
|
|
|
|
#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%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal {
|
|
|
|
display: none;
|
|
|
|
position: fixed;
|
|
|
|
z-index: 1000;
|
|
|
|
left: 0;
|
|
|
|
top: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background-color: rgba(0,0,0,0.5);
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal-content {
|
|
|
|
background-color: var(--bg-color);
|
|
|
|
margin: 15% auto;
|
|
|
|
padding: 20px;
|
|
|
|
border: 1px solid var(--highlight-border);
|
|
|
|
width: 300px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal-content h3 {
|
|
|
|
margin-top: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal-content input[type="password"] {
|
|
|
|
width: 100%;
|
|
|
|
padding: 10px;
|
|
|
|
margin: 10px 0;
|
|
|
|
border: 1px solid var(--highlight-border);
|
|
|
|
background-color: var(--highlight-bg);
|
|
|
|
color: var(--text-color);
|
|
|
|
border-radius: 4px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal-buttons {
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
margin-top: 20px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.modal-buttons button {
|
|
|
|
padding: 10px 20px;
|
|
|
|
border: none;
|
|
|
|
border-radius: 4px;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
.btn-ok {
|
|
|
|
background-color: #4CAF50;
|
|
|
|
color: white;
|
|
|
|
}
|
|
|
|
|
|
|
|
.btn-cancel {
|
|
|
|
background-color: #888;
|
|
|
|
color: white;
|
|
|
|
}
|
|
|
|
|
|
|
|
.btn-remove {
|
|
|
|
background-color: #f44336;
|
|
|
|
color: white;
|
|
|
|
}
|
|
|
|
|
2024-09-15 23:03:38 +02:00
|
|
|
.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;
|
|
|
|
}
|
|
|
|
|
2024-09-14 16:53:26 +02:00
|
|
|
{{ css|safe }}
|
2024-09-09 21:47:21 +02:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
2024-09-15 23:03:38 +02:00
|
|
|
<a href="/" class="home-button">⌂</a>
|
2024-09-14 16:53:26 +02:00
|
|
|
<div class="container">
|
|
|
|
<h2>Content</h2>
|
|
|
|
<p>Uploaded by: {{ content.username }}</p>
|
|
|
|
<p>Created at: {{ created_at }}</p>
|
|
|
|
|
|
|
|
<div class="highlight">
|
|
|
|
{{ highlighted_content|safe }}
|
|
|
|
</div>
|
|
|
|
<div class="btn-container">
|
|
|
|
<button onclick="copyToClipboard()" class="btn">Copy</button>
|
|
|
|
<a href="{{ url_for('raw_vanity', vanity=vanity) }}" class="btn">View Raw</a>
|
|
|
|
{% if current_user.is_authenticated and current_user.id == content.user_id %}
|
|
|
|
<a href="{{ url_for('edit_content', vanity=vanity) }}" class="btn">Edit</a>
|
|
|
|
{% if is_private %}
|
|
|
|
<button onclick="openEditPasswordModal()" class="btn">Edit Password</button>
|
|
|
|
{% else %}
|
|
|
|
<button onclick="openAddPasswordModal()" class="btn">Add Password</button>
|
|
|
|
{% endif %}
|
|
|
|
<form action="{{ url_for('delete_content', vanity=vanity) }}" method="post">
|
|
|
|
<button type="submit" class="btn">Delete</button>
|
|
|
|
</form>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2024-09-09 21:47:21 +02:00
|
|
|
</div>
|
2024-09-14 16:53:26 +02:00
|
|
|
|
|
|
|
<button id="theme-toggle">Toggle Theme</button>
|
|
|
|
|
|
|
|
<div id="editPasswordModal" class="modal">
|
|
|
|
<div class="modal-content">
|
|
|
|
<h3 id="passwordModalTitle">Edit Password</h3>
|
|
|
|
<input type="password" id="newPassword1" placeholder="Enter new password">
|
|
|
|
<input type="password" id="newPassword2" placeholder="Confirm new password">
|
|
|
|
<div class="modal-buttons">
|
|
|
|
<button onclick="closePasswordModal()" class="btn-cancel">Cancel</button>
|
|
|
|
<button onclick="updatePassword()" class="btn-ok">OK</button>
|
|
|
|
<button onclick="removePassword()" class="btn-remove" id="removePasswordBtn">Remove Password</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-09-09 21:47:21 +02:00
|
|
|
</div>
|
|
|
|
|
2024-09-15 23:03:38 +02:00
|
|
|
<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>
|
|
|
|
|
2024-09-09 21:47:21 +02:00
|
|
|
<script>
|
|
|
|
const rawContent = {{ raw_content|tojson }};
|
|
|
|
|
|
|
|
function copyToClipboard() {
|
|
|
|
navigator.clipboard.writeText(rawContent).then(() => {
|
2024-09-14 16:53:26 +02:00
|
|
|
alert('Copied to clipboard!');
|
2024-09-09 21:47:21 +02:00
|
|
|
}).catch(err => {
|
|
|
|
console.error('Failed to copy text: ', err);
|
|
|
|
});
|
|
|
|
}
|
2024-09-14 16:53:26 +02:00
|
|
|
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
|
|
|
function openEditPasswordModal() {
|
|
|
|
document.getElementById('passwordModalTitle').textContent = 'Edit Password';
|
|
|
|
document.getElementById('removePasswordBtn').style.display = 'inline-block';
|
|
|
|
document.getElementById('editPasswordModal').style.display = 'block';
|
|
|
|
}
|
|
|
|
|
|
|
|
function openAddPasswordModal() {
|
|
|
|
document.getElementById('passwordModalTitle').textContent = 'Add Password';
|
|
|
|
document.getElementById('removePasswordBtn').style.display = 'none';
|
|
|
|
document.getElementById('editPasswordModal').style.display = 'block';
|
|
|
|
}
|
|
|
|
|
|
|
|
function closePasswordModal() {
|
|
|
|
document.getElementById('editPasswordModal').style.display = 'none';
|
|
|
|
document.getElementById('newPassword1').value = '';
|
|
|
|
document.getElementById('newPassword2').value = '';
|
|
|
|
}
|
|
|
|
|
|
|
|
function updatePassword() {
|
|
|
|
const password1 = document.getElementById('newPassword1').value;
|
|
|
|
const password2 = document.getElementById('newPassword2').value;
|
|
|
|
|
|
|
|
if (password1 !== password2) {
|
|
|
|
alert('Passwords do not match');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
fetch('{{ url_for("edit_password", vanity=vanity) }}', {
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
},
|
|
|
|
body: JSON.stringify({
|
|
|
|
action: 'update',
|
|
|
|
new_password: password1
|
|
|
|
}),
|
|
|
|
})
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
if (data.success) {
|
|
|
|
alert('Password updated successfully');
|
|
|
|
closePasswordModal();
|
|
|
|
location.reload(); // Reload the page to reflect the changes
|
|
|
|
} else {
|
|
|
|
alert('Error updating password: ' + data.error);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
console.error('Error:', error);
|
|
|
|
alert('An error occurred while updating the password');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function removePassword() {
|
|
|
|
if (confirm('Are you sure you want to remove the password?')) {
|
|
|
|
fetch('{{ url_for("edit_password", vanity=vanity) }}', {
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
},
|
|
|
|
body: JSON.stringify({
|
|
|
|
action: 'remove'
|
|
|
|
}),
|
|
|
|
})
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
if (data.success) {
|
|
|
|
alert('Password removed successfully');
|
|
|
|
closePasswordModal();
|
|
|
|
location.reload(); // Reload the page to reflect the changes
|
|
|
|
} else {
|
|
|
|
alert('Error removing password: ' + data.error);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.catch(error => {
|
|
|
|
console.error('Error:', error);
|
|
|
|
alert('An error occurred while removing the password');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2024-09-09 21:47:21 +02:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|