mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 10:58:33 +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:
@@ -82,6 +82,9 @@ export const enableTC = window.app.pageOptions.enableTC;
|
||||
|
||||
export const enableVideoThumbnail = window.app.pageOptions.enableVideoThumbnail;
|
||||
|
||||
export const enableOnlyoffice = window.app.pageOptions.enableOnlyoffice || false;
|
||||
export const onlyofficeConverterExtensions = window.app.pageOptions.onlyofficeConverterExtensions || [];
|
||||
|
||||
// dtable
|
||||
export const workspaceID = window.app.pageOptions.workspaceID;
|
||||
export const showLogoutIcon = window.app.pageOptions.showLogoutIcon;
|
||||
|
@@ -21,6 +21,7 @@ const TextTranslation = {
|
||||
'ACCESS_LOG' : {key : 'Access Log', value : gettext('Access Log')},
|
||||
'TAGS': {key: 'Tags', value: gettext('Tags')},
|
||||
'RELATED_FILES': {key: 'Related Files', value: gettext('Related Files')},
|
||||
'ONLYOFFICE_CONVERT': {key: 'Convert with ONLYOFFICE', value: gettext('Convert with ONLYOFFICE')}
|
||||
};
|
||||
|
||||
export default TextTranslation;
|
@@ -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) :
|
||||
|
Reference in New Issue
Block a user