admin/plugins/search: now text is searched as author too
Massimo Melina committed
May 8, 2024 at 11:56 UTC
050b56aa6f6e541d17e7343c2dcee1cf241f4b40
1 file changed
+3
-1
src/github.ts
+3
-1
@@ -174,7 +174,9 @@ async function *apiGithubPaginated<T=any>(uri: string) {
174
175
export async function searchPlugins(text='', { skipRepos=[''] }={}) {
176
const projectInfo = await getProjectInfo()
177
- const list = await asyncGeneratorToArray(apiGithubPaginated(`search/repositories?q=topic:hfs-plugin+` + encodeURI(text)))
177
+ const list = await Promise.all(['', 'user:'].map(specifier => // search text with multiple specifiers
178
+ asyncGeneratorToArray(apiGithubPaginated(`search/repositories?q=topic:hfs-plugin+${specifier}${encodeURI(text)}`))))
179
+ .then(all => all.flat()) // make it a single array
180
return new AsapStream(list.map(async it => { // using AsapStream we parallelize these promises and produce each result as it's ready
181
const repo = it.full_name as string
182
if (projectInfo?.plugins_blacklist?.includes(repo) || skipRepos.includes(repo)) return