fix: custom domain setting check
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { OUR_DOMAIN } from "./env"
|
||||
import { getSite } from "~/models/site.model"
|
||||
|
||||
export const getTenant = async (request: Request, search: URLSearchParams) => {
|
||||
const host = request.headers.get("host")
|
||||
@@ -33,8 +32,15 @@ export const getTenant = async (request: Request, search: URLSearchParams) => {
|
||||
const txt = await res.json()
|
||||
const tenant = txt?.Answer?.[0]?.data.replace(/^"|"$/g, "")
|
||||
if (tenant) {
|
||||
const site = await getSite(tenant)
|
||||
if (site.custom_domain === host) {
|
||||
const res = await fetch(
|
||||
`https://indexer.crossbell.io/v1/handles/${tenant}/character`,
|
||||
)
|
||||
const char = await res.json()
|
||||
const customDomain =
|
||||
char?.metadata?.content?.attributes?.find(
|
||||
(a: any) => a.trait_type === "xlog_custom_domain",
|
||||
)?.value || ""
|
||||
if (customDomain && customDomain === host) {
|
||||
return tenant
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user