Spaces:
Sleeping
Sleeping
| <html lang="zh-CN"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>InterConnect Dashboard</title> | |
| <link rel="preconnect" href="https://fonts.googleapis.com"> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
| <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet"> | |
| <link rel="stylesheet" href="style.css"> | |
| </head> | |
| <body> | |
| <div id="login-screen" class="screen"> | |
| <div class="login-container"> | |
| <h1>Minecraft WebSocket API</h1> | |
| <h2>控制台登录</h2> | |
| <form id="login-form"> | |
| <input type="password" id="api-key-input" placeholder="请输入 Admin 或 Regular Key" required> | |
| <button type="submit">登录</button> | |
| </form> | |
| <p class="error-message" id="login-error"></p> | |
| <div class="login-info"> | |
| <p><strong>密钥类型</strong></p> | |
| <p>Admin Key - 拥有完整管理权限</p> | |
| <p>Regular Key - 服务器监测与命令访问</p> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="admin-screen" class="screen hidden"> | |
| <nav class="navbar"> | |
| <h1>管理员面板</h1> | |
| <div class="nav-info"> | |
| <button id="admin-theme-toggle" class="theme-toggle" title="切换深色/浅色模式"> | |
| <!-- Icon will be injected by JS --> | |
| </button> | |
| <span id="admin-user-info"></span> | |
| <button class="logout-btn">退出登录</button> | |
| </div> | |
| </nav> | |
| <div class="admin-tabs"> | |
| <button class="admin-tab-btn active" data-tab="keys">密钥管理</button> | |
| <button class="admin-tab-btn" data-tab="ai">AI 配置</button> | |
| <button class="admin-tab-btn" data-tab="events">事件监听</button> | |
| </div> | |
| <div class="container"> | |
| <div id="admin-tab-keys" class="admin-tab-content"> | |
| <div class="section"> | |
| <div class="section-header"> | |
| <h2>API 密钥管理</h2> | |
| <button id="create-key-btn" class="btn-primary">创建密钥</button> | |
| </div> | |
| <div id="admin-keys-list" class="keys-list"></div> | |
| </div> | |
| </div> | |
| <div id="admin-tab-ai" class="admin-tab-content hidden"> | |
| <div class="section" id="admin-ai-section"> | |
| <div class="section-header"> | |
| <h2>AI 配置</h2> | |
| </div> | |
| <div class="ai-config-form"> | |
| <form id="ai-config-form"> | |
| <div class="form-group"> | |
| <label>API 地址 *</label> | |
| <input type="text" id="ai-api-url" placeholder="https://api.openai.com/v1/chat/completions" required> | |
| </div> | |
| <div class="form-group"> | |
| <label>模型 ID *</label> | |
| <input type="text" id="ai-model-id" placeholder="gpt-3.5-turbo" required> | |
| </div> | |
| <div class="form-group"> | |
| <label>API 密钥 *</label> | |
| <input type="password" id="ai-api-key" placeholder="sk-xxx"> | |
| <small id="ai-api-key-hint" class="hint"></small> | |
| </div> | |
| <div class="form-group"> | |
| <label>系统提示词(可选)</label> | |
| <textarea id="ai-system-prompt" placeholder="你是 Minecraft 玩家助手。"></textarea> | |
| </div> | |
| <div class="form-group"> | |
| <label> | |
| <input type="checkbox" id="ai-enabled" checked> 启用 | |
| </label> | |
| </div> | |
| <div class="form-actions"> | |
| <button type="submit" class="btn-primary">保存配置</button> | |
| <button type="button" id="ai-test-btn" class="btn-secondary">测试连接</button> | |
| <button type="button" id="ai-delete-btn" class="btn-danger">删除配置</button> | |
| </div> | |
| </form> | |
| <div id="ai-status" class="ai-status"></div> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="admin-tab-events" class="admin-tab-content hidden"> | |
| <div class="section"> | |
| <h2>实时事件监听</h2> | |
| <div id="admin-events-list" class="events-terminal"></div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="user-screen" class="screen hidden"> | |
| <nav class="navbar"> | |
| <h1>用户监测</h1> | |
| <div class="nav-info"> | |
| <button id="user-theme-toggle" class="theme-toggle" title="切换深色/浅色模式"> | |
| <!-- Icon will be injected by JS --> | |
| </button> | |
| <span id="user-info"></span> | |
| <button class="logout-btn">退出登录</button> | |
| </div> | |
| </nav> | |
| <div class="container"> | |
| <div class="stats-grid"> | |
| <div class="stat-card"> | |
| <h3>活跃连接</h3> | |
| <p class="stat-value" id="user-stat-connections">0</p> | |
| </div> | |
| <div class="stat-card"> | |
| <h3>Server Keys</h3> | |
| <p class="stat-value" id="user-stat-server-keys">0</p> | |
| </div> | |
| </div> | |
| <div class="section"> | |
| <h2>服务器密钥</h2> | |
| <div id="user-keys-list" class="keys-list"></div> | |
| </div> | |
| <div class="section"> | |
| <h2>命令控制台</h2> | |
| <form id="command-form" class="command-form"> | |
| <input type="text" id="command-input" placeholder="输入命令" required> | |
| <button type="submit" class="btn-primary">发送</button> | |
| </form> | |
| <div id="command-history" class="command-history"></div> | |
| </div> | |
| <div class="section"> | |
| <h2>实时事件监听</h2> | |
| <div id="user-events-list" class="events-terminal"></div> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="create-key-modal" class="modal hidden"> | |
| <div class="modal-content"> | |
| <h2>创建 API 密钥</h2> | |
| <form id="create-key-form"> | |
| <label>名称 *</label> | |
| <input type="text" id="key-name" required> | |
| <label>描述</label> | |
| <textarea id="key-description"></textarea> | |
| <label>密钥类型</label> | |
| <select id="key-type"> | |
| <option value="regular">普通</option> | |
| <option value="admin">管理员</option> | |
| </select> | |
| <label>服务器 ID(可选)</label> | |
| <input type="text" id="key-server-id"> | |
| <div class="modal-actions"> | |
| <button type="button" id="cancel-create-btn" class="btn-secondary">取消</button> | |
| <button type="submit" class="btn-primary">创建</button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| <div id="key-details-modal" class="modal hidden"> | |
| <div class="modal-content"> | |
| <h2>密钥详情</h2> | |
| <div id="key-details-content"></div> | |
| <div class="modal-actions"> | |
| <button id="close-details-btn" class="btn-secondary">关闭</button> | |
| </div> | |
| </div> | |
| </div> | |
| <div id="create-server-key-modal" class="modal hidden"> | |
| <div class="modal-content"> | |
| <h2>为普通密钥创建服务器密钥</h2> | |
| <p id="create-server-key-parent-name" class="modal-parent-info"></p> | |
| <form id="create-server-key-form"> | |
| <input type="hidden" id="server-key-regular-id"> | |
| <label>名称 *</label> | |
| <input type="text" id="server-key-name" required> | |
| <label>描述</label> | |
| <textarea id="server-key-description"></textarea> | |
| <label>服务器 ID(可选)</label> | |
| <input type="text" id="server-key-server-id"> | |
| <div class="modal-actions"> | |
| <button type="button" id="cancel-server-key-btn" class="btn-secondary">取消</button> | |
| <button type="submit" class="btn-primary">创建</button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| <div id="refresh-key-modal" class="modal hidden"> | |
| <div class="modal-content"> | |
| <h2>刷新密钥</h2> | |
| <div class="modal-parent-info danger-bg"> | |
| <p>⚠️ <strong>警告:此操作不可撤销!</strong></p> | |
| <p>刷新密钥将立即使旧密钥失效。</p> | |
| <p>任何使用旧密钥连接的插件或服务都将断开连接,直到您更新为新密钥。</p> | |
| </div> | |
| <p>您确定要刷新密钥 <strong id="refresh-key-name"></strong> 吗?</p> | |
| <input type="hidden" id="refresh-key-id"> | |
| <div class="modal-actions"> | |
| <button id="cancel-refresh-btn" class="btn-secondary">取消</button> | |
| <button id="confirm-refresh-btn" class="btn-danger">确认刷新</button> | |
| </div> | |
| </div> | |
| </div> | |
| <script src="app.js"></script> | |
| </body> | |
| </html> |