This commit is contained in:
Baobhan Sith
2025-04-28 14:09:43 +08:00
parent 179f0035f6
commit cfbc124295
7 changed files with 139 additions and 41 deletions
+2 -1
View File
@@ -31,7 +31,8 @@
"sqlite3": "^5.1.7",
"ssh2": "^1.16.0",
"uuid": "^11.1.0",
"xterm": "^5.3.0"
"xterm": "^5.3.0",
"ws": "^8.18.1"
},
"devDependencies": {
"@types/bcrypt": "^5.0.2",
@@ -38,8 +38,13 @@ const desiredModalHeight = ref(858); // User sets the desired TOTAL modal height
const MIN_MODAL_WIDTH = 1024;
const MIN_MODAL_HEIGHT = 768;
const RDP_BACKEND_API_BASE = 'http://localhost:9090';
const RDP_BACKEND_WEBSOCKET_URL = 'ws://localhost:8081';
const RDP_BACKEND_API_BASE = 'http://localhost:9090'; // This might need adjustment too if API is accessed directly from browser, but currently it's proxied via backend
// Dynamically construct WebSocket URL
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsHost = window.location.hostname;
const wsPort = import.meta.env.VITE_RDP_WEBSOCKET_PORT || '18114'; // Read from env var or use default
const RDP_BACKEND_WEBSOCKET_URL = `${wsProtocol}//${wsHost}:${wsPort}`;
// Removed localStorage keys
const connectRdp = async () => { // Removed useInputValues parameter
+38
View File
@@ -0,0 +1,38 @@
# Use a lightweight Node.js image
FROM node:20-alpine AS builder
# Set the working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY packages/rdp/package.json packages/rdp/package-lock.json* ./
# Install ALL dependencies (including devDependencies like typescript)
RUN npm install
# Copy source code and tsconfig
COPY packages/rdp/src ./src
COPY packages/rdp/tsconfig.json ./tsconfig.json
# Build the TypeScript code
RUN npm run build
# Remove development dependencies after build
RUN npm prune --production
# --- Production Stage ---
FROM node:20-alpine
WORKDIR /app
# Copy built code and node_modules from builder stage
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY packages/rdp/package.json ./package.json
# Expose the API and WebSocket ports
EXPOSE 9090
EXPOSE 8081
# Command to run the application
CMD ["node", "dist/server.js"]
+3 -2
View File
@@ -1,10 +1,11 @@
{
"name": "backend",
"name": "@nexus-terminal/rdp",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "tsc && node dist/server.js",
"build": "tsc",
"start": "node dist/server.js",
"dev": "nodemon --exec \"ts-node --files src/server.ts\""
},
"keywords": [],