Skip to content

Commit

Permalink
fix: encrypted repo metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
杨国璇 committed Dec 7, 2024
1 parent 81ad75e commit c4dd244
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
12 changes: 8 additions & 4 deletions frontend/src/components/file-view/file-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const propTypes = {

const { isStarred, isLocked, lockedByMe,
repoID, filePath, filePerm, enableWatermark, userNickName,
fileName
fileName, repoEncrypted
} = window.app.pageOptions;

class FileView extends React.Component {
Expand Down Expand Up @@ -114,6 +114,10 @@ class FileView extends React.Component {
render() {
const { isOnlyofficeFile = false } = this.props;
const { isDetailsPanelOpen, isHeaderShown } = this.state;
const repoInfo = {
permission: filePerm,
encrypted: repoEncrypted
};
return (
<I18nextProvider i18n={ i18n }>
<Suspense fallback={<Loading />}>
Expand Down Expand Up @@ -152,14 +156,14 @@ class FileView extends React.Component {
}
{this.props.content}
{isDetailsPanelOpen && (
<MetadataStatusProvider repoID={repoID} >
<MetadataStatusProvider repoID={repoID} currentRepoInfo={repoInfo}>
<CollaboratorsProvider repoID={repoID}>
<TagsProvider repoID={repoID} repoInfo={{ permission: filePerm }}>
<TagsProvider repoID={repoID} repoInfo={repoInfo}>
<EmbeddedFileDetails
repoID={repoID}
path={filePath}
dirent={{ 'name': fileName, type: 'file' }}
repoInfo={{ permission: filePerm }}
repoInfo={repoInfo}
onClose={this.toggleDetailsPanel}
/>
</TagsProvider>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { CollaboratorsProvider } from './metadata';

import './index.css';

const { repoID } = window.app.pageOptions;
const { repoID, repoEncrypted, filePerm } = window.app.pageOptions;

ReactDom.render(
<I18nextProvider i18n={ i18n } >
<Suspense fallback={<Loading />}>
<MetadataStatusProvider repoID={repoID}>
<MetadataStatusProvider repoID={repoID} currentRepoInfo={{ permission: filePerm, encrypted: repoEncrypted }}>
<CollaboratorsProvider repoID={repoID}>
<MarkdownEditor />
</CollaboratorsProvider>
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/view-file-sdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { TagsProvider } from './tag/hooks';
const { serviceURL, avatarURL, siteRoot, lang, mediaUrl, isPro } = window.app.config;
const { username, name } = window.app.userInfo;
const {
repoID, repoName, parentDir, filePerm,
repoID, repoName, repoEncrypted, parentDir, filePerm,
docPath, docName, docUuid, seadocAccessToken, seadocServerUrl, assetsUrl,
isSdocRevision, isPublished, originFilename, revisionCreatedAt, originFileVersion,
originFilePath, originDocUuid, revisionId, isFreezed
Expand Down Expand Up @@ -51,12 +51,14 @@ window.seafile = {
isPro: isPro === 'True' ? true : false,
};

const repoInfo = { encrypted: repoEncrypted, permission: filePerm };

ReactDom.render(
<I18nextProvider i18n={ i18n } >
<Suspense fallback={<Loading />}>
<MetadataStatusProvider repoID={repoID}>
<MetadataStatusProvider repoID={repoID} currentRepoInfo={repoInfo}>
<CollaboratorsProvider repoID={repoID}>
<TagsProvider repoID={repoID} repoInfo={{ permission: filePerm }}>
<TagsProvider repoID={repoID} repoInfo={repoInfo}>
<SdocEditor />
</TagsProvider>
</CollaboratorsProvider>
Expand Down
2 changes: 2 additions & 0 deletions seahub/templates/markdown_file_view_react.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
pageOptions: {
repoID: '{{ repo.id }}',
repoName: '{{ repo.name|escapejs }}',
repoEncrypted: {% if repo.encrypted %}true{% else %}false{% endif %},
filePath: '{{ path|escapejs }}',
fileName: '{{ filename|escapejs }}',
filePerm: '{{ file_perm }}',
rawPath: '{{ raw_path|escapejs }}',
domain: '{{ domain }}',
protocol: '{{ protocol }}',
Expand Down

0 comments on commit c4dd244

Please sign in to comment.