mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 16:33:16 +00:00
feat(journey): read and unlock protected share links in the client hooks
The data side of the protected journey link (#2553), without markup yet: - journeyApi.unlockPublicJourney posts a reader's password; the answer sets the link's unlock cookie. - useJourneyPublic tells a locked link (access 'locked') and an expired one ('expired') apart from a broken one, and unlock() reports 'ok', 'wrong', 'rate_limited', 'expired' or 'failed', reloading the journey on success. - useJourneyShareLink carries has_password, expires_at, view_count and last_viewed_at, and setProtection() sets or clears the password and the expiry, shown only once the server took it.
This commit is contained in:
@@ -1047,6 +1047,12 @@ export const journeyApi = {
|
||||
createShareLink: (id: number, perms: JourneyShareLinkRequest) => apiClient.post(`/journeys/${id}/share-link`, perms).then(r => r.data),
|
||||
deleteShareLink: (id: number) => apiClient.delete(`/journeys/${id}/share-link`).then(r => r.data),
|
||||
getPublicJourney: (token: string) => apiClient.get(`/public/journey/${token}`).then(r => r.data),
|
||||
/**
|
||||
* A reader's password for a protected link (#2553). The answer sets the link's
|
||||
* unlock cookie, which every later read and photo of that link sends along.
|
||||
*/
|
||||
unlockPublicJourney: (token: string, password: string): Promise<{ success: true }> =>
|
||||
apiClient.post(`/public/journey/${token}/unlock`, { password }).then(r => r.data),
|
||||
}
|
||||
|
||||
// Photo providers (Immich, Synology Photos, …) behind /api/integrations/memories.
|
||||
|
||||
Reference in New Issue
Block a user