fix(server,web): correctly remove metadata from shared links (#4464)

* wip: strip metadata

* fix: authenticate time buckets

* hide detail panel

* fix tests

* fix lint

* add e2e tests

* chore: open api

* fix web compilation error

* feat: test with asset with gps position

* fix: only import fs.promises.cp

* fix: cleanup mapasset

* fix: format

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Jonathan Jogenfors
2023-10-14 03:46:30 +02:00
committed by GitHub
parent 4a9f58bf9b
commit dadcf49eca
39 changed files with 332 additions and 150 deletions

View File

@@ -640,6 +640,12 @@ export interface AssetResponseDto {
* @memberof AssetResponseDto
*/
'fileModifiedAt': string;
/**
*
* @type {boolean}
* @memberof AssetResponseDto
*/
'hasMetadata': boolean;
/**
*
* @type {string}
@@ -749,7 +755,7 @@ export interface AssetResponseDto {
*/
'tags'?: Array<TagResponseDto>;
/**
* base64 encoded thumbhash
*
* @type {string}
* @memberof AssetResponseDto
*/
@@ -2882,7 +2888,7 @@ export interface SharedLinkCreateDto {
* @type {boolean}
* @memberof SharedLinkCreateDto
*/
'showExif'?: boolean;
'showMetadata'?: boolean;
/**
*
* @type {SharedLinkType}
@@ -2927,7 +2933,7 @@ export interface SharedLinkEditDto {
* @type {boolean}
* @memberof SharedLinkEditDto
*/
'showExif'?: boolean;
'showMetadata'?: boolean;
}
/**
*
@@ -2994,7 +3000,7 @@ export interface SharedLinkResponseDto {
* @type {boolean}
* @memberof SharedLinkResponseDto
*/
'showExif': boolean;
'showMetadata': boolean;
/**
*
* @type {SharedLinkType}

View File

@@ -28,6 +28,7 @@
export let showMotionPlayButton: boolean;
export let isMotionPhotoPlaying = false;
export let showDownloadButton: boolean;
export let showDetailButton: boolean;
export let showSlideshow = false;
const isOwner = asset.ownerId === $page.data.user?.id;
@@ -133,7 +134,14 @@
title="Download"
/>
{/if}
<CircleIconButton isOpacity={true} logo={InformationOutline} on:click={() => dispatch('showDetail')} title="Info" />
{#if showDetailButton}
<CircleIconButton
isOpacity={true}
logo={InformationOutline}
on:click={() => dispatch('showDetail')}
title="Info"
/>
{/if}
{#if isOwner}
<CircleIconButton
isOpacity={true}

View File

@@ -55,6 +55,7 @@
let shouldPlayMotionPhoto = false;
let isShowProfileImageCrop = false;
let shouldShowDownloadButton = sharedLink ? sharedLink.allowDownload : !asset.isOffline;
let shouldShowDetailButton = asset.hasMetadata;
let canCopyImagesToClipboard: boolean;
const onKeyboardPress = (keyInfo: KeyboardEvent) => handleKeyboardPress(keyInfo);
@@ -392,6 +393,7 @@
showZoomButton={asset.type === AssetTypeEnum.Image}
showMotionPlayButton={!!asset.livePhotoVideoId}
showDownloadButton={shouldShowDownloadButton}
showDetailButton={shouldShowDetailButton}
showSlideshow={!!assetStore}
on:goBack={closeViewer}
on:showDetail={showDetailInfoHandler}
@@ -433,9 +435,9 @@
on:close={closeViewer}
on:onVideoEnded={() => (shouldPlayMotionPhoto = false)}
/>
{:else if asset.exifInfo?.projectionType === ProjectionType.EQUIRECTANGULAR || asset.originalPath
.toLowerCase()
.endsWith('.insp')}
{:else if asset.exifInfo?.projectionType === ProjectionType.EQUIRECTANGULAR || (asset.originalPath && asset.originalPath
.toLowerCase()
.endsWith('.insp'))}
<PanoramaViewer {asset} />
{:else}
<PhotoViewer {asset} on:close={closeViewer} />

View File

@@ -21,7 +21,7 @@
let description = '';
let allowDownload = true;
let allowUpload = false;
let showExif = true;
let showMetadata = true;
let expirationTime = '';
let shouldChangeExpirationTime = false;
let canCopyImagesToClipboard = true;
@@ -41,7 +41,7 @@
}
allowUpload = editingLink.allowUpload;
allowDownload = editingLink.allowDownload;
showExif = editingLink.showExif;
showMetadata = editingLink.showMetadata;
albumId = editingLink.album?.id;
assetIds = editingLink.assets.map(({ id }) => id);
@@ -66,7 +66,7 @@
allowUpload,
description,
allowDownload,
showExif,
showMetadata,
},
});
sharedLink = `${window.location.origin}/share/${data.key}`;
@@ -119,9 +119,9 @@
sharedLinkEditDto: {
description,
expiresAt: shouldChangeExpirationTime ? expirationDate : undefined,
allowUpload: allowUpload,
allowDownload: allowDownload,
showExif: showExif,
allowUpload,
allowDownload,
showMetadata,
},
});
@@ -184,7 +184,7 @@
</div>
<div class="my-3">
<SettingSwitch bind:checked={showExif} title={'Show metadata'} />
<SettingSwitch bind:checked={showMetadata} title={'Show metadata'} />
</div>
<div class="my-3">

View File

@@ -136,7 +136,7 @@
</div>
{/if}
{#if link.showExif}
{#if link.showMetadata}
<div
class="flex w-[60px] place-content-center place-items-center rounded-full bg-immich-primary px-2 py-1 text-xs text-white dark:bg-immich-dark-primary dark:text-immich-dark-gray"
>