File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 66import { ControllerReply_StatusCode } from '../proto/ssl_gc_rcon' ;
77
88export class ApiController {
9+ private readonly apiPath = '/api/control'
910 private ws ?: WebSocket
1011 private stateConsumer : ( ( state : RemoteControlTeamState ) => any ) [ ] = [ ]
1112 private errorConsumer : ( ( message : string ) => any ) [ ] = [ ]
@@ -27,7 +28,7 @@ export class ApiController {
2728 }
2829
2930 constructor ( ) {
30- this . connect ( ApiController . determineWebSocketAddress ( ) )
31+ this . connect ( this . determineWebSocketAddress ( ) )
3132 }
3233
3334 public Send ( request : RemoteControlToController ) {
@@ -47,14 +48,9 @@ export class ApiController {
4748 this . errorConsumer . push ( cb )
4849 }
4950
50- private static determineWebSocketAddress ( ) {
51- if ( process . env . NODE_ENV === 'development' ) {
52- // use the default backend port
53- return 'ws://localhost:8083/api/control'
54- }
55- // UI and backend are served on the same host+port on production builds
51+ private determineWebSocketAddress ( ) {
5652 const protocol = window . location . protocol === 'http:' ? 'ws:' : 'wss:' ;
57- return protocol + '//' + window . location . hostname + ':' + window . location . port + '/api/control'
53+ return protocol + '//' + window . location . hostname + ':' + window . location . port + this . apiPath
5854 }
5955
6056 private connect ( address : string ) {
Original file line number Diff line number Diff line change 1- import { defineConfig } from 'vite'
1+ import { defineConfig } from 'vite'
22import vue from '@vitejs/plugin-vue'
33
44// https://vitejs.dev/config/
55export default defineConfig ( {
6- plugins : [ vue ( ) ]
6+ plugins : [ vue ( ) ] ,
7+ server : {
8+ proxy : {
9+ '/api' : {
10+ target : 'http://localhost:8083' ,
11+ changeOrigin : true ,
12+ secure : false ,
13+ ws : true ,
14+ }
15+ }
16+ }
717} )
You can’t perform that action at this time.
0 commit comments