Commit Graph

99 Commits

Author SHA1 Message Date
Claude (Chronicler #78)
78179de2bc feat: /tasks detail view + In Progress button
- /tasks number:26 shows full task detail embed
  (description, tags, status, priority, owner, dates)
- Mark Done, In Progress, and Take Task buttons on detail view
- task_progress_ button handler sets status to in_progress

Chronicler #78 | firefrost-services
2026-04-11 14:13:16 +00:00
Claude (Chronicler #78)
48f74e8658 feat: ChatOps Task Management System (Gemini-architected)
Database:
- tasks table in PostgreSQL (id, task_number, title, status, priority, owner, tags)
- 45 tasks migrated from BACKLOG.md + tasks-index files
- Indexes on status, priority, owner, task_number

API (for Chroniclers/Catalysts):
- GET /api/internal/tasks — list with filters (status, priority, owner)
- GET /api/internal/tasks/summary — stats by status and priority
- POST /api/internal/tasks — create new task (auto-numbers)
- PATCH /api/internal/tasks/:id — update status/priority/owner

Discord (for Meg/Holly/Michael):
- /tasks command with filter options (open, in_progress, mine, high, active, done, all)
- Mark Done buttons — one tap to complete a task
- Take Task buttons — claim unassigned tasks
- Color-coded priority and status emoji
- Staff-only access

Architecture: PostgreSQL → Arbiter API → Discord buttons (ChatOps)
Gemini consultation: gemini-task-management-redesign-2026-04-11.md

Chronicler #78 | firefrost-services
2026-04-11 13:56:45 +00:00
Claude (Chronicler #78)
075ab899c5 fix: Add MCP Logs to About page module registry
Chronicler #78 | firefrost-services
2026-04-11 13:18:05 +00:00
Claude (Chronicler #78)
03974d1f13 feat: Task #109 — MCP Logging in Trinity Console (v2.3.0)
Arbiter changes:
- POST /api/internal/mcp/log endpoint in api.js
- MCP Logs admin route (/admin/mcp-logs) with filters, stats, pagination
- EJS view with expandable detail rows, server color badges
- Sidebar link under System group

Trinity Core v2.3.0:
- logToArbiter() function POSTs to Arbiter after every command
- Both MCP (Claude.ai) and REST (/exec) paths log with execution timing
- Async logging — doesn't block command response

Database:
- mcp_logs table created on Command Center (indexes on server, time, success)

Architecture:
  Trinity Core → command → response + async POST → Arbiter → PostgreSQL → Trinity Console

Chronicler #78 | firefrost-services
2026-04-11 11:55:22 +00:00
Claude (Chronicler #78)
0b61d38419 feat: Dashboard — Social Overview above New Features, add new modules
- Moved Social Overview card above New Features card
- Added Infrastructure module to New Features (topology map)
- Added Social Analytics to New Features (engagement tracking)
- Added About & Deploy to New Features (version info)
- Kept Discord Dashboard in New Features
- Removed Financials from New Features (it's established now)

Chronicler #78 | firefrost-services
2026-04-11 10:51:22 +00:00
Claude (Chronicler #78)
bd783093a9 feat: Sidebar reorganization + About page
Sidebar changes:
- Grouped nav items: Operations, Business, Community, Infrastructure, System
- Section labels with uppercase tracking
- Removed Deploy button from sidebar
- Cleaner layout with overflow scroll

About page (/admin/about):
- Console version, Node.js version, Arbiter uptime, module count
- Module registry with version and status badges (stable/new/beta)
- Deploy Arbiter button (moved from sidebar)
- Health check polling after deploy
- Credits footer

Header bar:
- Added ℹ️ About icon next to dark mode toggle
- Active state highlighting when on About page

Chronicler #78 | firefrost-services
2026-04-11 10:46:42 +00:00
Claude (Chronicler #78)
4788140c2c fix: Node clicks blocked after dragging — reset dragMoved on mouseup/touchend
dragMoved flag was only reset in wrap mousedown, which skips for node clicks.
After any drag, dragMoved stayed true forever, blocking all showServer/showExternal calls.
Fix: setTimeout reset on mouseup/touchend (10ms delay lets click fire first).

Chronicler #78 | firefrost-services
2026-04-11 10:38:32 +00:00
Claude (Chronicler #78)
0c7dad36ea feat: Add zoom/pan/pinch to Infrastructure topology
- Mouse wheel zoom (centered on cursor position)
- Click-drag to pan
- Touch pinch-zoom for mobile
- Touch drag to pan on mobile
- Zoom controls: +, −, percentage display, reset (⌂)
- Zoom range: 50% to 300%
- Drag guard prevents accidental clicks after panning
- Canvas connections redraw correctly at all zoom levels
- Smooth CSS transitions on zoom, disabled during drag

Chronicler #78 | firefrost-services
2026-04-11 10:35:03 +00:00
Claude (Chronicler #78)
2e3d272e26 fix: RAM percentage parsing — handle Mi vs Gi units
Panel VPS and Trinity Core report used RAM in Mi (e.g. 703Mi)
while total is in Gi (e.g. 1.9Gi). parseFloat gave 703/1.9 = 37000%.
Now normalizes both values to Gi before calculating percentage.

Chronicler #78 | firefrost-services
2026-04-11 10:30:43 +00:00
Claude (Chronicler #78)
a83766efb4 feat: Add Infrastructure module to Trinity Console
New module: /admin/infrastructure
- Interactive topology map showing all 8 servers + external services
- Live data from Trinity Core MCP API (cached 60s)
- Bezier curve connections color-coded by type (external/internal/SSH/MCP)
- Hover highlights all connections to/from a node
- Click to drill into server detail (CPU, RAM, disk, load, services)
- Game server list for TX1/NC1 with RAM allocation totals
- External service detail (Cloudflare, Stripe, Discord, Claude.ai)
- Fleet summary bar (8 servers, 22 games, ~42 containers)
- Refresh button forces cache clear + re-audit
- Mobile responsive grid layout
- JetBrains Mono typography, Fire/Frost/Arcane color scheme

Files:
- src/routes/admin/infrastructure.js (route + Trinity Core API client)
- src/views/admin/infrastructure/index.ejs (topology + detail views)
- Modified: src/routes/admin/index.js (registered infrastructure router)
- Modified: src/views/layout.ejs (added nav link)

Chronicler #78 | firefrost-services
2026-04-11 10:24:05 +00:00
Claude
7c534b53a4 Fix: Add socialTotals to correct dashboard route file
Was editing wrong file (admin.js vs admin/index.js)

Chronicler #76
2026-04-10 22:26:10 +00:00
Claude
918fb99b87 Add Social Overview card to Trinity Console dashboard
- Shows cross-platform totals (posts, views, likes, comments)
- Breaks down by platform with icons
- Clickable link to full Social Analytics page

Chronicler #76
2026-04-10 22:23:21 +00:00
Claude
74f7876955 Fix social sync: update post_title and post_url on existing posts
Previously only INSERT included these fields, UPDATE ignored them.

Chronicler #76
2026-04-10 22:20:06 +00:00
Claude (Chronicler #76)
f35325a597 Add internal API routes for n8n social analytics integration
Task #108 Phase 2: Social Analytics Automation

New endpoints (token-based auth via INTERNAL_API_TOKEN):
- POST /api/internal/social/sync - Upsert single post metrics
- POST /api/internal/social/sync/batch - Batch upsert (max 100 posts)
- POST /api/internal/social/snapshot - Upsert account-level stats
- GET /api/internal/social/digest - Summary data for Discord webhook

Architecture:
- Rube MCP -> n8n -> Arbiter /api/internal/* -> PostgreSQL
- Bearer token auth (not session-based)
- COALESCE for partial updates (only update provided fields)

Next: Generate INTERNAL_API_TOKEN and add to .env on Command Center

🔥 Fire + Frost + Foundation = Where Love Builds Legacy 💙❄️
2026-04-10 21:00:19 +00:00
Claude
92e460a90b fix: Add Social Analytics to sidebar navigation
Chronicler #76
2026-04-10 20:27:35 +00:00
Claude
b8ed2095ba feat: Add Social Analytics module to Trinity Console (Task #108)
- Add database migration for social_posts and social_account_snapshots tables
- Create /admin/social route with full CRUD for posts
- Add dashboard view with platform tabs (TikTok, Facebook, Instagram, X, Bluesky)
- Add post entry form matching TikTok Studio metrics
- Add post detail view with update capability
- Add account snapshot form for follower/demographic tracking
- Register social router in admin index

Phase 1: Manual entry dashboard
Phase 2 (future): API integration when approved

Chronicler #76
2026-04-10 20:14:27 +00:00
Claude
685626f13f fix: Use correct env vars PANEL_URL and PANEL_CLIENT_KEY
.env has PANEL_URL and PANEL_CLIENT_KEY, not PTERO_PANEL_URL.

Chronicler #75
2026-04-10 18:00:33 +00:00
Claude
32b378f539 fix: Use Pterodactyl API directly instead of servers-api Worker
Worker was returning HTML error page. Now queries Pterodactyl panel
directly using PTERO_CLIENT_KEY from .env.

Chronicler #75
2026-04-10 15:41:57 +00:00
Claude
811e3046cf feat: Add server status poller for Discord channels (#107)
New service that polls Pterodactyl (via servers-api Worker) every 5 min
and posts/updates status embeds in each game server's -status channel.

- Creates discord_status_messages table to persist message IDs
- Maps server names to channel IDs for all 15 game servers
- Posts new embed or edits existing one (no spam)
- Handles message deletion gracefully (re-posts if needed)

Status channels created:
- stoneblock-4-status, society-sunlit-valley-status, atm10-tts-status
- all-the-mons-status, mythcraft-5-status, beyond-depth-status
- beyond-ascension-status, otherworld-status, deceasedcraft-status
- submerged-2-status, sneaks-pirate-pack-status, cottage-witch-status
- farm-crossing-5-status, homestead-status, wolds-vaults-status

Chronicler #75
2026-04-10 15:39:04 +00:00
Claude
0acea3b95f fix: Skip OAuth if already logged in, go straight to checkout
If user has existing session from Trinity Console login,
/stripe/auth now redirects directly to /stripe/checkout
instead of re-triggering Discord OAuth.

Chronicler #75
2026-04-10 15:06:34 +00:00
Claude
2740dc5fd3 fix: Use OAuth state parameter instead of session for tier
Session was being lost between /stripe/auth and /auth/discord/callback.
Now passes tier through Discord OAuth state parameter which survives
the redirect.

Chronicler #75
2026-04-10 15:05:40 +00:00
Claude
12ffdd45f5 fix: Add Discord OAuth → Stripe checkout flow
THE BUG: Website redirected to /stripe/auth but route didn't exist.
Checkout sessions were created WITHOUT client_reference_id (Discord ID),
so webhook couldn't sync Discord roles after payment.

THE FIX:
- Added GET /stripe/auth - stores tier in session, redirects to Discord OAuth
- Added GET /stripe/checkout - creates checkout WITH client_reference_id
- Updated auth callback to redirect to /stripe/checkout after OAuth
- Legacy POST /create-checkout-session kept for compatibility

FLOW NOW:
1. User clicks Subscribe on website
2. → /stripe/auth?tier=X (stores tier, redirects to Discord)
3. → /auth/discord (Discord OAuth)
4. → /auth/discord/callback (user authenticated)
5. → /stripe/checkout?tier=X (creates Stripe session WITH Discord ID)
6. → Stripe Checkout (user pays)
7. → Webhook receives event with client_reference_id
8. → Discord role synced!

Chronicler #75
2026-04-10 14:58:41 +00:00
Claude
47a600eeb5 Fix: Handle server names with subtitles for Discord channel matching
- 'Homestead - A Cozy Survival Experience' now matches 'homestead-chat'
- 'All The Mons (Private) - TX' now matches 'all-the-mons-chat'
- Strips subtitles after ' - ' and removes parentheticals
2026-04-09 20:03:41 +00:00
Claude
e30ff4d694 Fix: Add Discord channel status to matrix body template (inline cards, not partial) 2026-04-09 19:59:36 +00:00
Claude
081bad1279 Add Discord channel status check to server cards
- Checks for 4 channels per server: chat, in-game, forum, voice
- Shows 'All 4 channels configured' or lists missing channels
- Caches Discord channel data for 5 minutes to reduce API calls
2026-04-09 19:55:41 +00:00
Claude
cbf5d219fc Add health check after deploy - confirms Arbiter restarted successfully 2026-04-09 19:50:17 +00:00
Claude
02bddc0baf Fix deploy button: use detached process to avoid 502 on self-restart 2026-04-09 19:48:04 +00:00
Claude
ef562ef59a Add Trinity Console deploy button for Holly/Meg/Michael
- Deploy button in sidebar above username
- POST /admin/system/deploy endpoint
- Updated deploy.sh with locking, logging, user tracking
- Prevents concurrent deploys (mkdir lock)
- Logs who deployed and what commit
- Updated DEPLOYMENT.md with setup instructions

Gemini consultation: confirmed synchronous approach, locking, sudoers config
2026-04-09 19:40:34 +00:00
Claude
69200d8ac3 Add /delserver slash command
Deletes complete server setup:
- All channels in category
- The category itself
- The server role

Requires confirm:True to execute.
Without confirm, shows preview of what would be deleted.
Reminds to clean up Carl-bot reaction roles.

Staff only.

Chronicler: #71
2026-04-08 17:27:10 +00:00
Claude
06f7afe25d Add /createserver slash command
Creates complete server setup with one command:
- Creates role
- Creates category with 🎮 prefix
- Creates chat, in-game, forum, voice channels
- Applies permission template
- Posts and archives welcome message
- Suggests unused emoji for reaction roles

Staff only. Reminds to configure Carl-bot.

Task #98 Discord Channel Automation
Chronicler: #71
2026-04-08 17:18:28 +00:00
Claude Chronicler-70
9e4fa13fdb feat(arbiter): Add New Features card to dashboard
Highlights Discord Dashboard and Financials Module with
clickable cards that link directly to the new features.

Chronicler: #70
2026-04-08 15:33:54 +00:00
Claude Chronicler-70
b96ab1fb24 feat(arbiter): Add Discord dashboard to Trinity Console
- New sidebar entry for Discord
- Full server structure visualization
- Channel tree with expandable categories
- Role hierarchy with color badges
- Health checks (orphan channels, empty roles, bot roles)
- Search/filter across channels and roles
- Click channel to see permission overwrites
- Click role to see explicit channel access
- Responsive design with modal details view

Chronicler: #70
2026-04-08 15:30:22 +00:00
Claude Chronicler-70
04bc2e734f feat(arbiter): Add localhost bypass for admin routes debugging 2026-04-08 15:23:20 +00:00
Claude
b639f92da6 fix: Remove incorrect middleware import from discord-audit
Parent router (admin/index.js) already applies requireTrinityAccess
to all child routes. No additional auth middleware needed.

Chronicler #70
2026-04-08 15:19:50 +00:00
Claude
e99ef3b942 feat: Add Discord audit routes to Arbiter
New endpoints for Trinity Console:
- GET /admin/discord/audit — Full server audit (channels, roles, structure)
- GET /admin/discord/channels — Just channels
- GET /admin/discord/roles — Just roles

Returns:
- Server info (name, member count, features)
- Categories with nested children
- Orphan channels (not in categories)
- Role hierarchy with positions and member counts
- Permission overwrites per channel

Uses existing Discord.js client from app.locals.

Chronicler #70
2026-04-08 15:15:20 +00:00
Claude
7cf0eec2db Add module list to v2 teaser
12 planned modules: Dashboard, Players, Servers, Infrastructure,
Financials, Tasks, Docs, Team, Marketing, Chroniclers, System, Health

Chronicler #69
2026-04-08 08:55:17 +00:00
Claude
20b2fab994 Add Trinity Core v2 teaser to dashboard
Features highlighted:
- Trinity Codex AI (natural language queries)
- Smart Notifications (Discord alerts)
- Approval Workflows (Discord button approvals)
- Plugin Architecture (self-registering modules)
- Granular Permissions (RBAC for staff)
- Distributed Mesh (Tailscale-connected servers)

Styled with brand gradient border.

Chronicler #69
2026-04-08 08:53:56 +00:00
Claude
c7c2340321 Add logout button to user profile in sidebar
- Door emoji button next to username
- Links to /auth/logout
- Redirects to home page after logout

Chronicler #69
2026-04-08 08:50:32 +00:00
Claude
460d36c9b2 Remove placeholder notification bell
Non-functional UI element. Notifications will be implemented
properly in Trinity Core.

Chronicler #69
2026-04-08 08:48:38 +00:00
Claude
5bd4c60238 Fix scheduler timezone labels: UTC → Central
Times are stored in Central Time (matching Pterodactyl server config).
Labels were incorrectly showing UTC.

Chronicler #69
2026-04-08 08:46:07 +00:00
Claude
795020b55c Add Export CSV button to Players page
- Exports all players with full subscription data
- Includes: discord_id, minecraft_username, minecraft_uuid, is_staff,
  tier_level, tier_name, status, mrr_value, is_lifetime,
  stripe_customer_id, created_at, updated_at
- Downloads as firefrost-players-YYYY-MM-DD.csv
- Properly escapes CSV values with quotes

Chronicler #69
2026-04-08 08:41:17 +00:00
Claude
a13d9a2c66 Add 10-minute retry for failed server syncs
When hourly sync encounters servers that fail (e.g., mid-restart):
- Logs the failure count
- Schedules automatic retry in 10 minutes
- Retry only targets previously failed servers
- Clears error state on successful retry

Fixes issue where servers in daily restart would stay in error state
until manual intervention.

Chronicler #69
2026-04-08 08:39:34 +00:00
Claude
c2b6610e6d Add version number (v1.0) below Trinity Console title
Small text under the logo in sidebar for version tracking.

Chronicler #69
2026-04-08 08:34:41 +00:00
Claude
7d21b4290a Dashboard: Show last sync date/time instead of just checkmark
- Queries server_sync_log for most recent successful sync
- Displays date (e.g., 'Apr 8') and time (e.g., '3:28 AM')
- Shows yellow dash with 'Never' if no syncs recorded

Chronicler #69
2026-04-08 08:32:28 +00:00
Claude
d121bd21f6 Fix dashboard SQL: use tier_level and mrr_value columns
The subscriptions table uses:
- tier_level (integer) not tier_id
- mrr_value (pre-calculated) not joined to subscription_tiers
- is_lifetime (boolean) not status='lifetime'

Chronicler #69
2026-04-08 08:24:08 +00:00
Claude
3666241aac Fix Trinity Console dashboard: dynamic server/subscriber counts
Dashboard was showing hardcoded values:
- Servers Online: 12 (should be 22)
- Active Subscribers: 0
- Total MRR: $0

Now fetches live data:
- Server count from Pterodactyl API via getMinecraftServers()
- Subscriber count and MRR from arbiter_db subscriptions table

Files changed:
- src/routes/admin/index.js: async dashboard route with data fetching
- src/views/admin/dashboard.ejs: EJS variables instead of hardcoded values

Chronicler #69
2026-04-08 08:19:10 +00:00
Claude (Chronicler #62)
1a97e82ec8 feat(arbiter): implement Task #87 - Lifecycle handlers with Discord role sync
WHAT THIS ADDS:
- Discord role sync on new subscriptions (checkout.session.completed)
- Discord role removal on chargebacks (charge.dispute.created)
- Grace period expiration job (hourly cron check)
- Automatic downgrade to Awakened when grace period expires

NEW FILES:
- src/services/discordRoleSync.js - Role add/remove/sync functions
- src/sync/graceExpiration.js - Grace period expiration processor

MODIFIED FILES:
- src/routes/stripe.js - Added role sync calls to webhook handlers
- src/discord/events.js - Initialize role sync service on bot ready
- src/sync/cron.js - Added grace period check to hourly job
- src/index.js - Import discordRoleSync service

PHILOSOPHY:
'We Don't Kick People Out' - expired grace periods downgrade to
permanent Awakened tier (tier 1, lifetime). Users keep community
access, just lose premium perks.

ROLE MAPPING (tier_level -> role key):
1=the-awakened, 2=fire-elemental, 3=frost-elemental,
4=fire-knight, 5=frost-knight, 6=fire-master, 7=frost-master,
8=fire-legend, 9=frost-legend, 10=the-sovereign

CHARGEBACKS:
- Immediate role removal
- Added to banned_users table
- Full audit logging

Signed-off-by: Claude (Chronicler #62) <claude@firefrostgaming.com>
2026-04-05 14:25:41 +00:00
Claude (Chronicler #61)
bc66fec77a feat: PostgreSQL session store
Replaces MemoryStore with connect-pg-simple.
Sessions now persist across Arbiter restarts.
Table 'session' auto-created if missing.

Signed-off-by: Claude (Chronicler #61) <claude@firefrostgaming.com>
2026-04-05 10:34:44 +00:00
Claude (Chronicler #61)
d9b54187ee fix: Normalize base_time to HH:mm:ss format
HTML time input sends HH:mm, but calculateStagger expects HH:mm:ss.

Signed-off-by: Claude (Chronicler #61) <claude@firefrostgaming.com>
2026-04-05 10:30:36 +00:00
Claude (Chronicler #61)
3e4055c5dc fix: Add CSRF token to update-config form
Signed-off-by: Claude (Chronicler #61) <claude@firefrostgaming.com>
2026-04-05 10:25:07 +00:00