mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-26 15:26:19 +00:00
@@ -1,7 +1,7 @@
|
||||
import React, { Fragment, useCallback, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Modal, ModalBody, TabContent, TabPane, Nav, NavItem, NavLink } from 'reactstrap';
|
||||
import { gettext, enableRepoAutoDel } from '../../utils/constants';
|
||||
import { gettext, enableRepoAutoDel, enableSeafileAI } from '../../utils/constants';
|
||||
import { TAB } from '../../constants/repo-setting-tabs';
|
||||
import LibHistorySettingPanel from './lib-settings/lib-history-setting-panel';
|
||||
import LibAutoDelSettingPanel from './lib-settings/lib-old-files-auto-del-setting-panel';
|
||||
@@ -18,8 +18,6 @@ import Loading from '../../components/loading';
|
||||
|
||||
import '../../css/lib-settings.css';
|
||||
|
||||
const { enableSeafileAI, enableSeafileOCR } = window.app.config;
|
||||
|
||||
const propTypes = {
|
||||
toggleDialog: PropTypes.func.isRequired,
|
||||
repoID: PropTypes.string.isRequired,
|
||||
@@ -164,7 +162,7 @@ const LibSettingsDialog = ({ repoID, currentRepoInfo, toggleDialog, tab, showMig
|
||||
{gettext('Tags')}
|
||||
</NavLink>
|
||||
</NavItem>
|
||||
{enableSeafileAI && enableSeafileOCR &&
|
||||
{enableSeafileAI &&
|
||||
<NavItem
|
||||
role="tab"
|
||||
aria-selected={activeTab === TAB.OCR_SETTING}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { siteRoot, thumbnailSizeForGrid } from '../../../utils/constants';
|
||||
import { siteRoot, thumbnailSizeForGrid, enableSeafileAI } from '../../../utils/constants';
|
||||
import { seafileAPI } from '../../../utils/seafile-api';
|
||||
import { Utils } from '../../../utils/utils';
|
||||
import toaster from '../../toast';
|
||||
@@ -16,8 +16,6 @@ import { EVENT_BUS_TYPE } from '../../../metadata/constants';
|
||||
|
||||
import './index.css';
|
||||
|
||||
const { enableSeafileAI } = window.app.config;
|
||||
|
||||
class DirentDetails extends React.Component {
|
||||
|
||||
constructor(props) {
|
||||
|
@@ -12,11 +12,10 @@ import AIIcon from '../../../metadata/components/metadata-details/ai-icon';
|
||||
import SettingsIcon from '../../../metadata/components/metadata-details/settings-icon';
|
||||
import Loading from '../../loading';
|
||||
import { useTags } from '../../../tag/hooks';
|
||||
import { enableSeafileAI } from '../../../utils/constants';
|
||||
|
||||
import './index.css';
|
||||
|
||||
const { enableSeafileAI } = window.app.config;
|
||||
|
||||
const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = 300, className, component = {} }) => {
|
||||
const { headerComponent } = component;
|
||||
const [direntDetail, setDirentDetail] = useState('');
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ItemDropdownMenu from '../dropdown-menu/item-dropdown-menu';
|
||||
import { gettext } from '../../utils/constants';
|
||||
import { gettext, enableSeafileAI } from '../../utils/constants';
|
||||
import { EVENT_BUS_TYPE, PRIVATE_COLUMN_KEY } from '../../metadata/constants';
|
||||
import TextTranslation from '../../utils/text-translation';
|
||||
import { getFileName } from '../../tag/utils/file';
|
||||
@@ -13,8 +13,6 @@ import { getColumnByKey } from '../../metadata/utils/column';
|
||||
import { useMetadataStatus } from '../../hooks';
|
||||
import { openInNewTab, openParentFolder } from '../../metadata/utils/file';
|
||||
|
||||
const { enableSeafileAI } = window.app.config;
|
||||
|
||||
const TableFilesToolbar = ({ repoID }) => {
|
||||
const [selectedRecordIds, setSelectedRecordIds] = useState([]);
|
||||
const metadataRef = useRef([]);
|
||||
|
@@ -3,8 +3,7 @@ import metadataAPI from '../metadata/api';
|
||||
import { Utils } from '../utils/utils';
|
||||
import toaster from '../components/toast';
|
||||
import Loading from '../components/loading';
|
||||
|
||||
const { enableSeafileAI, enableSeafileOCR } = window.app.config;
|
||||
import { enableSeafileAI } from '../utils/constants';
|
||||
|
||||
// This hook provides content related to seahub interaction, such as whether to enable extended attributes
|
||||
const MetadataStatusContext = React.createContext(null);
|
||||
@@ -65,7 +64,7 @@ export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, sta
|
||||
setEnableTags(enableTags);
|
||||
setTagsLang(tagsLang || 'en');
|
||||
setDetailsSettings(JSON.parse(detailsSettings));
|
||||
setEnableOCR(enableSeafileOCR && enableOCR);
|
||||
setEnableOCR(enableSeafileAI && enableOCR);
|
||||
setEnableFaceRecognition(enableSeafileAI && enableFaceRecognition);
|
||||
setEnableMetadata(enableMetadata);
|
||||
setLoading(false);
|
||||
|
@@ -129,6 +129,7 @@ const AIIcon = () => {
|
||||
}, [columns, generateDescription, onOCR, generateFileTags, extractFileDetails, onChange, onLocalRecordChange, updateFileTags, updateDescription]);
|
||||
|
||||
if (!enableMetadata || !canModifyRecord || !record || options.length === 0) return null;
|
||||
|
||||
return (
|
||||
<Dropdown className="sf-metadata-dropdown-menu" isOpen={isMenuShow} toggle={onToggle}>
|
||||
<DropdownToggle
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import React, { useState, useRef, useCallback, useMemo, useEffect } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useMetadataStatus } from '@/hooks';
|
||||
import { gettext } from '@/utils/constants';
|
||||
import { gettext, enableSeafileAI } from '@/utils/constants';
|
||||
import { Utils } from '@/utils/utils';
|
||||
import DeleteFolderDialog from '@/components/dialog/delete-folder-dialog';
|
||||
import MoveDirentDialog from '@/components/dialog/move-dirent-dialog';
|
||||
@@ -34,8 +34,6 @@ const OPERATION = {
|
||||
MOVE: 'move',
|
||||
};
|
||||
|
||||
const { enableSeafileAI } = window.app.config;
|
||||
|
||||
const ContextMenu = ({
|
||||
isGroupView, selectedRange, selectedPosition, recordMetrics, recordGetterByIndex, onClearSelected, onCopySelected,
|
||||
getTableContentRect, getTableCanvasContainerRect, deleteRecords, selectNone, moveRecord, addFolder, updateRecordDetails,
|
||||
|
@@ -99,6 +99,7 @@ export const ocmRemoteServers = window.app.pageOptions.ocmRemoteServers;
|
||||
export const enableOCMViaWebdav = window.app.pageOptions.enableOCMViaWebdav;
|
||||
export const enableSSOToThirdpartWebsite = window.app.pageOptions.enableSSOToThirdpartWebsite;
|
||||
export const enableSeadoc = window.app.pageOptions.enableSeadoc;
|
||||
export const enableMetadataManagement = window.app.pageOptions.enableMetadataManagement;
|
||||
export const enableSeafileAI = window.app.pageOptions.enableSeafileAI;
|
||||
export const enableWhiteboard = window.app.pageOptions.enableWhiteboard;
|
||||
export const enableExcalidraw = window.app.pageOptions.enableExcalidraw;
|
||||
|
@@ -25,8 +25,9 @@ from seahub.settings import SEAFILE_VERSION, SITE_DESCRIPTION, \
|
||||
LOGIN_BG_IMAGE_PATH, THUMBNAIL_DEFAULT_SIZE, \
|
||||
CUSTOM_LOGIN_BG_PATH, ENABLE_SHARE_LINK_REPORT_ABUSE, \
|
||||
PRIVACY_POLICY_LINK, TERMS_OF_SERVICE_LINK, ENABLE_SEADOC, THUMBNAIL_SIZE_FOR_GRID, \
|
||||
FILE_SERVER_ROOT, ENABLE_WHITEBOARD, ENABLE_SEAFILE_AI, ENABLE_EXCALIDRAW, \
|
||||
NOTIFICATION_SERVER_URL, ENABLE_SEAFILE_OCR, GOOGLE_MAP_ID
|
||||
FILE_SERVER_ROOT, ENABLE_WHITEBOARD, ENABLE_EXCALIDRAW, NOTIFICATION_SERVER_URL, \
|
||||
ENABLE_METADATA_MANAGEMENT, BAIDU_MAP_KEY, GOOGLE_MAP_KEY, GOOGLE_MAP_ID, \
|
||||
ENABLE_SEAFILE_AI
|
||||
|
||||
from seahub.organizations.models import OrgAdminSettings
|
||||
from seahub.organizations.settings import ORG_ENABLE_ADMIN_CUSTOM_LOGO
|
||||
@@ -181,15 +182,19 @@ def base(request):
|
||||
'help_link': HELP_LINK,
|
||||
'about_dialog_custom_html': ABOUT_DIALOG_CUSTOM_HTML,
|
||||
'enable_repo_auto_del': ENABLE_REPO_AUTO_DEL,
|
||||
'enable_metadata_management': ENABLE_METADATA_MANAGEMENT,
|
||||
'enable_seadoc': ENABLE_SEADOC,
|
||||
'enable_seafile_ai': ENABLE_SEAFILE_AI,
|
||||
'enable_whiteboard': ENABLE_WHITEBOARD,
|
||||
'enable_excalidraw': ENABLE_EXCALIDRAW,
|
||||
'notification_server_url': NOTIFICATION_SERVER_URL,
|
||||
'enable_seafile_ocr': ENABLE_SEAFILE_OCR,
|
||||
'google_map_id': GOOGLE_MAP_ID,
|
||||
}
|
||||
|
||||
if ENABLE_METADATA_MANAGEMENT:
|
||||
result['baidu_map_key'] = BAIDU_MAP_KEY
|
||||
result['google_map_key'] = GOOGLE_MAP_KEY
|
||||
result['google_map_id'] = GOOGLE_MAP_ID
|
||||
|
||||
if request.user.is_staff:
|
||||
result['is_default_admin'] = request.user.admin_role == DEFAULT_ADMIN
|
||||
result['enable_share_link_report_abuse'] = ENABLE_SHARE_LINK_REPORT_ABUSE
|
||||
|
@@ -1082,13 +1082,11 @@ METADATA_FILE_TYPES = {
|
||||
##############################
|
||||
# seafile ai #
|
||||
##############################
|
||||
ENABLE_SEAFILE_AI = False
|
||||
|
||||
SEAFILE_AI_SERVER_URL = ''
|
||||
SEAFILE_AI_SECRET_KEY = ''
|
||||
|
||||
ENABLE_SEAFILE_AI = False
|
||||
ENABLE_SEAFILE_OCR = False
|
||||
|
||||
d = os.path.dirname
|
||||
EVENTS_CONFIG_FILE = os.environ.get(
|
||||
'EVENTS_CONFIG_FILE',
|
||||
|
@@ -58,8 +58,6 @@
|
||||
avatarURL: '{{ avatar_url }}',
|
||||
cloudMode: {% if cloud_mode %} true {% else %} false {% endif %},
|
||||
isOrgContext: {% if org is not None %} true {% else %} false {% endif %},
|
||||
enableSeafileAI: {% if enable_seafile_ai %} true {% else %} false {% endif %},
|
||||
enableSeafileOCR: {% if enable_seafile_ocr %} true {% else %} false {% endif %},
|
||||
notificationServerUrl: '{{ notification_server_url }}'
|
||||
},
|
||||
pageOptions: {
|
||||
@@ -166,6 +164,7 @@
|
||||
enableExcalidraw: {% if enable_excalidraw %} true {% else %} false {% endif %},
|
||||
isOrgContext: {% if org is not None %} true {% else %} false {% endif %},
|
||||
enableMetadataManagement: {% if enable_metadata_management %} true {% else %} false {% endif %},
|
||||
enableSeafileAI: {% if enable_seafile_ai %} true {% else %} false {% endif %},
|
||||
isMultiTenacy: {% if multi_tenancy %} true {% else %} false {% endif %},
|
||||
enableFileTags: {% if enable_file_tags %} true {% else %} false {% endif %},
|
||||
enableShowAbout: {% if enable_show_about %} true {% else %} false {% endif %},
|
||||
|
@@ -44,6 +44,7 @@ window.app.pageOptions = {
|
||||
canDownloadFile: {% if can_download_file %}true{% else %}false{% endif %},
|
||||
enableWatermark: {% if enable_watermark %}true{% else %}false{% endif %},
|
||||
enableMetadataManagement: {% if enable_metadata_management %} true {% else %} false {% endif %},
|
||||
enableSeafileAI: {% if enable_seafile_ai %} true {% else %} false {% endif %},
|
||||
baiduMapKey: '{{ baidu_map_key }}',
|
||||
googleMapKey: '{{ google_map_key }}',
|
||||
googleMapId: '{{ google_map_id }}',
|
||||
|
@@ -60,6 +60,7 @@
|
||||
canDownloadFile: {% if can_download_file %}true{% else %}false{% endif %},
|
||||
fileDownloadURL: {% if file_download_url %}'{{ file_download_url|escapejs }}'{% else %}''{% endif %},
|
||||
enableMetadataManagement: {% if enable_metadata_management %} true {% else %} false {% endif %},
|
||||
enableSeafileAI: {% if enable_seafile_ai %} true {% else %} false {% endif %},
|
||||
},
|
||||
userInfo: {
|
||||
username: '{{ user.username }}',
|
||||
|
@@ -30,7 +30,6 @@ revisionCreatedAt: '{{ revision_created_at }}',
|
||||
revisionUpdatedAt: '{{ revision_updated_at }}',
|
||||
isFreezed: {% if is_freezed %}true{% else %}false{% endif %},
|
||||
lang: '{{ LANGUAGE_CODE }}',
|
||||
enableSeafileAI: {% if enable_seafile_ai %} true {% else %} false {% endif %},
|
||||
{% endblock %}
|
||||
|
||||
{% block render_bundle %}
|
||||
|
@@ -56,8 +56,7 @@ from seahub.utils.auth import get_login_bg_image_path
|
||||
from seahub.api2.endpoints.utils import get_seafevents_metrics
|
||||
import seahub.settings as settings
|
||||
from seahub.settings import AVATAR_FILE_STORAGE, ENABLE_REPO_SNAPSHOT_LABEL, \
|
||||
SHARE_LINK_EXPIRE_DAYS_MIN, ENABLE_METADATA_MANAGEMENT, \
|
||||
SHARE_LINK_EXPIRE_DAYS_MAX, SHARE_LINK_EXPIRE_DAYS_DEFAULT, \
|
||||
SHARE_LINK_EXPIRE_DAYS_MIN, SHARE_LINK_EXPIRE_DAYS_MAX, SHARE_LINK_EXPIRE_DAYS_DEFAULT, \
|
||||
UPLOAD_LINK_EXPIRE_DAYS_MIN, UPLOAD_LINK_EXPIRE_DAYS_MAX, UPLOAD_LINK_EXPIRE_DAYS_DEFAULT, \
|
||||
ENABLE_RESET_ENCRYPTED_REPO_PASSWORD, \
|
||||
ADDITIONAL_SHARE_DIALOG_NOTE, ADDITIONAL_ABOUT_DIALOG_LINKS, \
|
||||
@@ -1167,17 +1166,11 @@ def react_fake_view(request, **kwargs):
|
||||
'group_import_members_extra_msg': GROUP_IMPORT_MEMBERS_EXTRA_MSG,
|
||||
'request_from_onlyoffice_desktop_editor': ONLYOFFICE_DESKTOP_EDITOR_HTTP_USER_AGENT in request.headers.get('user-agent', ''),
|
||||
'enable_sso_to_thirdpart_website': settings.ENABLE_SSO_TO_THIRDPART_WEBSITE,
|
||||
'enable_metadata_management': ENABLE_METADATA_MANAGEMENT,
|
||||
'enable_file_tags': settings.ENABLE_FILE_TAGS,
|
||||
'enable_show_about': settings.ENABLE_SHOW_ABOUT,
|
||||
'multi_tenancy': MULTI_TENANCY,
|
||||
}
|
||||
|
||||
if ENABLE_METADATA_MANAGEMENT:
|
||||
return_dict['baidu_map_key'] = settings.BAIDU_MAP_KEY
|
||||
return_dict['google_map_key'] = settings.GOOGLE_MAP_KEY
|
||||
return_dict['google_map_id'] = settings.GOOGLE_MAP_ID
|
||||
|
||||
return render(request, "react_app.html", return_dict)
|
||||
|
||||
|
||||
|
@@ -78,7 +78,6 @@ from seahub.settings import FILE_ENCODING_LIST, FILE_PREVIEW_MAX_SIZE, \
|
||||
SHARE_LINK_EXPIRE_DAYS_MIN, SHARE_LINK_EXPIRE_DAYS_MAX, SHARE_LINK_PASSWORD_MIN_LENGTH, \
|
||||
SHARE_LINK_FORCE_USE_PASSWORD, SHARE_LINK_PASSWORD_STRENGTH_LEVEL, \
|
||||
SHARE_LINK_EXPIRE_DAYS_DEFAULT, ENABLE_SHARE_LINK_REPORT_ABUSE, SEADOC_SERVER_URL, \
|
||||
ENABLE_METADATA_MANAGEMENT, BAIDU_MAP_KEY, GOOGLE_MAP_KEY, GOOGLE_MAP_ID, \
|
||||
ENABLE_MULTIPLE_OFFICE_SUITE, OFFICE_SUITE_LIST, EXCALIDRAW_SERVER_URL
|
||||
from seahub.constants import PERMISSION_INVISIBLE
|
||||
|
||||
@@ -616,16 +615,10 @@ def view_lib_file(request, repo_id, path):
|
||||
'share_link_expire_days_min': SHARE_LINK_EXPIRE_DAYS_MIN,
|
||||
'share_link_expire_days_max': SHARE_LINK_EXPIRE_DAYS_MAX,
|
||||
'can_download_file': parse_repo_perm(permission).can_download,
|
||||
'enable_metadata_management': ENABLE_METADATA_MANAGEMENT,
|
||||
'file_download_url': gen_file_get_url_new(repo_id, path),
|
||||
'mobile_login': mobile_login,
|
||||
}
|
||||
|
||||
if ENABLE_METADATA_MANAGEMENT:
|
||||
return_dict['baidu_map_key'] = BAIDU_MAP_KEY
|
||||
return_dict['google_map_key'] = GOOGLE_MAP_KEY
|
||||
return_dict['google_map_id'] = GOOGLE_MAP_ID
|
||||
|
||||
# check whether file is starred
|
||||
is_starred = is_file_starred(username, repo_id, path, org_id)
|
||||
return_dict['is_starred'] = is_starred
|
||||
|
Reference in New Issue
Block a user