various bugfixes
This commit is contained in:
8
build/defaultSite.mjs
Normal file
8
build/defaultSite.mjs
Normal file
@ -0,0 +1,8 @@
|
||||
/** Validate the non-secret default site embedded in the renderer at build time. */
|
||||
export function defaultSite(value = 'https://ttp.joeykimsey.com') {
|
||||
const url = new URL(value.trim())
|
||||
if (!['https:', 'http:'].includes(url.protocol) || url.username || url.password || url.search || url.hash) {
|
||||
throw new Error('CAPSULE_DEFAULT_SITE must be an HTTP(S) site URL without credentials, query, or fragment.')
|
||||
}
|
||||
return url.href.replace(/\/+$/, '')
|
||||
}
|
||||
Reference in New Issue
Block a user