Fixed SocketIO calls when pgAdmin 4 server is running from a sub directory. #5521

This commit is contained in:
Aditya Toshniwal
2022-11-15 13:51:12 +05:30
committed by GitHub
parent c5e9aa6357
commit 669a3a7673
4 changed files with 20 additions and 11 deletions

View File

@@ -25,6 +25,8 @@ from pgadmin.utils.constants import MIMETYPE_APP_JS
from pgadmin.utils.driver import get_driver
from ... import socketio as sio
from pgadmin.utils import get_complete_file_path
from pgadmin.authenticate import socket_login_required
if _platform == 'win32':
# Check Windows platform support for WinPty api, Disable psql
@@ -149,6 +151,7 @@ def set_term_size(fd, row, col, xpix=0, ypix=0):
@sio.on('connect', namespace='/pty')
@socket_login_required
def connect():
"""
Connect to the server through socket.
@@ -276,6 +279,7 @@ def pty_handel_io(connection_data, data, sid):
@sio.on('start_process', namespace='/pty')
@socket_login_required
def start_process(data):
"""
Start the pty terminal and execute psql command and emit results to user.

View File

@@ -275,7 +275,11 @@ export function initialize(gettext, url_for, $, _, pgAdmin, csrfToken, Browser)
return new SearchAddon();
},
psql_socket: function() {
return io('/pty', {pingTimeout: 120000, pingInterval: 25000});
return io('/pty', {
path: `${url_for('pgadmin.root')}/socket.io`,
pingTimeout: 120000,
pingInterval: 25000
});
},
set_theme: function(term) {
let theme = {