Update from Git Manager GUI

This commit is contained in:
2026-03-30 20:41:48 +02:00
parent 605df075cd
commit 0efd52d893
4 changed files with 320 additions and 14 deletions

View File

@@ -0,0 +1,89 @@
<?php
/**
* MC Bridge — Einstellungs-Sektion für den Forum-Admin
*
* Diesen Block in forum-settings.php im Admin-Formular einfügen,
* z.B. nach der Discord-Sektion.
*/
if ( ! defined( 'ABSPATH' ) ) exit;
?>
<!-- ═══ Minecraft Bridge ═══ -->
<div class="wbf-settings-section">
<h3 style="display:flex;align-items:center;gap:8px;margin-bottom:12px">
<span style="font-size:1.3em">⛏️</span> Minecraft Bridge
</h3>
<p class="description" style="margin-bottom:16px;color:#9ca3af">
Verbindet das Forum mit deinem Minecraft-Server (BungeeCord StatusAPI Plugin).
Spieler können ihren Forum-Account verknüpfen und erhalten Ingame-Benachrichtigungen
bei neuen Antworten, Erwähnungen und Privatnachrichten.
</p>
<table class="form-table">
<tr>
<th>Aktiviert</th>
<td>
<label>
<input type="checkbox" name="wbf_settings[mc_bridge_enabled]" value="1"
<?php checked( ! empty( $s['mc_bridge_enabled'] ) ); ?>>
MC Bridge aktivieren
</label>
</td>
</tr>
<tr>
<th>StatusAPI URL</th>
<td>
<input type="url" name="wbf_settings[mc_bridge_api_url]"
value="<?php echo esc_attr( $s['mc_bridge_api_url'] ?? '' ); ?>"
class="regular-text"
placeholder="http://192.168.1.100:9191">
<p class="description">
Die URL deines BungeeCord StatusAPI Servers (IP + Port).
Beispiel: <code>http://dein-server:9191</code>
</p>
</td>
</tr>
<tr>
<th>API Secret</th>
<td>
<input type="password" name="wbf_settings[mc_bridge_api_secret]"
value="<?php echo esc_attr( $s['mc_bridge_api_secret'] ?? '' ); ?>"
class="regular-text"
autocomplete="new-password">
<p class="description">
Gemeinsames Passwort für die API-Kommunikation.
Muss identisch sein mit <code>forum.api_secret</code> in der
<code>verify.properties</code> des StatusAPI Plugins.
</p>
</td>
</tr>
<tr>
<th>Verbindungstest</th>
<td>
<button type="button" id="wbf-mc-test-btn" class="button"
onclick="wbfTestMcConnection()">
🔌 Verbindung testen
</button>
<span id="wbf-mc-test-result" style="margin-left:10px"></span>
<script>
function wbfTestMcConnection() {
var btn = document.getElementById('wbf-mc-test-btn');
var result = document.getElementById('wbf-mc-test-result');
var url = document.querySelector('input[name="wbf_settings[mc_bridge_api_url]"]').value;
if (!url) { result.textContent = '❌ Bitte erst eine URL eingeben.'; return; }
btn.disabled = true;
result.textContent = '⏳ Teste...';
fetch(url.replace(/\/$/, '') + '/forum/status')
.then(function(r) { return r.json(); })
.then(function(d) {
if (d.success) result.innerHTML = '✅ <strong>Verbunden!</strong> StatusAPI v' + (d.version || '?');
else result.textContent = '⚠️ Erreichbar aber Fehler: ' + JSON.stringify(d);
})
.catch(function(e) { result.textContent = '❌ Nicht erreichbar: ' + e.message; })
.finally(function() { btn.disabled = false; });
}
</script>
</td>
</tr>
</table>
</div>