mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-20 19:08:21 +00:00
optimize code (#5469)
This commit is contained in:
29
frontend/package-lock.json
generated
29
frontend/package-lock.json
generated
@@ -11,7 +11,7 @@
|
||||
"@gatsbyjs/reach-router": "1.3.9",
|
||||
"@seafile/react-image-lightbox": "2.0.2",
|
||||
"@seafile/resumablejs": "1.1.16",
|
||||
"@seafile/sdoc-editor": "0.1.29",
|
||||
"@seafile/sdoc-editor": "0.1.30",
|
||||
"@seafile/seafile-calendar": "0.0.12",
|
||||
"@seafile/seafile-editor": "0.3.132",
|
||||
"@seafile/slate-react": "0.54.13",
|
||||
@@ -5198,9 +5198,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@seafile/sdoc-editor": {
|
||||
"version": "0.1.29",
|
||||
"resolved": "https://registry.npmjs.org/@seafile/sdoc-editor/-/sdoc-editor-0.1.29.tgz",
|
||||
"integrity": "sha512-UJxPi7G9v4JNjI+57VDpjD4i3dadich+7b02BN5Esy/4zNj6oSajnb9+spwLn/RU2oZ+FHbDlFKGGQ3ZGt+pRg==",
|
||||
"version": "0.1.30",
|
||||
"resolved": "https://registry.npmjs.org/@seafile/sdoc-editor/-/sdoc-editor-0.1.30.tgz",
|
||||
"integrity": "sha512-Nf9HKZEMs/tQk0+ujJTLxmlEFvYUxTFdzgPrq+pdmZ729iK2geU6HTbJuIBw+EaoCO86t07ZsHe3KhxUAB8m6A==",
|
||||
"dependencies": {
|
||||
"@seafile/react-image-lightbox": "2.0.2",
|
||||
"@seafile/slate": "0.91.8",
|
||||
@@ -5215,6 +5215,7 @@
|
||||
"reactstrap": "8.9.0",
|
||||
"slugid": "3.2.0",
|
||||
"socket.io-client": "4.6.1",
|
||||
"url-join": "5.0.0",
|
||||
"url-parse": "1.5.10",
|
||||
"uuid": "9.0.0"
|
||||
}
|
||||
@@ -27728,6 +27729,14 @@
|
||||
"querystring": "0.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/url-join": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/url-join/-/url-join-5.0.0.tgz",
|
||||
"integrity": "sha512-n2huDr9h9yzd6exQVnH/jU5mr+Pfx08LRXXZhkLLetAMESRj+anQsTAh940iMrIetKAmry9coFuZQ2jY8/p3WA==",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/url-loader": {
|
||||
"version": "4.1.1",
|
||||
"dev": true,
|
||||
@@ -33273,9 +33282,9 @@
|
||||
"version": "1.1.16"
|
||||
},
|
||||
"@seafile/sdoc-editor": {
|
||||
"version": "0.1.29",
|
||||
"resolved": "https://registry.npmjs.org/@seafile/sdoc-editor/-/sdoc-editor-0.1.29.tgz",
|
||||
"integrity": "sha512-UJxPi7G9v4JNjI+57VDpjD4i3dadich+7b02BN5Esy/4zNj6oSajnb9+spwLn/RU2oZ+FHbDlFKGGQ3ZGt+pRg==",
|
||||
"version": "0.1.30",
|
||||
"resolved": "https://registry.npmjs.org/@seafile/sdoc-editor/-/sdoc-editor-0.1.30.tgz",
|
||||
"integrity": "sha512-Nf9HKZEMs/tQk0+ujJTLxmlEFvYUxTFdzgPrq+pdmZ729iK2geU6HTbJuIBw+EaoCO86t07ZsHe3KhxUAB8m6A==",
|
||||
"requires": {
|
||||
"@seafile/react-image-lightbox": "2.0.2",
|
||||
"@seafile/slate": "0.91.8",
|
||||
@@ -33290,6 +33299,7 @@
|
||||
"reactstrap": "8.9.0",
|
||||
"slugid": "3.2.0",
|
||||
"socket.io-client": "4.6.1",
|
||||
"url-join": "5.0.0",
|
||||
"url-parse": "1.5.10",
|
||||
"uuid": "9.0.0"
|
||||
},
|
||||
@@ -49172,6 +49182,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"url-join": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/url-join/-/url-join-5.0.0.tgz",
|
||||
"integrity": "sha512-n2huDr9h9yzd6exQVnH/jU5mr+Pfx08LRXXZhkLLetAMESRj+anQsTAh940iMrIetKAmry9coFuZQ2jY8/p3WA=="
|
||||
},
|
||||
"url-loader": {
|
||||
"version": "4.1.1",
|
||||
"dev": true,
|
||||
|
@@ -6,7 +6,7 @@
|
||||
"@gatsbyjs/reach-router": "1.3.9",
|
||||
"@seafile/react-image-lightbox": "2.0.2",
|
||||
"@seafile/resumablejs": "1.1.16",
|
||||
"@seafile/sdoc-editor": "0.1.29",
|
||||
"@seafile/sdoc-editor": "0.1.30",
|
||||
"@seafile/seafile-calendar": "0.0.12",
|
||||
"@seafile/seafile-editor": "0.3.132",
|
||||
"@seafile/slate-react": "0.54.13",
|
||||
|
@@ -8,7 +8,7 @@ import { Utils } from './utils/utils';
|
||||
|
||||
const { serviceURL, siteRoot } = window.app.config;
|
||||
const { username, filePerm } = window.app.pageOptions;
|
||||
const { repoID, filePath, fileName, rawPath } = window.shared.pageOptions;
|
||||
const { repoID, filePath, fileName, rawPath, assetsUrl } = window.shared.pageOptions;
|
||||
|
||||
window.seafile = {
|
||||
repoID,
|
||||
@@ -20,6 +20,7 @@ window.seafile = {
|
||||
siteRoot,
|
||||
docPerm: filePerm,
|
||||
historyURL: Utils.generateHistoryURL(siteRoot, repoID, filePath),
|
||||
assetsUrl,
|
||||
};
|
||||
|
||||
ReactDom.render(
|
||||
|
@@ -10,7 +10,7 @@ const { serviceURL, avatarURL, siteRoot } = window.app.config;
|
||||
const { username, name } = window.app.userInfo;
|
||||
const {
|
||||
repoID, repoName, parentDir, filePerm,
|
||||
docPath, docName, docUuid, seadocAccessToken, seadocServerUrl
|
||||
docPath, docName, docUuid, seadocAccessToken, seadocServerUrl, assetsUrl
|
||||
} = window.app.pageOptions;
|
||||
|
||||
window.seafile = {
|
||||
@@ -29,6 +29,7 @@ window.seafile = {
|
||||
docPerm: filePerm,
|
||||
historyURL: Utils.generateHistoryURL(siteRoot, repoID, docPath),
|
||||
parentFolderURL: `${siteRoot}library/${repoID}/${Utils.encodePath(repoName + parentDir)}`,
|
||||
assetsUrl,
|
||||
};
|
||||
|
||||
ReactDom.render(
|
||||
|
@@ -252,8 +252,8 @@ class SeadocUploadImage(APIView):
|
||||
}
|
||||
data = {'parent_dir': parent_path}
|
||||
resp = requests.post(upload_link, files=files, data=data)
|
||||
image_url = '/api/v2.1/seadoc/download-image/' + file_uuid + '/' + file.name
|
||||
return Response({'url': image_url})
|
||||
image_url = '/' + file.name
|
||||
return Response({'relative_path': image_url})
|
||||
|
||||
|
||||
class SeadocDownloadImage(APIView):
|
||||
|
@@ -11,6 +11,7 @@
|
||||
docPath: '{{ path|escapejs }}',
|
||||
docName: '{{ filename|escapejs }}',
|
||||
docUuid: '{{ file_uuid }}',
|
||||
assetsUrl: '{{ assets_url }}',
|
||||
seadocAccessToken: '{{ seadoc_access_token }}',
|
||||
seadocServerUrl: '{{ seadoc_server_url }}',
|
||||
{% endblock %}
|
||||
|
@@ -89,7 +89,8 @@ body {
|
||||
})(),
|
||||
{% endif %}
|
||||
prevImgPath: {% if img_prev %}'{{ img_prev|escapejs }}'{% else %}''{% endif %},
|
||||
nextImgPath: {% if img_next %}'{{ img_next|escapejs }}'{% else %}''{% endif %}
|
||||
nextImgPath: {% if img_next %}'{{ img_next|escapejs }}'{% else %}''{% endif %},
|
||||
assetsUrl: '{{ assets_url }}'
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@@ -656,6 +656,7 @@ def view_lib_file(request, repo_id, path):
|
||||
if filetype == SEADOC:
|
||||
file_uuid = get_seadoc_file_uuid(repo, path)
|
||||
return_dict['file_uuid'] = file_uuid
|
||||
return_dict['assets_url'] = '/api/v2.1/seadoc/download-image/' + file_uuid
|
||||
return_dict['seadoc_server_url'] = SEADOC_SERVER_URL
|
||||
return_dict['seadoc_access_token'] = gen_seadoc_access_token(file_uuid, filename, username)
|
||||
|
||||
@@ -1436,6 +1437,10 @@ def view_file_via_shared_dir(request, fileshare):
|
||||
ret_dict = {'err': '', 'file_content': '', 'encoding': '', 'file_enc': '',
|
||||
'file_encoding_list': [], 'filetype': filetype}
|
||||
|
||||
if filetype == SEADOC:
|
||||
file_uuid = get_seadoc_file_uuid(repo, raw_path)
|
||||
ret_dict['assets_url'] = '/api/v2.1/seadoc/download-image/' + file_uuid
|
||||
|
||||
if filetype in (DOCUMENT, SPREADSHEET):
|
||||
|
||||
if not request.user.is_authenticated:
|
||||
|
Reference in New Issue
Block a user