krsyer-server-monitor-pro 1.0.27 → 1.0.29

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.
Files changed (57) hide show
  1. package/monitor.js +7 -0
  2. package/package.json +9 -4
  3. package/DEPLOY_GUIDE.md +0 -68
  4. package/bin/cli.js +0 -84
  5. package/guestguru-api/.idea/guestguru-api.iml +0 -9
  6. package/guestguru-api/.idea/misc.xml +0 -6
  7. package/guestguru-api/.idea/modules.xml +0 -8
  8. package/guestguru-api/.idea/vcs.xml +0 -6
  9. package/guestguru-api/API_DESIGN_GUIDE.md +0 -140
  10. package/guestguru-api/API_DOCUMENTATION.md +0 -504
  11. package/guestguru-api/API_REQUIREMENTS_TENANTS.md +0 -110
  12. package/guestguru-api/AVAILABLE_TENANT_ENDPOINTS.md +0 -137
  13. package/guestguru-api/BACKEND_INSTRUCTIONS.md +0 -77
  14. package/guestguru-api/DINING_MODULE_INTEGRATION.md +0 -175
  15. package/guestguru-api/FRONTEND_FINANCE_MODULE.md +0 -151
  16. package/guestguru-api/README.md +0 -93
  17. package/guestguru-api/app.json +0 -12
  18. package/guestguru-api/database.sqlite +0 -0
  19. package/guestguru-api/eas.json +0 -21
  20. package/guestguru-api/ecosystem.config.js +0 -19
  21. package/guestguru-api/fix_db_schema.js +0 -77
  22. package/guestguru-api/list_columns.js +0 -27
  23. package/guestguru-api/package.json +0 -34
  24. package/guestguru-api/postman_backend_v2.json +0 -1745
  25. package/guestguru-api/postman_collection.json +0 -477
  26. package/guestguru-api/postman_environment.json +0 -17
  27. package/guestguru-api/public/icon.png +0 -0
  28. package/guestguru-api/public/icon_b64.txt +0 -1
  29. package/guestguru-api/readd_column.js +0 -27
  30. package/guestguru-api/server.js +0 -263
  31. package/guestguru-api/test_cashfree_connection.js +0 -52
  32. package/lib/controllers/cloudflareController.js +0 -1
  33. package/lib/controllers/dockerController.js +0 -1
  34. package/lib/controllers/networkController.js +0 -1
  35. package/lib/controllers/serverController.js +0 -1
  36. package/lib/ecosystem.config.js +0 -1
  37. package/lib/middleware/saasAuth.js +0 -1
  38. package/lib/public/login.html +0 -99
  39. package/lib/public/payment.html +0 -152
  40. package/lib/public/script.js +0 -1180
  41. package/lib/public/style.css +0 -1045
  42. package/lib/routes/cloudflareRoutes.js +0 -1
  43. package/lib/routes/dockerRoutes.js +0 -1
  44. package/lib/routes/networkRoutes.js +0 -1
  45. package/lib/routes/serverRoutes.js +0 -1
  46. package/lib/server.js +0 -1
  47. package/lib/services/cashfreeService.js +0 -1
  48. package/lib/views/activate.html +0 -109
  49. package/lib/views/index.html +0 -552
  50. package/license-portal/.env.example +0 -15
  51. package/license-portal/README.md +0 -93
  52. package/license-portal/ecosystem.config.js +0 -16
  53. package/license-portal/package.json +0 -22
  54. package/license-portal/server.js +0 -306
  55. package/license-portal/services/emailService.js +0 -126
  56. package/license-portal/views/pricing.html +0 -358
  57. package/temp_cf_method.js +0 -48
@@ -1,93 +0,0 @@
1
- # license-portal
2
-
3
-
4
-
5
- ## Getting started
6
-
7
- To make it easy for you to get started with GitLab, here's a list of recommended next steps.
8
-
9
- Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
10
-
11
- ## Add your files
12
-
13
- * [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
14
- * [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command:
15
-
16
- ```
17
- cd existing_repo
18
- git remote add origin https://gitlab.com/mulaorg/license-portal.git
19
- git branch -M main
20
- git push -uf origin main
21
- ```
22
-
23
- ## Integrate with your tools
24
-
25
- * [Set up project integrations](https://gitlab.com/mulaorg/license-portal/-/settings/integrations)
26
-
27
- ## Collaborate with your team
28
-
29
- * [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
30
- * [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
31
- * [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
32
- * [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
33
- * [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
34
-
35
- ## Test and Deploy
36
-
37
- Use the built-in continuous integration in GitLab.
38
-
39
- * [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/)
40
- * [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
41
- * [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
42
- * [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
43
- * [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
44
-
45
- ***
46
-
47
- # Editing this README
48
-
49
- When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template.
50
-
51
- ## Suggestions for a good README
52
-
53
- Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
54
-
55
- ## Name
56
- Choose a self-explaining name for your project.
57
-
58
- ## Description
59
- Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
60
-
61
- ## Badges
62
- On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
63
-
64
- ## Visuals
65
- Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
66
-
67
- ## Installation
68
- Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
69
-
70
- ## Usage
71
- Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
72
-
73
- ## Support
74
- Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
75
-
76
- ## Roadmap
77
- If you have ideas for releases in the future, it is a good idea to list them in the README.
78
-
79
- ## Contributing
80
- State if you are open to contributions and what your requirements are for accepting them.
81
-
82
- For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
83
-
84
- You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
85
-
86
- ## Authors and acknowledgment
87
- Show your appreciation to those who have contributed to the project.
88
-
89
- ## License
90
- For open source projects, say how it is licensed.
91
-
92
- ## Project status
93
- If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
@@ -1,16 +0,0 @@
1
- module.exports = {
2
- apps: [
3
- {
4
- name: "license-portal",
5
- script: "server.js",
6
- env: {
7
- NODE_ENV: "development",
8
- PORT: 3011
9
- },
10
- env_production: {
11
- NODE_ENV: "production",
12
- PORT: 3011
13
- }
14
- }
15
- ]
16
- };
@@ -1,22 +0,0 @@
1
- {
2
- "name": "mulasoft-license-portal",
3
- "version": "1.0.0",
4
- "description": "Payment and License Management Portal",
5
- "main": "server.js",
6
- "scripts": {
7
- "start": "node server.js",
8
- "dev": "nodemon server.js"
9
- },
10
- "dependencies": {
11
- "body-parser": "^1.20.2",
12
- "cashfree-pg": "^5.1.0",
13
- "cors": "^2.8.5",
14
- "dotenv": "^16.3.1",
15
- "express": "^4.18.2",
16
- "mysql2": "^3.16.0",
17
- "nodemailer": "^7.0.12"
18
- },
19
- "devDependencies": {
20
- "nodemon": "^3.1.11"
21
- }
22
- }
@@ -1,306 +0,0 @@
1
- require('dotenv').config();
2
- const express = require('express');
3
- const { Cashfree, CFEnvironment } = require('cashfree-pg');
4
- const path = require('path');
5
- const cors = require('cors');
6
- const fs = require('fs');
7
- const { sendLicenseEmail } = require('./services/emailService');
8
-
9
- const app = express();
10
- app.use(express.static('public'));
11
- app.use(express.json());
12
- app.use(express.urlencoded({ extended: true }));
13
- app.use(cors());
14
-
15
- // --- Database (Simple JSON File Persistence) ---
16
- const mysql = require('mysql2/promise');
17
-
18
- // --- Database (MySQL) ---
19
- const dbConfig = {
20
- host: process.env.DB_HOST || 'localhost',
21
- user: process.env.DB_USER || 'mulaorg',
22
- password: process.env.DB_PASSWORD || 'Krishika@9959',
23
- waitForConnections: true,
24
- connectionLimit: 10,
25
- queueLimit: 0
26
- };
27
-
28
- const DB_NAME = process.env.DB_NAME || 'license_portal';
29
-
30
- let pool;
31
-
32
- // Init DB
33
- (async () => {
34
- try {
35
- // 1. Create DB if not exists
36
- const output = await mysql.createConnection({
37
- host: dbConfig.host,
38
- user: dbConfig.user,
39
- password: dbConfig.password
40
- });
41
- await output.query(`CREATE DATABASE IF NOT EXISTS ${DB_NAME}`);
42
- await output.end();
43
-
44
- // 2. Init Pool
45
- pool = mysql.createPool({
46
- ...dbConfig,
47
- database: DB_NAME
48
- });
49
-
50
- // 3. Create Table
51
- const conn = await pool.getConnection();
52
- await conn.query(`
53
- CREATE TABLE IF NOT EXISTS licenses (
54
- id INT AUTO_INCREMENT PRIMARY KEY,
55
- license_key VARCHAR(255) NOT NULL UNIQUE,
56
- order_id VARCHAR(255),
57
- customer_email VARCHAR(255),
58
- customer_phone VARCHAR(50),
59
- plan VARCHAR(50) DEFAULT 'Pro',
60
- machine_id VARCHAR(255),
61
- active BOOLEAN DEFAULT TRUE,
62
- created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
63
- expiry_date DATETIME,
64
- INDEX idx_key (license_key)
65
- )
66
- `);
67
-
68
- // Migration: Add machine_id to existing tables if needed
69
- try {
70
- await conn.query("ALTER TABLE licenses ADD COLUMN machine_id VARCHAR(255)");
71
- console.log("Schema Updated: machine_id column added");
72
- } catch (e) {
73
- if (e.code !== 'ER_DUP_FIELDNAME') console.log("Schema check skipped:", e.message);
74
- }
75
-
76
- console.log('MySQL Database initialized');
77
- conn.release();
78
- } catch (err) {
79
- console.error('MySQL Init Error:', err.message);
80
- if (err.code === 'ECONNREFUSED') {
81
- console.error('❌ Could not connect to MySQL Server. Is it installed and running?');
82
- console.error('👉 Try: sudo systemctl start mysql');
83
- } else if (err.code === 'ER_ACCESS_DENIED_ERROR') {
84
- console.error('❌ Access Denied. Check DB_USER and DB_PASSWORD.');
85
- }
86
- }
87
- })();
88
-
89
-
90
- // --- Cashfree Init Helper ---
91
- const getCashfree = () => {
92
- const cf = new Cashfree();
93
- cf.XClientId = process.env.CASHFREE_APP_ID;
94
- cf.XClientSecret = process.env.CASHFREE_SECRET_KEY;
95
- cf.XEnvironment = CFEnvironment.PRODUCTION;
96
- return cf;
97
- };
98
-
99
- // --- Routes ---
100
-
101
- // 1. Landing Page (Serve on / and /pricing)
102
- app.get(['/', '/pricing'], (req, res) => {
103
- res.sendFile(path.join(__dirname, 'views', 'pricing.html'));
104
- });
105
-
106
- // 2. Buy Route
107
- app.post('/api/buy', async (req, res) => {
108
- try {
109
- const { email, phone } = req.body;
110
- const orderId = `order_${Date.now()}`;
111
-
112
- // Store temp order info? Not strictly needed if we trust Cashfree return
113
- // But helpful for reconciliation. For now, rely on Return URL params.
114
-
115
- const request = {
116
- order_amount: 99.00,
117
- order_currency: "INR",
118
- order_id: orderId,
119
- customer_details: {
120
- customer_id: email.replace(/[^a-zA-Z0-9]/g, '').substring(0, 20),
121
- customer_phone: phone,
122
- customer_email: email
123
- },
124
- order_meta: {
125
- return_url: `${process.env.APP_URL}/verify?order_id={order_id}&email=${encodeURIComponent(email)}&phone=${encodeURIComponent(phone)}`
126
- }
127
- };
128
-
129
- const cf = getCashfree();
130
- const response = await cf.PGCreateOrder(request);
131
- res.json(response.data);
132
-
133
- } catch (error) {
134
- console.error("Cashfree Order Create Error:", error.response?.data || error.message);
135
- res.status(500).json({ error: "Failed to create order" });
136
- }
137
- });
138
-
139
- // 3. Verify Route (Return URL)
140
- app.get('/verify', async (req, res) => {
141
- const { order_id, email, phone } = req.query;
142
-
143
- if (!order_id) {
144
- return res.redirect('/');
145
- }
146
-
147
- try {
148
- const cf = getCashfree();
149
- // Check Payment Status
150
- const response = await cf.PGOrderFetchPayments(order_id);
151
- const payments = response.data;
152
-
153
- // Find successful payment
154
- const isPaid = payments.some(p => p.payment_status === 'SUCCESS');
155
-
156
- if (isPaid) {
157
- // Generate License
158
- const licenseKey = 'PRO-' + Math.random().toString(36).substring(2, 10).toUpperCase() + '-' + Date.now().toString(36).toUpperCase();
159
-
160
- // Calculate Expiry (1 year from now)
161
- const expiryDate = new Date();
162
- expiryDate.setFullYear(expiryDate.getFullYear() + 1);
163
-
164
- // Check if license already exists for this order (Idempotency)
165
- if (pool) {
166
- const [existing] = await pool.query('SELECT license_key FROM licenses WHERE order_id = ?', [order_id]);
167
- if (existing.length > 0) {
168
- return res.send(getSuccessHtml(existing[0].license_key, order_id, true));
169
- }
170
-
171
- await pool.query(
172
- 'INSERT INTO licenses (license_key, order_id, customer_email, customer_phone, expiry_date, active) VALUES (?, ?, ?, ?, ?, ?)',
173
- [licenseKey, order_id, email || 'Unknown', phone || 'Unknown', expiryDate, true]
174
- );
175
-
176
- // Send Email Notification
177
- if (email && email !== 'Unknown') {
178
- // Fire and forget, or await? Let's await to log success
179
- await sendLicenseEmail(email, licenseKey, expiryDate);
180
- }
181
- } else {
182
- console.error("Critical: DB Pool missing during verify. License generated but not saved:", licenseKey);
183
- }
184
-
185
- // Show Success Page
186
- res.send(getSuccessHtml(licenseKey, order_id, false));
187
- } else {
188
- res.send(`<h1>Payment Failed or Pending</h1><a href="/">Try Again</a>`);
189
- }
190
- } catch (e) {
191
- console.error("Cashfree Verification Error:", e);
192
- res.status(500).send(`<h1>Verification Error</h1><p>${e.message}</p><pre>${JSON.stringify(e.response?.data || {}, null, 2)}</pre>`);
193
- }
194
- });
195
-
196
- // 4. API Validation Endpoint
197
- app.get('/api/validate', async (req, res) => {
198
- let { key, machineId } = req.query;
199
- if (!key) return res.json({ valid: false });
200
-
201
- key = key.trim();
202
-
203
- // Special Demo Key
204
- if (key === 'DEMO-123') {
205
- return res.json({ valid: true, plan: 'Pro (Demo)' });
206
- }
207
-
208
- if (!pool) {
209
- console.error("DB Pool not ready");
210
- return res.json({ valid: false, message: 'Server Starting...' });
211
- }
212
-
213
- try {
214
- const [rows] = await pool.query('SELECT * FROM licenses WHERE license_key = ?', [key]);
215
- const license = rows[0];
216
-
217
- if (license && license.active) {
218
- // Machine Binding Logic
219
- if (machineId) {
220
- if (!license.machine_id) {
221
- // First time: Bind license to this machine
222
- await pool.query('UPDATE licenses SET machine_id = ? WHERE id = ?', [machineId, license.id]);
223
- } else if (license.machine_id !== machineId) {
224
- // Already bound to another machine
225
- return res.json({ valid: false, message: 'License is active on another server' });
226
- }
227
- }
228
-
229
- // Check Expiry
230
- const now = new Date();
231
- const expiry = new Date(license.expiry_date);
232
-
233
- if (expiry && now > expiry) {
234
- return res.json({ valid: false, message: 'Subscription Expired' });
235
- }
236
-
237
- return res.json({
238
- valid: true,
239
- plan: license.plan,
240
- expiry: license.expiry_date
241
- });
242
- }
243
- } catch (e) {
244
- console.error("Validation Error", e);
245
- }
246
-
247
- return res.json({ valid: false, message: 'Invalid Key' });
248
- });
249
-
250
- const getSuccessHtml = (licenseKey, orderId, isExisting) => {
251
- return `
252
- <!DOCTYPE html>
253
- <html lang="en">
254
- <head>
255
- <meta charset="UTF-8">
256
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
257
- <title>License Activated</title>
258
- <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap" rel="stylesheet">
259
- <style>
260
- body { font-family: 'Space Grotesk', sans-serif; background: #0f172a; color: white; display: flex; justify-content: center; align-items: center; min-height: 100vh; margin: 0; }
261
- .card { background: #1e293b; padding: 2.5rem; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); text-align: center; max-width: 500px; width: 90%; border: 1px solid #334155; }
262
- h1 { color: ${isExisting ? '#fbbf24' : '#4ade80'}; margin-bottom: 0.5rem; font-size: 2rem; }
263
- .key-box { background: rgba(0,0,0,0.3); padding: 15px; border-radius: 8px; margin: 20px 0; border: 1px dashed #475569; position: relative; }
264
- .label { color: #94a3b8; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px; display: block; }
265
- .value { font-family: monospace; font-size: 1.25rem; color: #fbbf24; word-break: break-all; font-weight: bold; }
266
- .credentials { background: #334155; padding: 15px; border-radius: 8px; margin-top: 20px; text-align: left; }
267
- .cred-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 0.95rem; }
268
- .cred-label { color: #cbd5e1; }
269
- .cred-val { color: #fff; font-weight: 600; font-family: monospace; }
270
- .warning { color: #f87171; font-size: 0.85rem; margin-top: 10px; font-style: italic; text-align: center;}
271
- .btn { display: inline-block; margin-top: 25px; padding: 12px 24px; background: #3b82f6; color: white; text-decoration: none; border-radius: 8px; font-weight: 600; transition: all 0.2s; }
272
- .btn:hover { background: #2563eb; transform: translateY(-1px); }
273
- </style>
274
- </head>
275
- <body>
276
- <div class="card">
277
- <h1>${isExisting ? 'License Retrieved' : 'Payment Successful!'}</h1>
278
- <p style="color: #cbd5e1;">Your License is active.</p>
279
-
280
- <div class="key-box">
281
- <span class="label">License Key</span>
282
- <div class="value">${licenseKey}</div>
283
- </div>
284
-
285
- <div class="credentials">
286
- <div style="margin-bottom:12px; color:#60a5fa; font-weight:bold; font-size:0.95rem; text-align:center; text-transform:uppercase; letter-spacing:1px;">Monitor Credentials</div>
287
- <div class="cred-row">
288
- <span class="cred-label">Username:</span>
289
- <span class="cred-val">admin@monitor.com</span>
290
- </div>
291
- <div class="cred-row">
292
- <span class="cred-label">Password:</span>
293
- <span class="cred-val">AdminPass123!</span>
294
- </div>
295
- <div class="warning">⚠️ Please change your password after initial login</div>
296
- </div>
297
-
298
- <a href="/" class="btn">Back Home</a>
299
- </div>
300
- </body>
301
- </html>
302
- `;
303
- };
304
-
305
- const PORT = process.env.PORT || 3011;
306
- app.listen(PORT, () => console.log(`License Portal running on port ${PORT}`));
@@ -1,126 +0,0 @@
1
- const nodemailer = require('nodemailer');
2
-
3
- const transporter = nodemailer.createTransport({
4
- host: process.env.SMTP_HOST,
5
- port: parseInt(process.env.SMTP_PORT || '465'),
6
- secure: process.env.SMTP_SECURE === 'true',
7
- auth: {
8
- user: process.env.SMTP_USER,
9
- pass: process.env.SMTP_PASS
10
- }
11
- });
12
-
13
- /**
14
- * Sends the license confirmation email
15
- * @param {string} to - Recipient email
16
- * @param {string} licenseKey - The generated license key
17
- * @param {string} expiryDate - Expiry date string
18
- */
19
- const sendLicenseEmail = async (to, licenseKey, expiryDate) => {
20
- const subject = '🚀 Your Server Monitor Pro License + Credentials';
21
-
22
- // Formatting date
23
- const dateStr = new Date(expiryDate).toLocaleDateString('en-US', {
24
- year: 'numeric', month: 'long', day: 'numeric'
25
- });
26
-
27
- const html = `
28
- <!DOCTYPE html>
29
- <html>
30
- <head>
31
- <meta charset="utf-8">
32
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
33
- <title>License Key</title>
34
- </head>
35
- <body style="margin: 0; padding: 0; background-color: #f1f5f9; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;">
36
- <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width: 100%;">
37
- <tr>
38
- <td align="center" style="padding: 40px 0;">
39
- <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" style="background-color: #ffffff; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); overflow: hidden;">
40
- <!-- Header -->
41
- <tr>
42
- <td align="center" style="background: linear-gradient(135deg, #4f46e5, #7c3aed); padding: 40px 0;">
43
- <h1 style="color: #ffffff; margin: 0; font-size: 28px; letter-spacing: 1px;">Server Monitor Pro</h1>
44
- <p style="color: rgba(255,255,255,0.9); margin-top: 10px; font-size: 16px;">Thank you for your purchase!</p>
45
- </td>
46
- </tr>
47
-
48
- <!-- Content -->
49
- <tr>
50
- <td style="padding: 40px;">
51
- <h2 style="color: #1e293b; margin-top: 0; font-size: 20px;">Your License is Ready 🚀</h2>
52
- <p style="color: #64748b; line-height: 1.6;">Your Payment was successful. Below are your license details and default login credentials to access the monitor dashboard.</p>
53
-
54
- <!-- License Card -->
55
- <div style="background-color: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 25px; margin: 30px 0; text-align: center;">
56
- <p style="color: #94a3b8; margin: 0 0 10px 0; text-transform: uppercase; letter-spacing: 1.5px; font-size: 12px; font-weight: 600;">License Key</p>
57
- <div style="color: #4f46e5; font-size: 24px; font-weight: 700; letter-spacing: 1px; font-family: monospace; background: #fff; padding: 10px; border-radius: 8px; display: inline-block;">
58
- ${licenseKey}
59
- </div>
60
- <p style="margin-top: 15px; margin-bottom: 0; font-size: 14px; color: #64748b;">
61
- <span style="color: #10b981;">● Active</span> &nbsp;|&nbsp; Valid until <strong>${dateStr}</strong>
62
- </p>
63
- </div>
64
-
65
- <!-- Credentials Card -->
66
- <div style="background-color: #1e293b; color: #ffffff; border-radius: 12px; padding: 25px; margin-bottom: 30px;">
67
- <h3 style="margin: 0 0 15px 0; color: #38bdf8; font-size: 16px; border-bottom: 1px solid #334155; padding-bottom: 10px;">Default Admin Credentials</h3>
68
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
69
- <tr>
70
- <td style="padding: 8px 0; color: #94a3b8; width: 100px;">Username:</td>
71
- <td style="padding: 8px 0; font-weight: 600; font-family: monospace; color: #ffffff;">admin@monitor.com</td>
72
- </tr>
73
- <tr>
74
- <td style="padding: 8px 0; color: #94a3b8;">Password:</td>
75
- <td style="padding: 8px 0; font-weight: 600; font-family: monospace; color: #ffffff;">AdminPass123!</td>
76
- </tr>
77
- </table>
78
- <div style="margin-top: 15px; padding-top: 15px; border-top: 1px dotted #334155; color: #facc15; font-size: 13px;">
79
- ⚠️ <strong>Important:</strong> Please change your password immediately upon first login for security.
80
- </div>
81
- </div>
82
-
83
- <p style="color: #64748b; font-size: 14px; line-height: 1.6;">
84
- To activate, enter the license key in your monitor dashboard at port <strong>3014</strong>.
85
- </p>
86
-
87
- <table role="presentation" border="0" cellpadding="0" cellspacing="0" style="margin-top: 30px;">
88
- <tr>
89
- <td align="center" style="border-radius: 8px;" bgcolor="#4f46e5">
90
- <a href="#" style="font-size: 16px; font-family: Helvetica, Arial, sans-serif; color: #ffffff; text-decoration: none; border-radius: 8px; padding: 12px 24px; border: 1px solid #4f46e5; display: inline-block; font-weight: bold;">Open Dashboard</a>
91
- </td>
92
- </tr>
93
- </table>
94
- </td>
95
- </tr>
96
-
97
- <!-- Footer -->
98
- <tr>
99
- <td align="center" style="background-color: #f1f5f9; padding: 20px; color: #94a3b8; font-size: 12px;">
100
- &copy; ${new Date().getFullYear()} MulaSoft. All rights reserved.<br>
101
- This is an automated system email.
102
- </td>
103
- </tr>
104
- </table>
105
- </td>
106
- </tr>
107
- </table>
108
- </body>
109
- </html>
110
- `;
111
-
112
- try {
113
- const info = await transporter.sendMail({
114
- from: process.env.MAIL_FROM,
115
- to: to,
116
- subject: subject,
117
- html: html
118
- });
119
- console.log(`Email sent: ${info.messageId}`);
120
- } catch (error) {
121
- console.error('Error sending email:', error);
122
- // We don't throw here to avoid failing the response to user, just log it.
123
- }
124
- };
125
-
126
- module.exports = { sendLicenseEmail };