1
0
mirror of https://github.com/fcwu/docker-ubuntu-vnc-desktop synced 2026-08-05 16:12:41 +02:00

Add ENV variable PREFIX_PATH to backend and web project

This commit is contained in:
Tobias Stein
2019-06-26 11:56:29 +02:00
parent f26fe29012
commit 175d7a8517
10 changed files with 49 additions and 25 deletions
+7 -5
View File
@@ -56,7 +56,7 @@ export default {
'h': h
}
try {
const response = await this.$http.get(process.env.PREFIX_PATH + '/api/state', {params: params})
const response = await this.$http.get(`${process.env.PREFIX_PATH}` + '/api/state', {params: params})
const body = response.data
if (body.code !== 200) {
this.stateErrorCount += 1
@@ -71,7 +71,7 @@ export default {
// adaptive resolution
if (!body.data.config.fixedResolution && body.data.config.sizeChangedCount === 0) {
const response = await this.$http.get(process.env.PREFIX_PATH + '/api/reset', {params: params})
const response = await this.$http.get(`${process.env.PREFIX_PATH}` + '/api/reset', {params: params})
const body = response.data
if (body.code !== 200) {
this.stateErrorCount += 1
@@ -136,7 +136,9 @@ export default {
// console.trace()
console.log(`connecting...`)
this.errorMessage = ''
let websockifyPath = process.env.PREFIX_PATH + '/websockify'
let prefixName = `${process.env.PREFIX_PATH}`.substr(1)
console.log(prefixName)
let websockifyPath = prefixName + '/websockify'
if (force || this.vncState === 'stopped') {
this.vncState = 'connecting'
let hostname = window.location.hostname
@@ -144,7 +146,7 @@ export default {
if (!port) {
port = window.location.protocol[4] === 's' ? 443 : 80
}
let url = 'static/vnc.html?'
let url = prefixName + '/static/vnc.html?'
url += 'autoconnect=1&'
url += `host=${hostname}&port=${port}&`
url += `path=${websockifyPath}&title=novnc2&`
@@ -155,7 +157,7 @@ export default {
if (force || this.videoState === 'stopped') {
const w = this.$refs.vncFrame.clientWidth
const h = this.$refs.vncFrame.clientHeight
let url = `static/video.html?width=${w}&height=${h}&base=${window.location.host}`
let url = prefixName + `/static/video.html?width=${w}&height=${h}&base=${window.location.host}`
this.$refs.videoFrame.setAttribute('src', url)
this.videoState = 'connecting'
}
+3 -1
View File
@@ -4,9 +4,11 @@ import Vnc from '@/components/Vnc'
Vue.use(Router)
console.log(`within (router) /src/index.js: ${process.env.PREFIX_PATH}`)
export default new Router({
mode: 'history',
base: process.env.PREFIX_PATH,
base: `${process.env.PREFIX_PATH}`,
routes: [
{
path: '/',