From 985e061424d8f1a55458ad33b78dccbb4dba30dd Mon Sep 17 00:00:00 2001 From: Rafa Date: Tue, 4 Jun 2024 13:14:12 +0200 Subject: [PATCH 1/2] [_] fix domain rotation --- src/app/photos/components/ShareDialog.tsx | 2 +- src/app/routes/paths.json | 18 ++++++++++++++++++ .../ShareItemDialog/ShareItemDialog.tsx | 2 +- src/app/share/services/share.service.ts | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/app/photos/components/ShareDialog.tsx b/src/app/photos/components/ShareDialog.tsx index 0f31589e1..bc031660a 100644 --- a/src/app/photos/components/ShareDialog.tsx +++ b/src/app/photos/components/ShareDialog.tsx @@ -77,7 +77,7 @@ export default function ShareDialog({ const encryptedMnemonic = aes.encrypt(mnemonic, code); const share = await shares.createShare({ bucket, encryptedMnemonic, photoIds: photos, token, views }); - const link = `${window.location.origin}/sh/photos/${share.id}/${code}`; + const link = `${window.location.origin}/photos/${share.id}/${code}`; setStatus({ tag: 'done', link }); } diff --git a/src/app/routes/paths.json b/src/app/routes/paths.json index 67ec33f68..72c821419 100644 --- a/src/app/routes/paths.json +++ b/src/app/routes/paths.json @@ -191,12 +191,24 @@ "path": "/sh/file/:token/:code?", "exact": false }, + { + "id": "share-token", + "layout": "share", + "path": "/d/file/:token/:code?", + "exact": false + }, { "id": "share-folder-token", "layout": "share", "path": "/sh/folder/:token/:code?", "exact": false }, + { + "id": "share-folder-token", + "layout": "share", + "path": "/d/folder/:token/:code?", + "exact": false + }, { "id": "share-guest-accept-invite", "layout": "empty", @@ -209,6 +221,12 @@ "path": "/sh/photos/:token([a-z0-9]{24})/:code", "exact": false }, + { + "id": "share-folder-token", + "layout": "share", + "path": "/d/folder/:token/:code?", + "exact": false + }, { "id": "guest-accept-invite", "layout": "empty", diff --git a/src/app/share/components/ShareItemDialog/ShareItemDialog.tsx b/src/app/share/components/ShareItemDialog/ShareItemDialog.tsx index 1f8f382f6..16dc2d078 100644 --- a/src/app/share/components/ShareItemDialog/ShareItemDialog.tsx +++ b/src/app/share/components/ShareItemDialog/ShareItemDialog.tsx @@ -32,7 +32,7 @@ async function copyShareLink(type: string, code: string, token: string, translat domainManager.getDomainsList().length > 0 ? domainManager.getDomainsList() : [window.location.origin]; const shareDomain = _.sample(domainList); - copy(`${shareDomain}/sh/${type}/${token}/${code}`); + copy(`${shareDomain}/${type}/${token}/${code}`); notificationsService.show({ text: translate('shared-links.toast.copy-to-clipboard'), type: ToastType.Success }); } diff --git a/src/app/share/services/share.service.ts b/src/app/share/services/share.service.ts index a9acad4f3..654375308 100644 --- a/src/app/share/services/share.service.ts +++ b/src/app/share/services/share.service.ts @@ -376,7 +376,7 @@ export const getPublicShareLink = async ( const domains = domainManager.getDomainsList(); const selectedDomain = getRandomElement(domains); - const publicShareLink = `${selectedDomain}/sh/${itemType}/${sharingId}/${plainCode}`; + const publicShareLink = `${selectedDomain}/${itemType}/${sharingId}/${plainCode}`; // workaround to enable copy after login, because first copy always fails copy(publicShareLink); const isCopied = copy(publicShareLink); From 5dafc3b620f6bebed313f5cd9c6be667e7aa2b6e Mon Sep 17 00:00:00 2001 From: Rafa Date: Tue, 4 Jun 2024 13:40:06 +0200 Subject: [PATCH 2/2] [_] go back to sh and add d --- src/app/photos/components/ShareDialog.tsx | 2 +- src/app/routes/paths.json | 22 +++++++++++++++++-- .../ShareItemDialog/ShareItemDialog.tsx | 2 +- src/app/share/services/share.service.ts | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/app/photos/components/ShareDialog.tsx b/src/app/photos/components/ShareDialog.tsx index bc031660a..0f31589e1 100644 --- a/src/app/photos/components/ShareDialog.tsx +++ b/src/app/photos/components/ShareDialog.tsx @@ -77,7 +77,7 @@ export default function ShareDialog({ const encryptedMnemonic = aes.encrypt(mnemonic, code); const share = await shares.createShare({ bucket, encryptedMnemonic, photoIds: photos, token, views }); - const link = `${window.location.origin}/photos/${share.id}/${code}`; + const link = `${window.location.origin}/sh/photos/${share.id}/${code}`; setStatus({ tag: 'done', link }); } diff --git a/src/app/routes/paths.json b/src/app/routes/paths.json index 72c821419..0f8d29a34 100644 --- a/src/app/routes/paths.json +++ b/src/app/routes/paths.json @@ -191,6 +191,12 @@ "path": "/sh/file/:token/:code?", "exact": false }, + { + "id": "share-token", + "layout": "share", + "path": "/d/sh/file/:token/:code?", + "exact": false + }, { "id": "share-token", "layout": "share", @@ -203,6 +209,12 @@ "path": "/sh/folder/:token/:code?", "exact": false }, + { + "id": "share-folder-token", + "layout": "share", + "path": "/d/sh/folder/:token/:code?", + "exact": false + }, { "id": "share-folder-token", "layout": "share", @@ -222,9 +234,15 @@ "exact": false }, { - "id": "share-folder-token", + "id": "share-photos-token", "layout": "share", - "path": "/d/folder/:token/:code?", + "path": "/d/sh/photos/:token([a-z0-9]{24})/:code", + "exact": false + }, + { + "id": "share-photos-token", + "layout": "share", + "path": "/d/photos/:token([a-z0-9]{24})/:code", "exact": false }, { diff --git a/src/app/share/components/ShareItemDialog/ShareItemDialog.tsx b/src/app/share/components/ShareItemDialog/ShareItemDialog.tsx index 16dc2d078..1f8f382f6 100644 --- a/src/app/share/components/ShareItemDialog/ShareItemDialog.tsx +++ b/src/app/share/components/ShareItemDialog/ShareItemDialog.tsx @@ -32,7 +32,7 @@ async function copyShareLink(type: string, code: string, token: string, translat domainManager.getDomainsList().length > 0 ? domainManager.getDomainsList() : [window.location.origin]; const shareDomain = _.sample(domainList); - copy(`${shareDomain}/${type}/${token}/${code}`); + copy(`${shareDomain}/sh/${type}/${token}/${code}`); notificationsService.show({ text: translate('shared-links.toast.copy-to-clipboard'), type: ToastType.Success }); } diff --git a/src/app/share/services/share.service.ts b/src/app/share/services/share.service.ts index 654375308..a9acad4f3 100644 --- a/src/app/share/services/share.service.ts +++ b/src/app/share/services/share.service.ts @@ -376,7 +376,7 @@ export const getPublicShareLink = async ( const domains = domainManager.getDomainsList(); const selectedDomain = getRandomElement(domains); - const publicShareLink = `${selectedDomain}/${itemType}/${sharingId}/${plainCode}`; + const publicShareLink = `${selectedDomain}/sh/${itemType}/${sharingId}/${plainCode}`; // workaround to enable copy after login, because first copy always fails copy(publicShareLink); const isCopied = copy(publicShareLink);