v1.0.122: ZIP unzip in Lucee (unzip.cfm) — no CORS, FileReader→base64→same-origin POST
This commit is contained in:
@@ -75,7 +75,7 @@
|
||||
<body>
|
||||
<div class="topbar">
|
||||
<img src="/nubes-logo.svg" alt="Nubes">
|
||||
<span class="title">Сверка договоров — LLM AI-driven Event Sourcing <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.121 — Lucee</span></span>
|
||||
<span class="title">Сверка договоров — LLM AI-driven Event Sourcing <span style="font-weight:400;color:var(--muted);font-size:12px;">v1.0.122 — Lucee</span></span>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
@@ -176,7 +176,6 @@ lucide.createIcons();
|
||||
|
||||
var UPLOAD_URL = 'https://contracts.kube5s.ru/lucee/upload.cfm';
|
||||
var CONVERT_URL = 'https://contracts.kube5s.ru/convert-doc';
|
||||
var UNZIP_URL = 'https://contracts.kube5s.ru/unzip-upload';
|
||||
var SITE_URL = ''; // same origin for api calls
|
||||
|
||||
var fileInput = document.getElementById('fileInput');
|
||||
@@ -259,9 +258,19 @@ fileInput.addEventListener('change', async function() {
|
||||
renderTable();
|
||||
|
||||
try {
|
||||
var zipResp = await fetch(UNZIP_URL, {
|
||||
// Читаем ZIP через FileReader → base64
|
||||
var zipData = await new Promise(function(resolve, reject) {
|
||||
var reader = new FileReader();
|
||||
reader.onload = function() { resolve(reader.result); };
|
||||
reader.onerror = function() { reject(new Error('FileReader failed')); };
|
||||
reader.readAsDataURL(f);
|
||||
});
|
||||
var zipB64 = zipData.split(',')[1]; // убрать префикс data:application/zip;base64,
|
||||
|
||||
var zipResp = await fetch('/unzip.cfm', {
|
||||
method: 'POST',
|
||||
body: (function() { var fd = new FormData(); fd.append('file', f); return fd; })()
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({filename: f.name, data: zipB64, contract_id: contractId || ''})
|
||||
});
|
||||
var zipData = await zipResp.json();
|
||||
if (!zipData.ok || !zipData.files) throw new Error('unzip failed');
|
||||
|
||||
Reference in New Issue
Block a user