v4.0.0: дизайн Nubes, логотип, ZIP без mapping.csv внутри, CSV отдельно с датой-временем
Deploy drhider / validate (push) Waiting to run
Deploy drhider / validate (push) Waiting to run
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@ if _sys_path_root not in sys.path:
|
||||
sys.path.insert(0, _sys_path_root)
|
||||
|
||||
# Версия приложения (меняется при изменениях)
|
||||
VERSION = "3.2.4"
|
||||
VERSION = "4.0.0"
|
||||
|
||||
|
||||
def create_app():
|
||||
|
||||
+25
-66
@@ -1,66 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="120"
|
||||
height="120"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
|
||||
sodipodi:docname="favicon.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="5.6"
|
||||
inkscape:cx="91.428571"
|
||||
inkscape:cy="54.910714"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1027"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
width="120px" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Calque 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(-80.000001,-1018.2599)">
|
||||
<path
|
||||
style="fill:#004d00;stroke-width:0.100353;fill-opacity:1"
|
||||
d="m 144.12346,1127.3527 c -14.7384,-15.4935 -17.30029,-23.203 -14.91709,-44.8912 1.78418,-16.2372 1.43961,-18.7434 -3.2949,-23.9623 -4.60141,-5.0725 -4.72472,-5.8285 -0.95017,-5.8285 5.32989,0 5.67331,-6.0284 0.58406,-10.2519 -4.3155,-3.5819 -10.08626,-19.468 -8.64375,-23.7956 1.09412,-3.2824 21.29169,27.0158 23.93661,35.9068 0.94001,3.1601 8.83542,12.1943 17.54536,20.0767 11.55761,10.4589 14.47966,14.331 10.81518,14.331 -2.7616,0 -9.48553,-3.0338 -14.94204,-6.7417 -6.36215,-4.323 -10.81609,-5.8461 -12.41642,-4.2461 -1.60033,1.6005 3.29311,7.7342 13.64167,17.0989 8.87547,8.0322 15.48529,15.2553 14.68853,16.052 -0.79676,0.7967 -7.93147,-2.6984 -15.85488,-7.7667 -16.57177,-10.6009 -17.2489,-10.7849 -17.23587,-4.6824 0.0132,5.7346 7.77953,18.5635 16.5486,27.3327 3.71587,3.7157 6.75613,7.9746 6.75613,9.4643 0,5.5255 -6.27497,2.4016 -16.26102,-8.096 z"
|
||||
id="path3974"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Creator: CorelDRAW -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="82.3711mm" height="18.2443mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
|
||||
viewBox="0 0 8221.93 1821.07"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xodm="http://www.corel.com/coreldraw/odm/2003">
|
||||
<defs>
|
||||
<style type="text/css">
|
||||
<![CDATA[
|
||||
.fil0 {fill:#001C34}
|
||||
]]>
|
||||
</style>
|
||||
</defs>
|
||||
<g id="Слой_x0020_1">
|
||||
<metadata id="CorelCorpID_0Corel-Layer"/>
|
||||
<g id="_2283355517888">
|
||||
<path class="fil0" d="M477.49 479.69l-413.51 0 -63.98 276.48 178.44 0 1.17 1028.71 0 26.75 0.03 0 276.39 0 0 -871.72c0,-101.28 82.43,-183.69 183.75,-183.69l589.25 3.44c101.34,0 183.76,82.46 183.76,183.74l0 871.72 276.44 0 0 -871.72c0,-253.77 -206.46,-460.15 -460.05,-460.15l-589.52 -3.53 -162.17 0.45 0 -0.48z"/>
|
||||
<path class="fil0" d="M6664.65 1813.37l1181.04 0c212.14,0 376.24,-175.01 376.24,-387.08 0,-212.13 -172.55,-384.68 -384.69,-384.68l-653.66 0c-60.22,0 -109.16,-48.94 -109.16,-109.18l0 -66.18c0,-60.19 48.94,-109.14 109.16,-109.14l695.76 0 63.74 -275.49 -759.5 0c-212.13,0 -384.66,172.53 -384.66,384.63l0 66.18c0,212.13 172.53,384.67 384.66,384.67l653.66 0c60.2,0 109.2,49 109.2,109.19 0,60.13 -49,116.1 -109.2,116.1l-1118.9 0 -53.68 270.98z"/>
|
||||
<path class="fil0" d="M6200.79 483.5l-723.21 0c-215.88,0 -391.47,175.6 -391.47,391.51l0 485.5c0,248.38 202.05,450.4 450.4,450.4l989.38 0 62.13 -268.51 -1051.51 0c-96.41,0 -174.95,-85.37 -174.95,-181.88l-1.5 -39.46 923.62 0 308.51 -1.84 0 -237.95 0 -206.26c0,-215.91 -175.59,-391.51 -391.41,-391.51zm115.96 560.28l-955.19 0 0 -168.77c0,-63.96 52.07,-116.05 116.02,-116.05l723.21 0c63.91,0 115.96,52.08 115.96,116.05l0 168.77z"/>
|
||||
<path class="fil0" d="M4683.49 1194.24l0 168.28c0,100.92 -81.7,178.37 -182.67,178.37l-589.87 1.23c-93.18,0 -170.28,-69.96 -181.63,-160.09l0 -458.13c11.36,-90.1 88.46,-160.07 181.63,-160.07l589.44 3.5c100.97,0 183.1,82.18 183.1,183.1l0 30.42 0 213.4zm-1230.2 -345.53l-0.89 -795.03 276.91 -53.68 0 526.07c55.74,-24.16 117.03,-37.74 181.5,-37.74l589.71 3.5c252.69,0 458.42,205.72 458.42,458.59l0 30.42 0 213.4 0 168.28c0,252.86 -205.73,458.54 -458.42,458.54l-589.71 -3.5c-252.7,0 -458.41,-205.67 -458.41,-458.56l0 -171.61 0 -240.48 0.89 -98.2z"/>
|
||||
<path class="fil0" d="M3041.25 1150.84l0 204.28c0,100.93 -82.15,183.05 -183.11,183.05l-582.11 -3.46c-100.96,0 -183.11,-82.16 -183.11,-183.08l0 -67.42 1.48 0.24 0 -862.65 -276.91 53.68 0.12 103.41 -0.12 0.04 0 772.69c0,252.87 205.72,458.54 458.39,458.54l582.4 3.5c252.67,0 458.4,-205.68 458.4,-458.55l0 -70.79 0.71 0.12 0 -862.65 -276.91 53.68 0.76 675.35z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.8 KiB |
Executable
+25
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Creator: CorelDRAW -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="82.3711mm" height="18.2443mm" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
|
||||
viewBox="0 0 8221.93 1821.07"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:xodm="http://www.corel.com/coreldraw/odm/2003">
|
||||
<defs>
|
||||
<style type="text/css">
|
||||
<![CDATA[
|
||||
.fil0 {fill:#001C34}
|
||||
]]>
|
||||
</style>
|
||||
</defs>
|
||||
<g id="Слой_x0020_1">
|
||||
<metadata id="CorelCorpID_0Corel-Layer"/>
|
||||
<g id="_2283355517888">
|
||||
<path class="fil0" d="M477.49 479.69l-413.51 0 -63.98 276.48 178.44 0 1.17 1028.71 0 26.75 0.03 0 276.39 0 0 -871.72c0,-101.28 82.43,-183.69 183.75,-183.69l589.25 3.44c101.34,0 183.76,82.46 183.76,183.74l0 871.72 276.44 0 0 -871.72c0,-253.77 -206.46,-460.15 -460.05,-460.15l-589.52 -3.53 -162.17 0.45 0 -0.48z"/>
|
||||
<path class="fil0" d="M6664.65 1813.37l1181.04 0c212.14,0 376.24,-175.01 376.24,-387.08 0,-212.13 -172.55,-384.68 -384.69,-384.68l-653.66 0c-60.22,0 -109.16,-48.94 -109.16,-109.18l0 -66.18c0,-60.19 48.94,-109.14 109.16,-109.14l695.76 0 63.74 -275.49 -759.5 0c-212.13,0 -384.66,172.53 -384.66,384.63l0 66.18c0,212.13 172.53,384.67 384.66,384.67l653.66 0c60.2,0 109.2,49 109.2,109.19 0,60.13 -49,116.1 -109.2,116.1l-1118.9 0 -53.68 270.98z"/>
|
||||
<path class="fil0" d="M6200.79 483.5l-723.21 0c-215.88,0 -391.47,175.6 -391.47,391.51l0 485.5c0,248.38 202.05,450.4 450.4,450.4l989.38 0 62.13 -268.51 -1051.51 0c-96.41,0 -174.95,-85.37 -174.95,-181.88l-1.5 -39.46 923.62 0 308.51 -1.84 0 -237.95 0 -206.26c0,-215.91 -175.59,-391.51 -391.41,-391.51zm115.96 560.28l-955.19 0 0 -168.77c0,-63.96 52.07,-116.05 116.02,-116.05l723.21 0c63.91,0 115.96,52.08 115.96,116.05l0 168.77z"/>
|
||||
<path class="fil0" d="M4683.49 1194.24l0 168.28c0,100.92 -81.7,178.37 -182.67,178.37l-589.87 1.23c-93.18,0 -170.28,-69.96 -181.63,-160.09l0 -458.13c11.36,-90.1 88.46,-160.07 181.63,-160.07l589.44 3.5c100.97,0 183.1,82.18 183.1,183.1l0 30.42 0 213.4zm-1230.2 -345.53l-0.89 -795.03 276.91 -53.68 0 526.07c55.74,-24.16 117.03,-37.74 181.5,-37.74l589.71 3.5c252.69,0 458.42,205.72 458.42,458.59l0 30.42 0 213.4 0 168.28c0,252.86 -205.73,458.54 -458.42,458.54l-589.71 -3.5c-252.7,0 -458.41,-205.67 -458.41,-458.56l0 -171.61 0 -240.48 0.89 -98.2z"/>
|
||||
<path class="fil0" d="M3041.25 1150.84l0 204.28c0,100.93 -82.15,183.05 -183.11,183.05l-582.11 -3.46c-100.96,0 -183.11,-82.16 -183.11,-183.08l0 -67.42 1.48 0.24 0 -862.65 -276.91 53.68 0.12 103.41 -0.12 0.04 0 772.69c0,252.87 205.72,458.54 458.39,458.54l582.4 3.5c252.67,0 458.4,-205.68 458.4,-458.55l0 -70.79 0.71 0.12 0 -862.65 -276.91 53.68 0.76 675.35z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
+118
-188
@@ -11,108 +11,103 @@
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
|
||||
<style>
|
||||
:root {
|
||||
--bg: #f5f5f5;
|
||||
--brand-primary: #2563eb;
|
||||
--brand-gray: #d1d5db;
|
||||
--brand-grey-light: #f3f4f6;
|
||||
--bg: #f9fafb;
|
||||
--card: #ffffff;
|
||||
--border: #e0e0e0;
|
||||
--text: #1a1a1a;
|
||||
--muted: #888;
|
||||
--brand: #2563eb;
|
||||
--muted: #6b7280;
|
||||
--red: #ef4444;
|
||||
--green: #22c55e;
|
||||
}
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body { font: 14px system-ui, sans-serif; color: var(--text); background: var(--bg); min-height: 100vh; }
|
||||
.topbar {
|
||||
background: var(--card); border-bottom: 1px solid var(--border);
|
||||
padding: 0 24px; height: 52px; display: flex; align-items: center; gap: 12px;
|
||||
font-weight: 600; font-size: 15px;
|
||||
background: var(--card); border-bottom: 1px solid var(--brand-gray);
|
||||
padding: 0 16px; height: 48px; display: flex; align-items: center; gap: 10px;
|
||||
}
|
||||
.content { max-width: 780px; margin: 28px auto; padding: 0 16px; }
|
||||
.topbar img { height: 18px; }
|
||||
.topbar .title { font-weight: 600; font-size: 14px; }
|
||||
.topbar .ver { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: auto; }
|
||||
.content { max-width: 820px; margin: 20px auto; padding: 0 12px; }
|
||||
.card {
|
||||
background: var(--card); border-radius: 10px;
|
||||
border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.05);
|
||||
overflow: hidden;
|
||||
background: var(--card); border-radius: 12px;
|
||||
border: 1px solid var(--brand-gray); box-shadow: 0 1px 2px rgba(0,0,0,.04);
|
||||
}
|
||||
.card-header {
|
||||
background: #fafafa; padding: 10px 16px;
|
||||
font-weight: 600; font-size: 14px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.card-body { padding: 16px; }
|
||||
|
||||
.file-input-wrap { margin-bottom: 12px; }
|
||||
.file-input-wrap input[type="file"] { width: 100%; font-size: 14px; }
|
||||
|
||||
.table-wrap {
|
||||
border: 1px solid var(--border); border-radius: 6px;
|
||||
overflow-y: auto; max-height: 60vh;
|
||||
background: var(--brand-grey-light); padding: 10px 12px;
|
||||
font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--brand-gray);
|
||||
}
|
||||
.card-body { padding: 12px; }
|
||||
.sub { font-size: 12px; color: var(--muted); margin-bottom: 10px; line-height: 1.5; }
|
||||
.file-input-wrap { margin-bottom: 10px; }
|
||||
.file-input-wrap input[type="file"] { width: 100%; font-size: 13px; }
|
||||
.table-wrap { border: 1px solid var(--brand-gray); border-radius: 8px; overflow: hidden; }
|
||||
table { width: 100%; border-collapse: collapse; font-size: 13px; }
|
||||
th {
|
||||
background: #fafafa; text-transform: uppercase; padding: 6px 10px;
|
||||
border-right: 1px solid var(--border); text-align: left;
|
||||
font-weight: 600; font-size: 11px; color: var(--muted);
|
||||
background: var(--brand-grey-light); text-transform: uppercase; padding: 6px 8px;
|
||||
border-right: 1px solid var(--brand-gray); text-align: left;
|
||||
font-weight: 600; font-size: 10px; color: var(--muted);
|
||||
}
|
||||
td {
|
||||
padding: 6px 10px; border-right: 1px solid var(--border);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 5px 8px; border-right: 1px solid var(--brand-gray);
|
||||
border-bottom: 1px solid var(--brand-gray);
|
||||
}
|
||||
tr:hover td { background: rgba(37,99,235,.03); }
|
||||
.name-cell { max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.name-cell { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.num-cell { text-align: right; white-space: nowrap; }
|
||||
.empty-row td { color: var(--muted); text-align: center; padding: 24px; }
|
||||
|
||||
.empty-row td { color: var(--muted); text-align: center; padding: 20px; }
|
||||
.remove-btn {
|
||||
cursor: pointer; color: #f87171; background: none; border: none;
|
||||
padding: 2px 6px; font-size: 15px; line-height: 1;
|
||||
padding: 2px 4px; font-size: 14px; line-height: 1;
|
||||
}
|
||||
.remove-btn:hover { color: var(--red); }
|
||||
|
||||
.footer-bar {
|
||||
margin-top: 12px; display: flex; justify-content: space-between; align-items: center;
|
||||
font-size: 13px; color: var(--muted);
|
||||
margin-top: 10px; display: flex; justify-content: space-between; align-items: center;
|
||||
font-size: 12px; color: var(--muted);
|
||||
}
|
||||
.btn {
|
||||
height: 34px; border-radius: 6px; padding: 0 16px; font-size: 13px;
|
||||
font-family: inherit; cursor: pointer; border: 1px solid var(--border);
|
||||
height: 32px; border-radius: 6px; padding: 0 12px; font-size: 13px;
|
||||
font-family: inherit; cursor: pointer; border: 1px solid var(--brand-gray);
|
||||
background: var(--card); color: var(--text);
|
||||
display: inline-flex; align-items: center; gap: 6px;
|
||||
display: inline-flex; align-items: center; gap: 5px;
|
||||
}
|
||||
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
|
||||
.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
|
||||
.btn-primary:hover { opacity: .9; }
|
||||
.btn:disabled { opacity: .4; cursor: not-allowed; }
|
||||
|
||||
.status { margin-top: 12px; padding: 8px 12px; border-radius: 6px; font-size: 13px; display: none; }
|
||||
.status.success { background: #dcfce7; color: #166534; display: block; }
|
||||
.status.error { background: #fef2f2; color: #991b1b; display: block; }
|
||||
.status.info { background: #eff6ff; color: #1e40af; display: block; }
|
||||
.status { margin-top: 10px; padding: 8px 12px; border-radius: 8px; font-size: 13px; display: none; }
|
||||
.status.progress { background: #eff6ff; border: 1px solid var(--brand-primary); color: var(--brand-primary); display: block; }
|
||||
.status.done { background: #f0fdf4; border: 1px solid var(--green); color: #16a34a; display: block; }
|
||||
.status.error { background: #fef2f2; border: 1px solid var(--red); color: #991b1b; display: block; }
|
||||
.status.pack { background: #fefce8; border: 1px solid #eab308; color: #a16207; display: block; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="topbar">
|
||||
🛡️ DrHider — обфускация документов
|
||||
<span style="font-weight:400;color:var(--muted);font-size:12px;margin-left:auto;">v{{ version }}</span>
|
||||
<img src="/static/logo.svg" alt="Nubes">
|
||||
<span class="title">DrHider</span>
|
||||
<span class="ver">v{{ version }}</span>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<div class="card">
|
||||
<div class="card-header">Выбор файлов</div>
|
||||
<div class="card-header">Обфускация документов</div>
|
||||
<div class="card-body">
|
||||
<p style="color:var(--muted);margin-bottom:12px;font-size:13px;">
|
||||
Загрузите документы (.docx, .xlsx, .pptx, .pdf, .txt).<br>
|
||||
DrHider заменит все персональные данные, реквизиты компаний, телефоны, email на фиктивные значения.
|
||||
<p class="sub">
|
||||
Загрузите документы (.docx, .pdf, .txt, .zip) — получите ZIP с обезличенными копиями.<br>
|
||||
Персональные данные, реквизиты, телефоны, email заменяются. CSV с таблицей замен сохраняется отдельно.
|
||||
</p>
|
||||
<div class="file-input-wrap">
|
||||
<input type="file" id="fileInput" multiple accept=".docx,.xlsx,.pptx,.pdf,.txt,.doc,.xls,.ppt">
|
||||
<input type="file" id="fileInput" multiple accept=".docx,.pdf,.txt,.doc,.zip">
|
||||
</div>
|
||||
<div class="table-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Имя</th>
|
||||
<th style="width:90px;">Размер</th>
|
||||
<th style="width:90px;">Статус</th>
|
||||
<th style="width:40px;"></th>
|
||||
<th style="width:80px;">Размер</th>
|
||||
<th style="width:80px;">Статус</th>
|
||||
<th style="width:32px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="fileList">
|
||||
@@ -122,172 +117,107 @@
|
||||
</div>
|
||||
<div class="footer-bar">
|
||||
<span id="fileCount">0 файлов</span>
|
||||
<button class="btn btn-primary" id="uploadBtn" disabled onclick="uploadFiles()">
|
||||
🛡️ Обфусцировать
|
||||
</button>
|
||||
<button class="btn btn-primary" id="uploadBtn" disabled onclick="uploadFiles()">🛡️ Обфусцировать</button>
|
||||
</div>
|
||||
<div class="status" id="status"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const fileInput = document.getElementById('fileInput');
|
||||
const fileList = document.getElementById('fileList');
|
||||
const fileCount = document.getElementById('fileCount');
|
||||
const uploadBtn = document.getElementById('uploadBtn');
|
||||
const status = document.getElementById('status');
|
||||
let selectedFiles = [];
|
||||
const fi = document.getElementById('fileInput');
|
||||
const fl = document.getElementById('fileList');
|
||||
const fc = document.getElementById('fileCount');
|
||||
const ub = document.getElementById('uploadBtn');
|
||||
const st = document.getElementById('status');
|
||||
let sf = [];
|
||||
|
||||
function formatSize(bytes) {
|
||||
if (bytes < 1024) return bytes + ' B';
|
||||
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
|
||||
return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
|
||||
function fs(b) { return b < 1024 ? b + ' B' : b < 1048576 ? (b / 1024).toFixed(1) + ' KB' : (b / 1048576).toFixed(1) + ' MB'; }
|
||||
|
||||
function rr() {
|
||||
if (sf.length === 0) { fl.innerHTML = '<tr class="empty-row"><td colspan="4">Нет выбранных файлов</td></tr>'; }
|
||||
else { fl.innerHTML = sf.map((f, i) => '<tr id="row-' + i + '"><td class="name-cell">' + f.name + '</td><td class="num-cell">' + fs(f.size) + '</td><td class="num-cell" id="st-' + i + '" style="font-size:12px;">—</td><td><button class="remove-btn" onclick="rm(' + i + ')">✕</button></td></tr>').join(''); }
|
||||
fc.textContent = sf.length + ' файлов';
|
||||
ub.disabled = sf.length === 0;
|
||||
}
|
||||
|
||||
function renderFiles() {
|
||||
if (selectedFiles.length === 0) {
|
||||
fileList.innerHTML = '<tr class="empty-row"><td colspan="3">Нет выбранных файлов</td></tr>';
|
||||
} else {
|
||||
fileList.innerHTML = selectedFiles.map((f, i) =>
|
||||
'<tr id="row-' + i + '">' +
|
||||
'<td class="name-cell">' + f.name + '</td>' +
|
||||
'<td class="num-cell">' + formatSize(f.size) + '</td>' +
|
||||
'<td class="num-cell" id="status-' + i + '" style="font-size:12px;">—</td>' +
|
||||
'<td><button class="remove-btn" onclick="removeFile(' + i + ')">✕</button></td>' +
|
||||
'</tr>'
|
||||
).join('');
|
||||
}
|
||||
fileCount.textContent = selectedFiles.length + ' файлов';
|
||||
uploadBtn.disabled = selectedFiles.length === 0;
|
||||
function rm(i) { sf.splice(i, 1); const d = new DataTransfer(); sf.forEach(f => d.items.add(f)); fi.files = d.files; rr(); }
|
||||
|
||||
window.addEventListener('load', () => { sf = []; fi.value = ''; rr(); });
|
||||
fi.addEventListener('change', () => { sf = Array.from(fi.files); rr(); });
|
||||
|
||||
function ts() {
|
||||
const d = new Date();
|
||||
return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0') + '_' + String(d.getHours()).padStart(2, '0') + '-' + String(d.getMinutes()).padStart(2, '0') + '-' + String(d.getSeconds()).padStart(2, '0');
|
||||
}
|
||||
|
||||
function removeFile(i) {
|
||||
selectedFiles.splice(i, 1);
|
||||
// Пересоздаём FileList через DataTransfer
|
||||
const dt = new DataTransfer();
|
||||
selectedFiles.forEach(f => dt.items.add(f));
|
||||
fileInput.files = dt.files;
|
||||
renderFiles();
|
||||
}
|
||||
|
||||
// Сброс при загрузке страницы
|
||||
window.addEventListener('load', () => {
|
||||
selectedFiles = [];
|
||||
fileInput.value = '';
|
||||
renderFiles();
|
||||
});
|
||||
|
||||
fileInput.addEventListener('change', () => {
|
||||
selectedFiles = Array.from(fileInput.files);
|
||||
renderFiles();
|
||||
});
|
||||
|
||||
function setStatus(idx, html) {
|
||||
const el = document.getElementById('status-' + idx);
|
||||
if (el) el.innerHTML = html;
|
||||
}
|
||||
function ss(idx, h) { const e = document.getElementById('st-' + idx); if (e) e.innerHTML = h; }
|
||||
|
||||
async function uploadFiles() {
|
||||
if (selectedFiles.length === 0) return;
|
||||
uploadBtn.disabled = true;
|
||||
|
||||
const total = selectedFiles.length;
|
||||
const results = []; // { name, blob } для JSZip
|
||||
if (sf.length === 0) return;
|
||||
ub.disabled = true;
|
||||
const total = sf.length;
|
||||
const tstamp = ts();
|
||||
const maps = [];
|
||||
const zip = new JSZip();
|
||||
let ok = 0, fail = 0;
|
||||
|
||||
for (let i = 0; i < total; i++) {
|
||||
const f = selectedFiles[i];
|
||||
const n = i + 1;
|
||||
|
||||
setStatus(i, '⏳');
|
||||
status.className = 'status info';
|
||||
status.textContent = 'Файл ' + n + '/' + total + ': ' + f.name;
|
||||
|
||||
const f = sf[i], n = i + 1;
|
||||
ss(i, '⏳');
|
||||
st.className = 'status progress';
|
||||
st.textContent = 'Файл ' + n + '/' + total + ': ' + f.name;
|
||||
const t0 = performance.now();
|
||||
const fd = new FormData();
|
||||
fd.append('files', f, f.name);
|
||||
|
||||
try {
|
||||
const blob = await new Promise((resolve, reject) => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', '/api/drhider');
|
||||
xhr.responseType = 'blob';
|
||||
xhr.timeout = 600000;
|
||||
|
||||
xhr.onload = () => {
|
||||
if (xhr.status === 200) resolve(xhr.response);
|
||||
else reject(new Error('Сервер ' + xhr.status));
|
||||
};
|
||||
xhr.onerror = () => reject(new Error('Сеть'));
|
||||
xhr.ontimeout = () => reject(new Error('Таймаут'));
|
||||
xhr.send(fd);
|
||||
const x = new XMLHttpRequest();
|
||||
x.open('POST', '/api/drhider');
|
||||
x.responseType = 'blob';
|
||||
x.timeout = 600000;
|
||||
x.onload = () => x.status === 200 ? resolve(x.response) : reject(new Error('Сервер ' + x.status));
|
||||
x.onerror = () => reject(new Error('Сеть'));
|
||||
x.ontimeout = () => reject(new Error('Таймаут'));
|
||||
x.send(fd);
|
||||
});
|
||||
|
||||
const elapsed = ((performance.now() - t0) / 1000).toFixed(1);
|
||||
setStatus(i, '<span style="color:#22c55e">✓ ' + elapsed + 'с</span>');
|
||||
results.push({ name: f.name, blob: blob });
|
||||
const el = ((performance.now() - t0) / 1000).toFixed(1);
|
||||
const iz = await JSZip.loadAsync(blob);
|
||||
const ks = Object.keys(iz.files).filter(k => !iz.files[k].dir);
|
||||
for (const k of ks) {
|
||||
const d = await iz.files[k].async('blob');
|
||||
if (k === 'mapping.csv') {
|
||||
const t = await iz.files[k].async('string');
|
||||
const ls = t.split('\n');
|
||||
maps.push(maps.length === 0 ? ls.join('\n') : ls.slice(1).join('\n'));
|
||||
} else { zip.file(k, d); }
|
||||
}
|
||||
ss(i, '<span style="color:#22c55e">✓ ' + el + 'с</span>');
|
||||
ok++;
|
||||
|
||||
} catch (err) {
|
||||
setStatus(i, '<span style="color:#ef4444">✗</span>');
|
||||
ss(i, '<span style="color:#ef4444">✗</span>');
|
||||
fail++;
|
||||
}
|
||||
|
||||
// Пауза между файлами
|
||||
if (i < total - 1) await new Promise(r => setTimeout(r, 300));
|
||||
}
|
||||
|
||||
// ── Упаковка в один ZIP ──
|
||||
if (results.length > 0) {
|
||||
status.className = 'status info';
|
||||
status.textContent = 'Упаковка в ZIP...';
|
||||
|
||||
const zip = new JSZip();
|
||||
for (const r of results) {
|
||||
// Извлекаем обфусцированный файл из ZIP-ответа бэкенда
|
||||
const innerZip = await JSZip.loadAsync(r.blob);
|
||||
const files = Object.keys(innerZip.files).filter(k => !k.startsWith('mapping') && !innerZip.files[k].dir);
|
||||
for (const name of files) {
|
||||
const data = await innerZip.files[name].async('blob');
|
||||
// Имя: оригинальное_имя_obfuscated.расширение
|
||||
const ext = name.split('.').pop();
|
||||
const base = r.name.replace(/\.[^.]+$/, '');
|
||||
zip.file(base + '_obfuscated.' + ext, data);
|
||||
}
|
||||
// mapping.csv — только один (из первого файла или объединить)
|
||||
if (innerZip.files['mapping.csv']) {
|
||||
const csv = await innerZip.files['mapping.csv'].async('string');
|
||||
const existing = zip.files['mapping.csv'];
|
||||
if (existing) {
|
||||
// Дописываем к существующему (кроме заголовка)
|
||||
const lines = csv.split('\n').slice(1).join('\n');
|
||||
zip.file('mapping.csv', (await existing.async('string')) + '\n' + lines);
|
||||
} else {
|
||||
zip.file('mapping.csv', csv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const finalZip = await zip.generateAsync({ type: 'blob' });
|
||||
const url = URL.createObjectURL(finalZip);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = 'drhider_output.zip';
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
if (ok > 0) {
|
||||
st.className = 'status pack'; st.textContent = 'Упаковка...';
|
||||
const zb = await zip.generateAsync({ type: 'blob' });
|
||||
const u = URL.createObjectURL(zb);
|
||||
const a = document.createElement('a'); a.href = u; a.download = 'drhider_' + tstamp + '.zip'; a.click();
|
||||
URL.revokeObjectURL(u);
|
||||
}
|
||||
|
||||
// ── Итог ──
|
||||
if (fail === 0) {
|
||||
status.className = 'status success';
|
||||
status.textContent = '✅ Готово! ' + ok + '/' + total;
|
||||
} else {
|
||||
status.className = 'status error';
|
||||
status.textContent = 'Готово: ' + ok + ' OK, ' + fail + ' ошибок из ' + total;
|
||||
if (maps.length > 0) {
|
||||
const cb = new Blob(['\ufeff' + maps.join('\n')], { type: 'text/csv;charset=utf-8' });
|
||||
const u = URL.createObjectURL(cb);
|
||||
const a = document.createElement('a'); a.href = u; a.download = 'drhider_' + tstamp + '.csv'; a.click();
|
||||
URL.revokeObjectURL(u);
|
||||
}
|
||||
|
||||
uploadBtn.disabled = false;
|
||||
st.className = fail === 0 ? 'status done' : 'status error';
|
||||
st.textContent = fail === 0 ? '✅ Готово! ' + ok + '/' + total : 'Готово: ' + ok + ' OK, ' + fail + ' ошибок из ' + total;
|
||||
ub.disabled = false;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user