This commit is contained in:
Jan Prochazka 2021-01-18 17:38:03 +01:00
parent 22d37bda5d
commit 97a4cd1653

View File

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