Skip to content

Commit b447c82

Browse files
payments
1 parent 65608f0 commit b447c82

3 files changed

Lines changed: 228 additions & 0 deletions

File tree

dashboard.html

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Dashboard - InstaNode</title>
7+
<style>
8+
* { box-sizing: border-box; margin: 0; padding: 0; }
9+
body {
10+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
11+
background: #0a0a0a;
12+
color: #e0e0e0;
13+
line-height: 1.6;
14+
min-height: 100vh;
15+
padding: 20px;
16+
}
17+
.container { max-width: 800px; margin: 0 auto; }
18+
h1 { margin-bottom: 20px; }
19+
.resource {
20+
background: #111;
21+
border: 1px solid #222;
22+
border-radius: 8px;
23+
padding: 16px;
24+
margin-bottom: 16px;
25+
}
26+
.resource h3 { margin-bottom: 8px; }
27+
.resource p { margin-bottom: 4px; }
28+
.logout {
29+
position: absolute;
30+
top: 20px;
31+
right: 20px;
32+
background: #f44;
33+
color: white;
34+
border: none;
35+
padding: 8px 16px;
36+
border-radius: 4px;
37+
cursor: pointer;
38+
}
39+
</style>
40+
</head>
41+
<body>
42+
<button class="logout" onclick="logout()">Logout</button>
43+
<div class="container">
44+
<h1>Your Resources</h1>
45+
<div id="resources"></div>
46+
</div>
47+
<script>
48+
async function loadResources() {
49+
try {
50+
const res = await fetch('/api/me/resources');
51+
if (res.ok) {
52+
const resources = await res.json();
53+
const container = document.getElementById('resources');
54+
resources.forEach(r => {
55+
const div = document.createElement('div');
56+
div.className = 'resource';
57+
div.innerHTML = `
58+
<h3>${r.type} - ${r.name}</h3>
59+
<p>Token: ${r.token}</p>
60+
<p>Tier: ${r.tier}</p>
61+
<p>Status: ${r.status}</p>
62+
`;
63+
container.appendChild(div);
64+
});
65+
} else {
66+
window.location.href = '/start';
67+
}
68+
} catch (e) {
69+
window.location.href = '/start';
70+
}
71+
}
72+
73+
async function logout() {
74+
await fetch('/auth/logout', { method: 'POST' });
75+
window.location.href = '/';
76+
}
77+
78+
loadResources();
79+
</script>
80+
</body>
81+
</html>

pricing.html

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Pricing - InstaNode</title>
7+
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
8+
<style>
9+
* { box-sizing: border-box; margin: 0; padding: 0; }
10+
body {
11+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
12+
background: #0a0a0a;
13+
color: #e0e0e0;
14+
line-height: 1.6;
15+
min-height: 100vh;
16+
padding: 20px;
17+
}
18+
.container { max-width: 600px; margin: 0 auto; text-align: center; }
19+
h1 { margin-bottom: 40px; }
20+
.plan {
21+
background: #111;
22+
border: 1px solid #222;
23+
border-radius: 8px;
24+
padding: 20px;
25+
margin-bottom: 20px;
26+
}
27+
.plan h2 { margin-bottom: 10px; }
28+
.btn {
29+
background: #4af;
30+
color: #060a14;
31+
border: none;
32+
padding: 12px 24px;
33+
border-radius: 8px;
34+
font-size: 1rem;
35+
cursor: pointer;
36+
margin-top: 10px;
37+
}
38+
.btn:hover { background: #66bfff; }
39+
</style>
40+
</head>
41+
<body>
42+
<div class="container">
43+
<h1>Choose Your Plan</h1>
44+
<div class="plan">
45+
<h2>Monthly Plan</h2>
46+
<p>₹500/month</p>
47+
<button class="btn" onclick="pay('monthly')">Subscribe Monthly</button>
48+
</div>
49+
<div class="plan">
50+
<h2>Annual Plan</h2>
51+
<p>₹5000/year</p>
52+
<button class="btn" onclick="pay('annual')">Subscribe Annual</button>
53+
</div>
54+
</div>
55+
<script>
56+
async function pay(planId) {
57+
try {
58+
const res = await fetch('/billing/create-order', {
59+
method: 'POST',
60+
headers: { 'Content-Type': 'application/json' },
61+
body: JSON.stringify({ plan_id: planId })
62+
});
63+
const order = await res.json();
64+
65+
const options = {
66+
key: order.key_id,
67+
amount: order.amount,
68+
currency: order.currency,
69+
order_id: order.order_id,
70+
name: order.name,
71+
description: 'InstaNode Subscription',
72+
handler: function (response) {
73+
// After payment, migrate the resource
74+
const token = localStorage.getItem('instanode_token');
75+
if (token) {
76+
fetch('/billing/migrate?token=' + token, { method: 'POST' });
77+
}
78+
window.location.href = '/dashboard';
79+
}
80+
};
81+
const rzp = new Razorpay(options);
82+
rzp.open();
83+
} catch (e) {
84+
alert('Error: ' + e.message);
85+
}
86+
}
87+
</script>
88+
</body>
89+
</html>

start.html

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Claim Your Database - InstaNode</title>
7+
<style>
8+
* { box-sizing: border-box; margin: 0; padding: 0; }
9+
body {
10+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
11+
background: #0a0a0a;
12+
color: #e0e0e0;
13+
line-height: 1.6;
14+
min-height: 100vh;
15+
display: flex;
16+
align-items: center;
17+
justify-content: center;
18+
}
19+
.container {
20+
max-width: 400px;
21+
text-align: center;
22+
padding: 20px;
23+
}
24+
h1 {
25+
font-size: 2rem;
26+
margin-bottom: 20px;
27+
}
28+
.btn {
29+
background: #4af;
30+
color: #060a14;
31+
border: none;
32+
padding: 12px 24px;
33+
border-radius: 8px;
34+
font-size: 1rem;
35+
cursor: pointer;
36+
text-decoration: none;
37+
display: inline-block;
38+
margin-top: 20px;
39+
}
40+
.btn:hover { background: #66bfff; }
41+
</style>
42+
</head>
43+
<body>
44+
<div class="container">
45+
<h1>Claim Your Database</h1>
46+
<p>Your database is ready! Sign in with GitHub to access it.</p>
47+
<a href="/auth/github/login" class="btn">Login with GitHub</a>
48+
</div>
49+
<script>
50+
// Store token from URL
51+
const urlParams = new URLSearchParams(window.location.search);
52+
const token = urlParams.get('token');
53+
if (token) {
54+
localStorage.setItem('instanode_token', token);
55+
}
56+
</script>
57+
</body>
58+
</html>

0 commit comments

Comments
 (0)