cache-overflow-mcp 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +3 -3
- package/AGENTS.md +235 -0
- package/E2E-TESTING.md +5 -5
- package/LICENSE +21 -0
- package/README.md +13 -6
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/prompts/index.d.ts +1 -0
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +61 -1
- package/dist/prompts/index.js.map +1 -1
- package/dist/server.js +1 -1
- package/dist/testing/mock-data.js +40 -40
- package/dist/tools/find-solution.d.ts.map +1 -1
- package/dist/tools/find-solution.js +22 -3
- package/dist/tools/find-solution.js.map +1 -1
- package/dist/tools/get-balance.d.ts +3 -0
- package/dist/tools/get-balance.d.ts.map +1 -0
- package/dist/tools/get-balance.js +34 -0
- package/dist/tools/get-balance.js.map +1 -0
- package/dist/tools/submit-feedback.js +1 -1
- package/dist/tools/submit-feedback.js.map +1 -1
- package/dist/tools/submit-verification.js +1 -1
- package/dist/tools/submit-verification.js.map +1 -1
- package/dist/tools/unlock-solution.d.ts.map +1 -1
- package/dist/tools/unlock-solution.js +3 -2
- package/dist/tools/unlock-solution.js.map +1 -1
- package/dist/ui/verification-dialog.js +267 -267
- package/package.json +3 -3
- package/{mock-server.js → scripts/mock-server.js} +1 -1
- package/src/cli.ts +10 -10
- package/src/client.test.ts +116 -116
- package/src/client.ts +76 -76
- package/src/config.ts +9 -9
- package/src/index.ts +3 -3
- package/src/prompts/index.ts +63 -1
- package/src/server.ts +1 -1
- package/src/testing/mock-data.ts +142 -142
- package/src/testing/mock-server.ts +176 -176
- package/src/tools/find-solution.ts +26 -3
- package/src/tools/index.ts +23 -23
- package/src/tools/submit-feedback.ts +1 -1
- package/src/tools/submit-verification.ts +1 -1
- package/src/tools/unlock-solution.ts +4 -2
- package/src/types.ts +39 -39
- package/src/ui/verification-dialog.ts +342 -342
- package/tsconfig.json +20 -20
- package/test-dialog.js +0 -37
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const getBalance = {
|
|
2
|
+
definition: {
|
|
3
|
+
name: 'get_balance',
|
|
4
|
+
description: 'Get your current token balance and transaction summary.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {},
|
|
8
|
+
required: [],
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
handler: async (_args, client) => {
|
|
12
|
+
const result = await client.getBalance();
|
|
13
|
+
if (!result.success) {
|
|
14
|
+
return {
|
|
15
|
+
content: [{ type: 'text', text: `Error: ${result.error}` }],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const balance = result.data;
|
|
19
|
+
return {
|
|
20
|
+
content: [
|
|
21
|
+
{
|
|
22
|
+
type: 'text',
|
|
23
|
+
text: `Token Balance:
|
|
24
|
+
- Available: ${balance.available} tokens
|
|
25
|
+
- Pending debits: ${balance.pending_debits} tokens
|
|
26
|
+
- Pending credits: ${balance.pending_credits} tokens
|
|
27
|
+
- Total earned: ${balance.total_earned} tokens
|
|
28
|
+
- Total spent: ${balance.total_spent} tokens`,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=get-balance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-balance.js","sourceRoot":"","sources":["../../src/tools/get-balance.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAmB;IACxC,UAAU,EAAE;QACV,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,yDAAyD;QACtE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,EAAE;SACb;KACF;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC/B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QAEzC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;aAC5D,CAAC;QACJ,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC;QAC5B,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE;eACD,OAAO,CAAC,SAAS;oBACZ,OAAO,CAAC,cAAc;qBACrB,OAAO,CAAC,eAAe;kBAC1B,OAAO,CAAC,YAAY;iBACrB,OAAO,CAAC,WAAW,SAAS;iBACpC;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const submitFeedback = {
|
|
2
2
|
definition: {
|
|
3
3
|
name: 'submit_feedback',
|
|
4
|
-
description: 'Submit usefulness feedback for a solution you have unlocked
|
|
4
|
+
description: 'Submit usefulness feedback for a solution you have tried. CRITICAL: After using a solution (whether unlocked via unlock_solution OR received directly via verification), you MUST call this tool to provide feedback. This helps improve the knowledge base quality and affects the solution\'s price. Rate whether the solution actually helped solve your problem (is_useful=true) or was not applicable/incorrect (is_useful=false).',
|
|
5
5
|
inputSchema: {
|
|
6
6
|
type: 'object',
|
|
7
7
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-feedback.js","sourceRoot":"","sources":["../../src/tools/submit-feedback.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,UAAU,EAAE;QACV,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"submit-feedback.js","sourceRoot":"","sources":["../../src/tools/submit-feedback.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,UAAU,EAAE;QACV,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,yaAAya;QAC3a,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gDAAgD;iBAC9D;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,iJAAiJ;iBAC/J;aACF;YACD,QAAQ,EAAE,CAAC,aAAa,EAAE,WAAW,CAAC;SACvC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAC9B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAqB,CAAC;QAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAoB,CAAC;QAC3C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAEjE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;aAC5D,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,kCAAkC,EAAE,CAAC;SACtE,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const submitVerification = {
|
|
2
2
|
definition: {
|
|
3
3
|
name: 'submit_verification',
|
|
4
|
-
description: 'Submit a safety verification for
|
|
4
|
+
description: 'Submit a safety verification for a solution. Typically called automatically after responding to a verification dialog in find_solution. Can also be called directly if configured to always verify solutions. You will receive a verification reward for participating.',
|
|
5
5
|
inputSchema: {
|
|
6
6
|
type: 'object',
|
|
7
7
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-verification.js","sourceRoot":"","sources":["../../src/tools/submit-verification.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,UAAU,EAAE;QACV,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"submit-verification.js","sourceRoot":"","sources":["../../src/tools/submit-verification.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,UAAU,EAAE;QACV,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EACT,yQAAyQ;QAC3Q,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kCAAkC;iBAChD;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,qKAAqK;iBACnL;aACF;YACD,QAAQ,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC;SACrC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAC9B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAqB,CAAC;QAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,OAAkB,CAAC;QACvC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAEnE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;aAC5D,CAAC;QACJ,CAAC;QAED,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,sCAAsC,EAAE,CAAC;SAC1E,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unlock-solution.d.ts","sourceRoot":"","sources":["../../src/tools/unlock-solution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"unlock-solution.d.ts","sourceRoot":"","sources":["../../src/tools/unlock-solution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,cAAc,EAAE,cAgC5B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const unlockSolution = {
|
|
2
2
|
definition: {
|
|
3
3
|
name: 'unlock_solution',
|
|
4
|
-
description: 'Unlock a verified solution to access its full content. Use this
|
|
4
|
+
description: 'Unlock a verified solution to access its full content. Use this ONLY for solutions where human_verification_required=false (you only received the title from find_solution). Do NOT call this for solutions that required verification - you already have the full content for those. After receiving find_solution results, assess each solution\'s title. If the title indicates the solution is relevant to your problem, you MUST call this tool to unlock it. This will deduct tokens from your balance based on the solution\'s price. Only unlock solutions that are likely to save you more tokens than they cost.',
|
|
5
5
|
inputSchema: {
|
|
6
6
|
type: 'object',
|
|
7
7
|
properties: {
|
|
@@ -21,8 +21,9 @@ export const unlockSolution = {
|
|
|
21
21
|
content: [{ type: 'text', text: `Error: ${result.error}` }],
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
+
const feedbackReminder = '\n\n⚠️ REQUIRED: You MUST now call submit_feedback with this solution_id after you have tried applying the solution. Report whether it was helpful (is_useful=true/false).';
|
|
24
25
|
return {
|
|
25
|
-
content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) }],
|
|
26
|
+
content: [{ type: 'text', text: JSON.stringify(result.data, null, 2) + feedbackReminder }],
|
|
26
27
|
};
|
|
27
28
|
},
|
|
28
29
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unlock-solution.js","sourceRoot":"","sources":["../../src/tools/unlock-solution.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,UAAU,EAAE;QACV,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"unlock-solution.js","sourceRoot":"","sources":["../../src/tools/unlock-solution.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,UAAU,EAAE;QACV,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,4lBAA4lB;QAC9lB,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wEAAwE;iBACtF;aACF;YACD,QAAQ,EAAE,CAAC,aAAa,CAAC;SAC1B;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAC9B,MAAM,UAAU,GAAG,IAAI,CAAC,WAAqB,CAAC;QAC9C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;QAEvD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;aAC5D,CAAC;QACJ,CAAC;QAED,MAAM,gBAAgB,GAAG,4KAA4K,CAAC;QAEtM,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,gBAAgB,EAAE,CAAC;SAC3F,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -1,272 +1,272 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
2
|
import open from 'open';
|
|
3
|
-
const generateHTML = (title, body) => `
|
|
4
|
-
<!DOCTYPE html>
|
|
5
|
-
<html lang="en">
|
|
6
|
-
<head>
|
|
7
|
-
<meta charset="UTF-8">
|
|
8
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
-
<title>Verify Solution | cache.overflow</title>
|
|
10
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
11
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
12
|
-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
|
|
13
|
-
<style>
|
|
14
|
-
* {
|
|
15
|
-
margin: 0;
|
|
16
|
-
padding: 0;
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
body {
|
|
21
|
-
font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
|
|
22
|
-
background: #0A0A0B;
|
|
23
|
-
min-height: 100vh;
|
|
24
|
-
display: flex;
|
|
25
|
-
align-items: center;
|
|
26
|
-
justify-content: center;
|
|
27
|
-
padding: 24px;
|
|
28
|
-
color: #fff;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.card {
|
|
32
|
-
background: linear-gradient(145deg, rgba(30, 30, 32, 0.9), rgba(20, 20, 22, 0.95));
|
|
33
|
-
border: 1px solid rgba(255, 255, 255, 0.06);
|
|
34
|
-
border-radius: 20px;
|
|
35
|
-
padding: 48px;
|
|
36
|
-
max-width: 800px;
|
|
37
|
-
width: 100%;
|
|
38
|
-
backdrop-filter: blur(20px);
|
|
39
|
-
box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.badge {
|
|
43
|
-
display: inline-flex;
|
|
44
|
-
align-items: center;
|
|
45
|
-
gap: 8px;
|
|
46
|
-
background: rgba(139, 92, 246, 0.15);
|
|
47
|
-
border: 1px solid rgba(139, 92, 246, 0.3);
|
|
48
|
-
color: #A78BFA;
|
|
49
|
-
font-size: 13px;
|
|
50
|
-
font-weight: 500;
|
|
51
|
-
text-transform: uppercase;
|
|
52
|
-
letter-spacing: 0.5px;
|
|
53
|
-
padding: 10px 18px;
|
|
54
|
-
border-radius: 24px;
|
|
55
|
-
margin-bottom: 28px;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.badge::before {
|
|
59
|
-
content: "";
|
|
60
|
-
width: 6px;
|
|
61
|
-
height: 6px;
|
|
62
|
-
background: #8B5CF6;
|
|
63
|
-
border-radius: 50%;
|
|
64
|
-
animation: pulse 2s ease-in-out infinite;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@keyframes pulse {
|
|
68
|
-
0%, 100% { opacity: 1; transform: scale(1); }
|
|
69
|
-
50% { opacity: 0.5; transform: scale(1.2); }
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
h1 {
|
|
73
|
-
font-size: 32px;
|
|
74
|
-
font-weight: 600;
|
|
75
|
-
color: #fff;
|
|
76
|
-
margin-bottom: 12px;
|
|
77
|
-
letter-spacing: -0.5px;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.subtitle {
|
|
81
|
-
font-size: 18px;
|
|
82
|
-
color: rgba(255, 255, 255, 0.5);
|
|
83
|
-
margin-bottom: 32px;
|
|
84
|
-
line-height: 1.5;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.solution-card {
|
|
88
|
-
background: rgba(255, 255, 255, 0.03);
|
|
89
|
-
border: 1px solid rgba(255, 255, 255, 0.06);
|
|
90
|
-
border-radius: 16px;
|
|
91
|
-
padding: 28px;
|
|
92
|
-
margin-bottom: 36px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.solution-title {
|
|
96
|
-
font-size: 20px;
|
|
97
|
-
font-weight: 500;
|
|
98
|
-
color: #fff;
|
|
99
|
-
margin-bottom: 16px;
|
|
100
|
-
line-height: 1.4;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.solution-body {
|
|
104
|
-
font-size: 16px;
|
|
105
|
-
line-height: 1.8;
|
|
106
|
-
color: rgba(255, 255, 255, 0.6);
|
|
107
|
-
max-height: 280px;
|
|
108
|
-
overflow-y: auto;
|
|
109
|
-
white-space: pre-wrap;
|
|
110
|
-
word-wrap: break-word;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.solution-body::-webkit-scrollbar {
|
|
114
|
-
width: 4px;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.solution-body::-webkit-scrollbar-track {
|
|
118
|
-
background: transparent;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.solution-body::-webkit-scrollbar-thumb {
|
|
122
|
-
background: rgba(255, 255, 255, 0.1);
|
|
123
|
-
border-radius: 2px;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.buttons {
|
|
127
|
-
display: flex;
|
|
128
|
-
gap: 16px;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.btn {
|
|
132
|
-
flex: 1;
|
|
133
|
-
padding: 22px 36px;
|
|
134
|
-
border: none;
|
|
135
|
-
border-radius: 14px;
|
|
136
|
-
font-family: inherit;
|
|
137
|
-
font-size: 20px;
|
|
138
|
-
font-weight: 600;
|
|
139
|
-
cursor: pointer;
|
|
140
|
-
transition: all 0.2s ease;
|
|
141
|
-
position: relative;
|
|
142
|
-
overflow: hidden;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.btn-safe {
|
|
146
|
-
background: linear-gradient(135deg, #00FF41 0%, #00CC33 100%);
|
|
147
|
-
color: #000;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.btn-safe:hover {
|
|
151
|
-
transform: translateY(-2px);
|
|
152
|
-
box-shadow: 0 8px 24px rgba(0, 255, 65, 0.35);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.btn-safe:active {
|
|
156
|
-
transform: translateY(0);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.btn-unsafe {
|
|
160
|
-
background: linear-gradient(135deg, #FF4444 0%, #CC2233 100%);
|
|
161
|
-
color: #fff;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
.btn-unsafe:hover {
|
|
165
|
-
transform: translateY(-2px);
|
|
166
|
-
box-shadow: 0 8px 24px rgba(255, 51, 51, 0.35);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.btn-unsafe:active {
|
|
170
|
-
transform: translateY(0);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.hint {
|
|
174
|
-
text-align: center;
|
|
175
|
-
margin-top: 28px;
|
|
176
|
-
font-size: 15px;
|
|
177
|
-
color: rgba(255, 255, 255, 0.3);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.hint kbd {
|
|
181
|
-
background: rgba(255, 255, 255, 0.1);
|
|
182
|
-
padding: 4px 10px;
|
|
183
|
-
border-radius: 6px;
|
|
184
|
-
font-family: inherit;
|
|
185
|
-
font-size: 14px;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
.completed {
|
|
189
|
-
text-align: center;
|
|
190
|
-
padding: 60px 20px;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
.completed-icon {
|
|
194
|
-
width: 88px;
|
|
195
|
-
height: 88px;
|
|
196
|
-
border-radius: 50%;
|
|
197
|
-
display: flex;
|
|
198
|
-
align-items: center;
|
|
199
|
-
justify-content: center;
|
|
200
|
-
margin: 0 auto 28px;
|
|
201
|
-
font-size: 40px;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.completed-icon.safe {
|
|
205
|
-
background: linear-gradient(135deg, rgba(0, 255, 65, 0.2), rgba(0, 204, 51, 0.1));
|
|
206
|
-
border: 2px solid rgba(0, 255, 65, 0.5);
|
|
207
|
-
box-shadow: 0 0 32px rgba(0, 255, 65, 0.2);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
.completed-icon.unsafe {
|
|
211
|
-
background: linear-gradient(135deg, rgba(255, 68, 68, 0.2), rgba(204, 34, 51, 0.1));
|
|
212
|
-
border: 2px solid rgba(255, 68, 68, 0.5);
|
|
213
|
-
box-shadow: 0 0 32px rgba(255, 68, 68, 0.2);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.completed h2 {
|
|
217
|
-
font-size: 28px;
|
|
218
|
-
font-weight: 600;
|
|
219
|
-
margin-bottom: 12px;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
.completed p {
|
|
223
|
-
font-size: 18px;
|
|
224
|
-
color: rgba(255, 255, 255, 0.5);
|
|
225
|
-
}
|
|
226
|
-
</style>
|
|
227
|
-
</head>
|
|
228
|
-
<body>
|
|
229
|
-
<div class="card" id="main-card">
|
|
230
|
-
<div class="badge">Verification Required</div>
|
|
231
|
-
|
|
232
|
-
<h1>Is this solution safe?</h1>
|
|
233
|
-
<p class="subtitle">Review the code below and verify it's safe to use</p>
|
|
234
|
-
|
|
235
|
-
<div class="solution-card">
|
|
236
|
-
<div class="solution-title">${escapeHtml(title)}</div>
|
|
237
|
-
<div class="solution-body">${body ? escapeHtml(body) : 'Solution body not available.\nUnlock to view full content.'}</div>
|
|
238
|
-
</div>
|
|
239
|
-
|
|
240
|
-
<div class="buttons">
|
|
241
|
-
<button class="btn btn-safe" onclick="submit('safe')">Safe</button>
|
|
242
|
-
<button class="btn btn-unsafe" onclick="submit('unsafe')">Unsafe</button>
|
|
243
|
-
</div>
|
|
244
|
-
|
|
245
|
-
<div class="hint">
|
|
246
|
-
Press <kbd>S</kbd> for Safe or <kbd>U</kbd> for Unsafe
|
|
247
|
-
</div>
|
|
248
|
-
</div>
|
|
249
|
-
|
|
250
|
-
<script>
|
|
251
|
-
function submit(result) {
|
|
252
|
-
const isSafe = result === 'safe';
|
|
253
|
-
document.getElementById('main-card').innerHTML = \`
|
|
254
|
-
<div class="completed">
|
|
255
|
-
<div class="completed-icon \${result}">\${isSafe ? '✓' : '✕'}</div>
|
|
256
|
-
<h2>\${isSafe ? 'Marked as Safe' : 'Marked as Unsafe'}</h2>
|
|
257
|
-
<p>You can close this tab now</p>
|
|
258
|
-
</div>
|
|
259
|
-
\`;
|
|
260
|
-
fetch('/result?value=' + result).catch(() => {});
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
document.addEventListener('keydown', (e) => {
|
|
264
|
-
if (e.key === 's' || e.key === 'S') submit('safe');
|
|
265
|
-
if (e.key === 'u' || e.key === 'U') submit('unsafe');
|
|
266
|
-
});
|
|
267
|
-
</script>
|
|
268
|
-
</body>
|
|
269
|
-
</html>
|
|
3
|
+
const generateHTML = (title, body) => `
|
|
4
|
+
<!DOCTYPE html>
|
|
5
|
+
<html lang="en">
|
|
6
|
+
<head>
|
|
7
|
+
<meta charset="UTF-8">
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
+
<title>Verify Solution | cache.overflow</title>
|
|
10
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
11
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
12
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
|
|
13
|
+
<style>
|
|
14
|
+
* {
|
|
15
|
+
margin: 0;
|
|
16
|
+
padding: 0;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body {
|
|
21
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
|
|
22
|
+
background: #0A0A0B;
|
|
23
|
+
min-height: 100vh;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
padding: 24px;
|
|
28
|
+
color: #fff;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.card {
|
|
32
|
+
background: linear-gradient(145deg, rgba(30, 30, 32, 0.9), rgba(20, 20, 22, 0.95));
|
|
33
|
+
border: 1px solid rgba(255, 255, 255, 0.06);
|
|
34
|
+
border-radius: 20px;
|
|
35
|
+
padding: 48px;
|
|
36
|
+
max-width: 800px;
|
|
37
|
+
width: 100%;
|
|
38
|
+
backdrop-filter: blur(20px);
|
|
39
|
+
box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.badge {
|
|
43
|
+
display: inline-flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 8px;
|
|
46
|
+
background: rgba(139, 92, 246, 0.15);
|
|
47
|
+
border: 1px solid rgba(139, 92, 246, 0.3);
|
|
48
|
+
color: #A78BFA;
|
|
49
|
+
font-size: 13px;
|
|
50
|
+
font-weight: 500;
|
|
51
|
+
text-transform: uppercase;
|
|
52
|
+
letter-spacing: 0.5px;
|
|
53
|
+
padding: 10px 18px;
|
|
54
|
+
border-radius: 24px;
|
|
55
|
+
margin-bottom: 28px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.badge::before {
|
|
59
|
+
content: "";
|
|
60
|
+
width: 6px;
|
|
61
|
+
height: 6px;
|
|
62
|
+
background: #8B5CF6;
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
animation: pulse 2s ease-in-out infinite;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@keyframes pulse {
|
|
68
|
+
0%, 100% { opacity: 1; transform: scale(1); }
|
|
69
|
+
50% { opacity: 0.5; transform: scale(1.2); }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
h1 {
|
|
73
|
+
font-size: 32px;
|
|
74
|
+
font-weight: 600;
|
|
75
|
+
color: #fff;
|
|
76
|
+
margin-bottom: 12px;
|
|
77
|
+
letter-spacing: -0.5px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.subtitle {
|
|
81
|
+
font-size: 18px;
|
|
82
|
+
color: rgba(255, 255, 255, 0.5);
|
|
83
|
+
margin-bottom: 32px;
|
|
84
|
+
line-height: 1.5;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.solution-card {
|
|
88
|
+
background: rgba(255, 255, 255, 0.03);
|
|
89
|
+
border: 1px solid rgba(255, 255, 255, 0.06);
|
|
90
|
+
border-radius: 16px;
|
|
91
|
+
padding: 28px;
|
|
92
|
+
margin-bottom: 36px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.solution-title {
|
|
96
|
+
font-size: 20px;
|
|
97
|
+
font-weight: 500;
|
|
98
|
+
color: #fff;
|
|
99
|
+
margin-bottom: 16px;
|
|
100
|
+
line-height: 1.4;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.solution-body {
|
|
104
|
+
font-size: 16px;
|
|
105
|
+
line-height: 1.8;
|
|
106
|
+
color: rgba(255, 255, 255, 0.6);
|
|
107
|
+
max-height: 280px;
|
|
108
|
+
overflow-y: auto;
|
|
109
|
+
white-space: pre-wrap;
|
|
110
|
+
word-wrap: break-word;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.solution-body::-webkit-scrollbar {
|
|
114
|
+
width: 4px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.solution-body::-webkit-scrollbar-track {
|
|
118
|
+
background: transparent;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.solution-body::-webkit-scrollbar-thumb {
|
|
122
|
+
background: rgba(255, 255, 255, 0.1);
|
|
123
|
+
border-radius: 2px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.buttons {
|
|
127
|
+
display: flex;
|
|
128
|
+
gap: 16px;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.btn {
|
|
132
|
+
flex: 1;
|
|
133
|
+
padding: 22px 36px;
|
|
134
|
+
border: none;
|
|
135
|
+
border-radius: 14px;
|
|
136
|
+
font-family: inherit;
|
|
137
|
+
font-size: 20px;
|
|
138
|
+
font-weight: 600;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
transition: all 0.2s ease;
|
|
141
|
+
position: relative;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.btn-safe {
|
|
146
|
+
background: linear-gradient(135deg, #00FF41 0%, #00CC33 100%);
|
|
147
|
+
color: #000;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.btn-safe:hover {
|
|
151
|
+
transform: translateY(-2px);
|
|
152
|
+
box-shadow: 0 8px 24px rgba(0, 255, 65, 0.35);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.btn-safe:active {
|
|
156
|
+
transform: translateY(0);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.btn-unsafe {
|
|
160
|
+
background: linear-gradient(135deg, #FF4444 0%, #CC2233 100%);
|
|
161
|
+
color: #fff;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.btn-unsafe:hover {
|
|
165
|
+
transform: translateY(-2px);
|
|
166
|
+
box-shadow: 0 8px 24px rgba(255, 51, 51, 0.35);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.btn-unsafe:active {
|
|
170
|
+
transform: translateY(0);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.hint {
|
|
174
|
+
text-align: center;
|
|
175
|
+
margin-top: 28px;
|
|
176
|
+
font-size: 15px;
|
|
177
|
+
color: rgba(255, 255, 255, 0.3);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.hint kbd {
|
|
181
|
+
background: rgba(255, 255, 255, 0.1);
|
|
182
|
+
padding: 4px 10px;
|
|
183
|
+
border-radius: 6px;
|
|
184
|
+
font-family: inherit;
|
|
185
|
+
font-size: 14px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.completed {
|
|
189
|
+
text-align: center;
|
|
190
|
+
padding: 60px 20px;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.completed-icon {
|
|
194
|
+
width: 88px;
|
|
195
|
+
height: 88px;
|
|
196
|
+
border-radius: 50%;
|
|
197
|
+
display: flex;
|
|
198
|
+
align-items: center;
|
|
199
|
+
justify-content: center;
|
|
200
|
+
margin: 0 auto 28px;
|
|
201
|
+
font-size: 40px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.completed-icon.safe {
|
|
205
|
+
background: linear-gradient(135deg, rgba(0, 255, 65, 0.2), rgba(0, 204, 51, 0.1));
|
|
206
|
+
border: 2px solid rgba(0, 255, 65, 0.5);
|
|
207
|
+
box-shadow: 0 0 32px rgba(0, 255, 65, 0.2);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.completed-icon.unsafe {
|
|
211
|
+
background: linear-gradient(135deg, rgba(255, 68, 68, 0.2), rgba(204, 34, 51, 0.1));
|
|
212
|
+
border: 2px solid rgba(255, 68, 68, 0.5);
|
|
213
|
+
box-shadow: 0 0 32px rgba(255, 68, 68, 0.2);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.completed h2 {
|
|
217
|
+
font-size: 28px;
|
|
218
|
+
font-weight: 600;
|
|
219
|
+
margin-bottom: 12px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.completed p {
|
|
223
|
+
font-size: 18px;
|
|
224
|
+
color: rgba(255, 255, 255, 0.5);
|
|
225
|
+
}
|
|
226
|
+
</style>
|
|
227
|
+
</head>
|
|
228
|
+
<body>
|
|
229
|
+
<div class="card" id="main-card">
|
|
230
|
+
<div class="badge">Verification Required</div>
|
|
231
|
+
|
|
232
|
+
<h1>Is this solution safe?</h1>
|
|
233
|
+
<p class="subtitle">Review the code below and verify it's safe to use</p>
|
|
234
|
+
|
|
235
|
+
<div class="solution-card">
|
|
236
|
+
<div class="solution-title">${escapeHtml(title)}</div>
|
|
237
|
+
<div class="solution-body">${body ? escapeHtml(body) : 'Solution body not available.\nUnlock to view full content.'}</div>
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
<div class="buttons">
|
|
241
|
+
<button class="btn btn-safe" onclick="submit('safe')">Safe</button>
|
|
242
|
+
<button class="btn btn-unsafe" onclick="submit('unsafe')">Unsafe</button>
|
|
243
|
+
</div>
|
|
244
|
+
|
|
245
|
+
<div class="hint">
|
|
246
|
+
Press <kbd>S</kbd> for Safe or <kbd>U</kbd> for Unsafe
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
|
|
250
|
+
<script>
|
|
251
|
+
function submit(result) {
|
|
252
|
+
const isSafe = result === 'safe';
|
|
253
|
+
document.getElementById('main-card').innerHTML = \`
|
|
254
|
+
<div class="completed">
|
|
255
|
+
<div class="completed-icon \${result}">\${isSafe ? '✓' : '✕'}</div>
|
|
256
|
+
<h2>\${isSafe ? 'Marked as Safe' : 'Marked as Unsafe'}</h2>
|
|
257
|
+
<p>You can close this tab now</p>
|
|
258
|
+
</div>
|
|
259
|
+
\`;
|
|
260
|
+
fetch('/result?value=' + result).catch(() => {});
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
document.addEventListener('keydown', (e) => {
|
|
264
|
+
if (e.key === 's' || e.key === 'S') submit('safe');
|
|
265
|
+
if (e.key === 'u' || e.key === 'U') submit('unsafe');
|
|
266
|
+
});
|
|
267
|
+
</script>
|
|
268
|
+
</body>
|
|
269
|
+
</html>
|
|
270
270
|
`;
|
|
271
271
|
function escapeHtml(text) {
|
|
272
272
|
return text
|