From 78a2a29bfc2d07f5ee92175cdf9ac9b6583efda6 Mon Sep 17 00:00:00 2001 From: sirpiglr <49359077-sirpiglr@users.noreply.replit.com> Date: Wed, 10 Dec 2025 02:51:47 +0000 Subject: [PATCH] Add federation management to the dashboard and update the federation page Add new navigation item and page structure for federation management in dashboard.html, and update federation.html with new styling and content sections for explaining the federation concept and features. Replit-Commit-Author: Agent Replit-Commit-Session-Id: aed2e46d-25bb-4b73-81a1-bb9e8437c261 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Event-Id: f96502b3-64e2-454a-a892-81ab2a2f62a3 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3bdfff67-975a-46ad-9845-fbb6b4a4c4b5/aed2e46d-25bb-4b73-81a1-bb9e8437c261/MGpDued Replit-Helium-Checkpoint-Created: true --- .replit | 4 + aethex-bot/public/dashboard.html | 286 +++++++++ aethex-bot/public/federation.html | 986 +++++++++++------------------- 3 files changed, 645 insertions(+), 631 deletions(-) diff --git a/.replit b/.replit index 9585c0f..323067d 100644 --- a/.replit +++ b/.replit @@ -21,6 +21,10 @@ externalPort = 80 localPort = 8080 externalPort = 8080 +[[ports]] +localPort = 34599 +externalPort = 3000 + [workflows] runButton = "Project" diff --git a/aethex-bot/public/dashboard.html b/aethex-bot/public/dashboard.html index 2a4f5ce..780d831 100644 --- a/aethex-bot/public/dashboard.html +++ b/aethex-bot/public/dashboard.html @@ -1171,6 +1171,9 @@ + @@ -1708,6 +1711,114 @@ + + @@ -1885,6 +1996,7 @@ case 'admin-quests': await loadAdminQuests(); break; case 'admin-achievements': await loadAdminAchievements(); break; case 'admin-shop': await loadAdminShop(); break; + case 'federation': loadFederationData(); break; } } @@ -2591,6 +2703,180 @@ } } + document.querySelectorAll('[data-fed-tab]').forEach(tab => { + tab.addEventListener('click', () => { + document.querySelectorAll('[data-fed-tab]').forEach(t => t.classList.remove('active')); + document.querySelectorAll('.fed-section').forEach(s => s.classList.add('hidden')); + tab.classList.add('active'); + document.getElementById(tab.dataset.fedTab).classList.remove('hidden'); + }); + }); + + async function loadFederationStats() { + try { + const res = await fetch('/api/federation/stats'); + const data = await res.json(); + document.getElementById('fedTotalServers').textContent = data.totalServers || 0; + document.getElementById('fedActiveBans').textContent = data.activeBans || 0; + document.getElementById('fedPendingApps').textContent = data.pendingApplications || 0; + } catch (e) { + console.error('Failed to load federation stats:', e); + } + } + + async function loadFederationServers() { + try { + const res = await fetch('/api/federation/servers'); + const data = await res.json(); + const grid = document.getElementById('fedServerGrid'); + + if (!data.servers || data.servers.length === 0) { + grid.innerHTML = '
No servers in the federation yet. Use /federation apply to join!
'; + return; + } + + const categoryEmojis = { gaming: '🎮', creative: '🎨', development: '💻', education: '📚', community: '👥', business: '🏢' }; + + grid.innerHTML = data.servers.map(s => ` +
+
+
${categoryEmojis[s.category] || '🌐'}
+
+
${s.guild_name}
+
${s.category || 'General'}
+
+
+
${s.description || 'No description'}
+
${(s.member_count || 0).toLocaleString()} members
+
+ `).join(''); + } catch (e) { + console.error('Failed to load federation servers:', e); + } + } + + async function loadFederationBans() { + try { + const res = await fetch('/api/federation/bans?limit=50'); + const data = await res.json(); + const tbody = document.getElementById('fedBanList'); + + if (!data.bans || data.bans.length === 0) { + tbody.innerHTML = 'No active bans'; + return; + } + + const severityColors = { low: 'var(--muted)', medium: 'var(--warning)', high: '#f97316', critical: 'var(--danger)' }; + + tbody.innerHTML = data.bans.map(b => ` + + ${b.username || b.user_id} + ${(b.severity || 'unknown').toUpperCase()} + ${(b.reason || '').substring(0, 50)}${(b.reason || '').length > 50 ? '...' : ''} + ${new Date(b.created_at).toLocaleDateString()} + + `).join(''); + } catch (e) { + console.error('Failed to load federation bans:', e); + } + } + + async function loadFederationApplications() { + try { + const res = await fetch('/api/federation/applications'); + const data = await res.json(); + const tbody = document.getElementById('fedAppList'); + + if (!data.applications || data.applications.length === 0) { + tbody.innerHTML = 'No applications'; + return; + } + + const statusColors = { pending: 'var(--warning)', approved: 'var(--success)', rejected: 'var(--danger)' }; + + tbody.innerHTML = data.applications.map(a => ` + + ${a.guild_name} + ${a.category || 'General'} + ${(a.member_count || 0).toLocaleString()} + ${(a.status || 'pending').toUpperCase()} + + ${a.status === 'pending' ? ` + + + ` : '-'} + + + `).join(''); + } catch (e) { + console.error('Failed to load federation applications:', e); + } + } + + async function loadFederationLeaderboard() { + try { + const res = await fetch('/api/federation/leaderboard?limit=20'); + const data = await res.json(); + const container = document.getElementById('fedLeaderboardList'); + + if (!data.leaderboard || data.leaderboard.length === 0) { + container.innerHTML = '
No reputation data yet. Be active across federation servers!
'; + return; + } + + const tierEmojis = { newcomer: '🌱', member: '⭐', veteran: '🏆', elite: '💎', legend: '👑' }; + + container.innerHTML = data.leaderboard.map((l, i) => ` +
+
${i + 1}
+
+
${l.discord_id}
+
${tierEmojis[l.rank_tier] || '🌱'} ${(l.rank_tier || 'newcomer').toUpperCase()}
+
+
${(l.reputation_score || 0).toLocaleString()} rep
+
+ `).join(''); + } catch (e) { + console.error('Failed to load federation leaderboard:', e); + } + } + + async function approveFedApp(id) { + if (!confirm('Approve this application?')) return; + try { + await fetch('/api/federation/applications/' + id + '/approve', { method: 'POST' }); + loadFederationApplications(); + loadFederationStats(); + loadFederationServers(); + } catch (e) { + alert('Failed to approve'); + } + } + + async function rejectFedApp(id) { + const reason = prompt('Rejection reason:'); + if (!reason) return; + try { + await fetch('/api/federation/applications/' + id + '/reject', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ reason }) + }); + loadFederationApplications(); + loadFederationStats(); + } catch (e) { + alert('Failed to reject'); + } + } + + function loadFederationData() { + loadFederationStats(); + loadFederationServers(); + loadFederationBans(); + loadFederationApplications(); + loadFederationLeaderboard(); + } + init(); diff --git a/aethex-bot/public/federation.html b/aethex-bot/public/federation.html index 3a4a891..8c6dc0a 100644 --- a/aethex-bot/public/federation.html +++ b/aethex-bot/public/federation.html @@ -3,7 +3,7 @@ - Federation - AeThex | Warden + The Federation - AeThex | Warden
+
@@ -440,394 +405,153 @@

The Federation

-

A network of protected servers. Ban one, ban all.

-
-
- -
-

Upgrade Your Protection

-
-
-
Free
-
$0
-
forever
-
Basic protection for all federation members
-
    -
  • Critical threat auto-bans
  • -
  • Server directory listing
  • -
  • Reputation tracking
  • -
  • Community support
  • -
- -
- - - -
-
Featured Slot
-
$200
-
per week
-
Promote your server across the entire federation
-
    -
  • Featured in all member servers
  • -
  • Cross-server promotion
  • -
  • Boost your member count
  • -
  • Priority directory placement
  • -
-
- -
- +

A network of protected Discord servers. When one server bans a bad actor, every federation member is protected. Ban one, ban all.

+

Free protection for all members. Premium options for extra security.

+
-
-
-
-
-
-
Member Servers
-
-
-
-
-
Active Bans
-
-
-
-
-
Pending Applications
-
-
- -
- - - - -
- -
-
-
Loading servers...
-
-
- -
-
-
- Global Ban List +
+
+

How It Works

+

Join the federation and benefit from shared intelligence across hundreds of servers.

+ +
+
+
1
+

Join the Federation

+

Add Warden to your server and apply for federation membership. Get approved and you're in.

+
+
+
2
+

Share Ban Intelligence

+

When you ban someone for serious offenses, report them to the global ban list. Other servers are instantly protected.

+
+
+
3
+

Auto-Protection

+

Known bad actors are automatically blocked before they can cause problems in your server.

- - - - - - - - - - - - -
UserSeverityReasonDate
Loading bans...
- -
-
-
- Pending Applications +
+ +
+
+

Federation Features

+

Everything you need to keep your community safe.

+ +
+
+
🛡
+
+

Global Ban List

+

Shared database of confirmed bad actors across all federation servers.

+
+
+
+
+
+

Real-Time Protection

+

Instant alerts when known threats try to join your server.

+
+
+
+
📚
+
+

Server Directory

+

Browse and discover other federation member servers.

+
+
+
+
+
+

Reputation System

+

Track user reputation across the entire federation network.

+
+
+
+
📝
+
+

Application System

+

Treaty-based membership with admin approval process.

+
+
+
+
📈
+
+

Threat Severity Levels

+

Categorized bans: Low, Medium, High, Critical - with tiered responses.

+
- - - - - - - - - - - - - -
ServerCategoryMembersStatusActions
Loading applications...
- -
-
-
- Federation Reputation Leaders +
+ +
+
+

Protection Tiers

+

Free protection for everyone. Extra security for those who need it.

+ +
+
+
Free Tier
+
Core protection for all federation members
+
    +
  • Critical threat auto-bans
  • +
  • Server directory listing
  • +
  • Reputation tracking
  • +
  • Ban reporting
  • +
  • Community support
  • +
-
-
Loading leaderboard...
+
+
Premium Tier - $50/mo
+
Maximum protection for serious communities
+
    +
  • Everything in Free, plus:
  • +
  • All-severity auto-kick
  • +
  • Priority threat alerts
  • +
  • Premium server badge
  • +
  • Priority support
  • +
+
+
+ + +
+
+ +
+
+
+

Ready to Join the Federation?

+

Use /federation apply in your server to start your membership application.

+
- - + +