-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopencode-access.html
More file actions
149 lines (138 loc) · 5.2 KB
/
Copy pathopencode-access.html
File metadata and controls
149 lines (138 loc) · 5.2 KB
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html>
<head>
<title>OpenCode Access Portal</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
max-width: -600px;
margin: 0 auto;
padding: 20px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
color: white;
}
.container {
background: rgba(255, 255, 255, 0.95);
border-radius: 15px;
padding: 30px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
color: #333;
}
h1 {
color: #333;
margin-top: 0;
}
.connection-test {
background: #f8f9fa;
border-radius: 10px;
padding: 15px;
margin: 15px 0;
}
.success {
color: #28a745;
font-weight: bold;
}
.failure {
color: #dc3545;
font-weight: bold;
}
button {
background: #667eea;
color: white;
border: none;
padding: 12px 24px;
border-radius: 8px;
font-size: 16px;
cursor: pointer;
margin: 5px;
transition: background 0.3s;
}
button:hover {
background: #5a67d8;
}
.url-box {
background: #e9ecef;
padding: 15px;
border-radius: 8px;
margin: 15px 0;
word-break: break-all;
}
code {
background: #f1f3f5;
padding: 2px 6px;
border-radius: 4px;
font-family: 'SF Mono', Monaco, monospace;
}
</style>
</head>
<body>
<div class="container">
<h1>OpenCode Access Portal</h1>
<p>Your OpenCode server is running! Here are different ways to access it:</p>
<div class="connection-test">
<h3>Connection Status</h3>
<p id="status">Testing connection...</p>
<button onclick="testConnection()">Test Again</button>
</div>
<h3>Direct Access Methods</h3>
<div class="url-box">
<h4>Method 1: Credentials in URL (Safari)</h4>
<p>Copy and paste this URL directly into Safari:</p>
<code>http://opencode:Pncdfrwll25121997m@!@100.65.3.121:4096</code>
<button onclick="copyToClipboard('http://opencode:Pncdfrwll25121997m@!@100.65.3.121:4096')">Copy URL</button>
</div>
<div class="url-box">
<h4>Method 2: MagicDNS (Recommended)</h4>
<p>Use your machine name instead of IP:</p>
<code>http://mihais-macbook-pro:4096</code>
<button onclick="copyToClipboard('http://mihais-macbook-pro:4096')">Copy URL</button>
</div>
<div class="url-box">
<h4>Method 3: Manual Login</h4>
<p>Visit <code>http://100.65.3.121:4096</code> and use:</p>
<ul>
<li><strong>Username:</strong> <code>opencode</code></li>
<li><strong>Password:</strong> <code>Pncdfrwll25121997m@!</code></li>
</ul>
<button onclick="copyToClipboard('http://100.65.3.121:4096')">Copy URL</button>
</div>
<h3>Quick Launch</h3>
<button onclick="window.open('http://opencode:Pncdfrwll25121997m@!@100.65.3.121:4096', '_blank')">Open OpenCode Now</button>
<h3>Troubleshooting</h3>
<ul>
<li>If Safari doesn't prompt for credentials, use Method 1 (URL with embedded credentials)</li>
<li>Ensure Tailscale is running on both devices</li>
<li>Try using Chrome or Firefox if Safari continues to have issues</li>
<li>Check that port 4096 is not blocked by any firewall</li>
</ul>
</div>
<script>
async function testConnection() {
const statusEl = document.getElementById('status');
statusEl.innerHTML = 'Testing...';
try {
// Test with credentials in URL
const response = await fetch('http://opencode:Pncdfrwll25121997m@!@100.65.3.121:4096/health');
if (response.status === 401) {
statusEl.innerHTML = '<span class="success">Server is reachable but requires authentication</span>';
} else if (response.ok) {
statusEl.innerHTML = '<span class="success">Server is reachable and authenticated.</span>';
} else {
statusEl.innerHTML = `<span class="failure">Server responded with status: ${response.status}</span>`;
}
} catch (error) {
statusEl.innerHTML = `<span class="failure">Cannot connect: ${error.message}</span>`;
}
}
function copyToClipboard(text) {
navigator.clipboard.writeText(text).then(() => {
alert('Copied to clipboard!');
});
}
// Test connection on page load
testConnection();
</script>
</body>
</html>