[PR #2434] [MERGED] feat: Add path setting to share links (resourceAccessToken) #24339

Closed
opened 2026-06-05 07:46:06 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/pangolin/pull/2434
Author: @NHClaessens
Created: 2/8/2026
Status: Merged
Merged: 5/29/2026
Merged by: @oschwartz10612

Base: devHead: feature-share-link-redirect-path


📝 Commits (7)

  • a9b0bd8 Alter schema + add form field
  • b84a799 Adjust validation to allow creation with (optional) path
  • 94408aa Add path onto redirectUrl
  • ad7dcdd Add translations
  • db5d1d4 Update postgres schema
  • ffe1988 Reset translations
  • 8483616 Unstage ignored files

📊 Changes

6 files changed (+32 additions, -3 deletions)

View changed files

📝 messages/en-US.json (+1 -0)
📝 server/db/pg/schema/schema.ts (+1 -0)
📝 server/db/sqlite/schema/schema.ts (+1 -0)
📝 server/routers/accessToken/generateAccessToken.ts (+4 -1)
📝 server/routers/resource/authWithAccessToken.ts (+6 -1)
📝 src/components/CreateShareLinkForm.tsx (+19 -1)

📄 Description

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

Adds an optional path parameter to share links that allows specifying a custom redirect path when accessing a resource.

This feature addresses a specific use case, if this change is not desired in the main branch, or if any changes are required, I would be more than happy to cooperate.

The use case in question:

  • I run an Immich instance with shared albums
  • In order to allow users to upload pictures, the /api/ endpoint needs to be exposed, which is undesirable
  • Share links would mitigate this, as they use a cookie to only allow users with a link to access the resource
  • However, the link redirects to the base URL of the resource, with no option to change this
  • Thus, I have added the option to add an (optional) path onto a share link's redirect (e.g. share/xxxx)

Changes Made

  • Added path column in the resourceAccessToken schema in Postgres and SQLite schemas (optional field, so not a breaking change)
  • Added field in CreateSharedLinkForm.tsx
  • Change generateAccessToken.ts to accept and return path value
  • Change authWithAccessToken.ts to add the path onto the redirect url
  • Add translations for the new field

How to test?

  1. Go to Access > Links
  2. Create a new Share Link
  3. Optionally add a path
  4. Confirm that the final redirect leads to the expected location, and does not result in malformed URLs

(This is my first open-source contribution, thank you for your patience)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/pangolin/pull/2434 **Author:** [@NHClaessens](https://github.com/NHClaessens) **Created:** 2/8/2026 **Status:** ✅ Merged **Merged:** 5/29/2026 **Merged by:** [@oschwartz10612](https://github.com/oschwartz10612) **Base:** `dev` ← **Head:** `feature-share-link-redirect-path` --- ### 📝 Commits (7) - [`a9b0bd8`](https://github.com/fosrl/pangolin/commit/a9b0bd8b47ec9d248c2c185d191b172d71025ab8) Alter schema + add form field - [`b84a799`](https://github.com/fosrl/pangolin/commit/b84a7996a914b25ac22da2a04f686bcf94c3076e) Adjust validation to allow creation with (optional) path - [`94408aa`](https://github.com/fosrl/pangolin/commit/94408aad21821f2b416151bbb0358f4767894018) Add path onto redirectUrl - [`ad7dcdd`](https://github.com/fosrl/pangolin/commit/ad7dcddf24762c0fea0351fa2508a3eaba4b7600) Add translations - [`db5d1d4`](https://github.com/fosrl/pangolin/commit/db5d1d4a163aca18bbbfe2bb7ffaec574c1fe968) Update postgres schema - [`ffe1988`](https://github.com/fosrl/pangolin/commit/ffe198839a5b02063ad99e3ee6daf5e1ca2bd5b3) Reset translations - [`8483616`](https://github.com/fosrl/pangolin/commit/8483616b04d06973e1f354b375b1e39fa05d893e) Unstage ignored files ### 📊 Changes **6 files changed** (+32 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `messages/en-US.json` (+1 -0) 📝 `server/db/pg/schema/schema.ts` (+1 -0) 📝 `server/db/sqlite/schema/schema.ts` (+1 -0) 📝 `server/routers/accessToken/generateAccessToken.ts` (+4 -1) 📝 `server/routers/resource/authWithAccessToken.ts` (+6 -1) 📝 `src/components/CreateShareLinkForm.tsx` (+19 -1) </details> ### 📄 Description ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description Adds an optional `path` parameter to share links that allows specifying a custom redirect path when accessing a resource. This feature addresses a specific use case, if this change is not desired in the main branch, or if any changes are required, I would be more than happy to cooperate. The use case in question: - I run an Immich instance with shared albums - In order to allow users to upload pictures, the `/api/` endpoint needs to be exposed, which is undesirable - Share links would mitigate this, as they use a cookie to only allow users with a link to access the resource - However, the link redirects to the base URL of the resource, with no option to change this - Thus, I have added the option to add an (optional) path onto a share link's redirect (e.g. `share/xxxx`) ## Changes Made - Added `path` column in the `resourceAccessToken` schema in Postgres and SQLite schemas (optional field, so not a breaking change) - Added field in CreateSharedLinkForm.tsx - Change generateAccessToken.ts to accept and return `path` value - Change authWithAccessToken.ts to add the path onto the redirect url - Add translations for the new field ## How to test? 1. Go to `Access` > `Links` 2. Create a new Share Link 3. Optionally add a path 4. Confirm that the final redirect leads to the expected location, and does not result in malformed URLs (This is my first open-source contribution, thank you for your patience) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-05 07:46:06 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#24339