fix: admin/plugins/search: error '404' on repos with no dist/plugin.js

Massimo Melina committed Dec 22, 2023 at 15:37 UTC 1bde3d503b7ebb10d039f407b007f7aae72fe896
1 file changed +1 -2
src/github.ts
+1 -2
@@ -115,7 +115,6 @@ export async function readOnlinePlugin(repo: Repo, branch='') {
115 }
116 branch ||= await getGithubDefaultBranch(repo)
117 const res = await readGithubFile(`${repo}/${branch}/${DIST_ROOT}/plugin.js`)
118 - if (!res) throw Error("missing plugin.js")
118 const pl = parsePluginSource(repo, res) // use 'repo' as 'id' client-side
119 pl.branch = branch
120 return pl
@@ -165,7 +164,7 @@ export async function searchPlugins(text='') {
164 return new AsapStream(list.items.map(async (it: any) => {
165 const repo = it.full_name as string
166 if (projectInfo?.plugins_blacklist?.includes(repo)) return
168 - const pl = await readOnlineCompatiblePlugin(repo, it.default_branch)
167 + const pl = await readOnlineCompatiblePlugin(repo, it.default_branch).catch(() => undefined)
168 if (!pl) return
169 Object.assign(pl, { // inject some extra useful fields
170 downloading: downloading[repo],