From 69bed888b4b5f317212147f4b0aeffab7108037c Mon Sep 17 00:00:00 2001 From: 4cello <32751308+4cello@users.noreply.github.com> Date: Sat, 27 Apr 2024 15:46:48 +0200 Subject: [PATCH] feat: Connect to Moonraker via subdirectory/path (#1836) Co-authored-by: Stefan Dej --- .env.development.local.example | 3 + public/config.json | 1 + src/components/TheConnectingDialog.vue | 8 +- src/components/TheSelectPrinterDialog.vue | 92 +++++++++++++++---- .../settings/SettingsRemotePrintersTab.vue | 28 ++++-- src/locales/en.json | 2 + src/store/actions.ts | 1 + src/store/farm/index.ts | 1 + src/store/farm/printer/getters.ts | 16 +++- src/store/farm/printer/index.ts | 1 + src/store/farm/printer/types.ts | 1 + src/store/gui/remoteprinters/actions.ts | 4 + src/store/gui/remoteprinters/types.ts | 1 + src/store/socket/actions.ts | 5 +- src/store/socket/getters.ts | 9 +- src/store/socket/index.ts | 2 + src/store/socket/types.ts | 1 + src/store/types.ts | 2 + 18 files changed, 149 insertions(+), 29 deletions(-) diff --git a/.env.development.local.example b/.env.development.local.example index a818e9f67..c66b2044f 100644 --- a/.env.development.local.example +++ b/.env.development.local.example @@ -4,6 +4,9 @@ VUE_APP_HOSTNAME=printer.local # port from the moonraker instance VUE_APP_PORT=7125 +# route_prefix from the moonraker instance +VUE_APP_PATH="/" + # reconnect interval in ms VUE_APP_RECONNECT_INTERVAL=5000 diff --git a/public/config.json b/public/config.json index cdc1db4a6..9dd1d5a8d 100644 --- a/public/config.json +++ b/public/config.json @@ -3,6 +3,7 @@ "defaultTheme": "dark", "hostname": null, "port": null, + "path": null, "instancesDB": "moonraker", "instances": [] } diff --git a/src/components/TheConnectingDialog.vue b/src/components/TheConnectingDialog.vue index 190dd478f..29cad445b 100644 --- a/src/components/TheConnectingDialog.vue +++ b/src/components/TheConnectingDialog.vue @@ -65,8 +65,14 @@ export default class TheConnectingDialog extends Mixins(BaseMixin, ThemeMixin) { return this.$store.state.socket.port } + get path() { + return this.$store.state.socket.path + } + get formatHostname() { - return parseInt(this.port) !== 80 && this.port !== '' ? this.hostname + ':' + this.port : this.hostname + return parseInt(this.port) !== 80 && this.port !== '' + ? this.hostname + ':' + this.port + this.path + : this.hostname + this.path } get isConnecting() { diff --git a/src/components/TheSelectPrinterDialog.vue b/src/components/TheSelectPrinterDialog.vue index 8e82c03c6..235bf2624 100644 --- a/src/components/TheSelectPrinterDialog.vue +++ b/src/components/TheSelectPrinterDialog.vue @@ -1,5 +1,3 @@ - -