new file: consent-plugin/pom.xml

new file:   consent-plugin/src/main/java/de/simolzimol/mclogger/consent/ConsentConfig.java
	new file:   consent-plugin/src/main/java/de/simolzimol/mclogger/consent/ConsentPlugin.java
	new file:   consent-plugin/src/main/java/de/simolzimol/mclogger/consent/commands/ConsentCommand.java
	new file:   consent-plugin/src/main/java/de/simolzimol/mclogger/consent/database/ConsentDatabase.java
	new file:   consent-plugin/src/main/java/de/simolzimol/mclogger/consent/listeners/ConsentListener.java
	new file:   consent-plugin/src/main/java/de/simolzimol/mclogger/consent/util/MessageUtil.java
	new file:   consent-plugin/src/main/resources/config.yml
	new file:   consent-plugin/src/main/resources/plugin.yml
	modified:   web/app.py
	modified:   web/blueprints/group_admin.py
	modified:   web/panel_db.py
	modified:   web/templates/group_admin/base.html
	new file:   web/templates/group_admin/privacy_policy.html
	new file:   web/templates/group_policy.html
This commit is contained in:
simon
2026-04-17 11:41:35 +02:00
parent aa0544a4a5
commit 17a782b487
15 changed files with 1646 additions and 0 deletions

View File

@@ -18,6 +18,7 @@
<a href="{{ url_for('group_admin.dashboard') }}" class="nav-link text-dark {{ 'fw-bold' if request.endpoint == 'group_admin.dashboard' }}">Dashboard</a>
<a href="{{ url_for('group_admin.members') }}" class="nav-link text-dark {{ 'fw-bold' if request.endpoint == 'group_admin.members' }}">Members</a>
<a href="{{ url_for('group_admin.database') }}" class="nav-link text-dark {{ 'fw-bold' if request.endpoint == 'group_admin.database' }}">Database</a>
<a href="{{ url_for('group_admin.privacy_policy') }}" class="nav-link text-dark {{ 'fw-bold' if request.endpoint == 'group_admin.privacy_policy' }}">Privacy Policy</a>
<a href="{{ url_for('panel.dashboard') }}" class="btn btn-outline-dark btn-sm">
<i class="bi bi-grid me-1"></i>Panel
</a>

View File

@@ -0,0 +1,74 @@
{% extends "group_admin/base.html" %}
{% block title %}Privacy Policy{% endblock %}
{% block content %}
<div class="row justify-content-center">
<div class="col-lg-9">
<h2 class="mb-1"><i class="bi bi-file-earmark-lock2 me-2"></i>Server Privacy Policy</h2>
<p class="text-muted mb-4">
Write your Minecraft server's privacy policy here. Players will be shown this page when
the <strong>MCConsent</strong> plugin asks them to consent before playing.
</p>
{# ── Public URL banner ────────────────────────────────────── #}
<div class="alert alert-info d-flex align-items-center gap-2 mb-4">
<i class="bi bi-link-45deg fs-5 flex-shrink-0"></i>
<div>
<strong>Public URL</strong> — paste this into your <code>consent-plugin/config.yml</code>
as the <code>policy-url</code> value:<br>
<code id="publicUrl">{{ public_url }}</code>
<button class="btn btn-sm btn-outline-light ms-2" onclick="navigator.clipboard.writeText('{{ public_url }}')">
<i class="bi bi-clipboard"></i> Copy
</button>
</div>
</div>
{# ── Last updated ─────────────────────────────────────────── #}
{% if policy and policy.updated_at %}
<p class="text-muted small">Last updated: {{ policy.updated_at.strftime('%Y-%m-%d %H:%M UTC') }}</p>
{% endif %}
{# ── Editor form ──────────────────────────────────────────── #}
<form method="post">
<input type="hidden" name="_csrf_token" value="{{ csrf_token() }}">
<div class="mb-3">
<label for="policy_url" class="form-label fw-semibold">
Additional / External Policy URL <span class="text-muted fw-normal">(optional)</span>
</label>
<input type="url" class="form-control font-monospace"
id="policy_url" name="policy_url" maxlength="500"
placeholder="https://your-website.example.com/privacy"
value="{{ (policy.policy_url or '') if policy else '' }}">
<div class="form-text">
If you host a full policy on your own website you can link it here. It will be
displayed as a button on the public policy page.
</div>
</div>
<div class="mb-3">
<label for="policy_text" class="form-label fw-semibold">Policy Text</label>
<textarea class="form-control font-monospace" id="policy_text" name="policy_text"
rows="24" placeholder="Enter your privacy policy here…"
style="resize: vertical;">{{ (policy.policy_text or '') if policy else '' }}</textarea>
<div class="form-text">
Plain text or basic Markdown is accepted. HTML is <strong>not</strong> rendered.
</div>
</div>
<div class="d-flex gap-2">
<button type="submit" class="btn btn-warning">
<i class="bi bi-floppy me-1"></i>Save Policy
</button>
{% if policy %}
<a href="{{ public_url }}" target="_blank" class="btn btn-outline-light">
<i class="bi bi-box-arrow-up-right me-1"></i>Preview public page
</a>
{% endif %}
</div>
</form>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Privacy Policy — {{ group.name }}</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
</head>
<body class="bg-dark text-light">
<nav class="navbar navbar-dark bg-secondary bg-opacity-25 border-bottom border-secondary mb-4">
<div class="container">
<span class="navbar-brand">
<i class="bi bi-file-earmark-lock2 me-2 text-warning"></i>
<strong>{{ group.name }}</strong> — Privacy Policy
</span>
<span class="text-muted small">Powered by MCLogger</span>
</div>
</nav>
<div class="container" style="max-width: 860px;">
{% if not policy or not policy.policy_text %}
<div class="alert alert-warning">
<i class="bi bi-exclamation-triangle me-2"></i>
This server has not yet published a privacy policy.
Please contact the server administrator for more information.
</div>
{% else %}
{% if policy.updated_at %}
<p class="text-muted small mb-4">
<i class="bi bi-clock me-1"></i>
Last updated: {{ policy.updated_at.strftime('%B %d, %Y') }}
</p>
{% endif %}
{% if policy.policy_url %}
<a href="{{ policy.policy_url }}" target="_blank" rel="noopener noreferrer"
class="btn btn-outline-info btn-sm mb-4">
<i class="bi bi-box-arrow-up-right me-1"></i>View full policy on our website
</a>
{% endif %}
<div class="card bg-secondary bg-opacity-10 border-secondary">
<div class="card-body">
<pre class="mb-0 text-light" style="white-space: pre-wrap; word-break: break-word; font-family: inherit;">{{ policy.policy_text }}</pre>
</div>
</div>
{% endif %}
<hr class="border-secondary mt-5">
<p class="text-muted small text-center mb-4">
This page is hosted by <a href="https://github.com/simolzimol/MCLogger" class="text-secondary">MCLogger</a>
on behalf of <em>{{ group.name }}</em>.
</p>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>