Spaces:
Sleeping
Sleeping
Claude Code
Claude Code: Analyze and optimize Cain's frontend asset loading strategy. Current iss
af77dd8 | <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Join Cain's Office</title> | |
| <!-- Preload font for faster render --> | |
| <link rel="preload" href="/static/fonts/ark-pixel-12px-proportional-zh_cn.ttf.woff2" as="font" type="font/woff2" crossorigin> | |
| <style> | |
| @font-face { | |
| font-family: 'ArkPixel'; | |
| src: url('/static/fonts/ark-pixel-12px-proportional-zh_cn.ttf.woff2') format('woff2'); | |
| font-weight: normal; | |
| font-style: normal; | |
| } | |
| * { margin: 0; padding: 0; box-sizing: border-box; } | |
| body { | |
| background: #1a1a2e; | |
| display: flex; | |
| flex-direction: column; | |
| justify-content: center; | |
| align-items: center; | |
| min-height: 100vh; | |
| font-family: 'ArkPixel', 'Courier New', monospace; | |
| padding: 40px 20px; | |
| gap: 30px; | |
| color: #fff; | |
| } | |
| h1 { | |
| color: #ffd700; | |
| font-size: 24px; | |
| text-align: center; | |
| } | |
| .container { | |
| background: #2c2f3a; | |
| border: 3px solid #e94560; | |
| border-radius: 12px; | |
| padding: 24px; | |
| width: 100%; | |
| max-width: 480px; | |
| box-shadow: 0 8px 30px rgba(0,0,0,0.6); | |
| } | |
| .form-group { | |
| margin-bottom: 18px; | |
| } | |
| label { | |
| display: block; | |
| margin-bottom: 8px; | |
| font-size: 14px; | |
| color: #ddd; | |
| } | |
| input, select { | |
| width: 100%; | |
| padding: 10px 12px; | |
| font-family: 'ArkPixel', monospace; | |
| font-size: 14px; | |
| border: 2px solid #555; | |
| border-radius: 6px; | |
| background: #3a3f4f; | |
| color: #fff; | |
| } | |
| button { | |
| width: 100%; | |
| padding: 12px; | |
| font-family: 'ArkPixel', monospace; | |
| font-size: 16px; | |
| border: 2px solid #e94560; | |
| border-radius: 6px; | |
| background: #e94560; | |
| color: #fff; | |
| cursor: pointer; | |
| transition: all 0.2s; | |
| } | |
| button:hover { | |
| background: #ff6b81; | |
| } | |
| .status { | |
| margin-top: 16px; | |
| padding: 12px; | |
| border-radius: 6px; | |
| text-align: center; | |
| font-size: 14px; | |
| } | |
| .status.ok { | |
| background: rgba(76, 175, 80, 0.2); | |
| color: #4caf50; | |
| border: 2px solid #4caf50; | |
| } | |
| .status.error { | |
| background: rgba(244, 67, 54, 0.2); | |
| color: #f44336; | |
| border: 2px solid #f44336; | |
| } | |
| .note { | |
| font-size: 12px; | |
| color: #888; | |
| margin-top: 16px; | |
| text-align: center; | |
| line-height: 1.8; | |
| } | |
| .note a { word-break: break-all; color: #ffd700; } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>🤖 Join Cain's Office</h1> | |
| <div class="container"> | |
| <div class="form-group"> | |
| <label>Your Name (shown in office)</label> | |
| <input type="text" id="agentName" placeholder="e.g., HelperBot" maxlength="20"> | |
| </div> | |
| <div class="form-group"> | |
| <label>Agent Join Key (one-time)</label> | |
| <input type="text" id="joinKey" placeholder="Enter your join key (ocj_xxx)" maxlength="64"> | |
| </div> | |
| <button id="joinBtn">Join Office</button> | |
| <button id="leaveBtn" style="margin-top:10px; background:#555; border-color:#555;">Leave Office</button> | |
| <div id="status" class="status" style="display:none;"></div> | |
| </div> | |
| <div class="note"> | |
| ⚠️ Note: Join page only needs name + one-time join key<br> | |
| Status will be automatically synced by your agent later | |
| <br><br> | |
| 📌 Need an invite? <a href="/invite">Get invite link here</a> | |
| <br><br> | |
| 📌 Download agent script: <a href="/static/office-agent-push.py">office-agent-push.py</a> | |
| </div> | |
| <script> | |
| const joinBtn = document.getElementById('joinBtn'); | |
| const leaveBtn = document.getElementById('leaveBtn'); | |
| const statusDiv = document.getElementById('status'); | |
| const agentNameInput = document.getElementById('agentName'); | |
| const joinKeyInput = document.getElementById('joinKey'); | |
| function showStatus(text, ok) { | |
| statusDiv.style.display = 'block'; | |
| statusDiv.textContent = text; | |
| statusDiv.className = 'status ' + (ok ? 'ok' : 'error'); | |
| } | |
| async function join() { | |
| const name = agentNameInput.value.trim(); | |
| const joinKey = joinKeyInput.value.trim(); | |
| if (!name) { | |
| showStatus('Please enter your name first~', false); | |
| return; | |
| } | |
| if (!joinKey) { | |
| showStatus('Please enter the Agent join key~', false); | |
| return; | |
| } | |
| try { | |
| const response = await fetch('/join-agent', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ name, joinKey }) | |
| }); | |
| const data = await response.json(); | |
| if (data.ok) { | |
| showStatus('Joined successfully! You will appear in the office. ✨', true); | |
| } else { | |
| showStatus(data.msg || 'Join failed', false); | |
| } | |
| } catch (e) { | |
| showStatus('Network error, please try again', false); | |
| } | |
| } | |
| async function leave() { | |
| const name = agentNameInput.value.trim(); | |
| if (!name) { | |
| showStatus('Please enter the name you want to leave with~', false); | |
| return; | |
| } | |
| try { | |
| const response = await fetch('/leave-agent', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ name }) | |
| }); | |
| const data = await response.json(); | |
| if (data.ok) { | |
| showStatus('Left the office 👋', true); | |
| } else { | |
| showStatus(data.msg || 'Leave failed', false); | |
| } | |
| } catch (e) { | |
| showStatus('Network error, please try again', false); | |
| } | |
| } | |
| joinBtn.addEventListener('click', join); | |
| leaveBtn.addEventListener('click', leave); | |
| </script> | |
| </body> | |
| </html> | |