Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: encrypted repo metadata #7157

Merged
merged 1 commit into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading