From 97a4cd16536a4ac348de51356ac21e971bf9bb26 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Mon, 18 Jan 2021 17:38:03 +0100 Subject: [PATCH] fix --- packages/api/src/controllers/plugins.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/api/src/controllers/plugins.js b/packages/api/src/controllers/plugins.js index 5c026c75..86634230 100644 --- a/packages/api/src/controllers/plugins.js +++ b/packages/api/src/controllers/plugins.js @@ -51,7 +51,7 @@ module.exports = { `http://registry.npmjs.com/-/v1/search?text=${encodeURIComponent(filter)}+keywords:dbgateplugin&size=25&from=0` ); const { objects } = resp.data || {}; - return (objects || []).map(x => x.package); + return (objects || []).map((x) => x.package); }, info_meta: 'get', @@ -89,7 +89,9 @@ module.exports = { const files = await fs.readdir(pluginsdir()); const res = []; for (const packageName of files) { - const manifest = await fs.readFile(path.join(pluginsdir(), packageName, 'package.json')).then(x => JSON.parse(x)); + const manifest = await fs + .readFile(path.join(pluginsdir(), packageName, 'package.json')) + .then((x) => JSON.parse(x)); const readmeFile = path.join(pluginsdir(), packageName, 'README.md'); if (await fs.exists(readmeFile)) { manifest.readme = await fs.readFile(readmeFile, { encoding: 'utf-8' }); @@ -134,7 +136,7 @@ module.exports = { async authTypes({ engine }) { const packageName = extractPackageName(engine); const content = requirePlugin(packageName); - if (!content.driver || content.driver.engine != engine) return null; + if (!content.driver || content.driver.engine != engine || !content.driver.getAuthTypes) return null; return content.driver.getAuthTypes() || null; }, @@ -149,7 +151,7 @@ module.exports = { } for (const packageName of preinstallPlugins) { if (this.removedPlugins.includes(packageName)) continue; - if (installed.find(x => x.name == packageName)) continue; + if (installed.find((x) => x.name == packageName)) continue; try { console.log('Preinstalling plugin', packageName); await this.install({ packageName });