decentralised message store

fix: make url take from origin

serenity 0bc7204a aec09476

Changed files
+4 -4
src
lib
utils
+4 -4
src/lib/utils/atproto.ts
···
service.id === "#atproto_pds" &&
service.type === "AtprotoPersonalDataServer",
);
+
if (!pdsService)
return {
ok: false,
···
let pdsEndpointUrl;
try {
// @ts-expect-error yes, we are coercing something that is explicitly not a string into a string, but in this case we want to be specific. only serviceEndpoints with valid atproto pds URLs should be allowed.
-
pdsEndpointUrl = new URL(pdsEndpointRecord);
+
pdsEndpointUrl = new URL(pdsEndpointRecord).origin;
} catch (err) {
return { ok: false, error: err };
}
-
const req = new Request(
-
`${pdsEndpointUrl}/xrpc/com.atproto.repo.getRecord?did=${didDocResult.data.id}&collection=${collection}&rkey=${rKey}`,
+
`${pdsEndpointUrl}/xrpc/com.atproto.repo.getRecord?repo=${didDocResult.data.id}&collection=${collection}&rkey=${rKey}`,
);
+
const res = await fetch(req);
const data: unknown = await res.json();
···
if (!responseParseSuccess) {
return { ok: false, error: responseParseError };
}
-
return { ok: true, data: record.value };
};