Skip to content

Commit

Permalink
[feature] Add vsdx format to wopi discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
konovalovsergey committed Nov 22, 2024
1 parent af3cf2a commit 6bb847a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Common/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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,
Expand Down
19 changes: 18 additions & 1 deletion DocService/sources/wopiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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) => {
Expand Down

0 comments on commit 6bb847a

Please sign in to comment.