Skip to content

feat(web/server) Add more options to public shared link - #1348

Merged
alextran1502 merged 16 commits into
mainfrom
feat/add-more-options-to-public-sharing
Jan 22, 2023
Merged

alextran1502 merged 16 commits into
mainfrom
feat/add-more-options-to-public-sharing

Conversation

@alextran1502

@alextran1502 alextran1502 commented Jan 17, 2023 •

Copy link
Copy Markdown
Member

This PR adds additional options to the public shared link. Resolves #1302

  1. Allow Download
  2. Show EXIF

Default creation form

image

@vercel

vercel Bot commented Jan 17, 2023 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
immich ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Jan 18, 2023 at 6:16PM (UTC)
immich-code-coverage ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Jan 18, 2023 at 6:16PM (UTC)

@vercel
vercel Bot temporarily deployed to Preview – immich-code-coverage January 17, 2023 22:13 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich January 17, 2023 22:13 Inactive
@alextran1502
alextran1502 requested a review from jrasm91 January 17, 2023 22:13
@vercel
vercel Bot temporarily deployed to Preview – immich-code-coverage January 17, 2023 22:16 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich January 17, 2023 22:17 Inactive
@zackpollard

zackpollard commented Jan 17, 2023 •

Copy link
Copy Markdown
Member

Something to consider with this is, if they deny showing exif, we should probably strip the exif from file downloads too, as otherwise that permission is pretty much pointless if they also allow downloading. Also, without this, the PR wouldn't really resolve #1302

Comment thread server/apps/immich/src/api-v1/album/album.service.ts
Comment thread server/apps/immich/src/api-v1/asset/asset-repository.ts Outdated
Comment on lines +148 to +154
let allowOriginalFile = true;
if (authUser.isPublicUser && !authUser.isAllowDownload) {
allowOriginalFile = false;
}

await this.assetService.checkAssetsAccess(authUser, [assetId]);
return this.assetService.serveFile(assetId, query, res, headers);
return this.assetService.serveFile(assetId, query, res, headers, allowOriginalFile);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're trying to move all the business logic into the service (out of the controller and repository). Would it make sense for the serveFile method to take in AuthUserDto, and then the allowOriginalFile logic could happen inside the service? In general I think it would be good for all the service methods to be refactored to take in authUser and dto, so this would be a good opportunity to do that here.

Comment thread server/apps/immich/src/api-v1/asset/asset.controller.ts Outdated
Comment thread server/apps/immich/src/api-v1/asset/asset.service.ts Outdated
Comment thread server/apps/immich/src/api-v1/asset/asset.service.ts Outdated
Comment on lines +702 to +707
async checkDownloadAccess(authUser: AuthUserDto) {
if (authUser.isPublicUser && !authUser.isAllowDownload) {
throw new ForbiddenException();
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to keep all the access logic in one place. It would probably be better to refactor checkAssetAccess at some point to work for both these situations. You could do this by adding a permission so like checkAssetAccess(authUser, assets, AssetAction.READ) or checkAssetAccess(authUser, assets, AssetAction.DOWNLOAD)`, etc.

Comment thread server/apps/immich/src/api-v1/asset/asset.service.ts Outdated
@vercel
vercel Bot temporarily deployed to Preview – immich January 18, 2023 03:43 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich-code-coverage January 18, 2023 03:44 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich-code-coverage January 18, 2023 03:48 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich January 18, 2023 03:49 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich-code-coverage January 18, 2023 03:56 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich January 18, 2023 03:56 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich-code-coverage January 18, 2023 14:04 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich January 18, 2023 14:05 Inactive
@JVT038

JVT038 commented Jan 18, 2023

Copy link
Copy Markdown

Could 'show EXIF' be changed to 'show metadata'?
I don't know if all users will know what "EXIF" means. Changing it to 'metadata' would probably improve clarity, because 'metadata' is more commonly used than 'EXIF'

@vercel
vercel Bot temporarily deployed to Preview – immich January 18, 2023 16:02 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich-code-coverage January 18, 2023 16:02 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich-code-coverage January 18, 2023 16:31 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich January 18, 2023 16:31 Inactive

@jrasm91 jrasm91 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

<AssetViewer
asset={selectedAsset}
publicSharedKey={key}
publicSharedKey={sharedLink?.key}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to pass the whole shared link and the shared link key as two separate props?

@vercel
vercel Bot temporarily deployed to Preview – immich-code-coverage January 18, 2023 18:15 Inactive
@vercel
vercel Bot temporarily deployed to Preview – immich January 18, 2023 18:16 Inactive
@alextran1502
alextran1502 merged commit b078910 into main Jan 22, 2023
@alextran1502
alextran1502 deleted the feat/add-more-options-to-public-sharing branch January 22, 2023 04:15

This branch was previously deployed

2 inactive deployments
Preview – immich — c45a6f0c Deployed Jan 18, 2023 by vercel[bot]
Preview – immich-code-coverage — c45a6f0c Deployed Jan 18, 2023 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: ability to share images/albums publicly without sharing GPS exifdata

4 participants