This commit is contained in:
Baobhan Sith
2025-04-28 17:58:09 +08:00
parent fe172fdbed
commit 652a47404c
3 changed files with 25 additions and 7 deletions
+3 -1
View File
@@ -15,9 +15,11 @@ COPY packages/frontend/src ./packages/frontend/src
COPY packages/frontend/index.html ./packages/frontend/
COPY packages/frontend/tsconfig.json ./packages/frontend/
COPY packages/frontend/vite.config.ts ./packages/frontend/
COPY packages/frontend/.env ./packages/frontend/
# Copy the root .env file into the builder stage so Vite can read it during build
COPY .env ./.env
RUN npm run build --workspace=@nexus-terminal/frontend
FROM nginx:stable-alpine
@@ -40,19 +40,19 @@ const MIN_MODAL_HEIGHT = 768;
// Dynamically construct WebSocket URL based on environment
let backendBaseUrl: string;
const LOCAL_BACKEND_URL = 'ws://localhost:18112'
if (import.meta.env.DEV && import.meta.env.VITE_BACKEND_WS_URL) {
// Development mode: Use the URL specified in .env
backendBaseUrl = import.meta.env.VITE_BACKEND_WS_URL;
console.log(`[RDP Modal] Using development WebSocket Base URL from env: ${backendBaseUrl}`);
// Determine WebSocket URL based on hostname
if (window.location.hostname === 'localhost') {
backendBaseUrl = LOCAL_BACKEND_URL;
console.log(`[RDP Modal] Using localhost WebSocket Base URL: ${backendBaseUrl}`);
} else {
// Production mode: Construct URL based on current window location
// Fallback: Construct URL based on current window location for production/other environments
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsHostAndPort = window.location.host;
backendBaseUrl = `${wsProtocol}//${wsHostAndPort}`;
console.log(`[RDP Modal] Using production WebSocket Base URL from window.location: ${backendBaseUrl}`);
}
// Removed localStorage keys
const connectRdp = async () => { // Removed useInputValues parameter
if (!props.connection || !rdpDisplayRef.value) {