From 6bb847af74624160ccae55b2ce38969918efd334 Mon Sep 17 00:00:00 2001 From: Sergey Konovalov Date: Fri, 22 Nov 2024 18:40:24 +0300 Subject: [PATCH] [feature] Add vsdx format to wopi discovery --- Common/config/default.json | 3 +++ DocService/sources/wopiClient.js | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Common/config/default.json b/Common/config/default.json index e78ffc7a..10c2bace 100644 --- a/Common/config/default.json +++ b/Common/config/default.json @@ -226,6 +226,7 @@ "favIconUrlCell" : "/web-apps/apps/spreadsheeteditor/main/resources/img/favicon.ico", "favIconUrlSlide" : "/web-apps/apps/presentationeditor/main/resources/img/favicon.ico", "favIconUrlPdf" : "/web-apps/apps/pdfeditor/main/resources/img/favicon.ico", + "favIconUrlDraw" : "/web-apps/apps/visioeditor/main/resources/img/favicon.ico", "fileInfoBlockList" : ["FileUrl"], "pdfView": ["djvu", "xps", "oxps"], "pdfEdit": ["pdf"], @@ -236,6 +237,8 @@ "cellEdit": ["xlsx", "xltx", "xlsm", "ods", "csv"], "slideView": ["ppt", "ppsx", "ppsm", "pps", "potm", "pot", "fodp", "otp", "sxi", "dps", "dpt"], "slideEdit": ["pptx", "potx", "pptm", "odp"], + "drawView": ["vsdx"], + "drawEdit": [], "publicKey": "BgIAAACkAABSU0ExAAgAAAEAAQBpTpiJQ2hD8plpGTfEEmcq4IKyr31HikXpuVSBraMfqyodn2PGXBJ3daNSmdPOc0Nz4HO9Auljn8YYXDPBdpiABptSKvEDPF23Q+Qytg0+vCRyondyBcW91w7KLzXce3fnk8ZfJ8QtbZPL9m11wJIWZueQF+l0HKYx4lty+nccbCanytFTADkGQ3SnmExGEF3rBz6I9+OcrDDK9NKPJgEmCiuyei/d4XbPgKls3EIG0h38X5mVF2VytfWm2Yu850B6z3N4MYhj4b4vsYT62zEC4pMRUeb8dIBy4Jsmr3avtmeO00MUH6DVyPC8nirixj2YIOPKk13CdVqGDSXA3cvl", "modulus": "5cvdwCUNhlp1wl2TyuMgmD3G4iqevPDI1aAfFEPTjme2r3avJpvgcoB0/OZREZPiAjHb+oSxL77hY4gxeHPPekDnvIvZpvW1cmUXlZlf/B3SBkLcbKmAz3bh3S96sisKJgEmj9L0yjCsnOP3iD4H610QRkyYp3RDBjkAU9HKpyZsHHf6clviMaYcdOkXkOdmFpLAdW32y5NtLcQnX8aT53d73DUvyg7XvcUFcneiciS8Pg22MuRDt108A/EqUpsGgJh2wTNcGMafY+kCvXPgc0NzztOZUqN1dxJcxmOfHSqrH6OtgVS56UWKR32vsoLgKmcSxDcZaZnyQ2hDiZhOaQ==", "exponent": 65537, diff --git a/DocService/sources/wopiClient.js b/DocService/sources/wopiClient.js index 0a437c33..73d53468 100644 --- a/DocService/sources/wopiClient.js +++ b/DocService/sources/wopiClient.js @@ -75,11 +75,14 @@ const cfgWopiCellView = config.get('wopi.cellView'); const cfgWopiCellEdit = config.get('wopi.cellEdit'); const cfgWopiSlideView = config.get('wopi.slideView'); const cfgWopiSlideEdit = config.get('wopi.slideEdit'); +const cfgWopiDrawView = config.get('wopi.drawView'); +const cfgWopiDrawEdit = config.get('wopi.drawEdit'); const cfgWopiForms = config.get('wopi.forms'); const cfgWopiFavIconUrlWord = config.get('wopi.favIconUrlWord'); const cfgWopiFavIconUrlCell = config.get('wopi.favIconUrlCell'); const cfgWopiFavIconUrlSlide = config.get('wopi.favIconUrlSlide'); const cfgWopiFavIconUrlPdf = config.get('wopi.favIconUrlPdf'); +const cfgWopiFavIconUrlDraw = config.get('wopi.favIconUrlDraw'); const cfgWopiPublicKey = config.get('wopi.publicKey'); const cfgWopiModulus = config.get('wopi.modulus'); const cfgWopiExponent = config.get('wopi.exponent'); @@ -98,6 +101,11 @@ let templatesFolderExtsCache = null; const templateFilesSizeCache = {}; let shutdownFlag = false; +//patch mimeDB +if (mimeDB["application/vnd.visio"]) { + mimeDB["application/vnd.visio"].extensions.push("vsdx"); +} + let mimeTypesByExt = (function() { let mimeTypesByExt = {}; for (let mimeType in mimeDB) { @@ -149,11 +157,14 @@ function discovery(req, res) { const tenWopiCellEdit = ctx.getCfg('wopi.cellEdit', cfgWopiCellEdit); const tenWopiSlideView = ctx.getCfg('wopi.slideView', cfgWopiSlideView); const tenWopiSlideEdit = ctx.getCfg('wopi.slideEdit', cfgWopiSlideEdit); + const tenWopiDrawView = ctx.getCfg('wopi.slideView', cfgWopiDrawView); + const tenWopiDrawEdit = ctx.getCfg('wopi.slideEdit', cfgWopiDrawEdit); const tenWopiForms = ctx.getCfg('wopi.forms', cfgWopiForms); const tenWopiFavIconUrlWord = ctx.getCfg('wopi.favIconUrlWord', cfgWopiFavIconUrlWord); const tenWopiFavIconUrlCell = ctx.getCfg('wopi.favIconUrlCell', cfgWopiFavIconUrlCell); const tenWopiFavIconUrlSlide = ctx.getCfg('wopi.favIconUrlSlide', cfgWopiFavIconUrlSlide); - const tenWopiFavIconUrlPdf = ctx.getCfg('wopi.favIconUrlSlide', cfgWopiFavIconUrlPdf); + const tenWopiFavIconUrlPdf = ctx.getCfg('wopi.favIconUrlPdf', cfgWopiFavIconUrlPdf); + const tenWopiFavIconUrlDraw = ctx.getCfg('wopi.favIconUrlDraw', cfgWopiFavIconUrlDraw); const tenWopiPublicKey = ctx.getCfg('wopi.publicKey', cfgWopiPublicKey); const tenWopiModulus = ctx.getCfg('wopi.modulus', cfgWopiModulus); const tenWopiExponent = ctx.getCfg('wopi.exponent', cfgWopiExponent); @@ -172,6 +183,12 @@ function discovery(req, res) { {targetext: null, view: tenWopiPdfView, edit: tenWopiPdfEdit} ]; let documentTypes = [`word`, `cell`, `slide`, `pdf`]; + if (true) {//todo check packageType + names.push('Visio'); + favIconUrls.push(tenWopiFavIconUrlDraw); + exts.push({targetext: null, view: tenWopiDrawView, edit: tenWopiDrawEdit}); + documentTypes.push(`draw`); + } let templatesFolderExtsCache = yield getTemplatesFolderExts(ctx); let formsExts = tenWopiForms.reduce((result, item, index, array) => {