feat: 将registry收敛到代码中

移除因为github在国内访问不佳的问题导致插件列表加载异常的问题
release/desktop
moonrailgun 3 years ago
parent 15a099db39
commit 91c106b33b

@ -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<PluginManifest[]> {
Promise.all([
fetchRegistryPlugins().catch(() => []),
fetchServiceRegistryPlugins().catch(() => []),
fetchGithubStaticRegistryPlugins().catch(() => []),
fetchLocalStaticRegistryPlugins().catch(() => []),
]).then(([a, b, c]) => [...a, ...b, ...c]),
{
staleTime: 2 * 60 * 60 * 1000, // 缓存2小时

@ -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;
}

@ -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',

Loading…
Cancel
Save