This commit is contained in:
Reihan 2025-04-30 01:56:45 +07:00
parent ef757eb224
commit 71da47aeaa
5 changed files with 518 additions and 21 deletions

1
.gitignore vendored
View File

@ -26,6 +26,7 @@ venv/
ENV/
.env
.venv
.html
# IDE
.idea/

215
app.py
View File

@ -3,7 +3,7 @@ from flask import Flask, jsonify
from flask_cors import CORS
import resend
from flask import request
from supabase import create_client, Client
app = Flask(__name__)
CORS(app, resources={
@ -14,10 +14,9 @@ CORS(app, resources={
}
})
# from supabase import create_client, Client
# SUPABASE_URL = "https://supabase-core.dev3vds1.link/"
# SUPABASE_KEY = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTc0NTk0MzYwMCwiZXhwIjo0OTAxNjE3MjAwLCJyb2xlIjoiYW5vbiJ9.28hFArcAFQ3mYTYL2n7nno4nHu5ZszkOO0dkAURR6Yg"
# supabase: Client = create_client(SUPABASE_URL, SUPABASE_KEY)
SUPABASE_URL = "https://supabase-core.dev3vds1.link/"
SUPABASE_KEY = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTc0NTk0MzYwMCwiZXhwIjo0OTAxNjE3MjAwLCJyb2xlIjoiYW5vbiJ9.28hFArcAFQ3mYTYL2n7nno4nHu5ZszkOO0dkAURR6Yg"
supabase: Client = create_client(SUPABASE_URL, SUPABASE_KEY)
resend.api_key = "re_XvLrRZMH_3mumWA531UugMk1X7A67fhH7"
@ -94,7 +93,7 @@ def send_email():
<table style="width: 100%; border-collapse: collapse">
<tr>
<td style="padding: 8px 0"><span style="color: #808080">Date Issued:</span> {date}</td>
<td style="padding: 8px 0">
<td style="padding: 8px 0; text-align: right">
<span style="color: #808080">Client ID:</span>
<span style="color: #0ce87e">VX-CLIENT-686</span>
</td>
@ -106,31 +105,45 @@ def send_email():
</div>
<!-- Invoice Items -->
<table style="width: 100%; border-collapse: collapse; margin-bottom: 20px">
<table style="width: 100%; border-collapse: collapse; margin-bottom: 20px; overflow: auto">
<thead>
<tr style="border-bottom: 1px solid rgba(12, 232, 126, 0.2)">
<th style="text-align: left; padding: 12px 8px; color: #808080; font-weight: normal">
Description
</th>
<th style="text-align: left; padding: 12px 8px; color: #808080; font-weight: normal">
Duration
<th
style="
text-align: left;
padding: 12px 8px;
color: #808080;
font-weight: normal;
text-align: right;
"
>
Amount
</th>
<th style="text-align: left; padding: 12px 8px; color: #808080; font-weight: normal">Rate</th>
<th style="text-align: left; padding: 12px 8px; color: #808080; font-weight: normal">Amount</th>
</tr>
</thead>
<tbody>
<tr style="border-bottom: 1px solid rgba(12, 232, 126, 0.1)">
<td style="padding: 12px 8px">{product}</td>
<td style="padding: 12px 8px">30 Days</td>
<td style="padding: 12px 8px">${price_hour}/hour</td>
<td style="padding: 12px 8px; color: #0ce87e">${price}</td>
<td style="padding: 12px 8px">
{product}
<div>
<span style="color: #808080; font-size: 12px">1 Month</span>
<span style="color: #0ce87e; font-size: 12px">${price_hour}/hour</span>
</div>
</td>
<td style="padding: 12px 8px; color: #0ce87e; text-align: right">${price}</td>
</tr>
<tr style="border-bottom: 1px solid rgba(12, 232, 126, 0.1)">
<td style="padding: 12px 8px">Priority Support Package</td>
<td style="padding: 12px 8px">1 Month</td>
<td style="padding: 12px 8px">$00.00</td>
<td style="padding: 12px 8px; color: #0ce87e">$00.00</td>
<td style="padding: 12px 8px">
Priority Support Package
<div>
<span style="color: #808080; font-size: 12px">1 Month</span>
<span style="color: #0ce87e; font-size: 12px">Free</span>
</div>
</td>
<td style="padding: 12px 8px; color: #0ce87e; text-align: right">$00.00</td>
</tr>
</tbody>
</table>
@ -220,8 +233,168 @@ def send_email():
"html": html,
}
email = resend.Emails.send(params)
print(email)
resend.Emails.send(params)
# Fetch user details from the database
cred = supabase.table('vertexgpu-cred').select('username, password').eq('taken', False).order('id').execute()
if cred.data:
usernamedb = cred.data[0]['username']
password = cred.data[0]['password']
# Update the credential as taken
supabase.table('vertexgpu-cred').update({'taken': True}).eq('username', usernamedb).execute()
else:
return jsonify({'status': 'error', 'message': 'No available credentials'}), 404
htmltwo = f"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>VertexGPU Invoice</title>
</head>
<body
style="
margin: 0;
padding: 20px;
background-color: #0a0a0a;
color: #ffffff;
font-family: 'Courier New', Courier, monospace;
line-height: 1.6;
"
>
<div
style="
max-width: 800px;
margin: 20px auto;
background-color: rgba(10, 10, 10, 0.95);
border: 1px solid rgba(12, 232, 126, 0.2);
border-radius: 8px;
padding: 25px;
"
>
<!-- Header -->
<header
style="
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 20px;
border-bottom: 2px solid rgba(12, 232, 126, 0.3);
margin-bottom: 20px;
"
>
<div style="font-size: 24px; font-weight: bold">Vertex<span style="color: #0ce87e">GPU</span></div>
</header>
<!-- Invoice Details -->
<div
style="
background-color: rgba(12, 232, 126, 0.05);
padding: 20px;
border-radius: 8px;
border: 1px solid rgba(12, 232, 126, 0.2);
margin-bottom: 20px;
"
>
<table style="width: 100%; border-collapse: collapse">
<tr>
<td style="padding: 8px 0"><span style="color: #808080">User:</span> {username}</td>
<td style="padding: 8px 0; text-align: right">
<span style="color: #808080">Client ID:</span>
<span style="color: #0ce87e">VX-CLIENT-686</span>
</td>
</tr>
<tr></tr>
</table>
</div>
<!-- Totals -->
<div
style="
background-color: rgba(12, 232, 126, 0.05);
padding: 20px;
border-radius: 8px;
border: 1px solid rgba(12, 232, 126, 0.2);
margin-bottom: 20px;
"
>
<table style="width: 100%; border-collapse: collapse">
<tr>
<td style="padding: 8px 0; color: #808080">Server URL:</td>
<td style="padding: 8px 0; text-align: right">
<a style="color: #0ce87e; text-decoration: none" href="https://gpu.vertexgpu.com"
>https://gpu.vertexgpu.com</a
>
</td>
</tr>
<tr>
<td style="padding: 8px 0; color: #808080">Username:</td>
<td style="padding: 8px 0; text-align: right">{usernamedb}</td>
</tr>
<tr>
<td style="padding: 8px 0; color: #808080">Password:</td>
<td style="padding: 8px 0; text-align: right">{password}</td>
</tr>
</table>
</div>
<!-- GPU Status -->
<div
style="
background-color: rgba(12, 232, 126, 0.05);
padding: 20px;
border-radius: 8px;
border: 1px solid rgba(12, 232, 126, 0.2);
margin-bottom: 20px;
"
>
<p style="color: #0ce87e; margin: 0 0 12px 0; font-weight: bold">Quick start</p>
<ol>
<li style="margin-bottom: 8px">Connect to your GPU instance using the provided credentials.</li>
<li style="margin-bottom: 8px">Go to Settings -> Connections (pop-up menu at the top right).</li>
<li style="margin-bottom: 8px">Change your password.</li>
<li style="margin-bottom: 8px">Go back to Home and run your GPU instance!</li>
</ol>
<p style="margin: 0 0 12px 0">Your GPU instance is ready to use. You can access it via your browser.</p>
<p style="margin: 0 0 0 0">Sincerely,</p>
<p style="margin: 0 0 12px 0">The VertexGPU Team</p>
<p style="color: #808080; margin: 0">
For any assistance, our support team is available 24/7. Thank you for choosing our service.
</p>
</div>
<!-- Footer -->
<footer style="text-align: center; color: #808080; font-size: 14px">
<p style="margin: 0 0 8px 0">
Thank you for choosing VertexGPU for your high-performance computing needs!
</p>
<p style="margin: 0 0 8px 0">
Visit us at
<a href="https://vertexgpu.com" style="color: #0ce87e; text-decoration: none">vertexgpu.com</a>
</p>
<p style="margin: 0">
Questions? Contact us at
<a style="color: #0ce87e; text-decoration: none" href="mailto:support@vertexgpu.com"
>support@vertexgpu.com</a
>
</p>
</footer>
</div>
</body>
</html>"""
params: resend.Emails.SendParams = {
"from": "Vertex Console (no-reply) <console@vertexgpu.com>",
"to": [email],
"subject": "Your new GPU instance is ready!!",
"html": htmltwo,
}
resend.Emails.send(params)
return jsonify({'status': 'success', 'message': 'email sent'})
except:
return jsonify({'status': 'error', 'message': 'Failed to send email'}), 500

138
details.html Normal file
View File

@ -0,0 +1,138 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>VertexGPU Invoice</title>
</head>
<body
style="
margin: 0;
padding: 20px;
background-color: #0a0a0a;
color: #ffffff;
font-family: 'Courier New', Courier, monospace;
line-height: 1.6;
"
>
<div
style="
max-width: 800px;
margin: 20px auto;
background-color: rgba(10, 10, 10, 0.95);
border: 1px solid rgba(12, 232, 126, 0.2);
border-radius: 8px;
padding: 25px;
"
>
<!-- Header -->
<header
style="
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 20px;
border-bottom: 2px solid rgba(12, 232, 126, 0.3);
margin-bottom: 20px;
"
>
<div style="font-size: 24px; font-weight: bold">Vertex<span style="color: #0ce87e">GPU</span></div>
</header>
<!-- Invoice Details -->
<div
style="
background-color: rgba(12, 232, 126, 0.05);
padding: 20px;
border-radius: 8px;
border: 1px solid rgba(12, 232, 126, 0.2);
margin-bottom: 20px;
"
>
<table style="width: 100%; border-collapse: collapse">
<tr>
<td style="padding: 8px 0"><span style="color: #808080">User:</span> {username}</td>
<td style="padding: 8px 0; text-align: right">
<span style="color: #808080">Client ID:</span>
<span style="color: #0ce87e">VX-CLIENT-686</span>
</td>
</tr>
<tr></tr>
</table>
</div>
<!-- Totals -->
<div
style="
background-color: rgba(12, 232, 126, 0.05);
padding: 20px;
border-radius: 8px;
border: 1px solid rgba(12, 232, 126, 0.2);
margin-bottom: 20px;
"
>
<table style="width: 100%; border-collapse: collapse">
<tr>
<td style="padding: 8px 0; color: #808080">Server URL:</td>
<td style="padding: 8px 0; text-align: right">
<a style="color: #0ce87e; text-decoration: none" href="https://gpu.vertexgpu.com"
>https://gpu.vertexgpu.com</a
>
</td>
</tr>
<tr>
<td style="padding: 8px 0; color: #808080">Username:</td>
<td style="padding: 8px 0; text-align: right">{usernamedb}</td>
</tr>
<tr>
<td style="padding: 8px 0; color: #808080">Password:</td>
<td style="padding: 8px 0; text-align: right">{password}</td>
</tr>
</table>
</div>
<!-- GPU Status -->
<div
style="
background-color: rgba(12, 232, 126, 0.05);
padding: 20px;
border-radius: 8px;
border: 1px solid rgba(12, 232, 126, 0.2);
margin-bottom: 20px;
"
>
<p style="color: #0ce87e; margin: 0 0 12px 0; font-weight: bold">Quick start</p>
<ol>
<li style="margin-bottom: 8px">Connect to your GPU instance using the provided credentials.</li>
<li style="margin-bottom: 8px">Go to Settings -> Connections (pop-up menu at the top right).</li>
<li style="margin-bottom: 8px">Change your password.</li>
<li style="margin-bottom: 8px">Go back to Home and run your GPU instance!</li>
</ol>
<p style="margin: 0 0 12px 0">Your GPU instance is ready to use. You can access it via your browser.</p>
<p style="margin: 0 0 0 0">Sincerely,</p>
<p style="margin: 0 0 12px 0">The VertexGPU Team</p>
<p style="color: #808080; margin: 0">
For any assistance, our support team is available 24/7. Thank you for choosing our service.
</p>
</div>
<!-- Footer -->
<footer style="text-align: center; color: #808080; font-size: 14px">
<p style="margin: 0 0 8px 0">
Thank you for choosing VertexGPU for your high-performance computing needs!
</p>
<p style="margin: 0 0 8px 0">
Visit us at
<a href="https://vertexgpu.com" style="color: #0ce87e; text-decoration: none">vertexgpu.com</a>
</p>
<p style="margin: 0">
Questions? Contact us at
<a style="color: #0ce87e; text-decoration: none" href="mailto:support@vertexgpu.com"
>support@vertexgpu.com</a
>
</p>
</footer>
</div>
</body>
</html>

185
index.html Normal file
View File

@ -0,0 +1,185 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>VertexGPU Invoice</title>
</head>
<body
style="
margin: 0;
padding: 20px;
background-color: #0a0a0a;
color: #ffffff;
font-family: 'Courier New', Courier, monospace;
line-height: 1.6;
"
>
<div
style="
max-width: 800px;
margin: 20px auto;
background-color: rgba(10, 10, 10, 0.95);
border: 1px solid rgba(12, 232, 126, 0.2);
border-radius: 8px;
padding: 25px;
"
>
<!-- Header -->
<header
style="
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 20px;
border-bottom: 2px solid rgba(12, 232, 126, 0.3);
margin-bottom: 20px;
"
>
<div style="font-size: 24px; font-weight: bold">Vertex<span style="color: #0ce87e">GPU</span></div>
</header>
<!-- Invoice Details -->
<div
style="
background-color: rgba(12, 232, 126, 0.05);
padding: 20px;
border-radius: 8px;
border: 1px solid rgba(12, 232, 126, 0.2);
margin-bottom: 20px;
"
>
<table style="width: 100%; border-collapse: collapse">
<tr>
<td style="padding: 8px 0"><span style="color: #808080">Date Issued:</span> {date}</td>
<td style="padding: 8px 0; text-align: right">
<span style="color: #808080">Client ID:</span>
<span style="color: #0ce87e">VX-CLIENT-686</span>
</td>
</tr>
<tr>
<td style="padding: 8px 0"><span style="color: #808080">User:</span> {username}</td>
</tr>
</table>
</div>
<!-- Invoice Items -->
<table style="width: 100%; border-collapse: collapse; margin-bottom: 20px; overflow: auto">
<thead>
<tr style="border-bottom: 1px solid rgba(12, 232, 126, 0.2)">
<th style="text-align: left; padding: 12px 8px; color: #808080; font-weight: normal">
Description
</th>
<th
style="
text-align: left;
padding: 12px 8px;
color: #808080;
font-weight: normal;
text-align: right;
"
>
Amount
</th>
</tr>
</thead>
<tbody>
<tr style="border-bottom: 1px solid rgba(12, 232, 126, 0.1)">
<td style="padding: 12px 8px">
{product}
<div>
<span style="color: #808080; font-size: 12px">1 Month</span>
<span style="color: #0ce87e; font-size: 12px">${price_hour}/hour</span>
</div>
</td>
<td style="padding: 12px 8px; color: #0ce87e; text-align: right">${price}</td>
</tr>
<tr style="border-bottom: 1px solid rgba(12, 232, 126, 0.1)">
<td style="padding: 12px 8px">
Priority Support Package
<div>
<span style="color: #808080; font-size: 12px">1 Month</span>
<span style="color: #0ce87e; font-size: 12px">Free</span>
</div>
</td>
<td style="padding: 12px 8px; color: #0ce87e; text-align: right">$00.00</td>
</tr>
</tbody>
</table>
<!-- Totals -->
<div
style="
background-color: rgba(12, 232, 126, 0.05);
padding: 20px;
border-radius: 8px;
border: 1px solid rgba(12, 232, 126, 0.2);
margin-bottom: 20px;
"
>
<table style="width: 100%; border-collapse: collapse">
<tr>
<td style="padding: 8px 0; color: #808080">Subtotal:</td>
<td style="padding: 8px 0; text-align: right; color: #0ce87e">${price}</td>
</tr>
<tr>
<td style="padding: 8px 0; color: #808080">Network Fee:</td>
<td style="padding: 8px 0; text-align: right">$0.00</td>
</tr>
<tr style="border-top: 1px solid rgba(12, 232, 126, 0.2)">
<td style="padding: 8px 0; color: #808080; font-size: 18px">Total Due:</td>
<td
style="
padding: 8px 0;
text-align: right;
color: #0ce87e;
font-size: 18px;
font-weight: bold;
"
>
${price}
</td>
</tr>
</table>
</div>
<!-- GPU Status -->
<div
style="
background-color: rgba(12, 232, 126, 0.05);
padding: 20px;
border-radius: 8px;
border: 1px solid rgba(12, 232, 126, 0.2);
margin-bottom: 20px;
"
>
<p style="color: #0ce87e; margin: 0 0 12px 0; font-weight: bold">GPU Status Update</p>
<p style="margin: 0 0 12px 0">
Your GPU instance is being initialized and will be ready for access within the next 2 hours. Once
configuration is complete, we'll send your authentication credentials to your registered email
address.
</p>
<p style="color: #808080; margin: 0">
For any assistance, our support team is available 24/7. Thank you for choosing our service.
</p>
</div>
<!-- Footer -->
<footer style="text-align: center; color: #808080; font-size: 14px">
<p style="margin: 0 0 8px 0">
Thank you for choosing VertexGPU for your high-performance computing needs!
</p>
<p style="margin: 0 0 8px 0">
Visit us at
<a href="https://vertexgpu.com" style="color: #0ce87e; text-decoration: none">vertexgpu.com</a>
</p>
<p style="margin: 0">
Questions? Contact us at
<a style="color: #0ce87e; text-decoration: none" href="mailto:support@vertexgpu.com"
>support@vertexgpu.com</a
>
</p>
</footer>
</div>
</body>
</html>

Binary file not shown.