You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-24 23:26:50 +02:00
Merge branch 'dev' of github.com:laurent22/joplin into dev
This commit is contained in:
@ -4,6 +4,7 @@ import Global from './api/Global';
|
||||
import BasePluginRunner from './BasePluginRunner';
|
||||
import BaseService from '../BaseService';
|
||||
import shim from '../../shim';
|
||||
import { rtrimSlashes } from '../../path-utils';
|
||||
const { filename, dirname } = require('../../path-utils');
|
||||
const uslug = require('uslug');
|
||||
|
||||
@ -90,11 +91,15 @@ export default class PluginService extends BaseService {
|
||||
}
|
||||
|
||||
public async loadPluginFromString(pluginId: string, baseDir: string, jsBundleString: string): Promise<Plugin> {
|
||||
baseDir = rtrimSlashes(baseDir);
|
||||
|
||||
const r = await this.parsePluginJsBundle(jsBundleString);
|
||||
return this.loadPlugin(pluginId, baseDir, r.manifestText, r.scriptText);
|
||||
}
|
||||
|
||||
private async loadPluginFromPath(path: string): Promise<Plugin> {
|
||||
path = rtrimSlashes(path);
|
||||
|
||||
const fsDriver = shim.fsDriver();
|
||||
|
||||
if (path.toLowerCase().endsWith('.js')) return this.loadPluginFromString(filename(path), dirname(path), await fsDriver.readFile(path));
|
||||
@ -114,6 +119,8 @@ export default class PluginService extends BaseService {
|
||||
}
|
||||
|
||||
private async loadPlugin(pluginId: string, baseDir: string, manifestText: string, scriptText: string): Promise<Plugin> {
|
||||
baseDir = rtrimSlashes(baseDir);
|
||||
|
||||
const manifest = manifestFromObject(JSON.parse(manifestText));
|
||||
|
||||
// After transforming the plugin path to an ID, multiple plugins might end up with the same ID. For
|
||||
|
Reference in New Issue
Block a user