@ircam/comote-helpers 0.3.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +5 -0
- package/.github/workflows/main.yml +3 -3
- package/.history/.gitignore_20250415160643 +6 -0
- package/.history/.gitignore_20250415160723 +6 -0
- package/.history/examples/simple-webview/package-lock_20250415130242.json +5109 -0
- package/.history/examples/simple-webview/package-lock_20250416103557.json +5109 -0
- package/.history/examples/simple-webview/package_20250415130704.json +26 -0
- package/.history/examples/simple-webview/package_20250415184837.json +26 -0
- package/.history/examples/simple-webview/package_20250415190300.json +23 -0
- package/.history/examples/simple-webview/src/server_20250415105733.js +20 -0
- package/.history/examples/simple-webview/src/server_20250415184604.js +20 -0
- package/.history/examples/soundworks/package_20250415132431.json +35 -0
- package/.history/examples/soundworks/package_20250416105956.json +35 -0
- package/.history/max/CoMote/examples/simple-webview/package_20250415184836.json +26 -0
- package/.history/max/CoMote/examples/simple-webview/package_20250415185949.json +23 -0
- package/.history/max/CoMote/examples/simple-webview/package_20250415185950.json +23 -0
- package/.history/max/CoMote/package-info_20241018173608.json +41 -0
- package/.history/max/CoMote/package-info_20250416105743.json +27 -0
- package/.history/max/CoMote/package-info_20250416105826.json +27 -0
- package/.history/max/CoMote/source/comote-connect/package_20250415132759.json +19 -0
- package/.history/max/CoMote/source/comote-connect/package_20250416110158.json +19 -0
- package/.history/max/CoMote/source/comote-connect/server_20250414175059.js +193 -0
- package/.history/max/CoMote/source/comote-connect/server_20250415180549.js +193 -0
- package/.history/package_20250415143437.json +26 -0
- package/.history/package_20250416105907.json +26 -0
- package/LICENSE +2 -2
- package/examples/simple-webview/README.md +10 -0
- package/examples/simple-webview/build/comote-simple-webview-server.js +44 -0
- package/examples/simple-webview/package-lock.json +5109 -0
- package/examples/simple-webview/package.json +23 -0
- package/examples/simple-webview/public/favicon.ico +0 -0
- package/examples/simple-webview/public/index.html +13 -0
- package/examples/simple-webview/public/index.mjs +3623 -0
- package/examples/simple-webview/public/styles.css +99 -0
- package/examples/simple-webview/src/client.js +35 -0
- package/examples/simple-webview/src/server.js +20 -0
- package/examples/soundworks/.build/clients/components/sw-audit.js +64 -0
- package/examples/soundworks/.build/clients/components/sw-audit.js.map +1 -0
- package/examples/soundworks/.build/clients/components/sw-credits.js +73 -0
- package/examples/soundworks/.build/clients/components/sw-credits.js.map +1 -0
- package/examples/soundworks/.build/clients/player/.editorbackup/PlayerExperience.js~ +131 -0
- package/examples/soundworks/.build/clients/player/index.js +116 -0
- package/examples/soundworks/.build/clients/player/index.js.map +1 -0
- package/examples/soundworks/.build/clients/styles/app.scss +79 -0
- package/examples/soundworks/.build/clients/styles/normalize.scss +359 -0
- package/examples/soundworks/.build/clients/webview/index.js +72 -0
- package/examples/soundworks/.build/clients/webview/index.js.map +1 -0
- package/examples/soundworks/.build/public/css/app.css +76 -0
- package/examples/soundworks/.build/public/css/app.css.map +1 -0
- package/examples/soundworks/.build/public/css/normalize.css +321 -0
- package/examples/soundworks/.build/public/css/normalize.css.map +1 -0
- package/examples/soundworks/.build/public/player.js +98098 -0
- package/examples/soundworks/.build/public/player.js.map +1 -0
- package/examples/soundworks/.build/public/webview.js +50725 -0
- package/examples/soundworks/.build/public/webview.js.map +1 -0
- package/examples/soundworks/.build/server/index.js +57 -0
- package/examples/soundworks/.build/server/index.js.map +1 -0
- package/examples/soundworks/.build/server/schemas/.gitkeep +1 -0
- package/examples/soundworks/.build/server/schemas/global.js +19 -0
- package/examples/soundworks/.build/server/schemas/global.js.map +1 -0
- package/examples/soundworks/.build/server/tmpl/default.tmpl +27 -0
- package/examples/soundworks/.build/utils/catch-unhandled-errors.js +9 -0
- package/examples/soundworks/.build/utils/catch-unhandled-errors.js.map +1 -0
- package/examples/soundworks/.editorconfig +12 -0
- package/examples/soundworks/.eslintrc +3 -0
- package/examples/soundworks/.soundworks +7 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/CHANGELOG.md +76 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/LICENSE.md +19 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/README.md +259 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-ce.js +63 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-ce.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_dom.js +62 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_dom.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_js.js +95 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-pf_js.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js +374 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce-pf.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce.js +240 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd-ce.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd.js +196 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/bundles/webcomponents-sd.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/custom-elements-es5-adapter.js +15 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/package.json +51 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/custom-elements-es5-adapter-index.js +16 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-bundle-index.js +55 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-ce-index.js +17 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-pf_dom-index.js +19 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-pf_js-index.js +13 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-index.js +19 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-sd-ce-pf-index.js +25 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/entrypoints/webcomponents-sd-index.js +18 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/flag-parser.js +69 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/baseuri.js +28 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/after.js +47 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/before.js +40 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/index.js +14 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/remove.js +37 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/child-node/replace-with.js +42 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/custom-event.js +79 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/es6-misc.js +38 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/event-listener-options.js +122 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/get-attribute-names.js +27 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/matches.js +21 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/append.js +31 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/index.js +13 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/prepend.js +42 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/parent-node/replace-children.js +45 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/promise.js +50 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/svg-element-class-list.js +28 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/symbol.js +64 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/platform/toggle-attribute.js +39 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/src/unresolved.js +32 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-bundle.d.ts +175 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-bundle.js +384 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-bundle.js.map +1 -0
- package/examples/soundworks/.vendors/public/webcomponentsjs/webcomponents-loader.js +238 -0
- package/examples/soundworks/LICENSE +28 -0
- package/examples/soundworks/README.md +26 -0
- package/examples/soundworks/config/application.yaml +8 -0
- package/examples/soundworks/config/env-default.yaml +12 -0
- package/examples/soundworks/package.json +35 -0
- package/examples/soundworks/public/favicon.ico +0 -0
- package/examples/soundworks/public/images/loader.gif +0 -0
- package/examples/soundworks/src/clients/components/sw-audit.js +78 -0
- package/examples/soundworks/src/clients/components/sw-credits.js +80 -0
- package/examples/soundworks/src/clients/player/.editorbackup/PlayerExperience.js~ +131 -0
- package/examples/soundworks/src/clients/player/index.js +118 -0
- package/examples/soundworks/src/clients/styles/app.scss +79 -0
- package/examples/soundworks/src/clients/styles/normalize.scss +359 -0
- package/examples/soundworks/src/clients/webview/index.js +78 -0
- package/examples/soundworks/src/server/index.js +62 -0
- package/examples/soundworks/src/server/schemas/.gitkeep +1 -0
- package/examples/soundworks/src/server/schemas/global.js +18 -0
- package/examples/soundworks/src/server/tmpl/default.tmpl +27 -0
- package/examples/soundworks/src/utils/catch-unhandled-errors.js +9 -0
- package/index.html +51 -0
- package/max/CoMote/docs/sw.shared-state.maxref.xml +95 -0
- package/max/CoMote/examples/simple-webview/README.md +10 -0
- package/max/CoMote/examples/simple-webview/build/comote-simple-webview-server.js +44 -0
- package/max/CoMote/examples/simple-webview/comote-simple-webview-server.maxpat +186 -0
- package/max/CoMote/examples/simple-webview/package-lock.json +5109 -0
- package/max/CoMote/examples/simple-webview/package.json +23 -0
- package/max/CoMote/examples/simple-webview/public/favicon.ico +0 -0
- package/max/CoMote/examples/simple-webview/public/index.html +13 -0
- package/max/CoMote/examples/simple-webview/public/index.mjs +3623 -0
- package/max/CoMote/examples/simple-webview/public/styles.css +99 -0
- package/max/CoMote/examples/simple-webview/src/client.js +35 -0
- package/max/CoMote/examples/simple-webview/src/server.js +20 -0
- package/max/CoMote/examples/soundworks/.editorconfig +12 -0
- package/max/CoMote/examples/soundworks/.eslintrc +3 -0
- package/max/CoMote/examples/soundworks/.soundworks +7 -0
- package/max/CoMote/examples/soundworks/LICENSE +28 -0
- package/max/CoMote/examples/soundworks/README.md +26 -0
- package/max/CoMote/examples/soundworks/config/application.yaml +8 -0
- package/max/CoMote/examples/soundworks/config/env-default.yaml +12 -0
- package/max/CoMote/examples/soundworks/package.json +35 -0
- package/max/CoMote/examples/soundworks/public/favicon.ico +0 -0
- package/max/CoMote/examples/soundworks/public/images/loader.gif +0 -0
- package/max/CoMote/examples/soundworks/src/clients/components/sw-audit.js +78 -0
- package/max/CoMote/examples/soundworks/src/clients/components/sw-credits.js +80 -0
- package/max/CoMote/examples/soundworks/src/clients/player/.editorbackup/PlayerExperience.js~ +131 -0
- package/max/CoMote/examples/soundworks/src/clients/player/index.js +118 -0
- package/max/CoMote/examples/soundworks/src/clients/styles/app.scss +79 -0
- package/max/CoMote/examples/soundworks/src/clients/styles/normalize.scss +359 -0
- package/max/CoMote/examples/soundworks/src/clients/webview/index.js +78 -0
- package/max/CoMote/examples/soundworks/src/server/index.js +62 -0
- package/max/CoMote/examples/soundworks/src/server/schemas/.gitkeep +1 -0
- package/max/CoMote/examples/soundworks/src/server/schemas/global.js +18 -0
- package/max/CoMote/examples/soundworks/src/server/tmpl/default.tmpl +27 -0
- package/max/CoMote/examples/soundworks/src/utils/catch-unhandled-errors.js +9 -0
- package/max/CoMote/extras/CoMote.maxpat +1994 -0
- package/max/CoMote/help/comote_osc_receive.maxhelp +946 -0
- package/max/CoMote/icon.png +0 -0
- package/max/CoMote/init/objectmappings.txt +2 -0
- package/max/CoMote/media/comote-screenshot.png +0 -0
- package/max/CoMote/package-info.json +27 -0
- package/max/CoMote/patchers/comote-connect/comote-connect-public/comote-connect-client.mjs +2821 -0
- package/max/CoMote/patchers/comote-connect/comote-connect-public/favicon.ico +0 -0
- package/max/CoMote/patchers/comote-connect/comote-connect-public/index.html +22 -0
- package/max/CoMote/patchers/comote-connect/comote-connect-server.js +24775 -0
- package/max/CoMote/patchers/comote-connect/comote-connect.maxpat +1048 -0
- package/max/CoMote/patchers/comote-connect/package.json +4 -0
- package/max/CoMote/patchers/comote_format_from_comote_v2.maxpat +613 -0
- package/max/CoMote/patchers/comote_format_from_v3.maxpat +443 -0
- package/max/CoMote/patchers/comote_format_gyro_v2_to_v3.maxpat +240 -0
- package/max/CoMote/patchers/comote_format_gyro_v3_to_v2.maxpat +240 -0
- package/max/CoMote/patchers/comote_format_heading_v2_to_v3.maxpat +171 -0
- package/max/CoMote/patchers/comote_osc_receive.maxpat +440 -0
- package/max/CoMote/patchers/comote_osc_to_list.maxpat +161 -0
- package/max/CoMote/readme.md +22 -0
- package/max/CoMote/source/comote-connect/client.js +104 -0
- package/max/CoMote/source/comote-connect/package-lock.json +591 -0
- package/max/CoMote/source/comote-connect/package.json +19 -0
- package/max/CoMote/source/comote-connect/server.js +193 -0
- package/max-update.bash +44 -0
- package/package.json +10 -29
- package/src/.editorbackup/network-infos.js~ +60 -0
- package/src/.editorbackup/wifi-infos.js~ +33 -0
- package/src/network-infos.js +67 -0
- package/{qrcode.js → src/qrcode.js} +26 -40
- package/{server.js → src/server.js} +45 -69
- package/src/wifi-infos.js +33 -0
- package/README.md +0 -160
- package/wifi-infos.js +0 -41
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import http from 'node:http';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import url from 'node:url';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
import Max from 'max-api';
|
|
7
|
+
import { WebSocketServer } from 'ws';
|
|
8
|
+
import portfinder from 'portfinder';
|
|
9
|
+
|
|
10
|
+
import { getWifiInfos } from '@ircam/comote-helpers/wifi-infos.js';
|
|
11
|
+
import { getNetworkInterfacesInfos } from '@ircam/comote-helpers/network-infos.js';
|
|
12
|
+
|
|
13
|
+
const comoteConfig = {
|
|
14
|
+
id: 0,
|
|
15
|
+
interval: 16, // period in ms
|
|
16
|
+
ws: null,
|
|
17
|
+
osc: {
|
|
18
|
+
port: 8001,
|
|
19
|
+
hostname: '',
|
|
20
|
+
autostart: true,
|
|
21
|
+
},
|
|
22
|
+
webview: '',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const server = http.createServer((req, res) => {
|
|
26
|
+
const parsedUrl = url.parse(req.url);
|
|
27
|
+
let pathname = `./comote-connect-public${parsedUrl.pathname}`;
|
|
28
|
+
const ext = path.parse(pathname).ext || '.html';
|
|
29
|
+
// maps file extension to MIME typere
|
|
30
|
+
const map = {
|
|
31
|
+
'.ico': 'image/x-icon',
|
|
32
|
+
'.html': 'text/html',
|
|
33
|
+
'.js': 'text/javascript',
|
|
34
|
+
'.json': 'application/json',
|
|
35
|
+
'.css': 'text/css',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
if (fs.existsSync(pathname)) {
|
|
39
|
+
// if is a directory search for index file matching the extension
|
|
40
|
+
if (fs.statSync(pathname).isDirectory()) {
|
|
41
|
+
pathname += 'index.html';
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// read file from file system
|
|
45
|
+
fs.readFile(pathname, (err, data) => {
|
|
46
|
+
if (err) {
|
|
47
|
+
res.statusCode = 500;
|
|
48
|
+
res.end(`Error getting the file: ${err}.`);
|
|
49
|
+
} else {
|
|
50
|
+
// if the file is found, set Content-type and send data
|
|
51
|
+
res.setHeader('Content-type', map[ext] || 'text/plain' );
|
|
52
|
+
res.end(data);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
// file is not found, return 404
|
|
57
|
+
res.statusCode = 404;
|
|
58
|
+
res.end(`File ${pathname} not found!`);
|
|
59
|
+
}
|
|
60
|
+
});;
|
|
61
|
+
|
|
62
|
+
console.log('server started');
|
|
63
|
+
|
|
64
|
+
const wss = new WebSocketServer({ server });
|
|
65
|
+
const sockets = new Set();
|
|
66
|
+
|
|
67
|
+
wss.on('connection', async function connection(ws) {
|
|
68
|
+
const wifiInfos = await getWifiInfos();
|
|
69
|
+
const networkInterfacesInfos = await getNetworkInterfacesInfos();
|
|
70
|
+
|
|
71
|
+
const networkInfos = networkInterfacesInfos
|
|
72
|
+
.sort( (a, b) => {
|
|
73
|
+
if (a.default) {
|
|
74
|
+
// default is before
|
|
75
|
+
return -1;
|
|
76
|
+
} else if (b.default) {
|
|
77
|
+
// other is before
|
|
78
|
+
return 1;
|
|
79
|
+
} else {
|
|
80
|
+
// finally, sort by interface name
|
|
81
|
+
return a.ifaceName < b.ifaceName;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
});
|
|
85
|
+
ws.send(JSON.stringify({ type: 'networkInfos', payload: networkInfos }));
|
|
86
|
+
|
|
87
|
+
// use first network interface, it should be the default one
|
|
88
|
+
if (networkInfos && networkInfos[0]) {
|
|
89
|
+
comoteConfig.osc.hostname = networkInfos[0].ip4;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
ws.send(JSON.stringify({ type: 'wifiInfos', payload: wifiInfos }));
|
|
94
|
+
ws.send(JSON.stringify({ type: 'comoteConfig', payload: comoteConfig }));
|
|
95
|
+
|
|
96
|
+
sockets.add(ws);
|
|
97
|
+
|
|
98
|
+
ws.on('message', async (data, isBinary) => {
|
|
99
|
+
// isBinary is not always set
|
|
100
|
+
const message = (isBinary || typeof data !== 'string')
|
|
101
|
+
? data.toString()
|
|
102
|
+
: data;
|
|
103
|
+
|
|
104
|
+
const { type, payload } = JSON.parse(message);
|
|
105
|
+
|
|
106
|
+
switch (type) {
|
|
107
|
+
case 'comoteConfig':
|
|
108
|
+
Object.assign(comoteConfig, payload);
|
|
109
|
+
ws.send(JSON.stringify({ type: 'comoteConfig', payload: comoteConfig }));
|
|
110
|
+
|
|
111
|
+
await Max.outlet('id', comoteConfig.id);
|
|
112
|
+
await Max.outlet('interval', comoteConfig.interval);
|
|
113
|
+
await Max.outlet('osc_hostname', comoteConfig.osc.hostname);
|
|
114
|
+
await Max.outlet('osc_port', comoteConfig.osc.port);
|
|
115
|
+
await Max.outlet('osc_autostart', comoteConfig.osc.autostart);
|
|
116
|
+
await Max.outlet('webview_url', comoteConfig.webview);
|
|
117
|
+
break;
|
|
118
|
+
|
|
119
|
+
default:
|
|
120
|
+
console.warn('received unknown message', {type, payload});
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
ws.on('close', () => {
|
|
127
|
+
sockets.delete(ws);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const handlers = {
|
|
132
|
+
id: id => {
|
|
133
|
+
comoteConfig.id = id;
|
|
134
|
+
sockets.forEach(ws => {
|
|
135
|
+
ws.send(JSON.stringify({ type: 'comoteConfig', payload: comoteConfig }));
|
|
136
|
+
});
|
|
137
|
+
Max.outlet('id', id);
|
|
138
|
+
},
|
|
139
|
+
interval: interval => {
|
|
140
|
+
comoteConfig.interval = interval;
|
|
141
|
+
sockets.forEach(ws => {
|
|
142
|
+
ws.send(JSON.stringify({ type: 'comoteConfig', payload: comoteConfig }));
|
|
143
|
+
});
|
|
144
|
+
Max.outlet('interval', interval);
|
|
145
|
+
},
|
|
146
|
+
osc_hostname: hostname => {
|
|
147
|
+
comoteConfig.osc.hostname = hostname;
|
|
148
|
+
sockets.forEach(ws => {
|
|
149
|
+
ws.send(JSON.stringify({ type: 'comoteConfig', payload: comoteConfig }));
|
|
150
|
+
});
|
|
151
|
+
Max.outlet('osc_hostname', hostname);
|
|
152
|
+
},
|
|
153
|
+
osc_port: port => {
|
|
154
|
+
comoteConfig.osc.port = port;
|
|
155
|
+
sockets.forEach(ws => {
|
|
156
|
+
ws.send(JSON.stringify({ type: 'comoteConfig', payload: comoteConfig }));
|
|
157
|
+
});
|
|
158
|
+
Max.outlet('osc_port', port);
|
|
159
|
+
},
|
|
160
|
+
osc_autostart: autostart => {
|
|
161
|
+
comoteConfig.osc.autostart = !!autostart;
|
|
162
|
+
sockets.forEach(ws => {
|
|
163
|
+
ws.send(JSON.stringify({ type: 'comoteConfig', payload: comoteConfig }));
|
|
164
|
+
});
|
|
165
|
+
Max.outlet('osc_autostart', autostart);
|
|
166
|
+
},
|
|
167
|
+
webview_url: url => {
|
|
168
|
+
comoteConfig.webview = url;
|
|
169
|
+
sockets.forEach(ws => {
|
|
170
|
+
ws.send(JSON.stringify({ type: 'comoteConfig', payload: comoteConfig }));
|
|
171
|
+
});
|
|
172
|
+
Max.outlet('webview_url', url);
|
|
173
|
+
},
|
|
174
|
+
bang: async () => {
|
|
175
|
+
await Max.outlet('id', comoteConfig.id);
|
|
176
|
+
await Max.outlet('interval', comoteConfig.interval);
|
|
177
|
+
await Max.outlet('osc_hostname', comoteConfig.osc.hostname);
|
|
178
|
+
await Max.outlet('osc_port', comoteConfig.osc.port);
|
|
179
|
+
await Max.outlet('osc_autostart', comoteConfig.osc.autostart);
|
|
180
|
+
await Max.outlet('webview_url', comoteConfig.webview);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
Max.addHandlers(handlers);
|
|
185
|
+
|
|
186
|
+
portfinder.basePort = 8888;
|
|
187
|
+
portfinder.getPort((err, port) => {
|
|
188
|
+
server.listen(port, () => {
|
|
189
|
+
const url = `http://127.0.0.1:${port}`;
|
|
190
|
+
console.log(`server listening on ${url}`);
|
|
191
|
+
Max.outlet('url', url);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ircam/comote-helpers",
|
|
3
|
+
"version": "0.3.4",
|
|
4
|
+
"description": "Server component & utilities for the CoMote application",
|
|
5
|
+
"authors": [
|
|
6
|
+
"Benjamin.Matuszewski@ircam.fr",
|
|
7
|
+
"Jean-Philippe.Lambert@ircam.fr"
|
|
8
|
+
],
|
|
9
|
+
"license": "BSD-3-Clause",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/ircam-ismm/comote-helpers"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
"./*.js": "./src/*.js"
|
|
20
|
+
},
|
|
21
|
+
"workspaces": [
|
|
22
|
+
".",
|
|
23
|
+
"examples/*",
|
|
24
|
+
"max/CoMote/sources/*"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ircam/comote-helpers",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Server component & utilities for the CoMote application",
|
|
5
|
+
"authors": [
|
|
6
|
+
"Benjamin.Matuszewski@ircam.fr",
|
|
7
|
+
"Jean-Philippe.Lambert@ircam.fr"
|
|
8
|
+
],
|
|
9
|
+
"license": "BSD-3-Clause",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/ircam-ismm/comote-helpers"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
"./*.js": "./src/*.js"
|
|
20
|
+
},
|
|
21
|
+
"workspaces": [
|
|
22
|
+
".",
|
|
23
|
+
"examples/*",
|
|
24
|
+
"max/CoMote/sources/*"
|
|
25
|
+
]
|
|
26
|
+
}
|
package/LICENSE
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Copyright (c)
|
|
1
|
+
Copyright (c) 2022-present IRCAM, Paris, France
|
|
2
2
|
All rights reserved.
|
|
3
3
|
|
|
4
4
|
Redistribution and use in source and binary forms, with or without
|
|
@@ -25,4 +25,4 @@ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
25
25
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
26
26
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
27
27
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
28
|
-
POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
POSSIBILITY OF SUCH DAMAGE.
|