优化界面

This commit is contained in:
eafonyang
2026-07-27 18:14:19 +08:00
parent 3872d7d1dd
commit c099492380
5 changed files with 70 additions and 12 deletions
+27 -10
View File
@@ -1,12 +1,29 @@
import type { AllowList } from 'payload'
export const eversoloPasteURLAllowList: AllowList = [
{
hostname: 'www.eversolo.com',
protocol: 'https',
},
{
hostname: 'eversolo.com',
protocol: 'https',
},
]
/**
* Paste-URL allow list for upload fields (media / files / videos).
*
* Configure via the NEXT_PUBLIC_PASTE_URL_ALLOW_LIST environment variable:
* - Comma-separated hostnames, e.g. "www.eversolo.com,am.luxsinaudio.com"
* - Bare hostnames default to https; you may also pass full "protocol://host" entries.
* - When the variable is unset or empty, the built-in defaults below are used.
*
* NOTE: NEXT_PUBLIC_ prefix is required so the client-side fetch interceptor
* can also read this value at build time.
*/
const DEFAULT_HOSTS = ['www.eversolo.com', 'eversolo.com', 'am.luxsinaudio.com']
function buildAllowList(): AllowList {
const raw = (process.env.NEXT_PUBLIC_PASTE_URL_ALLOW_LIST || '').trim()
const entries = raw ? raw.split(',').map((item) => item.trim()).filter(Boolean) : DEFAULT_HOSTS
return entries.map((entry) => {
if (/^https?:\/\//i.test(entry)) {
const url = new URL(entry)
return { hostname: url.hostname, protocol: url.protocol.replace(':', '') as 'http' | 'https' }
}
return { hostname: entry, protocol: 'https' as const }
})
}
export const eversoloPasteURLAllowList: AllowList = buildAllowList()