1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-26 15:26:19 +00:00

fix: enable config (#7919)

Co-authored-by: 杨国璇 <ygx@MacBookPro.lan>
This commit is contained in:
杨国璇
2025-06-11 20:54:36 +08:00
committed by GitHub
parent 7aa257ce09
commit 6d546f5067
16 changed files with 24 additions and 43 deletions

View File

@@ -1,7 +1,7 @@
import React, { Fragment, useCallback, useState } from 'react'; import React, { Fragment, useCallback, useState } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Modal, ModalBody, TabContent, TabPane, Nav, NavItem, NavLink } from 'reactstrap'; 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 { TAB } from '../../constants/repo-setting-tabs';
import LibHistorySettingPanel from './lib-settings/lib-history-setting-panel'; import LibHistorySettingPanel from './lib-settings/lib-history-setting-panel';
import LibAutoDelSettingPanel from './lib-settings/lib-old-files-auto-del-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'; import '../../css/lib-settings.css';
const { enableSeafileAI, enableSeafileOCR } = window.app.config;
const propTypes = { const propTypes = {
toggleDialog: PropTypes.func.isRequired, toggleDialog: PropTypes.func.isRequired,
repoID: PropTypes.string.isRequired, repoID: PropTypes.string.isRequired,
@@ -164,7 +162,7 @@ const LibSettingsDialog = ({ repoID, currentRepoInfo, toggleDialog, tab, showMig
{gettext('Tags')} {gettext('Tags')}
</NavLink> </NavLink>
</NavItem> </NavItem>
{enableSeafileAI && enableSeafileOCR && {enableSeafileAI &&
<NavItem <NavItem
role="tab" role="tab"
aria-selected={activeTab === TAB.OCR_SETTING} aria-selected={activeTab === TAB.OCR_SETTING}

View File

@@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; 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 { seafileAPI } from '../../../utils/seafile-api';
import { Utils } from '../../../utils/utils'; import { Utils } from '../../../utils/utils';
import toaster from '../../toast'; import toaster from '../../toast';
@@ -16,8 +16,6 @@ import { EVENT_BUS_TYPE } from '../../../metadata/constants';
import './index.css'; import './index.css';
const { enableSeafileAI } = window.app.config;
class DirentDetails extends React.Component { class DirentDetails extends React.Component {
constructor(props) { constructor(props) {

View File

@@ -12,11 +12,10 @@ import AIIcon from '../../../metadata/components/metadata-details/ai-icon';
import SettingsIcon from '../../../metadata/components/metadata-details/settings-icon'; import SettingsIcon from '../../../metadata/components/metadata-details/settings-icon';
import Loading from '../../loading'; import Loading from '../../loading';
import { useTags } from '../../../tag/hooks'; import { useTags } from '../../../tag/hooks';
import { enableSeafileAI } from '../../../utils/constants';
import './index.css'; import './index.css';
const { enableSeafileAI } = window.app.config;
const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = 300, className, component = {} }) => { const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = 300, className, component = {} }) => {
const { headerComponent } = component; const { headerComponent } = component;
const [direntDetail, setDirentDetail] = useState(''); const [direntDetail, setDirentDetail] = useState('');

View File

@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import ItemDropdownMenu from '../dropdown-menu/item-dropdown-menu'; 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 { EVENT_BUS_TYPE, PRIVATE_COLUMN_KEY } from '../../metadata/constants';
import TextTranslation from '../../utils/text-translation'; import TextTranslation from '../../utils/text-translation';
import { getFileName } from '../../tag/utils/file'; import { getFileName } from '../../tag/utils/file';
@@ -13,8 +13,6 @@ import { getColumnByKey } from '../../metadata/utils/column';
import { useMetadataStatus } from '../../hooks'; import { useMetadataStatus } from '../../hooks';
import { openInNewTab, openParentFolder } from '../../metadata/utils/file'; import { openInNewTab, openParentFolder } from '../../metadata/utils/file';
const { enableSeafileAI } = window.app.config;
const TableFilesToolbar = ({ repoID }) => { const TableFilesToolbar = ({ repoID }) => {
const [selectedRecordIds, setSelectedRecordIds] = useState([]); const [selectedRecordIds, setSelectedRecordIds] = useState([]);
const metadataRef = useRef([]); const metadataRef = useRef([]);

View File

@@ -3,8 +3,7 @@ import metadataAPI from '../metadata/api';
import { Utils } from '../utils/utils'; import { Utils } from '../utils/utils';
import toaster from '../components/toast'; import toaster from '../components/toast';
import Loading from '../components/loading'; import Loading from '../components/loading';
import { enableSeafileAI } from '../utils/constants';
const { enableSeafileAI, enableSeafileOCR } = window.app.config;
// This hook provides content related to seahub interaction, such as whether to enable extended attributes // This hook provides content related to seahub interaction, such as whether to enable extended attributes
const MetadataStatusContext = React.createContext(null); const MetadataStatusContext = React.createContext(null);
@@ -65,7 +64,7 @@ export const MetadataStatusProvider = ({ repoID, repoInfo, hideMetadataView, sta
setEnableTags(enableTags); setEnableTags(enableTags);
setTagsLang(tagsLang || 'en'); setTagsLang(tagsLang || 'en');
setDetailsSettings(JSON.parse(detailsSettings)); setDetailsSettings(JSON.parse(detailsSettings));
setEnableOCR(enableSeafileOCR && enableOCR); setEnableOCR(enableSeafileAI && enableOCR);
setEnableFaceRecognition(enableSeafileAI && enableFaceRecognition); setEnableFaceRecognition(enableSeafileAI && enableFaceRecognition);
setEnableMetadata(enableMetadata); setEnableMetadata(enableMetadata);
setLoading(false); setLoading(false);

View File

@@ -129,6 +129,7 @@ const AIIcon = () => {
}, [columns, generateDescription, onOCR, generateFileTags, extractFileDetails, onChange, onLocalRecordChange, updateFileTags, updateDescription]); }, [columns, generateDescription, onOCR, generateFileTags, extractFileDetails, onChange, onLocalRecordChange, updateFileTags, updateDescription]);
if (!enableMetadata || !canModifyRecord || !record || options.length === 0) return null; if (!enableMetadata || !canModifyRecord || !record || options.length === 0) return null;
return ( return (
<Dropdown className="sf-metadata-dropdown-menu" isOpen={isMenuShow} toggle={onToggle}> <Dropdown className="sf-metadata-dropdown-menu" isOpen={isMenuShow} toggle={onToggle}>
<DropdownToggle <DropdownToggle

View File

@@ -1,7 +1,7 @@
import React, { useState, useRef, useCallback, useMemo, useEffect } from 'react'; import React, { useState, useRef, useCallback, useMemo, useEffect } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useMetadataStatus } from '@/hooks'; import { useMetadataStatus } from '@/hooks';
import { gettext } from '@/utils/constants'; import { gettext, enableSeafileAI } from '@/utils/constants';
import { Utils } from '@/utils/utils'; import { Utils } from '@/utils/utils';
import DeleteFolderDialog from '@/components/dialog/delete-folder-dialog'; import DeleteFolderDialog from '@/components/dialog/delete-folder-dialog';
import MoveDirentDialog from '@/components/dialog/move-dirent-dialog'; import MoveDirentDialog from '@/components/dialog/move-dirent-dialog';
@@ -34,8 +34,6 @@ const OPERATION = {
MOVE: 'move', MOVE: 'move',
}; };
const { enableSeafileAI } = window.app.config;
const ContextMenu = ({ const ContextMenu = ({
isGroupView, selectedRange, selectedPosition, recordMetrics, recordGetterByIndex, onClearSelected, onCopySelected, isGroupView, selectedRange, selectedPosition, recordMetrics, recordGetterByIndex, onClearSelected, onCopySelected,
getTableContentRect, getTableCanvasContainerRect, deleteRecords, selectNone, moveRecord, addFolder, updateRecordDetails, getTableContentRect, getTableCanvasContainerRect, deleteRecords, selectNone, moveRecord, addFolder, updateRecordDetails,

View File

@@ -99,6 +99,7 @@ export const ocmRemoteServers = window.app.pageOptions.ocmRemoteServers;
export const enableOCMViaWebdav = window.app.pageOptions.enableOCMViaWebdav; export const enableOCMViaWebdav = window.app.pageOptions.enableOCMViaWebdav;
export const enableSSOToThirdpartWebsite = window.app.pageOptions.enableSSOToThirdpartWebsite; export const enableSSOToThirdpartWebsite = window.app.pageOptions.enableSSOToThirdpartWebsite;
export const enableSeadoc = window.app.pageOptions.enableSeadoc; export const enableSeadoc = window.app.pageOptions.enableSeadoc;
export const enableMetadataManagement = window.app.pageOptions.enableMetadataManagement;
export const enableSeafileAI = window.app.pageOptions.enableSeafileAI; export const enableSeafileAI = window.app.pageOptions.enableSeafileAI;
export const enableWhiteboard = window.app.pageOptions.enableWhiteboard; export const enableWhiteboard = window.app.pageOptions.enableWhiteboard;
export const enableExcalidraw = window.app.pageOptions.enableExcalidraw; export const enableExcalidraw = window.app.pageOptions.enableExcalidraw;

View File

@@ -25,8 +25,9 @@ from seahub.settings import SEAFILE_VERSION, SITE_DESCRIPTION, \
LOGIN_BG_IMAGE_PATH, THUMBNAIL_DEFAULT_SIZE, \ LOGIN_BG_IMAGE_PATH, THUMBNAIL_DEFAULT_SIZE, \
CUSTOM_LOGIN_BG_PATH, ENABLE_SHARE_LINK_REPORT_ABUSE, \ CUSTOM_LOGIN_BG_PATH, ENABLE_SHARE_LINK_REPORT_ABUSE, \
PRIVACY_POLICY_LINK, TERMS_OF_SERVICE_LINK, ENABLE_SEADOC, THUMBNAIL_SIZE_FOR_GRID, \ PRIVACY_POLICY_LINK, TERMS_OF_SERVICE_LINK, ENABLE_SEADOC, THUMBNAIL_SIZE_FOR_GRID, \
FILE_SERVER_ROOT, ENABLE_WHITEBOARD, ENABLE_SEAFILE_AI, ENABLE_EXCALIDRAW, \ FILE_SERVER_ROOT, ENABLE_WHITEBOARD, ENABLE_EXCALIDRAW, NOTIFICATION_SERVER_URL, \
NOTIFICATION_SERVER_URL, ENABLE_SEAFILE_OCR, GOOGLE_MAP_ID ENABLE_METADATA_MANAGEMENT, BAIDU_MAP_KEY, GOOGLE_MAP_KEY, GOOGLE_MAP_ID, \
ENABLE_SEAFILE_AI
from seahub.organizations.models import OrgAdminSettings from seahub.organizations.models import OrgAdminSettings
from seahub.organizations.settings import ORG_ENABLE_ADMIN_CUSTOM_LOGO from seahub.organizations.settings import ORG_ENABLE_ADMIN_CUSTOM_LOGO
@@ -181,15 +182,19 @@ def base(request):
'help_link': HELP_LINK, 'help_link': HELP_LINK,
'about_dialog_custom_html': ABOUT_DIALOG_CUSTOM_HTML, 'about_dialog_custom_html': ABOUT_DIALOG_CUSTOM_HTML,
'enable_repo_auto_del': ENABLE_REPO_AUTO_DEL, 'enable_repo_auto_del': ENABLE_REPO_AUTO_DEL,
'enable_metadata_management': ENABLE_METADATA_MANAGEMENT,
'enable_seadoc': ENABLE_SEADOC, 'enable_seadoc': ENABLE_SEADOC,
'enable_seafile_ai': ENABLE_SEAFILE_AI, 'enable_seafile_ai': ENABLE_SEAFILE_AI,
'enable_whiteboard': ENABLE_WHITEBOARD, 'enable_whiteboard': ENABLE_WHITEBOARD,
'enable_excalidraw': ENABLE_EXCALIDRAW, 'enable_excalidraw': ENABLE_EXCALIDRAW,
'notification_server_url': NOTIFICATION_SERVER_URL, '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: if request.user.is_staff:
result['is_default_admin'] = request.user.admin_role == DEFAULT_ADMIN result['is_default_admin'] = request.user.admin_role == DEFAULT_ADMIN
result['enable_share_link_report_abuse'] = ENABLE_SHARE_LINK_REPORT_ABUSE result['enable_share_link_report_abuse'] = ENABLE_SHARE_LINK_REPORT_ABUSE

View File

@@ -1082,13 +1082,11 @@ METADATA_FILE_TYPES = {
############################## ##############################
# seafile ai # # seafile ai #
############################## ##############################
ENABLE_SEAFILE_AI = False
SEAFILE_AI_SERVER_URL = '' SEAFILE_AI_SERVER_URL = ''
SEAFILE_AI_SECRET_KEY = '' SEAFILE_AI_SECRET_KEY = ''
ENABLE_SEAFILE_AI = False
ENABLE_SEAFILE_OCR = False
d = os.path.dirname d = os.path.dirname
EVENTS_CONFIG_FILE = os.environ.get( EVENTS_CONFIG_FILE = os.environ.get(
'EVENTS_CONFIG_FILE', 'EVENTS_CONFIG_FILE',

View File

@@ -58,8 +58,6 @@
avatarURL: '{{ avatar_url }}', avatarURL: '{{ avatar_url }}',
cloudMode: {% if cloud_mode %} true {% else %} false {% endif %}, cloudMode: {% if cloud_mode %} true {% else %} false {% endif %},
isOrgContext: {% if org is not None %} 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 }}' notificationServerUrl: '{{ notification_server_url }}'
}, },
pageOptions: { pageOptions: {
@@ -166,6 +164,7 @@
enableExcalidraw: {% if enable_excalidraw %} true {% else %} false {% endif %}, enableExcalidraw: {% if enable_excalidraw %} true {% else %} false {% endif %},
isOrgContext: {% if org is not None %} true {% else %} false {% endif %}, isOrgContext: {% if org is not None %} true {% else %} false {% endif %},
enableMetadataManagement: {% if enable_metadata_management %} 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 %}, isMultiTenacy: {% if multi_tenancy %} true {% else %} false {% endif %},
enableFileTags: {% if enable_file_tags %} true {% else %} false {% endif %}, enableFileTags: {% if enable_file_tags %} true {% else %} false {% endif %},
enableShowAbout: {% if enable_show_about %} true {% else %} false {% endif %}, enableShowAbout: {% if enable_show_about %} true {% else %} false {% endif %},

View File

@@ -44,6 +44,7 @@ window.app.pageOptions = {
canDownloadFile: {% if can_download_file %}true{% else %}false{% endif %}, canDownloadFile: {% if can_download_file %}true{% else %}false{% endif %},
enableWatermark: {% if enable_watermark %}true{% else %}false{% endif %}, enableWatermark: {% if enable_watermark %}true{% else %}false{% endif %},
enableMetadataManagement: {% if enable_metadata_management %} 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 }}', baiduMapKey: '{{ baidu_map_key }}',
googleMapKey: '{{ google_map_key }}', googleMapKey: '{{ google_map_key }}',
googleMapId: '{{ google_map_id }}', googleMapId: '{{ google_map_id }}',

View File

@@ -60,6 +60,7 @@
canDownloadFile: {% if can_download_file %}true{% else %}false{% endif %}, canDownloadFile: {% if can_download_file %}true{% else %}false{% endif %},
fileDownloadURL: {% if file_download_url %}'{{ file_download_url|escapejs }}'{% else %}''{% endif %}, fileDownloadURL: {% if file_download_url %}'{{ file_download_url|escapejs }}'{% else %}''{% endif %},
enableMetadataManagement: {% if enable_metadata_management %} true {% else %} false {% endif %}, enableMetadataManagement: {% if enable_metadata_management %} true {% else %} false {% endif %},
enableSeafileAI: {% if enable_seafile_ai %} true {% else %} false {% endif %},
}, },
userInfo: { userInfo: {
username: '{{ user.username }}', username: '{{ user.username }}',

View File

@@ -30,7 +30,6 @@ revisionCreatedAt: '{{ revision_created_at }}',
revisionUpdatedAt: '{{ revision_updated_at }}', revisionUpdatedAt: '{{ revision_updated_at }}',
isFreezed: {% if is_freezed %}true{% else %}false{% endif %}, isFreezed: {% if is_freezed %}true{% else %}false{% endif %},
lang: '{{ LANGUAGE_CODE }}', lang: '{{ LANGUAGE_CODE }}',
enableSeafileAI: {% if enable_seafile_ai %} true {% else %} false {% endif %},
{% endblock %} {% endblock %}
{% block render_bundle %} {% block render_bundle %}

View File

@@ -56,8 +56,7 @@ from seahub.utils.auth import get_login_bg_image_path
from seahub.api2.endpoints.utils import get_seafevents_metrics from seahub.api2.endpoints.utils import get_seafevents_metrics
import seahub.settings as settings import seahub.settings as settings
from seahub.settings import AVATAR_FILE_STORAGE, ENABLE_REPO_SNAPSHOT_LABEL, \ from seahub.settings import AVATAR_FILE_STORAGE, ENABLE_REPO_SNAPSHOT_LABEL, \
SHARE_LINK_EXPIRE_DAYS_MIN, ENABLE_METADATA_MANAGEMENT, \ SHARE_LINK_EXPIRE_DAYS_MIN, SHARE_LINK_EXPIRE_DAYS_MAX, SHARE_LINK_EXPIRE_DAYS_DEFAULT, \
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, \ UPLOAD_LINK_EXPIRE_DAYS_MIN, UPLOAD_LINK_EXPIRE_DAYS_MAX, UPLOAD_LINK_EXPIRE_DAYS_DEFAULT, \
ENABLE_RESET_ENCRYPTED_REPO_PASSWORD, \ ENABLE_RESET_ENCRYPTED_REPO_PASSWORD, \
ADDITIONAL_SHARE_DIALOG_NOTE, ADDITIONAL_ABOUT_DIALOG_LINKS, \ 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, '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', ''), '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_sso_to_thirdpart_website': settings.ENABLE_SSO_TO_THIRDPART_WEBSITE,
'enable_metadata_management': ENABLE_METADATA_MANAGEMENT,
'enable_file_tags': settings.ENABLE_FILE_TAGS, 'enable_file_tags': settings.ENABLE_FILE_TAGS,
'enable_show_about': settings.ENABLE_SHOW_ABOUT, 'enable_show_about': settings.ENABLE_SHOW_ABOUT,
'multi_tenancy': MULTI_TENANCY, '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) return render(request, "react_app.html", return_dict)

View File

@@ -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_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_FORCE_USE_PASSWORD, SHARE_LINK_PASSWORD_STRENGTH_LEVEL, \
SHARE_LINK_EXPIRE_DAYS_DEFAULT, ENABLE_SHARE_LINK_REPORT_ABUSE, SEADOC_SERVER_URL, \ 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 ENABLE_MULTIPLE_OFFICE_SUITE, OFFICE_SUITE_LIST, EXCALIDRAW_SERVER_URL
from seahub.constants import PERMISSION_INVISIBLE 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_min': SHARE_LINK_EXPIRE_DAYS_MIN,
'share_link_expire_days_max': SHARE_LINK_EXPIRE_DAYS_MAX, 'share_link_expire_days_max': SHARE_LINK_EXPIRE_DAYS_MAX,
'can_download_file': parse_repo_perm(permission).can_download, '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), 'file_download_url': gen_file_get_url_new(repo_id, path),
'mobile_login': mobile_login, '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 # check whether file is starred
is_starred = is_file_starred(username, repo_id, path, org_id) is_starred = is_file_starred(username, repo_id, path, org_id)
return_dict['is_starred'] = is_starred return_dict['is_starred'] = is_starred