remote control: /EDIT* commands sent by a custom module are not affected by the server's read-only option anymore

This commit is contained in:
jean-emmanuel 2024-01-17 16:05:03 +01:00
parent 3a5fdf17c7
commit 9181c2a3aa
5 changed files with 16 additions and 14 deletions

View file

@ -69,7 +69,7 @@ var Osc = class Osc extends EventEmitter {
if (data._rawTarget && !CLIENT_SYNC) return
if (typeof this.remoteControl.exists === 'function' && this.remoteControl.exists(data.address)) this.remoteControl.exec(data.address, data.args)
if (typeof this.remoteControl.exists === 'function' && this.remoteControl.exists(data.address)) this.remoteControl.exec(data.address, data.args, data.cm)
var [widgets, restArgs] = widgetManager.getWidgetByAddressAndArgs(data.address, data.args)

View file

@ -8,9 +8,9 @@ var {updateWidget} = require('./editor/data-workers'),
uiConsole = require('./ui/ui-console')
var callbacks = {
'/EDIT': function(args) {
'/EDIT': function(args, custom_module) {
if (READ_ONLY) return
if (READ_ONLY && !custom_module) return
var [id, json, opts] = args,
newdata = typeof json == 'string' ? JSON.parseFlex(json) : json,
@ -40,9 +40,9 @@ var callbacks = {
if (options.noWarning) editor.unsavedSession = false
},
'/EDIT/MERGE': function(args) {
'/EDIT/MERGE': function(args, custom_module) {
if (READ_ONLY) return
if (READ_ONLY && !custom_module) return
var [id, json, opts] = args,
newdata = typeof json == 'string' ? JSON.parseFlex(json) : json,
@ -70,16 +70,16 @@ var callbacks = {
if (options.noWarning) editor.unsavedSession = false
},
'/EDIT/UNDO': function(args) {
'/EDIT/UNDO': function(args, custom_module) {
if (READ_ONLY) return
if (READ_ONLY && !custom_module) return
editor.undo()
},
'/EDIT/REDO': function(args) {
'/EDIT/REDO': function(args, custom_module) {
if (READ_ONLY) return
if (READ_ONLY && !custom_module) return
editor.redo()
@ -307,9 +307,9 @@ var callbacks = {
}
module.exports = {
exec: function(name, args){
exec: function(name, args, custom_module){
if (callbacks[name]) {
callbacks[name](args)
callbacks[name](args, custom_module)
}
},
exists: function(name){