diff --git a/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx b/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx index f223f58..1d79365 100644 Binary files a/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx and b/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx differ diff --git a/renderer/carbone-templates/registry.json b/renderer/carbone-templates/registry.json index f637f33..5d48489 100644 --- a/renderer/carbone-templates/registry.json +++ b/renderer/carbone-templates/registry.json @@ -6,6 +6,6 @@ "originalName": "master_cv_template.docx", "path": "/root/workspace/cv-app/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx", "uploadedAt": "2026-07-16T09:03:29.601Z", - "updatedAt": "2026-07-16T11:23:15.854Z" + "updatedAt": "2026-07-16T11:52:26.701Z" } ] \ No newline at end of file diff --git a/renderer/onlyoffice-service.js b/renderer/onlyoffice-service.js index 30d6e51..5804d30 100644 --- a/renderer/onlyoffice-service.js +++ b/renderer/onlyoffice-service.js @@ -143,7 +143,8 @@ router.get('/:templateId/config', (req, res) => { // Get file modification time for cache-busting doc key const fileStats = fs.statSync(template.path); const fileMtime = fileStats.mtimeMs; - const docKey = generateDocKey(templateId, fileMtime); + // Use Date.now() as the primary uniqueness driver — guaranteed fresh every time + const docKey = generateDocKey(templateId, Date.now()); const fileName = template.originalName || template.name + '.docx'; // Add file mtime as cache-buster to the document URL so ONLYOFFICE diff --git a/static/carbone.js b/static/carbone.js index 886201a..f52fe7e 100644 --- a/static/carbone.js +++ b/static/carbone.js @@ -324,10 +324,15 @@ async function openOnlyofficeEditor(templateId, templateName) { `; showModal(body, '', 'xlarge'); - // Load ONLYOFFICE API script dynamically - const scriptUrl = onlyofficeUrl + '/web-apps/apps/api/documents/api.js'; - if (!document.getElementById('onlyoffice-api-script')) { - await new Promise((resolve, reject) => { + // Load ONLYOFFICE API script - force fresh load each time + // Remove old script to force ONLYOFFICE to reload API.js from server + const oldScript = document.getElementById('onlyoffice-api-script'); + if (oldScript) oldScript.remove(); + + // Reload with cache-buster so ONLYOFFICE gets fresh API state + const scriptBuster = Date.now(); + const scriptUrl = onlyofficeUrl + '/web-apps/apps/api/documents/api.js?cb=' + scriptBuster; + await new Promise((resolve, reject) => { const script = document.createElement('script'); script.id = 'onlyoffice-api-script'; script.src = scriptUrl; @@ -335,8 +340,7 @@ async function openOnlyofficeEditor(templateId, templateName) { script.onerror = () => reject(new Error('Failed to load ONLYOFFICE API from ' + scriptUrl)); document.head.appendChild(script); }); - } - + // Initialize the ONLYOFFICE editor if (typeof DocsAPI === 'undefined' || !DocsAPI.DocEditor) { throw new Error('ONLYOFFICE API not loaded. Check that the server is running at ' + onlyofficeUrl); diff --git a/static/index.html b/static/index.html index b099f2c..8a43737 100644 --- a/static/index.html +++ b/static/index.html @@ -139,7 +139,7 @@
- - + +