diff --git a/src/components/TheConnectingDialog.vue b/src/components/TheConnectingDialog.vue index 890c8d91f..29cad445b 100644 --- a/src/components/TheConnectingDialog.vue +++ b/src/components/TheConnectingDialog.vue @@ -70,7 +70,9 @@ export default class TheConnectingDialog extends Mixins(BaseMixin, ThemeMixin) { } get formatHostname() { - return parseInt(this.port) !== 80 && this.port !== '' ? this.hostname + ':' + this.port + this.path : this.hostname + this.path + 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 c2cad2ee1..70c82caa5 100644 --- a/src/components/TheSelectPrinterDialog.vue +++ b/src/components/TheSelectPrinterDialog.vue @@ -435,14 +435,15 @@ export default class TheSelectPrinterDialog extends Mixins(BaseMixin) { port: printer.socket.port, path: printer.socket.path, }) - let normPath = printer.socket.path.replaceAll(/(^\/*)|(\/*$)/g, "") - let url = this.protocol + - '://' + - printer.socket.hostname + - ':' + - printer.socket.port + - (normPath.length > 0 ? `/${normPath}` : '') + - '/websocket' + const normPath = printer.socket.path.replaceAll(/(^\/*)|(\/*$)/g, '') + const url = + this.protocol + + '://' + + printer.socket.hostname + + ':' + + printer.socket.port + + (normPath.length > 0 ? `/${normPath}` : '') + + '/websocket' this.$socket.setUrl(url) this.$socket.connect() } diff --git a/src/store/farm/printer/getters.ts b/src/store/farm/printer/getters.ts index 6dfc907f1..7f9fd8631 100644 --- a/src/store/farm/printer/getters.ts +++ b/src/store/farm/printer/getters.ts @@ -7,17 +7,9 @@ import { GuiWebcamStateWebcam } from '@/store/gui/webcams/types' // eslint-disable-next-line export const getters: GetterTree = { getSocketUrl: (state) => { - const normPath = state.socket.path.replaceAll(/(^\/*)|(\/*$)/g, "") + const normPath = state.socket.path.replaceAll(/(^\/*)|(\/*$)/g, '') const path = normPath.length > 0 ? `/${normPath}` : '' - return ( - state.socket.protocol + - '://' + - state.socket.hostname + - ':' + - state.socket.port + - path + - '/websocket' - ) + return state.socket.protocol + '://' + state.socket.hostname + ':' + state.socket.port + path + '/websocket' }, getSocketData: (state) => { @@ -138,7 +130,7 @@ export const getters: GetterTree = { const dir = indexLastDir !== -1 ? state.current_file.filename.substring(0, indexLastDir) + '/' : '' const thumbnail = state.current_file.thumbnails.find((thumb) => thumb.width >= thumbnailBigMin) - const normPath = state.socket.path.replaceAll(/(^\/*)|(\/*$)/g, "") + const normPath = state.socket.path.replaceAll(/(^\/*)|(\/*$)/g, '') const path = normPath.length > 0 ? `/${normPath}` : '' if (thumbnail && 'relative_path' in thumbnail) return ( @@ -163,10 +155,12 @@ export const getters: GetterTree = { acceptExtensions.includes(element.substr(element.lastIndexOf('.') + 1)) ) - const normPath = state.socket.path.replaceAll(/(^\/*)|(\/*$)/g, "") + const normPath = state.socket.path.replaceAll(/(^\/*)|(\/*$)/g, '') const path = normPath.length > 0 ? `/${normPath}` : '' - return file ? '//' + state.socket.hostname + ':' + state.socket.port + path + '/server/files/config/' + file : null + return file + ? '//' + state.socket.hostname + ':' + state.socket.port + path + '/server/files/config/' + file + : null }, getLogo: (state, getters) => { @@ -284,7 +278,7 @@ export const getters: GetterTree = { ) { return ( state.data.print_stats.print_duration / - (state.data.print_stats.filament_used / state.current_file.filament_total) - + (state.data.print_stats.filament_used / state.current_file.filament_total) - state.data.print_stats.print_duration ).toFixed(0) } diff --git a/src/store/socket/actions.ts b/src/store/socket/actions.ts index a001ca0b0..d05de1db3 100644 --- a/src/store/socket/actions.ts +++ b/src/store/socket/actions.ts @@ -18,7 +18,7 @@ export const actions: ActionTree = { commit('setData', payload) if ('$socket' in Vue.prototype) { - const normPath = payload.path.replaceAll(/(^\/*)|(\/*$)/g, "") + const normPath = payload.path.replaceAll(/(^\/*)|(\/*$)/g, '') const path = normPath.length > 0 ? `/${normPath}` : '' await Vue.prototype.$socket.close() await Vue.prototype.$socket.setUrl(