Browse Source

use npms.io API to load plugins

Eugene Pankov 3 years ago
parent
commit
1aa45ddcdf
1 changed files with 2 additions and 6 deletions
  1. 2 6
      tabby-plugin-manager/src/services/pluginManager.service.ts

+ 2 - 6
tabby-plugin-manager/src/services/pluginManager.service.ts

@@ -47,13 +47,9 @@ export class PluginManagerService {
 
     _listAvailableInternal (namePrefix: string, keyword: string, query?: string): Observable<PluginInfo[]> {
         return from(
-            axios.get(`https://www.npmjs.com/search?q=keywords%3A${keyword}+${encodeURIComponent(query ?? '')}&from=0&size=1000`, {
-                headers: {
-                    'x-spiferack': '1',
-                },
-            })
+            axios.get(`https://api.npms.io/v2/search?q=keywords%3A${keyword}+${encodeURIComponent(query ?? '')}&size=250`)
         ).pipe(
-            map(response => response.data.objects
+            map(response => response.data.results
                 .filter(item => !item.keywords?.includes('tabby-dummy-transition-plugin'))
                 .map(item => ({
                     name: item.package.name.substring(namePrefix.length),