File size: 3,433 Bytes
5e1dfdc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Onboarding Wizard</title>
  <style>
    body { font-family: sans-serif; padding: 2rem; background: #f4f4f4; }
    .container { background: white; padding: 2rem; border-radius: 8px; max-width: 700px; margin: auto; }
    h2 { margin-top: 0; }
    label, select, input { display: block; width: 100%; margin-top: 1rem; }
    button { margin-top: 1.5rem; padding: 0.75rem; background: #2b5797; color: white; border: none; border-radius: 4px; cursor: pointer; }
    .token-link { font-size: 0.9em; color: #333; margin-top: 0.5rem; }
  </style>
</head>
<body>
  <div class="container">
    <h2>Welcome to Agentic Terraforming Setup</h2>

    <label for="role">Are you deploying or using the system today?</label>
    <select id="role" onchange="toggleSections()">
      <option value="">-- Choose Role --</option>
      <option value="admin">Admin / Deploying</option>
      <option value="user">User / Agent Access</option>
    </select>

    <div id="adminFields" style="display:none">
      <h3>Admin Credentials</h3>
      <label>GitHub Token<input type="text" id="github"></label>
      <div class="token-link"><a href="https://github.com/settings/tokens" target="_blank">Get GitHub Token</a></div>

      <label>DockerHub Token<input type="text" id="docker"></label>
      <div class="token-link"><a href="https://hub.docker.com/settings/security" target="_blank">Get Docker Token</a></div>

      <label>DigitalOcean API Key<input type="text" id="digitalocean"></label>
      <div class="token-link"><a href="https://cloud.digitalocean.com/account/api/tokens" target="_blank">Get DigitalOcean Token</a></div>
    </div>

    <div id="userFields" style="display:none">
      <h3>User OAuth Tokens</h3>
      <label>Google Token<input type="text" id="google"></label>
      <label>Notion Token<input type="text" id="notion"></label>
      <label>Other Token (optional)<input type="text" id="custom"></label>
<button onclick="window.open('/auth/google', '_blank')">Connect Google Account</button>

      <p>You can also upload your previously saved credentials file:</p>
      <input type="file" id="credUpload">
    </div>

    <button onclick="submitCreds()">Submit & Start</button>
  </div>

  <script>
    function toggleSections() {
      const role = document.getElementById('role').value;
      document.getElementById('adminFields').style.display = role === 'admin' ? 'block' : 'none';
      document.getElementById('userFields').style.display = role === 'user' ? 'block' : 'none';
    }

    async function submitCreds() {
      const role = document.getElementById('role').value;
      const body = { role };
      if (role === 'admin') {
        body.github = document.getElementById('github').value;
        body.docker = document.getElementById('docker').value;
        body.digitalocean = document.getElementById('digitalocean').value;
      } else {
        body.google = document.getElementById('google').value;
        body.notion = document.getElementById('notion').value;
        body.custom = document.getElementById('custom').value;
      }

      const res = await fetch('/intake', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(body)
      });

      const result = await res.json();
      alert(result.message || JSON.stringify(result));
    }
  </script>
</body>
</html>