mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 02:42:47 +00:00
merge 10.0
This commit is contained in:
1
frontend/package-lock.json
generated
1
frontend/package-lock.json
generated
@@ -8,6 +8,7 @@
|
||||
"name": "seahub-frontend",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@codemirror/view": "^6.22.0",
|
||||
"@gatsbyjs/reach-router": "1.3.9",
|
||||
"@seafile/react-image-lightbox": "2.0.2",
|
||||
"@seafile/resumablejs": "1.1.16",
|
||||
|
@@ -3,6 +3,7 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@codemirror/view": "^6.22.0",
|
||||
"@gatsbyjs/reach-router": "1.3.9",
|
||||
"@seafile/react-image-lightbox": "2.0.2",
|
||||
"@seafile/resumablejs": "1.1.16",
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import CodeMirror from '@uiw/react-codemirror';
|
||||
import { EditorView } from "@codemirror/view"
|
||||
import { loadLanguage } from '@uiw/codemirror-extensions-langs';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
@@ -64,6 +65,7 @@ class SeafileCodeMirror extends React.Component {
|
||||
{...options}
|
||||
onChange={this.onChange}
|
||||
basicSetup={DEFAULT_CODEMIRROR_OPTIONS}
|
||||
extensions={[EditorView.lineWrapping]}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@@ -7,6 +7,7 @@ import FileView from './components/file-view/file-view';
|
||||
import SeafileCodeMirror from './components/seafile-codemirror';
|
||||
import FileViewTip from './components/file-view/file-view-tip';
|
||||
import { seafileAPI } from './utils/seafile-api';
|
||||
import { Utils } from './utils/utils';
|
||||
|
||||
import './css/text-file-view.css';
|
||||
const {
|
||||
@@ -64,7 +65,7 @@ class ViewFileText extends React.Component {
|
||||
if (!this.isParticipant) {
|
||||
this.addParticipant();
|
||||
}
|
||||
let dirPath = '/';
|
||||
let dirPath = Utils.getDirName(filePath);
|
||||
return (
|
||||
seafileAPI.getUpdateLink(repoID, dirPath).then((res) => {
|
||||
const uploadLink = res.data;
|
||||
|
@@ -234,8 +234,13 @@ class ShareLinks(APIView):
|
||||
|
||||
tmp_key = f"{repo_id}_{path}"
|
||||
if tmp_key not in repo_folder_permission_dict:
|
||||
permission = seafile_api.check_permission_by_path(repo_id, path, username)
|
||||
repo_folder_permission_dict[tmp_key] = permission
|
||||
try:
|
||||
permission = seafile_api.check_permission_by_path(repo_id,
|
||||
path,
|
||||
username)
|
||||
repo_folder_permission_dict[tmp_key] = permission
|
||||
except Exception:
|
||||
repo_folder_permission_dict[tmp_key] = ''
|
||||
|
||||
links_info = []
|
||||
for fs in fileshares:
|
||||
|
@@ -230,7 +230,7 @@ class WOPIFilesView(APIView):
|
||||
dirent = seafile_api.get_dirent_by_path(repo_id, file_path)
|
||||
if dirent:
|
||||
last_modified = datetime.datetime.utcfromtimestamp(dirent.mtime)
|
||||
result['LastModifiedTime'] = last_modified.isoformat()
|
||||
result['LastModifiedTime'] = last_modified.strftime('%Y-%m-%dT%H:%M:%S.%fZ')
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
return HttpResponse(json.dumps({}), status=500,
|
||||
@@ -245,14 +245,16 @@ class WOPIFilesView(APIView):
|
||||
|
||||
absolute_uri = request.build_absolute_uri('/')
|
||||
result['PostMessageOrigin'] = urllib.parse.urljoin(absolute_uri, SITE_ROOT).strip('/')
|
||||
result['HideSaveOption'] = True
|
||||
result['HideExportOption'] = True
|
||||
result['HideSaveOption'] = True if not can_edit else False
|
||||
result['HideExportOption'] = True if not can_download else False
|
||||
result['EnableOwnerTermination'] = True
|
||||
result['SupportsLocks'] = True
|
||||
result['SupportsGetLock'] = True
|
||||
|
||||
result['DisablePrint'] = True if not can_download else False
|
||||
result['HidePrintOption'] = True if not can_download else False
|
||||
result['DisableCopy'] = True if not can_download else False
|
||||
result['DisableExport'] = True if not can_download else False
|
||||
|
||||
result['SupportsUpdate'] = True if can_edit else False
|
||||
result['UserCanWrite'] = True if can_edit else False
|
||||
@@ -449,14 +451,22 @@ class WOPIFilesContentsView(APIView):
|
||||
resp = requests.post(update_url, files=files, data=data)
|
||||
if resp.status_code != 200:
|
||||
logger.error('update_url: {}'.format(update_url))
|
||||
logger.error('parameter file: {}'.format(files['file'][:100]))
|
||||
logger.error('parameter file_name: {}'.format(files['file_name']))
|
||||
logger.error('parameter target_file: {}'.format(files['target_file']))
|
||||
logger.error('parameter file: {}'.format(files['file'][1][:100]))
|
||||
logger.error('parameter file_name: {}'.format(files['file'][0]))
|
||||
logger.error('parameter target_file: {}'.format(data['target_file']))
|
||||
logger.error('response: {}'.format(resp.__dict__))
|
||||
return HttpResponse(json.dumps({}), status=500, content_type=json_content_type)
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
return HttpResponse(json.dumps({}), status=500,
|
||||
content_type=json_content_type)
|
||||
|
||||
return HttpResponse(json.dumps({}), status=200,
|
||||
content_type=json_content_type)
|
||||
result = dict()
|
||||
try:
|
||||
dirent = seafile_api.get_dirent_by_path(repo_id, file_path)
|
||||
if dirent:
|
||||
last_modified = datetime.datetime.utcfromtimestamp(dirent.mtime)
|
||||
result['LastModifiedTime'] = last_modified.strftime('%Y-%m-%dT%H:%M:%S.%fZ')
|
||||
except Exception as e:
|
||||
logger.error(e)
|
||||
return HttpResponse(json.dumps(result), status=200, content_type=json_content_type)
|
||||
|
Reference in New Issue
Block a user