From 71293de694b1949ddaa53b65ba3627fcc12e5e86 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 5 Dec 2025 17:53:50 +0100 Subject: [PATCH 001/166] docs: scription: set() external flag implies send:false, not sync:false --- resources/docs/docs/widgets/scripting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/docs/docs/widgets/scripting.md b/resources/docs/docs/widgets/scripting.md index 6860ec0f..498991c2 100644 --- a/resources/docs/docs/widgets/scripting.md +++ b/resources/docs/docs/widgets/scripting.md @@ -161,7 +161,7 @@ Returns the value of the first matching widget. If the returned value is an obje - `sync: false`: prevents widgets from triggering synchronization and scripts - `script: false`: prevents scripts but not synchronization - `send: false`: prevents widgets from sending osc messages - - `external: true`: simulates a value coming from an osc/midi message (implies `sync: false` automatically) + - `external: true`: simulates a value coming from an osc/midi message (implies `send: false` automatically) Sets the value of the first matching widget. If `ìd` contains wildcards, affects all matching widgets **except** the emitting widget. From 92ef3b7ac19107c355723e936c6f16b1206f4bda Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 9 Dec 2025 12:17:26 +0100 Subject: [PATCH 002/166] server/client: tidy up cache control, enforce server validation and remove version from build assets file names --- package.json | 2 +- resources/fonts/fa-solid.css | 2 +- resources/fonts/roboto.css | 10 +++++----- scripts/client.rollup.config.js | 4 ++-- scripts/launcher.rollup.config.js | 2 +- scripts/server.rollup.config.js | 2 +- src/html/client.html | 18 +++++++++--------- src/server/node/server.mjs | 31 +++++++++++++++++++++++++++---- src/server/node/theme.mjs | 4 ++++ 9 files changed, 51 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 745a9a23..c43af4a3 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "open-stage-control", "productName": "Open Stage Control", "description": "Libre and modular OSC / MIDI controller", - "version": "1.30.0-beta5", + "version": "1.30.0-beta6", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" diff --git a/resources/fonts/fa-solid.css b/resources/fonts/fa-solid.css index a372185a..ff9ec65e 100644 --- a/resources/fonts/fa-solid.css +++ b/resources/fonts/fa-solid.css @@ -11,7 +11,7 @@ font-style: normal; font-weight: 900; font-display: block; - src: url("./fa-solid-900.woff2?__OSC_ASSET__=1") format("woff2"); } + src: url("./fa-solid-900.woff2") format("woff2"); } .fa, .fas, diff --git a/resources/fonts/roboto.css b/resources/fonts/roboto.css index 6d9ce780..52ba4da3 100644 --- a/resources/fonts/roboto.css +++ b/resources/fonts/roboto.css @@ -2,14 +2,14 @@ font-family: 'Roboto'; font-style: normal; font-weight: 700; - src: url('./Roboto-Bold.woff2?__OSC_ASSET__=1') format('woff2'); + src: url('./Roboto-Bold.woff2') format('woff2'); } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 500; - src: url('./Roboto-Medium.woff2?__OSC_ASSET__=1') format('woff2'); + src: url('./Roboto-Medium.woff2') format('woff2'); } @@ -17,19 +17,19 @@ font-family: 'Roboto'; font-style: normal; font-weight: 400; - src: url('./Roboto-Regular.woff2?__OSC_ASSET__=1') format('woff2'); + src: url('./Roboto-Regular.woff2') format('woff2'); } @font-face { font-family: 'Roboto'; font-style: normal; font-weight: 100; - src: url('./Roboto-Light.woff2?__OSC_ASSET__=1') format('woff2'); + src: url('./Roboto-Light.woff2') format('woff2'); } @font-face { font-family: 'Roboto Mono'; font-style: normal; font-weight: 500; - src: url('./roboto-mono.woff?__OSC_ASSET__=1') format('woff'); + src: url('./roboto-mono.woff') format('woff'); } diff --git a/scripts/client.rollup.config.js b/scripts/client.rollup.config.js index 05f94f8d..2a708795 100644 --- a/scripts/client.rollup.config.js +++ b/scripts/client.rollup.config.js @@ -15,8 +15,8 @@ module.exports = { output: [ { dir: 'app/client/', - chunkFileNames: `[name]-${package.version}.js`, - entryFileNames: `[name]-${package.version}.js`, + chunkFileNames: `[name].js`, + entryFileNames: `[name].js`, format: 'es', sourcemap: true, sourcemapExcludeSources: true diff --git a/scripts/launcher.rollup.config.js b/scripts/launcher.rollup.config.js index 6c6ccfb4..c0b2eda1 100644 --- a/scripts/launcher.rollup.config.js +++ b/scripts/launcher.rollup.config.js @@ -13,7 +13,7 @@ module.exports = { output: [ { dir: 'app/launcher/', - chunkFileNames: `[name]-${package.version}.js`, + chunkFileNames: `[name].js`, format: 'commonjs', sourcemap: true, sourcemapExcludeSources: true, diff --git a/scripts/server.rollup.config.js b/scripts/server.rollup.config.js index 8fcabe0a..dac5b03a 100644 --- a/scripts/server.rollup.config.js +++ b/scripts/server.rollup.config.js @@ -16,7 +16,7 @@ module.exports = { output: [ { dir: 'app/server/', - chunkFileNames: `[name]-${package.version}.js`, + chunkFileNames: `[name].js`, format: 'commonjs', sourcemap: true, sourcemapExcludeSources: true, diff --git a/src/html/client.html b/src/html/client.html index bcc620c4..24ae5908 100644 --- a/src/html/client.html +++ b/src/html/client.html @@ -7,15 +7,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/src/server/node/server.mjs b/src/server/node/server.mjs index c631c84c..c87e248c 100644 --- a/src/server/node/server.mjs +++ b/src/server/node/server.mjs @@ -127,7 +127,21 @@ class WebServer extends EventEmitter { res.sendFile = (path)=>{ var fpath = path.split('?')[0] - if (!fs.existsSync(fpath)) throw `File "${fpath}" not found.` + var stats = fs.statSync(fpath) + if (!stats || !stats.isFile()) { + throw `File "${fpath}" not found.` + } + var lastModified = new Date(stats.mtime) + lastModified.setMilliseconds(0) + res.setHeader('Cache-Control', 'no-cache') + res.setHeader("Last-Modified", lastModified.toUTCString()) + if ( + req.headers['if-modified-since'] && new Date(req.headers['if-modified-since']).getTime() >= lastModified.getTime() + ) { + res.statusCode = 304 + res.end() + return + } return send(req, fpath).pipe(res) } @@ -152,6 +166,7 @@ class WebServer extends EventEmitter { clientOptions[k] = v } } + res.setHeader('Cache-Control', 'no-store') fs.createReadStream(path.resolve(__dirname + '/../../client/index.html')) .pipe(replaceStream('', ` + + + + From 934550c942548d122b89200f405a624d19b065c2 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 13 Dec 2025 11:20:58 +0100 Subject: [PATCH 018/166] events: make sure event.offsetX/Y works the same for touch & mouse --- src/client/events/utils.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/events/utils.mjs b/src/client/events/utils.mjs index b673fe4d..03981977 100644 --- a/src/client/events/utils.mjs +++ b/src/client/events/utils.mjs @@ -66,7 +66,7 @@ export function normalizeDragEvent(event, previousEvent) { resetEventOffset(event, event.target) - } else if (event.isTouch && previousEvent) { + } else if (previousEvent) { event.offsetX = previousEvent.offsetX + event.movementX event.offsetY = previousEvent.offsetY + event.movementY From b064b8f3a8510126fc31ed76afd606ecfebace1e Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 13 Dec 2025 11:30:10 +0100 Subject: [PATCH 019/166] button: add onTouch --- CHANGELOG.md | 1 + src/client/widgets/basics/button.mjs | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52a1e417..7b3b3962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - add new `scrollbar` widget that connects to a scrolling container widget and acts as it scrollbar - input: add `noCanvas` option to avoid blurry text under some circumstances - xy: add `clipX` and `clipY` proprties (allows multixy to set per-pads anges limits) + - button: add `onTouch` script - editor - selecting a widget automatically shows it in the widget tree if it's not minimized diff --git a/src/client/widgets/basics/button.mjs b/src/client/widgets/basics/button.mjs index 22890c90..ae048a66 100644 --- a/src/client/widgets/basics/button.mjs +++ b/src/client/widgets/basics/button.mjs @@ -51,6 +51,9 @@ class Button extends Widget { 'From a script property, feedback messages can be simulated with:', '`set("widget_id", value, {external: true})`' ]}, + }, + scripting: { + onTouch: {type: 'script', value: '', editor:'javascript', help: ['Script executed when the panel is touched and released, and when the pointer moves when the widget is touched. See documentation.',]}, } }) @@ -84,6 +87,10 @@ class Button extends Widget { }, {element: this.widget}) } + if (this.getProp('onTouch')) { + this.on('draginit',(e)=>this.onTouch(e, 'start'), {element: this.container}) + } + var mode = this.getProp('mode'), tap = mode === 'momentary' || mode === 'tap', push = mode === 'push' || tap @@ -219,8 +226,24 @@ class Button extends Widget { } + if (this.getProp('onTouch')) { + this.on('dragend',(e)=>this.onTouch(e, 'stop'), {element: this.container}) + } + } + onTouch(e, name) { + + var event = {...e} + + event.type = name + + this.scripts.onTouch.run({ + value: this.value, + event: event + }, {sync: true, send: true}) + + } get value() { From 9b58f4e365375da2100502fafdb3e3ec722414c4 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 13 Dec 2025 11:44:35 +0100 Subject: [PATCH 020/166] server: more reliable url check for client assets requests --- src/server/node/server.mjs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/server/node/server.mjs b/src/server/node/server.mjs index 395ff92e..ccf7c71a 100644 --- a/src/server/node/server.mjs +++ b/src/server/node/server.mjs @@ -187,8 +187,7 @@ class WebServer extends EventEmitter { } else { if ( - url.indexOf('/assets/') == 0 || - url.indexOf('/client/') == 0 + path.resolve(url).match(/^\/assets|client\//) ) { // osc asset files From d4cd2ec666c0040c880afbfd2ba34468f689c2eb Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 13 Dec 2025 19:24:10 +0100 Subject: [PATCH 021/166] imports: use some black magic **** to please safari/ios and fix dynamic imports order --- src/client/events/utils.mjs | 5 +++-- src/client/stacktrace.mjs | 6 +----- src/client/widgets/common/widget.mjs | 9 +++------ src/client/widgets/scripts/script-vm.mjs | 5 +++-- src/client/widgets/vm.mjs | 5 +++-- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/client/events/utils.mjs b/src/client/events/utils.mjs index 03981977..d8a783a0 100644 --- a/src/client/events/utils.mjs +++ b/src/client/events/utils.mjs @@ -1,9 +1,10 @@ import {DOM} from '../globals.mjs' var zoom -;(async()=>{ +setTimeout(async()=>{ + // use setTimeout to fix init order in safari... zoom = (await import('../ui/zoom.mjs')).default -})() +}) // impot cssTransformCoords from './transform-coords.mjs' diff --git a/src/client/stacktrace.mjs b/src/client/stacktrace.mjs index e476d21a..274128fe 100644 --- a/src/client/stacktrace.mjs +++ b/src/client/stacktrace.mjs @@ -1,10 +1,6 @@ import StackTrace from 'stacktrace-js' import ipc from './ipc/index.mjs' - -var uiConsole -;(async()=>{ - uiConsole = (await import('./ui/ui-console.mjs')).default -})() +import uiConsole from './ui/ui-console.mjs' window.onerror = function(msg,url,row,col, error) { diff --git a/src/client/widgets/common/widget.mjs b/src/client/widgets/common/widget.mjs index 4e3c9b81..a2ceda03 100644 --- a/src/client/widgets/common/widget.mjs +++ b/src/client/widgets/common/widget.mjs @@ -16,13 +16,14 @@ import {PXSCALE, JSON5} from '../../globals.mjs' var updateWidget = ()=>{}, uiConsole, widgetTree, widgetDragResize, sessionManager -;(async()=>{ +setTimeout(async()=>{ + // use setTimeout to fix init order in safari... updateWidget = (await import('../../editor/data-workers.mjs')).updateWidget uiConsole = (await import('../../ui/ui-console.mjs')).default widgetTree = (await import('../../editor/index.mjs')).default.widgetTree widgetDragResize = (await import('../../editor/index.mjs')).default.widgetDragResize sessionManager = (await import('../../managers/session/index.mjs')).default -})() +}) var vm = new Vm() @@ -37,10 +38,6 @@ var OSCProps = [ 'bypass' ] -setTimeout(()=>{ - -}) - class Widget extends EventEmitter { static description() { diff --git a/src/client/widgets/scripts/script-vm.mjs b/src/client/widgets/scripts/script-vm.mjs index bd185b75..b4dc8b39 100644 --- a/src/client/widgets/scripts/script-vm.mjs +++ b/src/client/widgets/scripts/script-vm.mjs @@ -9,9 +9,10 @@ import uiFilebrowser from '../../ui/ui-filebrowser.mjs' import {setFOCUSABLE} from '../../globals.mjs' var toolbar -;(async()=>{ +setTimeout(async()=>{ + // use setTimeout to fix init order in safari... toolbar = (await import('../../ui/main-menu.mjs')).default -})() +}) class ScriptVm extends Vm { diff --git a/src/client/widgets/vm.mjs b/src/client/widgets/vm.mjs index 82ad43ba..294b9e53 100644 --- a/src/client/widgets/vm.mjs +++ b/src/client/widgets/vm.mjs @@ -2,9 +2,10 @@ import {deepCopy} from '../utils.mjs' import {ENV, IP} from '../globals.mjs' var sessionManager -;(async()=>{ +setTimeout(async()=>{ + // use setTimeout to fix init order in safari... sessionManager = (await import('../managers/session/index.mjs')).default -})() +}) var globals From 42b71ef6fc55b04e53e429ce5da6f6e795488e78 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sat, 13 Dec 2025 19:27:21 +0100 Subject: [PATCH 022/166] package: beta 8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 95a7b532..fbc63eb3 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "open-stage-control", "productName": "Open Stage Control", "description": "Libre and modular OSC / MIDI controller", - "version": "1.30.0-beta7", + "version": "1.30.0-beta8", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" From 31f4119442d89dbb3aa541d547ab28ed515155bc Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 14 Dec 2025 14:41:05 +0100 Subject: [PATCH 023/166] scripting: calling setFocus() without if now unfocuses active element --- CHANGELOG.md | 1 + resources/docs/docs/widgets/scripting.md | 2 +- src/client/widgets/scripts/script-vm.mjs | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b3b3962..2d48c2cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - user scripts are longer protected against infinite loop and the main window object may be reached (it's not supported to break out of scripting context, but resources are no longer wasted to prevent it) - `toolbar()` can now target menu actions by id instead of index - `getToolbar()` function added (returns the state of a menu entry toggle) + - calling `setFocus()` without argument now unfocuses current active element - midi - add `no_auto_note_off` option diff --git a/resources/docs/docs/widgets/scripting.md b/resources/docs/docs/widgets/scripting.md index ee65c8a8..45c94034 100644 --- a/resources/docs/docs/widgets/scripting.md +++ b/resources/docs/docs/widgets/scripting.md @@ -303,7 +303,7 @@ Reference: - `id` (optional): widget `id` as a string -Gives focus to a widget (ie input widget). +Gives focus to a widget (ie input widget). If `id` is omitted or falsy, currently focused element will be unfocused. *Built-in client only*: tells the operating system to give the focus to the client window diff --git a/src/client/widgets/scripts/script-vm.mjs b/src/client/widgets/scripts/script-vm.mjs index b4dc8b39..9f862b54 100644 --- a/src/client/widgets/scripts/script-vm.mjs +++ b/src/client/widgets/scripts/script-vm.mjs @@ -452,6 +452,8 @@ class ScriptVm extends Vm { if (widgets.length) { if (widgets[0].focus) widgets[0].focus() } + } else if (document.activeElement) { + document.activeElement.blur() } // built-in client only: electron will call window.focus() From e4eae76bdfc17de16cf9c0b393b8874e082d550a Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 15 Dec 2025 09:41:17 +0100 Subject: [PATCH 024/166] midi: implement backend restart feature --- CHANGELOG.md | 2 + .../docs/docs/custom-module/custom-module.md | 4 ++ .../docs/docs/user-interface/launcher.md | 4 +- src/launcher/toolbar.mjs | 30 ++++++++--- src/server/electron/index.mjs | 7 ++- src/server/node/midi.mjs | 54 ++++++++++++++++--- src/server/node/osc/index.mjs | 1 + 7 files changed, 84 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d48c2cb..e994ee36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,8 @@ - midi - add `no_auto_note_off` option + - add `Restart backend` action to the launcher's menu + - add `restartMidiBackend()` function to custom module context - breaking change - dropped support for iOS 10.3 diff --git a/resources/docs/docs/custom-module/custom-module.md b/resources/docs/docs/custom-module/custom-module.md index 3615e4fc..8bb3081f 100644 --- a/resources/docs/docs/custom-module/custom-module.md +++ b/resources/docs/docs/custom-module/custom-module.md @@ -167,6 +167,10 @@ for (var ip in tcpServer.clients) { ``` +#### `restartMidiBackend()` + +This function can be used to restart the midi backend (if already running) without restarting the server + #### Other javascript globals - `console` diff --git a/resources/docs/docs/user-interface/launcher.md b/resources/docs/docs/user-interface/launcher.md index 304aa33b..87ba9d67 100644 --- a/resources/docs/docs/user-interface/launcher.md +++ b/resources/docs/docs/user-interface/launcher.md @@ -7,7 +7,9 @@ - New window: open a new client window (hidden when stopped) - Load: load server configuration from file - Save / Save as: save server configuration to file -- List MIDI devices: list available MIDI devices in the console +- MIDI + - List devices: list available MIDI devices in the console + - Restart backend: restart midi backend without restarting the server - Console: - Clear: clear console - Autoscroll: enable/disable console autoscroll diff --git a/src/launcher/toolbar.mjs b/src/launcher/toolbar.mjs index 8c80fc9d..a6677b4d 100644 --- a/src/launcher/toolbar.mjs +++ b/src/launcher/toolbar.mjs @@ -9,7 +9,7 @@ import {DOM, PXSCALE} from '../client/globals.mjs' var {Menu, MenuItem} = remote.require('electron'), menu = new Menu(), - {midilist, openDocs} = remote.getGlobal('launcherSharedGlobals'), + {midiList, midiRestart, openDocs} = remote.getGlobal('launcherSharedGlobals'), serverStarting = false, serverStart = ()=>{ if (serverStarting) return @@ -77,13 +77,25 @@ menu.append(new MenuItem({ menu.append(new MenuItem({ type: 'separator' })) -menu.append(new MenuItem({ - label: 'List MIDI Devices', - click: ()=>{ - midilist() - }, - accelerator: 'ctrl + m' -})) + +menu.append(new MenuItem({type: 'submenu' , label: 'MIDI', submenu: [ + new MenuItem({ + label: 'List devices', + click: ()=>{ + midiList() + }, + accelerator: 'ctrl + m' + }), + new MenuItem({ + label: 'Restart backend', + id: 'midiRestart', + click: ()=>{ + midiRestart() + }, + enabled: false + }), + +]})) menu.append(new MenuItem({type: 'submenu' , label: 'Console', submenu: [ new MenuItem({ label: 'Clear', @@ -211,6 +223,8 @@ class Toolbar { stop.visible = !!serverStarting qrcode.visible = !!serverStarting newWindow.visible = !!serverStarting + menu.getMenuItemById('midiRestart').enabled = !!serverStarting + menu.popup({window: remote.getCurrentWindow(), x: parseInt(PXSCALE), y: parseInt(40 * PXSCALE)}) }) diff --git a/src/server/electron/index.mjs b/src/server/electron/index.mjs index 567c34f8..f75f121d 100644 --- a/src/server/electron/index.mjs +++ b/src/server/electron/index.mjs @@ -169,7 +169,12 @@ function startLauncher() { global.launcherSharedGlobals = { settings: settings, openDocs: openDocs, - midilist: midi.list + midiList: midi.list, + midiRestart: ()=>{ + if (serverProcess) { + serverProcess.send('midiRestart') + } + } } var address = 'file://' + path.resolve(__dirname + '/../../launcher/' + 'index.html') diff --git a/src/server/node/midi.mjs b/src/server/node/midi.mjs index 6ff6048d..9cb7ee17 100644 --- a/src/server/node/midi.mjs +++ b/src/server/node/midi.mjs @@ -1,10 +1,11 @@ import {PythonShell} from 'python-shell' import fs from 'fs' import path from 'path' +import {EventEmitter} from 'events' import * as settings from './settings.mjs' -var scriptPath = __dirname.includes('server/node') ? +var scriptPath = __dirname.includes('server/node') ? path.resolve(__dirname, '../python') : // src folder structure path.resolve(__dirname, './python') // app folder structure with rollup chunking @@ -32,12 +33,33 @@ if (midiBinaries[process.arch] && midiBinaries[process.arch][process.platform]) } } -class MidiConverter { +class MidiConverter extends EventEmitter{ constructor() { + super() + if (expectMidiBinariesError) MidiConverter.midiBinariesError() + this.running = false + this.restarting = false + this.py = {} + + this.start() + + + process.on('message', (m) => { + if (m == 'midiRestart') { + this.restart() + } + }) + + } + + start() { + + if (this.running) return + this.py = new PythonShell('midi.py', Object.assign({ args: [ '--params', @@ -55,12 +77,32 @@ class MidiConverter { } }) - this.running = true this.py.childProcess.on('exit', (code)=>{ - if (code === null) console.error('(ERROR, MIDI) Midi bridge process crashed') + if (code === null && !this.restarting) console.error('(ERROR, MIDI) Midi bridge process crashed') this.running = false + this.emit('stopped') }) + this.running = true + + } + + stop() { + + if (this.running) this.py.childProcess.kill() + + } + + restart() { + + if (this.running) { + this.restarting = true + this.once('stopped', ()=>{ + this.start() + this.restarting = false + }) + this.stop() + } } send(data) { @@ -76,11 +118,7 @@ class MidiConverter { } - stop() { - this.py.childProcess.kill() - - } init(receiveOsc) { diff --git a/src/server/node/osc/index.mjs b/src/server/node/osc/index.mjs index a3f27274..89870658 100644 --- a/src/server/node/osc/index.mjs +++ b/src/server/node/osc/index.mjs @@ -19,6 +19,7 @@ export default class OscServer { this.customModuleEventEmitter = new EventEmitter() this.customModule = settings.read('custom-module') ? new CustomModule(settings.read('custom-module'), { app: this.customModuleEventEmitter, + restartMidiBackend: ()=>{if (this.midiServer) this.midiServer.restart()}, tcpServer: this.oscTCPServer, sendOsc: this.sendOsc.bind(this), receiveOsc: this.receiveOsc.bind(this), From ce48146bdb90c4fbf07a0f869cd99cf150d82a1c Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 15 Dec 2025 09:41:33 +0100 Subject: [PATCH 025/166] launcher: fix regression --- src/client/events/utils.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/events/utils.mjs b/src/client/events/utils.mjs index d8a783a0..850191a7 100644 --- a/src/client/events/utils.mjs +++ b/src/client/events/utils.mjs @@ -13,7 +13,7 @@ const Touch = window.Touch || class Touch {} export function fix(e) { - var localZoom = zoom.editor.enabled ? zoom.localZoom : 1 + var localZoom = zoom.editor && zoom.editor.enabled ? zoom.localZoom : 1 return { From 55d5f440be1b169451d06e2c4b85b8ecee60a9cb Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Mon, 15 Dec 2025 13:00:36 +0100 Subject: [PATCH 026/166] ipc: dedupe 'connected' response to 'open' request (no functionnal effect) --- src/server/node/ipc/callbacks.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/node/ipc/callbacks.mjs b/src/server/node/ipc/callbacks.mjs index 2d5ce884..2376fee3 100644 --- a/src/server/node/ipc/callbacks.mjs +++ b/src/server/node/ipc/callbacks.mjs @@ -30,7 +30,7 @@ export default class Callbacks { open(data, clientId) { // client connected - this.ipcServer.send('connected') + this.ipcServer.send('connected', null, clientId) var recentSessions = settings.read('recentSessions') From 8af432933cd4f945f5272cc0975eb7e5f71b8fb2 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 16 Dec 2025 10:30:12 +0100 Subject: [PATCH 027/166] ipc: fix an old regression preventing uuid from being reused --- src/client/ipc/index.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/ipc/index.mjs b/src/client/ipc/index.mjs index ae8d7c7b..9a3d4275 100644 --- a/src/client/ipc/index.mjs +++ b/src/client/ipc/index.mjs @@ -16,7 +16,7 @@ var loadDeps = (async()=>{ await import('../ui/ui-keyboard.mjs') })() -var uuid, localUuid = ENV.id || cache.get('osc.uuid', false) +var uuid, localUuid = ENV.id || cache.get('uuid', false) if (localUuid) { uuid = localUuid } else { From 3777b1fcbbddebb6b791daa989e6e3fac34e47f1 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 16 Dec 2025 12:16:20 +0100 Subject: [PATCH 028/166] client: make app more resilient to storage access denial --- src/client/index.mjs | 5 +- src/client/managers/cache.mjs | 22 +++++-- src/client/ui/ui-code-editor.mjs | 5 +- src/client/widgets/scripts/script-vm.mjs | 75 ++++++++++-------------- src/client/widgets/vm.mjs | 14 +++-- 5 files changed, 67 insertions(+), 54 deletions(-) diff --git a/src/client/index.mjs b/src/client/index.mjs index ff95ffbc..e9599d3a 100644 --- a/src/client/index.mjs +++ b/src/client/index.mjs @@ -29,7 +29,10 @@ function init() { } if (document.requestStorageAccess) { - document.requestStorageAccess().then(init, init) + document.requestStorageAccess().then(init, ()=>{ + console.error('Could not obtain storage access, the app might not work correctly unless the browser\'s settings are updated') + init() + }) } else { init() } diff --git a/src/client/managers/cache.mjs b/src/client/managers/cache.mjs index 0d4a2b1e..b28ae0a7 100644 --- a/src/client/managers/cache.mjs +++ b/src/client/managers/cache.mjs @@ -4,17 +4,31 @@ class Cache { set(key, value, persistent = true) { - var storage = persistent ? localStorage : sessionStorage + try { + + var storage = persistent ? localStorage : sessionStorage + + storage.setItem(keyPrefix + key, JSON.stringify(value)) + + } catch(e){ + console.error(`Could not write to ${persistent ? 'localStorage' : 'sessionStorage'}`) + } - storage.setItem(keyPrefix + key, JSON.stringify(value)) } get(key, persistent = true) { - var storage = persistent ? localStorage : sessionStorage + try { - return JSON.parse(storage.getItem(keyPrefix + key)) + var storage = persistent ? localStorage : sessionStorage + + return JSON.parse(storage.getItem(keyPrefix + key)) + + } catch(e){ + console.error(`Could not read from ${persistent ? 'localStorage' : 'sessionStorage'}`) + return null + } } diff --git a/src/client/ui/ui-code-editor.mjs b/src/client/ui/ui-code-editor.mjs index ceac60c2..b0f91a5d 100644 --- a/src/client/ui/ui-code-editor.mjs +++ b/src/client/ui/ui-code-editor.mjs @@ -207,6 +207,9 @@ class CodeEditor { if (this.language === 'javascript') { let globals = {} + for (var k in scriptGlobals) { + globals[k] = true + } if (this.name === 'onKeyboard') { globals = {type: true, key: true, code: true, ctrl: true, shift: true, alt: true, meta: true} } else if (this.name === 'onCreate') { @@ -230,7 +233,7 @@ class CodeEditor { globals.this = false if (this.syntaxChecker !== false) editor.getSession().$worker.send('changeOptions', [{ - globals: {...scriptGlobals, ...globals} + globals: globals }]) } diff --git a/src/client/widgets/scripts/script-vm.mjs b/src/client/widgets/scripts/script-vm.mjs index 9f862b54..4170bedc 100644 --- a/src/client/widgets/scripts/script-vm.mjs +++ b/src/client/widgets/scripts/script-vm.mjs @@ -53,9 +53,7 @@ class ScriptVm extends Vm { registerGlobals() { - super.registerGlobals() - - this.sandbox.contentWindow.set = (id, value, extraOptions = {send: true, sync: true})=>{ + this.globals.set = (id, value, extraOptions = {send: true, sync: true})=>{ this.checkContext('set') @@ -102,7 +100,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.setVar = (id, name, value)=>{ + this.globals.setVar = (id, name, value)=>{ this.checkContext('setVar') @@ -137,7 +135,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.send = (target, address, ...args)=>{ + this.globals.send = (target, address, ...args)=>{ this.checkContext('send') @@ -165,7 +163,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.get = (id)=>{ + this.globals.get = (id)=>{ this.checkContext('get') @@ -184,7 +182,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.getVar = (id, name)=>{ + this.globals.getVar = (id, name)=>{ this.checkContext('getVar') @@ -198,7 +196,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.getProp = (id, prop)=>{ + this.globals.getProp = (id, prop)=>{ this.checkContext('getProp') @@ -213,7 +211,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.updateProp = (id, prop)=>{ + this.globals.updateProp = (id, prop)=>{ this.checkContext('updateProp') @@ -228,7 +226,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.updateCanvas = (id)=>{ + this.globals.updateCanvas = (id)=>{ this.checkContext('updateCanvas') @@ -241,7 +239,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.getIndex = (id = 'this')=>{ + this.globals.getIndex = (id = 'this')=>{ this.checkContext('getIndex') @@ -250,7 +248,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.getScroll = (id)=>{ + this.globals.getScroll = (id)=>{ this.checkContext('getScroll') @@ -266,7 +264,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.setScroll = (id, x, y)=>{ + this.globals.setScroll = (id, x, y)=>{ this.checkContext('setScroll') @@ -280,7 +278,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.httpGet = (url, callback)=>{ + this.globals.httpGet = (url, callback)=>{ this.checkContext('httpGet') @@ -301,7 +299,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.stateGet = (filter)=>{ + this.globals.stateGet = (filter)=>{ this.checkContext('stateGet') @@ -321,7 +319,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.stateSet = (state, extraOptions = {})=>{ + this.globals.stateSet = (state, extraOptions = {})=>{ this.checkContext('stateSet') @@ -331,7 +329,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.storage = { + this.globals.storage = { setItem: (k, v)=>{ this.checkContext('storage.setItem') @@ -352,7 +350,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.setTimeout = (id, callback, timeout)=>{ + this.globals.setTimeout = (id, callback, timeout)=>{ this.checkContext('setTimeout') @@ -386,7 +384,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.clearTimeout = (id)=>{ + this.globals.clearTimeout = (id)=>{ this.checkContext('clearTimeout') @@ -397,7 +395,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.setInterval = (id, callback, timeout)=>{ + this.globals.setInterval = (id, callback, timeout)=>{ this.checkContext('setInterval') @@ -430,7 +428,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.clearInterval = (id)=>{ + this.globals.clearInterval = (id)=>{ this.checkContext('clearInterval') @@ -442,7 +440,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.setFocus = (id)=>{ + this.globals.setFocus = (id)=>{ this.checkContext('setFocus') @@ -461,7 +459,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.unfocus = ()=>{ + this.globals.unfocus = ()=>{ this.checkContext('unfocus') @@ -471,7 +469,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.setFocusable = (focusable)=>{ + this.globals.setFocusable = (focusable)=>{ this.checkContext('setFocusable') setFOCUSABLE(!!focusable) @@ -492,7 +490,7 @@ class ScriptVm extends Vm { } } - this.sandbox.contentWindow.toolbar = (...args)=>{ + this.globals.toolbar = (...args)=>{ this.checkContext('toolbar') @@ -524,7 +522,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.getToolbar = (id)=>{ + this.globals.getToolbar = (id)=>{ this.checkContext('toolbar') @@ -538,7 +536,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.openUrl = (url)=>{ + this.globals.openUrl = (url)=>{ this.checkContext('openUrl') @@ -548,7 +546,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.runAs = (id, callback)=>{ + this.globals.runAs = (id, callback)=>{ this.checkContext('runAs') @@ -569,7 +567,7 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.reload = (keepState = true)=>{ + this.globals.reload = (keepState = true)=>{ this.checkContext('reload') @@ -586,16 +584,16 @@ class ScriptVm extends Vm { } - this.sandbox.contentWindow.Image = Image + this.globals.Image = Image - this.sandbox.contentWindow.getNavigator = ()=>{ + this.globals.getNavigator = ()=>{ this.checkContext('getNavigator') return navigator } - this.sandbox.contentWindow.browseFile = (options, callback)=>{ + this.globals.browseFile = (options, callback)=>{ this.checkContext('browseFile') if (typeof options === 'function') { callback = options @@ -629,18 +627,7 @@ class ScriptVm extends Vm { } } - - this.globals = {} - - for (var imports of ['set', 'get', 'getProp', 'getIndex', 'updateProp', 'send', 'httpGet', 'stateGet', 'stateSet', 'storage', - 'setInterval', 'clearInterval', 'setTimeout', 'clearTimeout', 'setFocus', 'unfocus' , 'setFocusable', 'setScroll', 'getScroll', 'toolbar', - 'getToolbar', 'openUrl', 'getVar', 'setVar', 'runAs', 'reload', 'Image', 'updateCanvas', 'getNavigator', 'browseFile']) { - this.globals[imports] = true - } - - for (var k in this.sandbox.contentWindow) { - if (window[k] === undefined) this.globals[k] = true - } + super.registerGlobals() } diff --git a/src/client/widgets/vm.mjs b/src/client/widgets/vm.mjs index 294b9e53..4a8b2cbd 100644 --- a/src/client/widgets/vm.mjs +++ b/src/client/widgets/vm.mjs @@ -52,6 +52,7 @@ class Vm { this.sandbox.contentWindow.document.close() // global context + this.globals = {} this.registerGlobals() // detach sandbox @@ -74,7 +75,7 @@ class Vm { registerGlobals() { - this.sandbox.contentWindow.console = { + this.globals.console = { ...console, log: (...msg)=>{ msg = msg.map(m => typeof m == 'object' ? JSON.stringify(m) : m) @@ -82,11 +83,16 @@ class Vm { } } - this.sandbox.contentWindow.setTimeout = - this.sandbox.contentWindow.setInterval = ()=>{ + this.globals.setTimeout = + this.globals.setInterval = ()=>{ throw 'setTimeout and setInterval can\'t be used in the JS sandbox' } - this.sandbox.contentWindow.globals = globals + + this.globals.globals = globals + + for (var k in this.globals) { + this.sandbox.contentWindow[k] = this.globals[k] + } } From b27d38132451fd2972af77343b336b00828566f2 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 16 Dec 2025 12:21:52 +0100 Subject: [PATCH 029/166] client: better storage access error log --- src/client/managers/cache.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client/managers/cache.mjs b/src/client/managers/cache.mjs index b28ae0a7..1d1cee77 100644 --- a/src/client/managers/cache.mjs +++ b/src/client/managers/cache.mjs @@ -11,7 +11,8 @@ class Cache { storage.setItem(keyPrefix + key, JSON.stringify(value)) } catch(e){ - console.error(`Could not write to ${persistent ? 'localStorage' : 'sessionStorage'}`) + console.error(`Could not write to ${persistent ? 'localStorage' : 'sessionStorage'}: ${e}`) + console.debug(e) } @@ -26,7 +27,8 @@ class Cache { return JSON.parse(storage.getItem(keyPrefix + key)) } catch(e){ - console.error(`Could not read from ${persistent ? 'localStorage' : 'sessionStorage'}`) + console.error(`Could not read from ${persistent ? 'localStorage' : 'sessionStorage'}: ${e}`) + console.debug(e) return null } From 37b305eaea97eabe79a1dd507e8ed9e37b42e555 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 16 Dec 2025 12:24:32 +0100 Subject: [PATCH 030/166] client: delay access storage denial error log --- src/client/index.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client/index.mjs b/src/client/index.mjs index e9599d3a..c1d5753c 100644 --- a/src/client/index.mjs +++ b/src/client/index.mjs @@ -30,8 +30,10 @@ function init() { if (document.requestStorageAccess) { document.requestStorageAccess().then(init, ()=>{ - console.error('Could not obtain storage access, the app might not work correctly unless the browser\'s settings are updated') init() + setTimeout(()=>{ + console.error('Could not obtain storage access, the app might not work correctly unless the browser\'s settings are updated') + }, 1000) }) } else { init() From 422c84d42e810c52ac5367a48b94ba619b3e53b9 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 16 Dec 2025 12:34:09 +0100 Subject: [PATCH 031/166] package: beta 9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fbc63eb3..f01c25e6 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "open-stage-control", "productName": "Open Stage Control", "description": "Libre and modular OSC / MIDI controller", - "version": "1.30.0-beta8", + "version": "1.30.0-beta9", "author": { "name": "Jean-Emmanuel Doucet", "email": "jean-emmanuel@ammd.net" From 6bd129395934222c19707b5b962a3177fb38c1d6 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 16 Dec 2025 12:36:23 +0100 Subject: [PATCH 032/166] log: update --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e994ee36..7fd92d82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - prevent changing editor zoom level when it's disabled - fader: fix touchZone == knob for compact design - separator labels missing in inspector + - make the client app more robust to restrictive browser settings (cookie must still be enabled for the app to fully work) - widgets - the html property is no longer restricted / sanitized From dc85311b5431f2eecd9a03c7cca935084719e151 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 17 Dec 2025 10:03:34 +0100 Subject: [PATCH 033/166] deps: ditch osc.js fork --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f01c25e6..11645825 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "nodemon": "2.0.16", "nosleep.js": "0.12.0", "open": "8.4.0", - "osc": "github:jean-emmanuel/osc.js", + "osc": "2.4.5", "python-shell": "3.0.1", "qrcode": "1.5.1", "replacestream": "4.0.3", From 618fb3b01fe75e42e4ee47bbfb35a2f8199bc9da Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 17 Dec 2025 11:16:37 +0100 Subject: [PATCH 034/166] docs: framagit migration --- resources/docs/download.md | 72 ++++++---------------------------- resources/mkdocs.yml | 5 +++ src/docs/client-shim.mjs | 2 + src/docs/widgets-reference.mjs | 6 +-- 4 files changed, 23 insertions(+), 62 deletions(-) diff --git a/resources/docs/download.md b/resources/docs/download.md index 58b5fb88..5b6b50c7 100644 --- a/resources/docs/download.md +++ b/resources/docs/download.md @@ -3,66 +3,20 @@ !!! tip "" [*Click here*](/docs/getting-started/introduction/#installation) to read the installation guide. - Open Stage Control + + Open Stage Control v{{config.latest_release}} + -
Loading assets...
+
    +
  • GNU/Linux RPM (64-bit)
  • +
  • GNU/Linux Debian (64-bit)
  • +
  • GNU/Linux (64-bit)
  • +
  • Node.js
  • +
  • MacOS x64
  • +
  • MacOS arm64
  • +
  • Windows (64-bit)
  • - +