elpaypg 2.0.0 → 2.0.2
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/package.json +1 -1
- package/public/admin.html +7480 -0
- package/src/router.js +6 -1
- package/src/routes/admin.routes.js +4 -1
package/src/router.js
CHANGED
|
@@ -24,7 +24,12 @@ export function createRouter(ctx = {}) {
|
|
|
24
24
|
res.type('html').send(html);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
router.get('/
|
|
27
|
+
router.get('/admin', (req, res) => {
|
|
28
|
+
const htmlPath = path.join(__dirname, '..', 'public', 'admin.html');
|
|
29
|
+
const html = fs.readFileSync(htmlPath, 'utf8')
|
|
30
|
+
.replace(/\{\{API_BASE_URL\}\}/g, ctx.baseUrl || 'http://localhost:5000');
|
|
31
|
+
res.type('html').send(html);
|
|
32
|
+
});
|
|
28
33
|
const t = ctx.theme || {};
|
|
29
34
|
const vars = [
|
|
30
35
|
t.primaryColor ? `--elpay-primary: ${t.primaryColor};` : '',
|
|
@@ -1120,7 +1120,10 @@ export function registerAdminRoutes(router, ctx) {
|
|
|
1120
1120
|
|
|
1121
1121
|
// GET /api/v1/admin/stream (SSE for Live Admin Counter & Queue Events)
|
|
1122
1122
|
router.get('/api/v1/admin/stream', async (req, res) => {
|
|
1123
|
-
|
|
1123
|
+
res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*' });
|
|
1124
|
+
res.write('event: connected\ndata: {"status":"connected"}\n\n');
|
|
1125
|
+
const _iv = setInterval(() => { try { res.write(': keepalive\n\n'); } catch {} }, 15000);
|
|
1126
|
+
req.on('close', () => clearInterval(_iv));
|
|
1124
1127
|
});
|
|
1125
1128
|
|
|
1126
1129
|
// --- WHATSAPP BERRY PROTOCOL MERCHANT SESSION CONFIGURATION ---
|