Always use full origin for api origin

This commit is contained in:
Johannes Zellner
2023-07-14 18:34:22 +02:00
parent be16ad6953
commit 159ff1704f
2 changed files with 3 additions and 4 deletions

View File

@@ -74,7 +74,7 @@ import { FitAddon } from 'xterm-addon-fit';
import { create } from '../models/AppModel.js';
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? 'https://' + import.meta.env.VITE_API_ORIGIN : '';
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? 'https://' + import.meta.env.VITE_API_ORIGIN : window.location.origin;
export default {
name: 'Terminal',
@@ -142,7 +142,6 @@ export default {
}
this.downloadFileDialog.downloadUrl = `${this.apiOrigin}/api/v1/apps/${this.id}/download?file=${encodeURIComponent(this.downloadFileDialog.name)}&access_token=${this.accessToken}`;
console.log(this.downloadFileDialog.downloadUrl)
// we have to click the link to make the browser do the download
// don't know how to prevent the browsers
@@ -241,7 +240,7 @@ export default {
});
// websocket cannot use relative urls
var url = `${this.apiOrigin.replace('https', 'wss')}/api/v1/apps/${this.id}/exec/${execId}/startws?tty=true&rows=${this.terminal.rows}&columns=${this.terminal.cols}&access_token=${this.accessToken}`;
const url = `${this.apiOrigin.replace('https', 'wss')}/api/v1/apps/${this.id}/exec/${execId}/startws?tty=true&rows=${this.terminal.rows}&columns=${this.terminal.cols}&access_token=${this.accessToken}`;
this.socket = new WebSocket(url);
this.terminal.loadAddon(new AttachAddon(this.socket));