fix: update deployment scripts and resolve backend API communication issue
This commit is contained in:
1 parent
ae023525ec
commit
441560a910
14 files changed
+61
-66
No files matched your search
+12
-12
@@ -1,9 +1,9 @@
|
||||
// StrixWebSSH Client JavaScript
|
||||
// WebSSH Client JavaScript
|
||||
|
||||
let connections = [];
|
||||
let currentConnectionId = null;
|
||||
let authToken = localStorage.getItem('strixwebssh_token');
|
||||
let currentUser = localStorage.getItem('strixwebssh_user');
|
||||
let authToken = localStorage.getItem('webssh_token');
|
||||
let currentUser = localStorage.getItem('webssh_user');
|
||||
let storedUsers = {}; // Will be loaded from /api/config
|
||||
let maxUploadSize = localStorage.getItem('maxUploadSize') ? parseInt(localStorage.getItem('maxUploadSize')) : 100 * 1024 * 1024;
|
||||
// Dynamically determine API URL based on current host (same origin since everything is in container)
|
||||
@@ -17,7 +17,7 @@ function getWsUrl() {
|
||||
return `${protocol}//${window.location.host}/ws`;
|
||||
}
|
||||
|
||||
const CONNECTIONS_KEY = 'strixwebssh_connections';
|
||||
const CONNECTIONS_KEY = 'webssh_connections';
|
||||
|
||||
// Load connections from server (with encrypted credentials)
|
||||
async function loadSavedConnections() {
|
||||
@@ -256,7 +256,7 @@ async function login() {
|
||||
|
||||
if (response.ok && data.token) {
|
||||
authToken = data.token;
|
||||
localStorage.setItem('strixwebssh_token', authToken);
|
||||
localStorage.setItem('webssh_token', authToken);
|
||||
document.getElementById('loginModal').classList.remove('active');
|
||||
document.getElementById('loggedInUser').textContent = data.username;
|
||||
term.writeln(`[Authenticated as ${data.username}]`);
|
||||
@@ -287,18 +287,18 @@ async function verifyToken() {
|
||||
loadSavedConnections(); // Load encrypted credentials from server
|
||||
setTimeout(loadConfig, 500); // Load configuration after successful token verification with delay
|
||||
} else {
|
||||
localStorage.removeItem('strixwebssh_token');
|
||||
localStorage.removeItem('webssh_token');
|
||||
authToken = null;
|
||||
}
|
||||
} catch (e) {
|
||||
localStorage.removeItem('strixwebssh_token');
|
||||
localStorage.removeItem('webssh_token');
|
||||
authToken = null;
|
||||
}
|
||||
}
|
||||
|
||||
function logout() {
|
||||
localStorage.removeItem('strixwebssh_token');
|
||||
localStorage.removeItem('strixwebssh_api_url');
|
||||
localStorage.removeItem('webssh_token');
|
||||
localStorage.removeItem('webssh_api_url');
|
||||
authToken = null;
|
||||
location.reload();
|
||||
}
|
||||
@@ -773,7 +773,7 @@ function sendResizeForConnection(conn) {
|
||||
|
||||
// Initialize
|
||||
toggleAuthFields();
|
||||
term.writeln('StrixWebSSH Multi-Connection Client');
|
||||
term.writeln('WebSSH Multi-Connection Client');
|
||||
term.writeln('Click "+ New Connection" to get started');
|
||||
|
||||
// ============================================
|
||||
@@ -787,13 +787,13 @@ let sftpUploadQueue = [];
|
||||
let currentSftpConnection = null;
|
||||
// Load configuration from API
|
||||
function loadConfig() {
|
||||
console.log('loadConfig() called, token exists:', !!localStorage.getItem('strixwebssh_token'));
|
||||
console.log('loadConfig() called, token exists:', !!localStorage.getItem('webssh_token'));
|
||||
console.log('apiBaseUrl:', apiBaseUrl);
|
||||
|
||||
fetch(`${apiBaseUrl}/api/config`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Authorization': `Bearer ${localStorage.getItem('strixwebssh_token')}`
|
||||
'Authorization': `Bearer ${localStorage.getItem('webssh_token')}`
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
|
||||
Reference in new issue
Block a user