init f0ckm

This commit is contained in:
2026-04-25 19:51:52 +02:00
commit b646107eb7
241 changed files with 70364 additions and 0 deletions

81
views/mod/motd.html Normal file
View File

@@ -0,0 +1,81 @@
@include(snippets/header)
<div class="pagewrapper">
<div id="main">
<div class="container">
<h2>Moderator Message of the Day (MOTD)</h2>
<p style="color: #ccc; margin-bottom: 20px;">This message is displayed site-wide. It will automatically be tagged with your name (<code>t. {!! session.display_name || session.user !!}</code>).</p>
<div class="admin-motd-form">
<form id="motd-form" action="/mod/motd" method="POST" onsubmit="event.preventDefault(); saveMotd(this);">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<div style="margin-bottom: 20px;">
<label for="motd-text" style="display: block; margin-bottom: 8px; color: var(--accent);">MOTD Content (Markdown supported)</label>
<textarea id="motd-text" name="motd" style="width: 100%; min-height: 200px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: #fff; padding: 15px; border-radius: 4px; font-family: inherit; font-size: 1.1em; resize: vertical;">{!! motd !!}</textarea>
</div>
<div style="display: flex; gap: 10px; align-items: center;">
<button type="submit" class="btn-primary" style="width: auto; padding: 10px 30px;">Save MOTD</button>
<button type="button" class="btn-remove" style="width: auto; padding: 10px 20px;" onclick="document.getElementById('motd-text').value=''; saveMotd(document.getElementById('motd-form'));">Clear MOTD</button>
<span id="motd-status" style="margin-left: 10px; font-weight: bold; display: none;"></span>
</div>
</form>
</div>
<div style="margin-top: 40px; padding: 20px; background: rgba(0,0,0,0.2); border-left: 4px solid var(--accent); border-radius: 4px;">
<h4 style="color: var(--accent); margin-top: 0;">Preview Tip</h4>
<p style="margin-bottom: 0;">You can use <strong>Markdown</strong> syntax like <code># Header</code>, <code>**bold**</code>, <code>[links](url)</code>, or standard HTML. Your username will be appended as a signature.
</p>
</div>
</div>
<script>
async function saveMotd(form) {
const status = document.getElementById('motd-status');
const textarea = document.getElementById('motd-text');
status.textContent = 'Saving...';
status.style.color = 'var(--accent)';
status.style.display = 'inline';
try {
const res = await fetch(form.action, {
method: 'POST',
headers: {
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'application/x-www-form-urlencoded',
'X-CSRF-Token': window.f0ckSession?.csrf_token
},
body: new URLSearchParams(new FormData(form))
});
const data = await res.json();
if (data.success) {
status.textContent = 'Saved!';
status.style.color = '#28a745';
// Update textarea with the actual saved MOTD (which includes the tag)
if (data.motd) {
textarea.value = data.motd;
}
if (typeof window.updateMotdUI === 'function') {
window['motd_dismissed'] = false; // Force show on save
window.updateMotdUI(data.motd || textarea.value);
}
setTimeout(() => {
status.style.display = 'none';
}, 2000);
} else {
throw new Error(data.msg || 'Unknown error');
}
} catch (err) {
console.error('MOTD Save Error:', err);
status.textContent = 'Error: ' + err.message;
status.style.color = '#d9534f';
}
}
</script>
</div>
</div>
@include(snippets/footer)