1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-30 23:44:55 +02:00

Desktop: Install default plugins on first app start (#6585)

This commit is contained in:
Mayank Bondre
2022-09-01 16:14:33 +05:30
committed by GitHub
parent 1069d7d6fb
commit 01f4bb0591
14 changed files with 382 additions and 7 deletions

View File

@ -28,6 +28,19 @@ export interface Plugins {
[key: string]: Plugin;
}
export interface SettingAndValue {
[settingName: string]: string;
}
export interface DefaultPluginSettings {
version: string;
settings?: SettingAndValue;
}
export interface DefaultPluginsInfo {
[pluginId: string]: DefaultPluginSettings;
}
export interface PluginSetting {
enabled: boolean;
deleted: boolean;
@ -416,7 +429,7 @@ export default class PluginService extends BaseService {
return this.installPluginFromRepo(repoApi, pluginId);
}
public async installPlugin(jplPath: string): Promise<Plugin> {
public async installPlugin(jplPath: string, loadPlugin: boolean = true): Promise<Plugin | null> {
logger.info(`Installing plugin: "${jplPath}"`);
// Before moving the plugin to the profile directory, we load it
@ -429,9 +442,11 @@ export default class PluginService extends BaseService {
await shim.fsDriver().copy(jplPath, destPath);
// Now load it from the profile directory
const plugin = await this.loadPluginFromPath(destPath);
if (!this.plugins_[plugin.id]) this.setPluginAt(plugin.id, plugin);
return plugin;
if (loadPlugin) {
const plugin = await this.loadPluginFromPath(destPath);
if (!this.plugins_[plugin.id]) this.setPluginAt(plugin.id, plugin);
return plugin;
} else { return null; }
}
private async pluginPath(pluginId: string) {