diff --git a/configUtil.js b/configUtil.js index d6e1a7169..4bab3d5f0 100644 --- a/configUtil.js +++ b/configUtil.js @@ -28,6 +28,8 @@ module.exports = { 'base-uri ': "'self'", 'frame-ancestors': " 'none'", 'form-action': "'none'", + 'report-uri': ' https://csp-reporter.ente.io', + 'report-to': ' https://csp-reporter.ente.io', }, WORKBOX_CONFIG: { @@ -38,10 +40,9 @@ module.exports = { ALL_ROUTES: '/(.*)', buildCSPHeader: (directives) => ({ - 'Content-Security-Policy': Object.entries(directives).reduce( - (acc, [key, value]) => acc + `${key} ${value};`, - '' - ), + 'Content-Security-Policy-Report-Only': Object.entries( + directives + ).reduce((acc, [key, value]) => acc + `${key} ${value};`, ''), }), convertToNextHeaderFormat: (headers) => diff --git a/package.json b/package.json index 35f4c69da..bcedc93d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bada-frame", - "version": "0.6.1", + "version": "0.7.0", "private": true, "scripts": { "dev": "next dev", diff --git a/public/_headers b/public/_headers index a7f00d897..18af99761 100644 --- a/public/_headers +++ b/public/_headers @@ -8,5 +8,5 @@ X-Frame-Options: deny X-XSS-Protection: 1; mode=block Referrer-Policy: same-origin - Content-Security-Policy-Report-Only: default-src 'none'; img-src 'self' blob:; media-src 'self' blob:; style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self' 'unsafe-eval' blob:; manifest-src': 'self'; connect-src 'self' https://*.ente.io data: blob: https://ente-prod-eu.s3.eu-central-003.backblazeb2.com ; base-uri 'self'; frame-ancestors 'none'; form-action 'none'; report-uri https://csp-reporter.ente.io; report-to https://csp-reporter.ente.io; + Content-Security-Policy-Report-Only: default-src 'none'; img-src 'self' blob:; media-src 'self' blob:; style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self' 'unsafe-eval' blob:; manifest-src 'self'; connect-src 'self' https://*.ente.io data: blob: https://ente-prod-eu.s3.eu-central-003.backblazeb2.com ; base-uri 'self'; frame-ancestors 'none'; form-action 'none'; report-uri https://csp-reporter.ente.io; report-to https://csp-reporter.ente.io; diff --git a/sentry.client.config.js b/sentry.client.config.js index 34ad71aa9..4cb6db2df 100644 --- a/sentry.client.config.js +++ b/sentry.client.config.js @@ -29,6 +29,11 @@ Sentry.init({ event.request.url = currentURL; return event; }, + integrations: function (i) { + return i.filter(function (i) { + return i.name !== 'Breadcrumbs'; + }); + }, // ... // Note: if you want to override the automatic release value, do not set a // `release` value here - use the environment variable `SENTRY_RELEASE`, so diff --git a/src/components/PhotoFrame.tsx b/src/components/PhotoFrame.tsx index 259beb112..30d014db5 100644 --- a/src/components/PhotoFrame.tsx +++ b/src/components/PhotoFrame.tsx @@ -69,6 +69,7 @@ interface Props { deleted?: number[]; activeCollection: number; isSharedCollection: boolean; + enableDownload: boolean; } const PhotoFrame = ({ @@ -86,6 +87,7 @@ const PhotoFrame = ({ deleted, activeCollection, isSharedCollection, + enableDownload, }: Props) => { const [open, setOpen] = useState(false); const [currentIndex, setCurrentIndex] = useState(0); @@ -464,7 +466,8 @@ const PhotoFrame = ({ url = await PublicCollectionDownloadManager.getThumbnail( item, - publicCollectionGalleryContext.token + publicCollectionGalleryContext.token, + publicCollectionGalleryContext.passwordToken ); } else { url = await DownloadManager.getThumbnail(item); @@ -501,6 +504,7 @@ const PhotoFrame = ({ url = await PublicCollectionDownloadManager.getFile( item, publicCollectionGalleryContext.token, + publicCollectionGalleryContext.passwordToken, true ); } else { @@ -578,6 +582,7 @@ const PhotoFrame = ({ favItemIds={favItemIds} isSharedCollection={isSharedCollection} isTrashCollection={activeCollection === TRASH_SECTION} + enableDownload={enableDownload} /> )} diff --git a/src/components/PhotoSwipe/PhotoSwipe.tsx b/src/components/PhotoSwipe/PhotoSwipe.tsx index eec1a7a22..8757378a3 100644 --- a/src/components/PhotoSwipe/PhotoSwipe.tsx +++ b/src/components/PhotoSwipe/PhotoSwipe.tsx @@ -71,6 +71,7 @@ interface Iprops { favItemIds: Set; isSharedCollection: boolean; isTrashCollection: boolean; + enableDownload: boolean; } const LegendContainer = styled.div` @@ -704,7 +705,8 @@ function PhotoSwipe(props: Iprops) { await downloadFile( file, publicCollectionGalleryContext.accessedThroughSharedURL, - publicCollectionGalleryContext.token + publicCollectionGalleryContext.token, + publicCollectionGalleryContext.passwordToken ); galleryContext.finishLoading(); @@ -738,14 +740,15 @@ function PhotoSwipe(props: Iprops) { title={constants.CLOSE} /> -