diff --git a/shared/cache/cache.ts b/shared/cache/cache.ts index ae74af3b..49babcf5 100644 --- a/shared/cache/cache.ts +++ b/shared/cache/cache.ts @@ -1,7 +1,7 @@ import { ChatConverseInfo, fetchConverseInfo } from '../model/converse'; import { findGroupInviteByCode, GroupInvite } from '../model/group'; import { - fetchGithubStaticRegistryPlugins, + fetchLocalStaticRegistryPlugins, fetchRegistryPlugins, fetchServiceRegistryPlugins, PluginManifest, @@ -63,7 +63,7 @@ export async function getCachedRegistryPlugins(): Promise { Promise.all([ fetchRegistryPlugins().catch(() => []), fetchServiceRegistryPlugins().catch(() => []), - fetchGithubStaticRegistryPlugins().catch(() => []), + fetchLocalStaticRegistryPlugins().catch(() => []), ]).then(([a, b, c]) => [...a, ...b, ...c]), { staleTime: 2 * 60 * 60 * 1000, // 缓存2小时 diff --git a/shared/model/plugin.ts b/shared/model/plugin.ts index 5501864c..e01a4d8b 100644 --- a/shared/model/plugin.ts +++ b/shared/model/plugin.ts @@ -72,16 +72,14 @@ export async function fetchServiceRegistryPlugins() { } /** - * 获取官方Github注册表文件 + * 获取本地固定的registry * * 前端固定 */ -export async function fetchGithubStaticRegistryPlugins(): Promise< +export async function fetchLocalStaticRegistryPlugins(): Promise< PluginManifest[] > { - const data = await fetch( - 'https://raw.githubusercontent.com/msgbyte/tailchat/master/registry.json' - ); + const { data } = await request.get('/registry.json', { baseURL: '' }); - return await data.json(); + return data; } diff --git a/web/build/webpack.config.ts b/web/build/webpack.config.ts index 4358b66e..d767b8e6 100644 --- a/web/build/webpack.config.ts +++ b/web/build/webpack.config.ts @@ -69,6 +69,10 @@ const plugins: Configuration['plugins'] = [ from: path.resolve(ROOT_PATH, '../locales'), to: 'locales', }, + { + from: path.resolve(ROOT_PATH, './registry.json'), + to: 'registry.json', + }, { from: path.resolve(ROOT_PATH, './assets/pwa.webmanifest'), to: 'pwa.webmanifest', diff --git a/registry.json b/web/registry.json similarity index 100% rename from registry.json rename to web/registry.json