diff --git a/src/config.ts b/src/config.ts index a4445e5d..5e884533 100644 --- a/src/config.ts +++ b/src/config.ts @@ -8,6 +8,7 @@ const config: { readonly key: string readonly domain: string + readonly cdnDomain: string readonly site: string readonly api: string readonly cdn: string @@ -31,6 +32,7 @@ const config: { key: 'iszy', domain: 'iszy.xyz', + cdnDomain: 'iszy.cc', site: 'tools', api: 'api', cdn: 'cdn', @@ -46,7 +48,7 @@ const config: { return `${this.api}.${this.domain}` }, get cdnHost() { - return `${this.cdn}.${this.domain}` + return `${this.cdn}.${this.cdnDomain || this.domain}` }, get siteOrigin() { diff --git a/uno.config.ts b/uno.config.ts index 66dd95ab..93f39d82 100644 --- a/uno.config.ts +++ b/uno.config.ts @@ -7,7 +7,9 @@ import { transformerDirectives, transformerVariantGroup, } from 'unocss' +import axios from 'axios' import tools from './src/tools' +import config from './src/config' const iconClass = tools.map(item => item.icon).filter(item => item) @@ -23,6 +25,10 @@ export default defineConfig({ }), presetWebFonts({ provider: 'google', + async customFetch(url) { + url = url.replace('fonts.googleapis.com', `fonts.${config.cdnHost}`) + return axios.get(url).then(res => res.data) + }, fonts: { main: [ {