feat: shared links custom URL (#19999)

* feat: custom url for shared links

* feat: use a separate route and query param

---------

Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
Jed-Giblin
2025-07-28 14:16:55 -04:00
committed by GitHub
parent 16b14b390f
commit 9b3718120b
65 changed files with 947 additions and 432 deletions

View File

@@ -184,7 +184,7 @@ export const getAssetOriginalUrl = (options: string | AssetUrlOptions) => {
options = { id: options };
}
const { id, cacheKey } = options;
return createUrl(getAssetOriginalPath(id), { key: authManager.key, c: cacheKey });
return createUrl(getAssetOriginalPath(id), { ...authManager.params, c: cacheKey });
};
export const getAssetThumbnailUrl = (options: string | (AssetUrlOptions & { size?: AssetMediaSize })) => {
@@ -192,7 +192,7 @@ export const getAssetThumbnailUrl = (options: string | (AssetUrlOptions & { size
options = { id: options };
}
const { id, size, cacheKey } = options;
return createUrl(getAssetThumbnailPath(id), { size, key: authManager.key, c: cacheKey });
return createUrl(getAssetThumbnailPath(id), { ...authManager.params, size, c: cacheKey });
};
export const getAssetPlaybackUrl = (options: string | AssetUrlOptions) => {
@@ -200,7 +200,7 @@ export const getAssetPlaybackUrl = (options: string | AssetUrlOptions) => {
options = { id: options };
}
const { id, cacheKey } = options;
return createUrl(getAssetPlaybackPath(id), { key: authManager.key, c: cacheKey });
return createUrl(getAssetPlaybackPath(id), { ...authManager.params, c: cacheKey });
};
export const getProfileImageUrl = (user: UserResponseDto) =>
@@ -257,8 +257,9 @@ export const copyToClipboard = async (secret: string) => {
}
};
export const makeSharedLinkUrl = (key: string) => {
return new URL(`share/${key}`, get(serverConfig).externalDomain || globalThis.location.origin).href;
export const makeSharedLinkUrl = (sharedLink: SharedLinkResponseDto) => {
const path = sharedLink.slug ? `s/${sharedLink.slug}` : `share/${sharedLink.key}`;
return new URL(path, get(serverConfig).externalDomain || globalThis.location.origin).href;
};
export const oauth = {