shared-albums: add support for handling both hex and base58 encoding for ck
This commit is contained in:
parent
2dd2c64a78
commit
068d20ffca
|
@ -36,6 +36,7 @@ const Loader = () => (
|
||||||
</EnteSpinner>
|
</EnteSpinner>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
|
const bs58 = require('bs58');
|
||||||
export default function PublicCollectionGallery() {
|
export default function PublicCollectionGallery() {
|
||||||
const token = useRef<string>(null);
|
const token = useRef<string>(null);
|
||||||
const collectionKey = useRef<string>(null);
|
const collectionKey = useRef<string>(null);
|
||||||
|
@ -92,10 +93,13 @@ export default function PublicCollectionGallery() {
|
||||||
const currentURL = new URL(url.current);
|
const currentURL = new URL(url.current);
|
||||||
const t = currentURL.searchParams.get('t');
|
const t = currentURL.searchParams.get('t');
|
||||||
const ck = currentURL.hash.slice(1);
|
const ck = currentURL.hash.slice(1);
|
||||||
const dck = await worker.fromHex(ck);
|
if (!t || !ck) {
|
||||||
if (!t || !dck) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const dck =
|
||||||
|
ck.length < 50
|
||||||
|
? await worker.toB64(bs58.decode(ck))
|
||||||
|
: await worker.fromHex(ck);
|
||||||
token.current = t;
|
token.current = t;
|
||||||
collectionKey.current = dck;
|
collectionKey.current = dck;
|
||||||
url.current = window.location.href;
|
url.current = window.location.href;
|
||||||
|
|
Loading…
Reference in a new issue