feat: add itunes email
This commit is contained in:
@@ -26,6 +26,14 @@ export async function GET(
|
||||
|
||||
const hasAudio = pages.list?.find((page) => page.metadata?.content?.audio)
|
||||
|
||||
const email = site?.metadata?.content?.connected_accounts
|
||||
?.map((account) => {
|
||||
const match = account.match(/:\/\/account:(.*)@email/)
|
||||
if (match) {
|
||||
return match[1]
|
||||
}
|
||||
})
|
||||
.find((email) => email)
|
||||
const link = getSiteLink({
|
||||
subdomain: site?.handle || "",
|
||||
domain: site?.metadata?.content?.custom_domain,
|
||||
@@ -40,8 +48,13 @@ export async function GET(
|
||||
...(hasAudio && {
|
||||
_itunes: {
|
||||
image: site?.metadata?.content?.avatars?.[0],
|
||||
author: site?.metadata?.content?.name,
|
||||
author:
|
||||
site?.metadata?.content?.site_name || site?.metadata?.content?.name,
|
||||
summary: site?.metadata?.content?.bio,
|
||||
owner: {
|
||||
email: email,
|
||||
name: site?.metadata?.content?.name,
|
||||
},
|
||||
},
|
||||
}),
|
||||
items: pages.list?.map((page) => ({
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
// @ts-nocheck
|
||||
globalThis._singletons = globalThis._singletons || {}
|
||||
|
||||
export const singleton = <T>(id: string, factory: () => T): T => {
|
||||
if (!globalThis._singletons[id]) {
|
||||
globalThis._singletons[id] = factory()
|
||||
}
|
||||
return globalThis._singletons[id]
|
||||
}
|
||||
|
||||
export const singletonAsync = <T>(
|
||||
id: string,
|
||||
factory: () => Promise<T>,
|
||||
enableSingleton = true,
|
||||
): { readonly value: T; wait: Promise<void> } => {
|
||||
if (globalThis._singletons[id] && enableSingleton) {
|
||||
return {
|
||||
wait: Promise.resolve(),
|
||||
|
||||
get value() {
|
||||
return globalThis._singletons[id]
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
let ready = false
|
||||
|
||||
const wait = factory().then((value) => {
|
||||
ready = true
|
||||
globalThis._singletons[id] = value
|
||||
})
|
||||
|
||||
return {
|
||||
wait,
|
||||
|
||||
get value() {
|
||||
if (!ready) {
|
||||
throw new Error(`please await .wait before using the value of '${id}'`)
|
||||
}
|
||||
return globalThis._singletons[id]
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user