From 2bc8f293f7471b92b68391c39812faefe0278d80 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 17 Aug 2024 11:15:14 +0200 Subject: [PATCH 1/4] build(deps): bump axios and start-server-and-test (#1974) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 68 ++++++++++++++++++++--------------------------- package.json | 4 +-- 2 files changed, 31 insertions(+), 41 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5032e8e7c..255490f1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "@lezer/highlight": "^1.0.0", "@sindarius/gcodeviewer": "^3.7.11", "@uiw/codemirror-theme-vscode": "^4.19.11", - "axios": "^1.6.0", + "axios": "^1.7.4", "codemirror": "^6.0.1", "core-js": "^3.16.0", "detect-browser": "^5.3.0", @@ -77,7 +77,7 @@ "postcss-nesting": "^12.0.1", "prettier": "^3.0.0", "sass": "~1.32", - "start-server-and-test": "^2.0.0", + "start-server-and-test": "^2.0.5", "typescript": "^4.5.5", "unplugin-vue-components": "^0.22.12", "vite": "^4.5.3", @@ -3177,9 +3177,9 @@ } }, "node_modules/@sideway/address": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", - "integrity": "sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.5.tgz", + "integrity": "sha512-IqO/DUQHUkPeixNQ8n0JA6102hT9CmaljNTPmQ1u8MEhBo/R4Q8eKLN/vGZxuebwOroDB4cbpjheD4+/sKFK4Q==", "dev": true, "dependencies": { "@hapi/hoek": "^9.0.0" @@ -4156,9 +4156,9 @@ "dev": true }, "node_modules/axios": { - "version": "1.6.8", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", - "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", + "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -5244,9 +5244,9 @@ "dev": true }, "node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz", + "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==", "dev": true, "dependencies": { "ms": "2.1.2" @@ -7113,14 +7113,14 @@ "integrity": "sha512-4qjXl8JS138WyCZZoOYwXq/qVrHcE0UIpt2lMtGyq2wuBSPMNSzP1K2CEWSrwAMgjZ9jD7Btc0SxMkiLIhoHsg==" }, "node_modules/joi": { - "version": "17.10.2", - "resolved": "https://registry.npmjs.org/joi/-/joi-17.10.2.tgz", - "integrity": "sha512-hcVhjBxRNW/is3nNLdGLIjkgXetkeGc2wyhydhz8KumG23Aerk4HPjU5zaPAMRqXQFc0xNqXTC7+zQjxr0GlKA==", + "version": "17.13.3", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.13.3.tgz", + "integrity": "sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA==", "dev": true, "dependencies": { - "@hapi/hoek": "^9.0.0", - "@hapi/topo": "^5.0.0", - "@sideway/address": "^4.1.3", + "@hapi/hoek": "^9.3.0", + "@hapi/topo": "^5.1.0", + "@sideway/address": "^4.1.5", "@sideway/formula": "^3.0.1", "@sideway/pinpoint": "^2.0.0" } @@ -8724,19 +8724,19 @@ } }, "node_modules/start-server-and-test": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-2.0.1.tgz", - "integrity": "sha512-8PFo4DLLLCDMuS51/BEEtE1m9CAXw1LNVtZSS1PzkYQh6Qf9JUwM4huYeSoUumaaoAyuwYBwCa9OsrcpMqcOdQ==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-2.0.5.tgz", + "integrity": "sha512-2CV4pz69NJVJKQmJeSr+O+SPtOreu0yxvhPmSXclzmAKkPREuMabyMh+Txpzemjx0RDzXOcG2XkhiUuxjztSQw==", "dev": true, "dependencies": { "arg": "^5.0.2", "bluebird": "3.7.2", "check-more-types": "2.24.0", - "debug": "4.3.4", + "debug": "4.3.6", "execa": "5.1.1", "lazy-ass": "1.6.0", "ps-tree": "1.2.0", - "wait-on": "7.0.1" + "wait-on": "7.2.0" }, "bin": { "server-test": "src/bin/start.js", @@ -10254,16 +10254,16 @@ "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==" }, "node_modules/wait-on": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.0.1.tgz", - "integrity": "sha512-9AnJE9qTjRQOlTZIldAaf/da2eW0eSRSgcqq85mXQja/DW3MriHxkpODDSUEg+Gri/rKEcXUZHe+cevvYItaog==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-7.2.0.tgz", + "integrity": "sha512-wCQcHkRazgjG5XoAq9jbTMLpNIjoSlZslrJ2+N9MxDsGEv1HnFoVjOCexL0ESva7Y9cu350j+DWADdk54s4AFQ==", "dev": true, "dependencies": { - "axios": "^0.27.2", - "joi": "^17.7.0", + "axios": "^1.6.1", + "joi": "^17.11.0", "lodash": "^4.17.21", - "minimist": "^1.2.7", - "rxjs": "^7.8.0" + "minimist": "^1.2.8", + "rxjs": "^7.8.1" }, "bin": { "wait-on": "bin/wait-on" @@ -10272,16 +10272,6 @@ "node": ">=12.0.0" } }, - "node_modules/wait-on/node_modules/axios": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.2.tgz", - "integrity": "sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==", - "dev": true, - "dependencies": { - "follow-redirects": "^1.14.9", - "form-data": "^4.0.0" - } - }, "node_modules/webidl-conversions": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", diff --git a/package.json b/package.json index 2c22cbcb3..65de31342 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@lezer/highlight": "^1.0.0", "@sindarius/gcodeviewer": "^3.7.11", "@uiw/codemirror-theme-vscode": "^4.19.11", - "axios": "^1.6.0", + "axios": "^1.7.4", "codemirror": "^6.0.1", "core-js": "^3.16.0", "detect-browser": "^5.3.0", @@ -92,7 +92,7 @@ "postcss-nesting": "^12.0.1", "prettier": "^3.0.0", "sass": "~1.32", - "start-server-and-test": "^2.0.0", + "start-server-and-test": "^2.0.5", "typescript": "^4.5.5", "unplugin-vue-components": "^0.22.12", "vite": "^4.5.3", From 78d563ebbabc83f60079bd9b226a15697bf3cbdd Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sat, 17 Aug 2024 11:36:20 +0200 Subject: [PATCH 2/4] fix: fix uuid request in MediaMTX webcam client (#1968) --- .../webcams/streamers/WebrtcMediaMTX.vue | 54 ++++++++++++++----- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/src/components/webcams/streamers/WebrtcMediaMTX.vue b/src/components/webcams/streamers/WebrtcMediaMTX.vue index f26194cda..189e9e18e 100644 --- a/src/components/webcams/streamers/WebrtcMediaMTX.vue +++ b/src/components/webcams/streamers/WebrtcMediaMTX.vue @@ -35,18 +35,22 @@ export default class WebrtcMediaMTX extends Mixins(BaseMixin, WebcamMixin) { @Prop({ default: null }) readonly printerUrl!: string | null @Ref() declare video: HTMLVideoElement - private pc: RTCPeerConnection | null = null - private restartTimeout: any = null - private status: string = 'connecting' - private eTag: string | null = null - private sessionUuid: string | null = null - private queuedCandidates: RTCIceCandidate[] = [] - private offerData: OfferData = { + pc: RTCPeerConnection | null = null + restartTimeout: any = null + status: string = 'connecting' + eTag: string | null = null + sessionUuid: string | null = null + queuedCandidates: RTCIceCandidate[] = [] + offerData: OfferData = { iceUfrag: '', icePwd: '', medias: [], } - private RESTART_PAUSE = 2000 + RESTART_PAUSE = 2000 + + mounted() { + this.start() + } // stop the video and close the streams if the component is going to be destroyed so we don't leave hanging streams beforeDestroy() { @@ -70,9 +74,15 @@ export default class WebrtcMediaMTX extends Mixins(BaseMixin, WebcamMixin) { let baseUrl = this.camSettings.stream_url if (!baseUrl.endsWith('/')) baseUrl += '/' - baseUrl = new URL('whep', baseUrl).toString() + try { + baseUrl = new URL('whep', baseUrl).toString() + + return this.convertUrl(baseUrl, this.printerUrl) + } catch (e) { + this.log('invalid baseURL', baseUrl) - return this.convertUrl(baseUrl, this.printerUrl) + return null + } } // stop and restart the video if the url changes @@ -87,7 +97,7 @@ export default class WebrtcMediaMTX extends Mixins(BaseMixin, WebcamMixin) { } // start or stop the video when the expand state changes - @Watch('expanded', { immediate: true }) + @Watch('expanded') expandChanged(newExpanded: boolean): void { if (!newExpanded) { this.terminate() @@ -189,6 +199,14 @@ export default class WebrtcMediaMTX extends Mixins(BaseMixin, WebcamMixin) { } start() { + // stop if url is not valid + if (this.url === null) { + this.log('invalid url') + + this.scheduleRestart() + return + } + this.log('requesting ICE servers from ' + this.url) fetch(this.url, { @@ -232,7 +250,7 @@ export default class WebrtcMediaMTX extends Mixins(BaseMixin, WebcamMixin) { this.offerData = this.parseOffer(offer.sdp ?? '') this.pc?.setLocalDescription(offer) - fetch(this.url, { + fetch(this.url ?? '', { method: 'POST', headers: { 'Content-Type': 'application/sdp', @@ -242,7 +260,8 @@ export default class WebrtcMediaMTX extends Mixins(BaseMixin, WebcamMixin) { .then((res) => { if (res.status !== 201) throw new Error('bad status code') this.eTag = res.headers.get('ETag') - this.sessionUuid = res.headers.get('location') + const location = res.headers.get('Location') ?? '' + this.sessionUuid = location?.substring(location.lastIndexOf('/') + 1) ?? null // fallback for MediaMTX v1.0.x with broken ETag header if (res.headers.has('E-Tag')) this.eTag = res.headers.get('E-Tag') @@ -301,7 +320,14 @@ export default class WebrtcMediaMTX extends Mixins(BaseMixin, WebcamMixin) { } sendLocalCandidates(candidates: RTCIceCandidate[]) { - const url = new URL(this.sessionUuid ?? '', this.url).toString() + if (this.sessionUuid === null) { + this.log('Session-UUID is null') + this.scheduleRestart() + + return + } + + const url = (this.url ?? '') + '/' + this.sessionUuid fetch(url, { method: 'PATCH', headers: { From e0f5f78d348adc75851d9c468685c15cc454be2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Maggioni?= Date: Sat, 17 Aug 2024 16:39:36 +0200 Subject: [PATCH 3/4] feat(console): add debug prefix (#1973) --- src/components/console/ConsoleTableEntry.vue | 4 ++-- src/plugins/helpers.ts | 2 ++ src/store/server/actions.ts | 5 ++++- src/store/server/mutations.ts | 5 ++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/console/ConsoleTableEntry.vue b/src/components/console/ConsoleTableEntry.vue index 21c2af4d9..e00ff72c2 100644 --- a/src/components/console/ConsoleTableEntry.vue +++ b/src/components/console/ConsoleTableEntry.vue @@ -19,7 +19,7 @@ export default class ConsoleTableEntry extends Mixins(BaseMixin) { get entryStyle() { const classes = ['ma-0', 'flex-nowrap'] classes.push(this.$store.state.gui.console.entryStyle ?? 'default') - if (this.event.type === 'action') classes.push('text--disabled') + if (['action', 'debug'].includes(this.event.type)) classes.push('text--disabled') return classes } @@ -31,7 +31,7 @@ export default class ConsoleTableEntry extends Mixins(BaseMixin) { get messageClass() { const classes = ['console-message'] - if (this.event.type === 'action') classes.push('text--disabled') + if (['action', 'debug'].includes(this.event.type)) classes.push('text--disabled') else if (this.event.message.startsWith('!! ')) classes.push('error--text') else classes.push('text--primary') diff --git a/src/plugins/helpers.ts b/src/plugins/helpers.ts index c0be39dab..f0727ff93 100644 --- a/src/plugins/helpers.ts +++ b/src/plugins/helpers.ts @@ -72,6 +72,8 @@ export function formatConsoleMessage(message: string): string { message = message.replace(/\n\/\/ /g, '\n') // remove echo message = message.replace(/^echo:/g, '') + // remove debug + message = message.replace(/^debug:/g, '') // replace linebreaks with html
message = message.replace('\n// ', '
') message = message.replace(/\r\n|\r|\n/g, '
') diff --git a/src/store/server/actions.ts b/src/store/server/actions.ts index 75c11cc30..270b3e7e7 100644 --- a/src/store/server/actions.ts +++ b/src/store/server/actions.ts @@ -258,7 +258,10 @@ export const actions: ActionTree = { else if ('error' in payload) message = message.error.message let formatMessage = formatConsoleMessage(message) - if (type === 'response' && message.startsWith('// action:')) type = 'action' + if (type === 'response') { + if (message.startsWith('// action:')) type = 'action' + else if (message.startsWith('// debug:')) type = 'debug' + } const filters = rootGetters['gui/console/getConsolefilterRules'] let boolImport = true diff --git a/src/store/server/mutations.ts b/src/store/server/mutations.ts index da2777490..c11d5160a 100644 --- a/src/store/server/mutations.ts +++ b/src/store/server/mutations.ts @@ -103,7 +103,10 @@ export const mutations: MutationTree = { let type = message.type if (type === 'command') formatMessage = '' + formatMessage + '' - if (type === 'response' && message.message.startsWith('// action:')) type = 'action' + if (type === 'response') { + if (message.message.startsWith('// action:')) type = 'action' + else if (message.message.startsWith('// debug:')) type = 'debug' + } state.events.push({ date, From 85c577434efaa60fdcf1a017ab0fa00b99c9eecf Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sat, 24 Aug 2024 18:35:48 +0200 Subject: [PATCH 4/4] fix(MediaMTX): fix some connection issues (#1979) --- src/components/panels/WebcamPanel.vue | 2 +- .../settings/Webcams/WebcamForm.vue | 2 +- src/components/webcams/WebcamWrapper.vue | 9 +- src/components/webcams/WebcamWrapperItem.vue | 3 +- .../webcams/streamers/WebrtcMediaMTX.vue | 173 ++++++++++-------- src/pages/Webcam.vue | 2 +- 6 files changed, 104 insertions(+), 87 deletions(-) diff --git a/src/components/panels/WebcamPanel.vue b/src/components/panels/WebcamPanel.vue index 652c3e5c8..b0f935cc3 100644 --- a/src/components/panels/WebcamPanel.vue +++ b/src/components/panels/WebcamPanel.vue @@ -42,7 +42,7 @@ - + diff --git a/src/components/settings/Webcams/WebcamForm.vue b/src/components/settings/Webcams/WebcamForm.vue index 5a43c4fbc..1de588da6 100644 --- a/src/components/settings/Webcams/WebcamForm.vue +++ b/src/components/settings/Webcams/WebcamForm.vue @@ -145,7 +145,7 @@ - + diff --git a/src/components/webcams/WebcamWrapper.vue b/src/components/webcams/WebcamWrapper.vue index cd2dfb679..a67f3196a 100644 --- a/src/components/webcams/WebcamWrapper.vue +++ b/src/components/webcams/WebcamWrapper.vue @@ -4,13 +4,17 @@ - + @@ -31,6 +35,7 @@ export default class WebcamWrapper extends Mixins(BaseMixin) { @Prop({ type: Object, required: true }) webcam!: GuiWebcamStateWebcam @Prop({ type: Boolean, default: true }) showFps!: Boolean @Prop({ type: String, default: null }) printerUrl!: string | null + @Prop({ type: String, default: null }) page!: string | null get webcams(): GuiWebcamStateWebcam[] { return this.$store.getters['gui/webcams/getWebcams'] diff --git a/src/components/webcams/WebcamWrapperItem.vue b/src/components/webcams/WebcamWrapperItem.vue index 4e7217ef1..8d95a42f7 100644 --- a/src/components/webcams/WebcamWrapperItem.vue +++ b/src/components/webcams/WebcamWrapperItem.vue @@ -25,7 +25,7 @@