Merge branch 'main' into demo
This commit is contained in:
commit
60a6cf6fc1
|
@ -32,12 +32,15 @@ import { useRouter } from 'next/router';
|
|||
import SingleInputForm, {
|
||||
SingleInputFormProps,
|
||||
} from 'components/SingleInputForm';
|
||||
import { Card } from 'react-bootstrap';
|
||||
import { logError } from 'utils/sentry';
|
||||
import SharedAlbumNavbar from 'components/pages/sharedAlbum/Navbar';
|
||||
import { CollectionInfo } from 'components/Collections/CollectionInfo';
|
||||
import { CollectionInfoBarWrapper } from 'components/Collections/styledComponents';
|
||||
import { ITEM_TYPE, TimeStampListItem } from 'components/PhotoList';
|
||||
import FormContainer from 'components/Form/FormContainer';
|
||||
import FormPaper from 'components/Form/FormPaper';
|
||||
import FormPaperTitle from 'components/Form/FormPaper/Title';
|
||||
import Typography from '@mui/material/Typography';
|
||||
|
||||
const Loader = () => (
|
||||
<VerticallyCentered>
|
||||
|
@ -267,21 +270,23 @@ export default function PublicCollectionGallery() {
|
|||
}
|
||||
if (isPasswordProtected && !passwordJWTToken.current) {
|
||||
return (
|
||||
<VerticallyCentered>
|
||||
<Card style={{ maxWidth: '332px' }} className="text-center">
|
||||
<Card.Body style={{ padding: '40px 30px' }}>
|
||||
<Card.Subtitle style={{ marginBottom: '2rem' }}>
|
||||
<FormContainer>
|
||||
<FormPaper>
|
||||
<FormPaperTitle>{constants.PASSWORD}</FormPaperTitle>
|
||||
<Typography
|
||||
color={'text.secondary'}
|
||||
mb={2}
|
||||
variant="body2">
|
||||
{constants.LINK_PASSWORD}
|
||||
</Card.Subtitle>
|
||||
</Typography>
|
||||
<SingleInputForm
|
||||
callback={verifyLinkPassword}
|
||||
placeholder={constants.RETURN_PASSPHRASE_HINT}
|
||||
buttonText={'unlock'}
|
||||
fieldType="password"
|
||||
/>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</VerticallyCentered>
|
||||
</FormPaper>
|
||||
</FormContainer>
|
||||
);
|
||||
}
|
||||
if (!publicFiles) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import CryptoWorker from 'utils/crypto';
|
|||
import {
|
||||
generateStreamFromArrayBuffer,
|
||||
convertForPreview,
|
||||
needsConversionForPreview,
|
||||
createTypedObjectURL,
|
||||
} from 'utils/file';
|
||||
import HTTPService from './HTTPService';
|
||||
|
@ -90,20 +89,13 @@ class DownloadManager {
|
|||
return decrypted;
|
||||
};
|
||||
|
||||
getFile = async (
|
||||
file: EnteFile,
|
||||
forPreview = false,
|
||||
tokenOverride?: string
|
||||
) => {
|
||||
const shouldBeConverted = forPreview && needsConversionForPreview(file);
|
||||
const fileKey = shouldBeConverted
|
||||
? `${file.id}_converted`
|
||||
: `${file.id}`;
|
||||
getFile = async (file: EnteFile, forPreview = false) => {
|
||||
const fileKey = forPreview ? `${file.id}_preview` : `${file.id}`;
|
||||
try {
|
||||
const getFilePromise = async (convert: boolean) => {
|
||||
const fileStream = await this.downloadFile(file, tokenOverride);
|
||||
const getFilePromise = async () => {
|
||||
const fileStream = await this.downloadFile(file);
|
||||
const fileBlob = await new Response(fileStream).blob();
|
||||
if (convert) {
|
||||
if (forPreview) {
|
||||
const convertedBlobs = await convertForPreview(
|
||||
file,
|
||||
fileBlob
|
||||
|
@ -123,10 +115,7 @@ class DownloadManager {
|
|||
];
|
||||
};
|
||||
if (!this.fileObjectURLPromise.get(fileKey)) {
|
||||
this.fileObjectURLPromise.set(
|
||||
fileKey,
|
||||
getFilePromise(shouldBeConverted)
|
||||
);
|
||||
this.fileObjectURLPromise.set(fileKey, getFilePromise());
|
||||
}
|
||||
const fileURLs = await this.fileObjectURLPromise.get(fileKey);
|
||||
return fileURLs;
|
||||
|
|
|
@ -3,11 +3,7 @@ import {
|
|||
getPublicCollectionThumbnailURL,
|
||||
} from 'utils/common/apiUtil';
|
||||
import CryptoWorker from 'utils/crypto';
|
||||
import {
|
||||
generateStreamFromArrayBuffer,
|
||||
convertForPreview,
|
||||
needsConversionForPreview,
|
||||
} from 'utils/file';
|
||||
import { generateStreamFromArrayBuffer, convertForPreview } from 'utils/file';
|
||||
import HTTPService from './HTTPService';
|
||||
import { EnteFile } from 'types/file';
|
||||
|
||||
|
@ -107,19 +103,16 @@ class PublicCollectionDownloadManager {
|
|||
passwordToken: string,
|
||||
forPreview = false
|
||||
) => {
|
||||
const shouldBeConverted = forPreview && needsConversionForPreview(file);
|
||||
const fileKey = shouldBeConverted
|
||||
? `${file.id}_converted`
|
||||
: `${file.id}`;
|
||||
const fileKey = forPreview ? `${file.id}_preview` : `${file.id}`;
|
||||
try {
|
||||
const getFilePromise = async (convert: boolean) => {
|
||||
const getFilePromise = async () => {
|
||||
const fileStream = await this.downloadFile(
|
||||
token,
|
||||
passwordToken,
|
||||
file
|
||||
);
|
||||
const fileBlob = await new Response(fileStream).blob();
|
||||
if (convert) {
|
||||
if (forPreview) {
|
||||
const convertedBlobs = await convertForPreview(
|
||||
file,
|
||||
fileBlob
|
||||
|
@ -131,10 +124,7 @@ class PublicCollectionDownloadManager {
|
|||
return [URL.createObjectURL(fileBlob)];
|
||||
};
|
||||
if (!this.fileObjectURLPromise.get(fileKey)) {
|
||||
this.fileObjectURLPromise.set(
|
||||
fileKey,
|
||||
getFilePromise(shouldBeConverted)
|
||||
);
|
||||
this.fileObjectURLPromise.set(fileKey, getFilePromise());
|
||||
}
|
||||
const fileURLs = await this.fileObjectURLPromise.get(fileKey);
|
||||
return fileURLs;
|
||||
|
|
Loading…
Reference in a new issue