You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Cli: Fixes #3548: Desktop-only scripts were incorrectly being loaded in CLI server tool
This commit is contained in:
		| @@ -18,7 +18,8 @@ class Command extends BaseCommand { | ||||
| 		const command = args.command; | ||||
|  | ||||
| 		const ClipperServer = require('lib/ClipperServer'); | ||||
| 		const stdoutFn = (s) => this.stdout(s); | ||||
| 		ClipperServer.instance().initialize(); | ||||
| 		const stdoutFn = (...s) => this.stdout(s.join(' ')); | ||||
| 		const clipperLogger = new Logger(); | ||||
| 		clipperLogger.addTarget('file', { path: `${Setting.value('profileDir')}/log-clipper.txt` }); | ||||
| 		clipperLogger.addTarget('console', { console: { | ||||
|   | ||||
| @@ -20,6 +20,7 @@ const InteropService = require('lib/services/InteropService'); | ||||
| const InteropServiceHelper = require('./InteropServiceHelper.js'); | ||||
| const ResourceService = require('lib/services/ResourceService'); | ||||
| const ClipperServer = require('lib/ClipperServer'); | ||||
| const actionApi = require('lib/services/rest/actionApi.desktop').default; | ||||
| const ExternalEditWatcher = require('lib/services/ExternalEditWatcher'); | ||||
| const ResourceEditWatcher = require('lib/services/ResourceEditWatcher/index').default; | ||||
| const { bridge } = require('electron').remote.require('./bridge'); | ||||
| @@ -1255,6 +1256,7 @@ class Application extends BaseApplication { | ||||
| 		clipperLogger.addTarget('file', { path: `${Setting.value('profileDir')}/log-clipper.txt` }); | ||||
| 		clipperLogger.addTarget('console'); | ||||
|  | ||||
| 		ClipperServer.instance().initialize(actionApi); | ||||
| 		ClipperServer.instance().setLogger(clipperLogger); | ||||
| 		ClipperServer.instance().setDispatch(this.store().dispatch); | ||||
|  | ||||
|   | ||||
| @@ -4,7 +4,6 @@ const { Logger } = require('lib/logger.js'); | ||||
| const { randomClipperPort, startPort } = require('lib/randomClipperPort'); | ||||
| const enableServerDestroy = require('server-destroy'); | ||||
| const Api = require('lib/services/rest/Api'); | ||||
| const actionApi = require('lib/services/rest/actionApi.desktop').default; | ||||
| const ApiResponse = require('lib/services/rest/ApiResponse'); | ||||
| const multiparty = require('multiparty'); | ||||
|  | ||||
| @@ -14,9 +13,6 @@ class ClipperServer { | ||||
| 		this.startState_ = 'idle'; | ||||
| 		this.server_ = null; | ||||
| 		this.port_ = null; | ||||
| 		this.api_ = new Api(() => { | ||||
| 			return Setting.value('api.token'); | ||||
| 		}, actionApi); | ||||
| 	} | ||||
|  | ||||
| 	static instance() { | ||||
| @@ -25,6 +21,12 @@ class ClipperServer { | ||||
| 		return this.instance_; | ||||
| 	} | ||||
|  | ||||
| 	initialize(actionApi = null) { | ||||
| 		this.api_ = new Api(() => { | ||||
| 			return Setting.value('api.token'); | ||||
| 		}, actionApi); | ||||
| 	} | ||||
|  | ||||
| 	setLogger(l) { | ||||
| 		this.logger_ = l; | ||||
| 		this.api_.setLogger(l); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user