1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-24 23:26:50 +02:00

Desktop: Add support for searching and installing plugins from repository

This commit is contained in:
Laurent Cozic
2021-01-07 16:30:53 +00:00
parent 1700b29f7d
commit 6dc5a816e5
17 changed files with 775 additions and 329 deletions

View File

@ -7,6 +7,7 @@ import shim from '../../shim';
import { filename, dirname, rtrimSlashes } from '../../path-utils';
import Setting from '../../models/Setting';
import Logger from '../../Logger';
import RepositoryApi from './RepositoryApi';
const compareVersions = require('compare-versions');
const uslug = require('uslug');
const md5File = require('md5-file/promise');
@ -328,6 +329,13 @@ export default class PluginService extends BaseService {
return this.runner_.run(plugin, pluginApi);
}
public async installPluginFromRepo(repoApi: RepositoryApi, pluginId: string): Promise<Plugin> {
const pluginPath = await repoApi.downloadPlugin(pluginId);
const plugin = await this.installPlugin(pluginPath);
await shim.fsDriver().remove(pluginPath);
return plugin;
}
public async installPlugin(jplPath: string): Promise<Plugin> {
logger.info(`Installing plugin: "${jplPath}"`);