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:
@@ -3,5 +3,6 @@ const merge = require('webpack-merge')
|
||||
const prodEnv = require('./prod.env')
|
||||
|
||||
module.exports = merge(prodEnv, {
|
||||
NODE_ENV: '"development"'
|
||||
NODE_ENV: '"development"',
|
||||
PREFIX_PATH: '"/app"'
|
||||
})
|
||||
|
||||
+4
-2
@@ -5,7 +5,9 @@
|
||||
const path = require('path')
|
||||
const BACKEND = process.env.BACKEND || 'http://127.0.0.1:6080'
|
||||
|
||||
const PREFIX_PATH = process.env.PREFIX_PATH
|
||||
const PREFIX_PATH = process.env.PREFIX_PATH || '/app'
|
||||
|
||||
console.log(`within /config/index.js: ${process.env.PREFIX_PATH}`)
|
||||
|
||||
const api_key = `${PREFIX_PATH}/api`
|
||||
const websockify_key = `${PREFIX_PATH}/websockfiy`
|
||||
@@ -67,7 +69,7 @@ module.exports = {
|
||||
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||
assetsSubDirectory: 'static',
|
||||
assetsSubDirectory: PREFIX_PATH.substr(1)+'/static',
|
||||
assetsPublicPath: '/',
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
'use strict'
|
||||
module.exports = {
|
||||
NODE_ENV: '"production"'
|
||||
NODE_ENV: '"production"',
|
||||
PREFIX_PATH: '"/app"'
|
||||
}
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
@@ -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: '/',
|
||||
|
||||
Reference in New Issue
Block a user