-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathredeem-backup.html
More file actions
139 lines (114 loc) · 3.66 KB
/
redeem-backup.html
File metadata and controls
139 lines (114 loc) · 3.66 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Kinnected Redemption Test</title>
<style>
body {
font-family: Arial, sans-serif;
max-width: 500px;
margin: 60px auto;
padding: 0 20px;
}
h2 {
color: #333;
}
label {
display: block;
margin-top: 16px;
font-weight: bold;
font-size: 14px;
}
input {
width: 100%;
padding: 10px;
margin-top: 6px;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 6px;
font-size: 14px;
}
button {
margin-top: 24px;
width: 100%;
padding: 12px;
background: #4CAF50;
color: white;
border: none;
border-radius: 6px;
font-size: 16px;
cursor: pointer;
}
button:disabled {
background: #aaa;
cursor: not-allowed;
}
#result {
margin-top: 24px;
padding: 16px;
border-radius: 6px;
font-size: 13px;
white-space: pre-wrap;
word-break: break-all;
display: none;
}
.success {
background: #e8f5e9;
border: 1px solid #4CAF50;
color: #2e7d32;
}
.error {
background: #ffebee;
border: 1px solid #e53935;
color: #b71c1c;
}
</style>
</head>
<body>
<h2>Kinnected Redemption Test</h2>
<label>Link ID</label>
<input type="text" id="linkId" placeholder="Paste your payment link ID here" />
<label>Destination Wallet</label>
<input type="text" id="wallet" placeholder="Paste a Solana wallet address here" />
<button id="btn" onclick="redeem()">Redeem</button>
<div id="result"></div>
<script>
async function redeem() {
const linkId = document.getElementById("linkId").value.trim();
const destinationWallet = document.getElementById("wallet").value.trim();
const btn = document.getElementById("btn");
const result = document.getElementById("result");
if (!linkId || !destinationWallet) {
showResult("Please fill in both fields.", false);
return;
}
btn.disabled = true;
btn.textContent = "Redeeming...";
result.style.display = "none";
try {
// 1. Point the URL to your locally running Node.js server
const response = await fetch("http://localhost:5000/api/secure-redeem", {
method: "POST",
headers: {
"Content-Type": "application/json"
// 2. The dangerous API key header has been completely stripped out of here!
},
body: JSON.stringify({ linkId, destinationWallet })
});
const data = await response.json();
showResult(JSON.stringify(data, null, 2), data.success);
} catch (err) {
showResult("Network error: " + err.message, false);
}
btn.disabled = false;
btn.textContent = "Redeem";
}
function showResult(text, success) {
const result = document.getElementById("result");
result.textContent = text;
result.className = success ? "success" : "error";
result.style.display = "block";
}
</script>
</body>
</html>