Always use full origin for api origin
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user