SOURCE / PINNED RELEASE
Made of little things.
Atlas map viewer
- Release
- 1d2807e80b44…
- Author-recorded commit
- 43810ed2b368…
- License
- LICENSE
- Author’s source reference
- nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-4757dbabc86
Archive hash verified: 8db6876d96c460ac…. The source-to-build association is the author’s claim; it has not been independently rebuilt.
export function httpUrl(value: string, base?: string) {
const url = new URL(value, base);
if (
!["http:", "https:"].includes(url.protocol) ||
url.username ||
url.password
)
throw new Error("Use an HTTP(S) URL without credentials.");
return url.href;
}
/** A map's immutable content reference is an identity, never an HTTP fetch target. */
export function mapReference(
value: string,
base?: string,
expectedRoot?: string,
) {
if (typeof value !== "string") throw new Error("Invalid map reference");
if (value.startsWith("htree:")) {
const match = /^htree:\/\/([a-f0-9]{64})$/.exec(value);
if (!match) throw new Error("Invalid Hashtree map reference");
if (expectedRoot !== undefined && match[1] !== expectedRoot)
throw new Error("Map reference and Hashtree root disagree");
return value;
}
return httpUrl(value, base);
}
