1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-02 07:27:04 +00:00

Feature/onlyoffice converter (#4937)

* onlyoffice-converter: initial setup

* onlyoffice-converter: hardcoded converter

* onlyoffice-converter: converter v0.1

* onlyoffice-converter: config tweaks

* onlyoffice-connector: jwt typo fix

* format

* onlyoffice-converter: async fix

* onlyoffice-converter: jwt fix

Co-authored-by: Dmitrii Vershinin <dmitry.vershinin@onlyoffice.com>
This commit is contained in:
Sergey Linnik
2021-09-13 11:37:15 +03:00
committed by lian
parent a24c4abf8a
commit 2e17d92991
11 changed files with 259 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
import { mediaUrl, gettext, serviceURL, siteRoot, isPro, enableFileComment, fileAuditEnabled, canGenerateShareLink, canGenerateUploadLink, shareLinkPasswordMinLength, username, folderPermEnabled } from './constants';
import { mediaUrl, gettext, serviceURL, siteRoot, isPro, enableFileComment, fileAuditEnabled, canGenerateShareLink, canGenerateUploadLink, shareLinkPasswordMinLength, username, folderPermEnabled, onlyofficeConverterExtensions, enableOnlyoffice } from './constants';
import { strChineseFirstPY } from './pinyin-by-unicode';
import TextTranslation from './text-translation';
import React from 'react';
@@ -523,7 +523,7 @@ export const Utils = {
getFileOperationList: function(isRepoOwner, currentRepoInfo, dirent, isContextmenu) {
let list = [];
const { SHARE, DOWNLOAD, DELETE, RENAME, MOVE, COPY, TAGS, UNLOCK, LOCK,
COMMENT, HISTORY, ACCESS_LOG, OPEN_VIA_CLIENT } = TextTranslation;
COMMENT, HISTORY, ACCESS_LOG, OPEN_VIA_CLIENT, ONLYOFFICE_CONVERT } = TextTranslation;
const permission = dirent.permission;
const { isCustomPermission, customPermission } = Utils.getUserPermission(permission);
@@ -610,14 +610,24 @@ export const Utils = {
list.push(HISTORY);
}
if (permission == 'rw' && enableOnlyoffice &&
onlyofficeConverterExtensions.includes(this.getFileExtension(dirent.name, false))) {
list.push(ONLYOFFICE_CONVERT);
}
// if the last item of menuList is Divider, delete the last item
if (list[list.length - 1] === 'Divider') {
list.pop();
}
return list;
},
getFileExtension: function (fileName, withoutDot) {
let parts = fileName.toLowerCase().split(".");
return withoutDot ? parts.pop() : "." + parts.pop();
},
getDirentOperationList: function(isRepoOwner, currentRepoInfo, dirent, isContextmenu) {
return dirent.type == 'dir' ?
Utils.getFolderOperationList(isRepoOwner, currentRepoInfo, dirent, isContextmenu) :