mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 01:12:03 +00:00
intiate (#7049)
This commit is contained in:
@@ -211,13 +211,9 @@ class MarkdownEditor extends React.Component {
|
|||||||
const fileInfoRes = await seafileAPI.getFileInfo(repoID, filePath);
|
const fileInfoRes = await seafileAPI.getFileInfo(repoID, filePath);
|
||||||
const { mtime, size, starred, permission, last_modifier_name, id } = fileInfoRes.data;
|
const { mtime, size, starred, permission, last_modifier_name, id } = fileInfoRes.data;
|
||||||
const lastModifier = last_modifier_name;
|
const lastModifier = last_modifier_name;
|
||||||
|
const { rawPath } = window.app.pageOptions;
|
||||||
// get file download url
|
|
||||||
const fileDownloadUrlRes = await seafileAPI.getFileDownloadLink(repoID, filePath);
|
|
||||||
const downloadUrl = fileDownloadUrlRes.data;
|
|
||||||
|
|
||||||
// get file content
|
// get file content
|
||||||
const fileContentRes = await seafileAPI.getFileContent(downloadUrl);
|
const fileContentRes = await seafileAPI.getFileContent(rawPath);
|
||||||
const markdownContent = fileContentRes.data;
|
const markdownContent = fileContentRes.data;
|
||||||
|
|
||||||
// init permission
|
// init permission
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
repoName: '{{ repo.name|escapejs }}',
|
repoName: '{{ repo.name|escapejs }}',
|
||||||
filePath: '{{ path|escapejs }}',
|
filePath: '{{ path|escapejs }}',
|
||||||
fileName: '{{ filename|escapejs }}',
|
fileName: '{{ filename|escapejs }}',
|
||||||
|
rawPath: '{{ raw_path|escapejs }}',
|
||||||
domain: '{{ domain }}',
|
domain: '{{ domain }}',
|
||||||
protocol: '{{ protocol }}',
|
protocol: '{{ protocol }}',
|
||||||
lang: '{{ language_code }}',
|
lang: '{{ language_code }}',
|
||||||
|
@@ -643,9 +643,10 @@ def view_lib_file(request, repo_id, path):
|
|||||||
# template = 'view_file_%s.html' % filetype.lower()
|
# template = 'view_file_%s.html' % filetype.lower()
|
||||||
template = '%s_file_view_react.html' % filetype.lower()
|
template = '%s_file_view_react.html' % filetype.lower()
|
||||||
|
|
||||||
if filetype in (IMAGE, VIDEO, AUDIO, PDF, SVG, XMIND, 'Unknown'):
|
if filetype in [VIDEO, PDF, MARKDOWN]:
|
||||||
if filetype == VIDEO:
|
|
||||||
raw_path = gen_file_get_url_new(repo_id, path)
|
raw_path = gen_file_get_url_new(repo_id, path)
|
||||||
|
|
||||||
|
if filetype in (IMAGE, VIDEO, AUDIO, PDF, SVG, XMIND, 'Unknown'):
|
||||||
template = 'common_file_view_react.html'
|
template = 'common_file_view_react.html'
|
||||||
|
|
||||||
if filetype == SEADOC:
|
if filetype == SEADOC:
|
||||||
@@ -746,6 +747,7 @@ def view_lib_file(request, repo_id, path):
|
|||||||
return_dict['share_link_expire_days_Default'] = SHARE_LINK_EXPIRE_DAYS_DEFAULT
|
return_dict['share_link_expire_days_Default'] = SHARE_LINK_EXPIRE_DAYS_DEFAULT
|
||||||
return_dict['share_link_expire_days_min'] = SHARE_LINK_EXPIRE_DAYS_MIN
|
return_dict['share_link_expire_days_min'] = SHARE_LINK_EXPIRE_DAYS_MIN
|
||||||
return_dict['share_link_expire_days_max'] = SHARE_LINK_EXPIRE_DAYS_MAX
|
return_dict['share_link_expire_days_max'] = SHARE_LINK_EXPIRE_DAYS_MAX
|
||||||
|
return_dict['raw_path'] = raw_path
|
||||||
|
|
||||||
can_edit_file = True
|
can_edit_file = True
|
||||||
if parse_repo_perm(permission).can_edit_on_web is False:
|
if parse_repo_perm(permission).can_edit_on_web is False:
|
||||||
@@ -1231,8 +1233,8 @@ def view_shared_file(request, fileshare):
|
|||||||
ret_dict = {'err': '', 'file_content': '', 'encoding': '', 'file_enc': '',
|
ret_dict = {'err': '', 'file_content': '', 'encoding': '', 'file_enc': '',
|
||||||
'file_encoding_list': [], 'filetype': filetype}
|
'file_encoding_list': [], 'filetype': filetype}
|
||||||
|
|
||||||
if filetype == VIDEO:
|
if filetype in [VIDEO, PDF, MARKDOWN]:
|
||||||
raw_path = gen_file_get_url_new(repo_id, path)
|
raw_path = gen_file_get_url_by_sharelink(fileshare.token)
|
||||||
|
|
||||||
if filetype == SEADOC:
|
if filetype == SEADOC:
|
||||||
file_uuid = get_seadoc_file_uuid(repo, path)
|
file_uuid = get_seadoc_file_uuid(repo, path)
|
||||||
|
Reference in New Issue
Block a user