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

@ -5,6 +5,9 @@
- bug fixes
- rare issue that made the last widget(s) in a container disappear when other widgets in the same container had a specific property dependency pattern
- remote control
- `/EDIT*` commands sent by a custom module are not affected by the server's `read-only` option anymore
## 1.25.6
- bug fixes

View file

@ -11,8 +11,7 @@ When osc messages are received, the default behavior is to update the value of a
#### `/EDIT id properties options`
Apply a set of options to an existing widget by replacing the old ones with the new ones. This ignores the widget's `lock` property.
Apply a set of options to an existing widget by replacing the old ones with the new ones. This ignores the widget's `lock` property. If sent by a custom module using `receive()`, this command will not be prevented by the server's `read-only` option.
- `id`: `string`, widget's `id`
- `properties`: `string`, [JSON5](https://github.com/json5/json5) stringified object defining the new properties to merge

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){

View file

@ -36,7 +36,7 @@ class OscServer {
if (typeof lastArg === 'object' && lastArg !== null && lastArg.clientId !== undefined) {
options = args.pop()
}
this.receiveOsc({host, port, address, args:args.map(x=>this.parseArg(x))}, options.clientId)
this.receiveOsc({host, port, address, args:args.map(x=>this.parseArg(x)), cm: 1}, options.clientId)
},
}) : {}