-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
575 lines (490 loc) · 19.3 KB
/
index.html
File metadata and controls
575 lines (490 loc) · 19.3 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FixIt API - Stack Overflow Error Solutions</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #0a0a0a;
color: #ffffff;
line-height: 1.6;
min-height: 100vh;
display: flex;
flex-direction: column;
}
.gradient-bg {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: radial-gradient(ellipse at bottom, #1e3c72 0%, #0a0a0a 100%);
opacity: 0.5;
z-index: -1;
}
header {
padding: 2rem;
text-align: center;
border-bottom: 1px solid rgba(255,255,255,0.1);
}
h1 {
font-size: 3rem;
margin-bottom: 0.5rem;
background: linear-gradient(45deg, #00ff88, #0088ff);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.subtitle {
font-size: 1.2rem;
color: #888;
}
main {
flex: 1;
max-width: 1200px;
margin: 0 auto;
padding: 3rem 2rem;
width: 100%;
}
.demo-section {
background: rgba(255,255,255,0.05);
border-radius: 12px;
padding: 2rem;
margin-bottom: 3rem;
border: 1px solid rgba(255,255,255,0.1);
}
.demo-section h2 {
margin-bottom: 1.5rem;
color: #00ff88;
}
.input-group {
margin-bottom: 1rem;
}
label {
display: block;
margin-bottom: 0.5rem;
color: #ccc;
}
input, textarea {
width: 100%;
padding: 0.75rem;
background: rgba(255,255,255,0.1);
border: 1px solid rgba(255,255,255,0.2);
border-radius: 6px;
color: white;
font-family: monospace;
}
textarea {
min-height: 150px;
resize: vertical;
}
button {
background: linear-gradient(45deg, #00ff88, #0088ff);
color: #000;
border: none;
padding: 0.75rem 2rem;
border-radius: 6px;
font-size: 1rem;
font-weight: bold;
cursor: pointer;
transition: transform 0.2s;
}
button:hover {
transform: translateY(-2px);
}
button:active {
transform: translateY(0);
}
.results {
margin-top: 2rem;
padding: 1rem;
background: rgba(0,0,0,0.5);
border-radius: 6px;
border: 1px solid rgba(0,255,136,0.3);
display: none;
}
.results.show {
display: block;
}
.error {
color: #ff4444;
}
.success {
color: #00ff88;
}
pre {
background: rgba(0,0,0,0.5);
padding: 1rem;
border-radius: 6px;
overflow-x: auto;
margin: 1rem 0;
}
code {
color: #00ff88;
}
.features {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin: 3rem 0;
}
.feature {
background: rgba(255,255,255,0.05);
padding: 1.5rem;
border-radius: 8px;
border: 1px solid rgba(255,255,255,0.1);
}
.feature h3 {
color: #0088ff;
margin-bottom: 0.5rem;
}
.stats {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
gap: 2rem;
margin: 2rem 0;
text-align: center;
}
.stat {
flex: 1;
min-width: 150px;
}
.stat-number {
font-size: 2.5rem;
font-weight: bold;
color: #00ff88;
}
.stat-label {
color: #888;
}
.api-docs {
background: rgba(0,0,0,0.5);
padding: 2rem;
border-radius: 8px;
margin-top: 3rem;
}
.endpoint {
margin-bottom: 2rem;
}
.endpoint h3 {
color: #0088ff;
margin-bottom: 0.5rem;
}
.method {
display: inline-block;
padding: 0.25rem 0.5rem;
background: #00ff88;
color: #000;
border-radius: 4px;
font-weight: bold;
margin-right: 0.5rem;
}
.loading {
display: none;
text-align: center;
margin: 1rem 0;
}
.loading.show {
display: block;
}
.spinner {
border: 3px solid rgba(255,255,255,0.1);
border-radius: 50%;
border-top: 3px solid #00ff88;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>
</head>
<body>
<div class="gradient-bg"></div>
<header>
<h1>FixIt API</h1>
<p class="subtitle">3.3M+ Stack Overflow solutions at your fingertips</p>
</header>
<main>
<div class="stats">
<div class="stat">
<div class="stat-number">3.3M</div>
<div class="stat-label">Stack Overflow Solutions</div>
</div>
<div class="stat">
<div class="stat-number">830K</div>
<div class="stat-label">Accepted Answers</div>
</div>
<div class="stat">
<div class="stat-number">56K</div>
<div class="stat-label">Elite Solutions (100+ score)</div>
</div>
</div>
<div class="demo-section">
<h2>Get Your API Key</h2>
<div id="registrationForm">
<div class="input-group">
<label for="name">Your Name</label>
<input type="text" id="name" placeholder="John Doe">
</div>
<div class="input-group">
<label for="email">Email</label>
<input type="email" id="email" placeholder="john@example.com">
</div>
<button onclick="register()">Get Free Beta Access</button>
</div>
<div class="results" id="registrationResult"></div>
<div style="margin-top: 2rem; text-align: center;">
<p style="color: #888;">Already have a key? <a href="#" onclick="showForgotForm()" style="color: #00ff88;">Retrieve it here</a></p>
</div>
<div id="forgotForm" style="display: none;">
<h3 style="color: #0088ff; margin-top: 2rem;">Retrieve Your API Key</h3>
<div class="input-group">
<label for="forgotEmail">Email</label>
<input type="email" id="forgotEmail" placeholder="your@email.com">
</div>
<button onclick="retrieveKey()">Retrieve Key</button>
<div class="results" id="forgotResult"></div>
</div>
</div>
<div class="demo-section">
<h2>Try It Now</h2>
<div class="input-group">
<label for="apiKey">API Key (use 'demo' for testing)</label>
<input type="text" id="apiKey" value="demo" placeholder="Enter your API key">
</div>
<div class="input-group">
<label for="errorInput">Paste Your Error Message</label>
<textarea id="errorInput" placeholder="TypeError: Cannot read property 'map' of undefined
at Array.map (<anonymous>)
at processData (app.js:42:15)"></textarea>
</div>
<button onclick="searchError()">Find Solution</button>
<div class="loading" id="loading">
<div class="spinner"></div>
<p>Searching 3.3M solutions...</p>
</div>
<div class="results" id="results"></div>
</div>
<div class="features">
<div class="feature">
<h3>🚀 Lightning Fast</h3>
<p>Full-text search across millions of solutions with SQLite FTS5.</p>
</div>
<div class="feature">
<h3>🔧 Self-Healing</h3>
<p>Automatically fixes common errors and learns from successful fixes.</p>
</div>
<div class="feature">
<h3>🌐 Multi-Language</h3>
<p>Support for Python, JavaScript, Java, SQL, C++, and C# error patterns.</p>
</div>
</div>
<div class="api-docs">
<h2>API Documentation</h2>
<div class="endpoint">
<h3><span class="method">GET</span>/health</h3>
<p>Check API status and statistics</p>
<pre><code>curl https://fixitapi.dev/health</code></pre>
</div>
<div class="endpoint">
<h3><span class="method">POST</span>/register</h3>
<p>Get your API key</p>
<pre><code>curl -X POST https://fixitapi.dev/register \
-H "Content-Type: application/json" \
-d '{"name": "Your Name", "email": "your@email.com"}'</code></pre>
</div>
<div class="endpoint">
<h3><span class="method">POST</span>/search</h3>
<p>Search for error solutions</p>
<pre><code>curl -X POST https://fixitapi.dev/search \
-H "Content-Type: application/json" \
-H "X-API-Key: your-key" \
-d '{"query": "TypeError: NoneType", "limit": 5}'</code></pre>
</div>
<div class="endpoint">
<h3><span class="method">POST</span>/fix</h3>
<p>Get automated fixes for errors</p>
<pre><code>curl -X POST https://fixitapi.dev/fix \
-H "Content-Type: application/json" \
-H "X-API-Key: your-key" \
-d '{"error_type": "AttributeError", "error_message": "NoneType has no attribute split"}'</code></pre>
</div>
<div class="endpoint">
<h3><span class="method">GET</span>/stats</h3>
<p>Check your API usage</p>
<pre><code>curl https://fixitapi.dev/stats \
-H "X-API-Key: your-key"</code></pre>
</div>
</div>
</main>
<script>
const API_URL = 'https://fixitapi.dev';
async function register() {
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const resultDiv = document.getElementById('registrationResult');
if (!name || !email) {
alert('Please fill in all fields');
return;
}
try {
const response = await fetch(`${API_URL}/register`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ name, email })
});
const data = await response.json();
if (response.ok) {
resultDiv.classList.add('show');
resultDiv.innerHTML = `
<h3 class="success">Success! Your API Key:</h3>
<div style="background: #000; padding: 1rem; border-radius: 6px; margin: 1rem 0;">
<code style="font-size: 1.2rem; color: #00ff88;">${data.api_key}</code>
</div>
<p><strong>Daily Limit:</strong> ${data.daily_limit} requests</p>
<p class="error">⚠️ Save this key now - it won't be shown again!</p>
<pre><code>${data.usage.example}</code></pre>
`;
document.getElementById('name').value = '';
document.getElementById('email').value = '';
document.getElementById('apiKey').value = data.api_key;
} else {
resultDiv.classList.add('show');
resultDiv.innerHTML = `<p class="error">${data.error}</p>`;
}
} catch (error) {
resultDiv.classList.add('show');
resultDiv.innerHTML = `<p class="error">Registration failed: ${error.message}</p>`;
}
}
function showForgotForm() {
document.getElementById('forgotForm').style.display = 'block';
return false;
}
async function retrieveKey() {
const email = document.getElementById('forgotEmail').value;
const resultDiv = document.getElementById('forgotResult');
if (!email) {
alert('Please enter your email');
return;
}
try {
const response = await fetch(`${API_URL}/forgot-key`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ email })
});
const data = await response.json();
resultDiv.classList.add('show');
if (response.ok) {
let keysHtml = '<h4 class="success">Your API Keys:</h4>';
data.keys.forEach(keyInfo => {
keysHtml += `
<div style="background: #000; padding: 1rem; border-radius: 6px; margin: 0.5rem 0;">
<code style="color: #00ff88;">${keyInfo.key}</code>
<p style="margin: 0.5rem 0 0 0; color: #888;">
Name: ${keyInfo.name}<br>
Created: ${keyInfo.created}
</p>
</div>
`;
});
resultDiv.innerHTML = keysHtml;
} else {
resultDiv.innerHTML = `<p class="error">${data.error}</p>`;
}
} catch (error) {
resultDiv.classList.add('show');
resultDiv.innerHTML = `<p class="error">Lookup failed: ${error.message}</p>`;
}
}
async function searchError() {
const apiKey = document.getElementById('apiKey').value;
const errorInput = document.getElementById('errorInput').value;
const resultsDiv = document.getElementById('results');
const loadingDiv = document.getElementById('loading');
if (!errorInput.trim()) {
alert('Please enter an error message');
return;
}
loadingDiv.classList.add('show');
resultsDiv.classList.remove('show');
try {
const response = await fetch(`${API_URL}/search`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': apiKey
},
body: JSON.stringify({
query: errorInput,
limit: 5
})
});
const data = await response.json();
loadingDiv.classList.remove('show');
resultsDiv.classList.add('show');
if (response.ok) {
displayResults(data);
} else {
resultsDiv.innerHTML = `<p class="error">Error: ${data.error || 'Failed to search'}</p>`;
}
} catch (error) {
loadingDiv.classList.remove('show');
resultsDiv.classList.add('show');
resultsDiv.innerHTML = `<p class="error">Error: ${error.message}</p>`;
}
}
function displayResults(data) {
const resultsDiv = document.getElementById('results');
if (data.results && data.results.length > 0) {
let html = '<h3 class="success">Found ' + data.total + ' solutions!</h3>';
data.results.forEach((result, index) => {
html += `
<div style="margin: 1rem 0; padding: 1rem; background: rgba(255,255,255,0.05); border-radius: 6px;">
<h4>Solution ${index + 1} (Score: ${result.answer_score}, Confidence: ${(result.confidence * 100).toFixed(1)}%)</h4>
<p><strong>Title:</strong> ${escapeHtml(result.question_title || 'N/A')}</p>
<p><strong>URL:</strong> <a href="${result.url}" target="_blank" style="color: #00ff88;">${result.url}</a></p>
<p><strong>Preview:</strong> ${escapeHtml(result.preview || 'No preview available')}</p>
${result.code ? `<pre><code>${escapeHtml(result.code)}</code></pre>` : '<p style="color: #888;">No code snippet extracted - click URL to see full answer</p>'}
</div>
`;
});
resultsDiv.innerHTML = html;
} else {
resultsDiv.innerHTML = '<p class="error">No solutions found. Try a different query.</p>';
}
}
function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
}
document.getElementById('errorInput').addEventListener('keypress', function(e) {
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
searchError();
}
});
</script>
</body>
</html>