krsyer-server-monitor-pro 1.0.12 → 1.0.14
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/lib/controllers/cloudflareController.js +1 -1
- package/lib/controllers/dockerController.js +1 -1
- package/lib/controllers/networkController.js +1 -1
- package/lib/controllers/serverController.js +1 -1
- package/lib/ecosystem.config.js +1 -1
- package/lib/middleware/saasAuth.js +1 -1
- package/lib/public/script.js +9 -1
- package/lib/public/style.css +60 -6
- package/lib/routes/cloudflareRoutes.js +1 -1
- package/lib/routes/dockerRoutes.js +1 -1
- package/lib/routes/networkRoutes.js +1 -1
- package/lib/routes/serverRoutes.js +1 -1
- package/lib/server.js +1 -1
- package/lib/services/cashfreeService.js +1 -1
- package/license-portal/package.json +2 -1
- package/license-portal/server.js +8 -1
- package/license-portal/services/emailService.js +126 -0
- package/license-portal/views/pricing.html +21 -24
- package/package.json +1 -1
|
@@ -269,7 +269,11 @@
|
|
|
269
269
|
mode: "production"
|
|
270
270
|
});
|
|
271
271
|
|
|
272
|
+
let isSubmitting = false;
|
|
273
|
+
|
|
272
274
|
document.getElementById('buyBtn').addEventListener('click', async () => {
|
|
275
|
+
if (isSubmitting) return;
|
|
276
|
+
|
|
273
277
|
const email = document.getElementById('email').value;
|
|
274
278
|
const phone = document.getElementById('phone').value;
|
|
275
279
|
const btn = document.getElementById('buyBtn');
|
|
@@ -279,46 +283,39 @@
|
|
|
279
283
|
return;
|
|
280
284
|
}
|
|
281
285
|
|
|
286
|
+
isSubmitting = true;
|
|
282
287
|
btn.innerHTML = '<span class="loader-spinner"></span> Processing...';
|
|
283
288
|
btn.disabled = true;
|
|
284
289
|
|
|
290
|
+
const emailVal = document.getElementById('email').value;
|
|
291
|
+
const phoneVal = document.getElementById('phone').value;
|
|
292
|
+
|
|
285
293
|
try {
|
|
286
294
|
// Create Order
|
|
287
295
|
const res = await fetch('/api/buy', {
|
|
288
296
|
method: 'POST',
|
|
289
297
|
headers: { 'Content-Type': 'application/json' },
|
|
290
|
-
body: JSON.stringify({ email, phone })
|
|
298
|
+
body: JSON.stringify({ email: emailVal, phone: phoneVal })
|
|
291
299
|
});
|
|
300
|
+
|
|
301
|
+
if (!res.ok) {
|
|
302
|
+
const errData = await res.json().catch(() => ({}));
|
|
303
|
+
throw new Error(errData.message || errData.error || `Server Error ${res.status}`);
|
|
304
|
+
}
|
|
305
|
+
|
|
292
306
|
const data = await res.json();
|
|
293
307
|
|
|
294
308
|
if (data.payment_session_id) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
const phone = document.getElementById('phone').value;
|
|
298
|
-
|
|
299
|
-
cashfree.checkout({
|
|
300
|
-
paymentSessionId: data.payment_session_id
|
|
301
|
-
}).then(() => {
|
|
302
|
-
console.log("Checkout initiated");
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
cashfree.on("payment.success", (data) => {
|
|
306
|
-
// Pass email/phone to verify route
|
|
307
|
-
window.location.href = `/verify?order_id=${data.orderId}&email=${encodeURIComponent(email)}&phone=${encodeURIComponent(phone)}`;
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
cashfree.on("payment.failed", (data) => {
|
|
311
|
-
alert("Payment Failed: " + data.message);
|
|
312
|
-
});
|
|
309
|
+
const cf = new Cashfree(data.payment_session_id);
|
|
310
|
+
cf.redirect();
|
|
313
311
|
} else {
|
|
314
|
-
|
|
315
|
-
btn.innerText = 'Buy License Now';
|
|
316
|
-
btn.disabled = false;
|
|
312
|
+
throw new Error(data.message || 'No payment session ID returned');
|
|
317
313
|
}
|
|
318
314
|
} catch (e) {
|
|
319
315
|
console.error(e);
|
|
320
|
-
alert('Connection Error');
|
|
321
|
-
|
|
316
|
+
alert('Connection Error: ' + e.message + '. Ensure server is running on port 3011 and you are accessing via http://localhost:3011');
|
|
317
|
+
isSubmitting = false;
|
|
318
|
+
btn.innerHTML = 'Buy License Now';
|
|
322
319
|
btn.disabled = false;
|
|
323
320
|
}
|
|
324
321
|
});
|