[web] Use the public link origin provided by the server

When implementing https://github.com/ente-io/ente/pull/1443 it was found that
the Photos web app wasnt' using the sharedCollectionUrl prefix that is returned
by the server. Instead, it was using NEXT_PUBLIC_ENTE_ALBUMS_ENDPOINT as the
baseHost, while mobile client completely rely on the server for returning the
correct hostUrl.

**Tested by**

Running against the modified server, and verifying that changes to
apps.public-albums were being used.
This commit is contained in:
Manav Rathi
2024-04-15 09:57:01 +05:30
parent 8ed2c7cff9
commit bcfd144ce9
2 changed files with 3 additions and 6 deletions

View File

@@ -61,6 +61,9 @@
# on port 3002 (using `yarn dev:albums`), we can connect to it and emulate the
# production behaviour.
#
# Note: To use your custom albums endpoint in the generated public link, set the
# `apps.public-albums` property in museum's configuration.
#
# Enhancement: Consider splitting this into a separate app/ in this repository.
# That can also reduce bundle sizes and make it load faster.
#

View File

@@ -1,7 +1,6 @@
import { ensureElectron } from "@/next/electron";
import log from "@/next/log";
import { CustomError } from "@ente/shared/error";
import { getAlbumsURL } from "@ente/shared/network/api";
import { LS_KEYS, getData } from "@ente/shared/storage/localStorage";
import { getUnixTimeInMicroSecondsWithDelta } from "@ente/shared/time";
import { User } from "@ente/shared/user/types";
@@ -189,11 +188,6 @@ export function appendCollectionKeyToShareURL(
}
const sharableURL = new URL(url);
const albumsURL = new URL(getAlbumsURL());
sharableURL.protocol = albumsURL.protocol;
sharableURL.host = albumsURL.host;
sharableURL.pathname = albumsURL.pathname;
const bytes = Buffer.from(collectionKey, "base64");
sharableURL.hash = bs58.encode(bytes);