From dfe36719d2bae2df0e64a1ac9d8f9ec810f8b8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=98JoinTyang=E2=80=99?= Date: Sat, 24 Aug 2024 16:22:07 +0800 Subject: [PATCH] rebase --- frontend/src/components/file-chooser/file-chooser.js | 2 +- seahub/api2/endpoints/metadata_manage.py | 3 +-- seahub/repo_metadata/utils.py | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/file-chooser/file-chooser.js b/frontend/src/components/file-chooser/file-chooser.js index 33247256733..1096c638f70 100644 --- a/frontend/src/components/file-chooser/file-chooser.js +++ b/frontend/src/components/file-chooser/file-chooser.js @@ -257,7 +257,7 @@ class FileChooser extends React.Component { return results; }; - if (isPro && enableSeasearch && !enableElasticsearch) { + if (isPro) { seafileAPI.aiSearchFiles(queryData, cancelToken).then(res => { const filteredResults = filterCurrentRepo(res.data.results.filter(item => item.is_dir)); this.setState({ diff --git a/seahub/api2/endpoints/metadata_manage.py b/seahub/api2/endpoints/metadata_manage.py index da986758d31..65d09996f11 100644 --- a/seahub/api2/endpoints/metadata_manage.py +++ b/seahub/api2/endpoints/metadata_manage.py @@ -12,11 +12,10 @@ from seahub.repo_metadata.models import RepoMetadata, RepoMetadataViews from seahub.views import check_folder_permission from seahub.repo_metadata.utils import add_init_metadata_task, gen_unique_id, init_metadata, \ - get_sys_columns, update_docs_summary + get_sys_columns, update_docs_summary, get_file_download_token from seahub.repo_metadata.metadata_server_api import MetadataServerAPI, list_metadata_view_records from seahub.utils.timeutils import datetime_to_isoformat_timestr from seahub.utils.repo import is_repo_admin -from seahub.ai.utils import get_file_download_token from pysearpc import SearpcError from seaserv import seafile_api diff --git a/seahub/repo_metadata/utils.py b/seahub/repo_metadata/utils.py index 41e689380b5..d344be7bf46 100644 --- a/seahub/repo_metadata/utils.py +++ b/seahub/repo_metadata/utils.py @@ -7,6 +7,7 @@ from seahub.settings import SECRET_KEY, SEAFEVENTS_SERVER_URL, SEAFILE_AI_SECRET_KEY, SEAFILE_AI_SERVER_URL +from seaserv import seafile_api def add_init_metadata_task(params): payload = {'exp': int(time.time()) + 300, } @@ -76,3 +77,6 @@ def update_docs_summary(repo_id, files_info_list): } resp = requests.post(url, json=params, headers=headers) return resp + +def get_file_download_token(repo_id, file_id, username): + return seafile_api.get_fileserver_access_token(repo_id, file_id, 'download', username, use_onetime=True)