From cf97a8c9bff96fdebbd4355e35e365aa684b52cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Mon, 22 Jun 2026 20:47:02 +0400 Subject: [PATCH] =?UTF-8?q?export=20view=3D2:=20=D1=82=D0=B0=D0=B1=D0=BB?= =?UTF-8?q?=D0=B8=D1=86=D0=B0=20=D0=B1=D0=B5=D0=B7=20=D1=82=D0=BE=D1=87?= =?UTF-8?q?=D0=B5=D0=BA,=20=D0=BE=D0=BA=D1=82=D0=B5=D1=82=D1=8B=20=D0=B2?= =?UTF-8?q?=20=D1=81=D0=B2=D0=BE=D0=B8=D1=85=20=D1=8F=D1=87=D0=B5=D0=B9?= =?UTF-8?q?=D0=BA=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- v2/src/export/index.js | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index a1e7b16..a193c2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ipwhitelist", - "version": "0.1.2", + "version": "0.1.3", "description": "IP WhiteList microservice for cloud provider", "main": "server.js", "scripts": { diff --git a/v2/src/export/index.js b/v2/src/export/index.js index fb16327..e83cf2a 100644 --- a/v2/src/export/index.js +++ b/v2/src/export/index.js @@ -60,20 +60,23 @@ function createExportRouter() { return router; } -function padIP(cidr) { - const [ip, mask] = cidr.split('/'); - const octets = ip.split('.').map(o => o.padStart(3, ' ')); - return octets.join('.') + ' / ' + mask; -} - function renderTable(cidrs) { - const rows = cidrs.map(c => '' + padIP(c) + '').join('\n'); + const rows = cidrs.map(c => { + const [ip, mask] = c.split('/'); + const [a, b, c2, d] = ip.split('.'); + return '' + + '' + a.padStart(3, ' ') + '' + + '' + b.padStart(3, ' ') + '' + + '' + c2.padStart(3, ' ') + '' + + '' + d.padStart(3, ' ') + '' + + ' / ' + mask + '' + + ''; + }).join('\n'); return 'WhiteList Export' + '' + '

WhiteList — ' + cidrs.length + ' записей

' + '' + rows + '
'