Skip to content

Commit

Permalink
Fix server port error
Browse files Browse the repository at this point in the history
  • Loading branch information
qianlifeng committed Dec 4, 2023
1 parent 029ea98 commit c19042b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Wox.UI.Flutter/wox/lib/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:get/get.dart';
import 'package:logger/logger.dart';
import 'package:uuid/v4.dart';
import 'package:window_manager/window_manager.dart';
import 'package:wox/utils/env.dart';
import 'package:wox/utils/websocket.dart';

import 'entity.dart';
Expand Down Expand Up @@ -34,7 +35,7 @@ class WoxController extends GetxController {
}

void _setupWebSocket() {
ws = WoxWebsocket(Uri.parse("ws://localhost:34987/ws"), onMessageReceived: _handleWebSocketMessage);
ws = WoxWebsocket(Uri.parse("ws://localhost:${Env.serverPort}/ws"), onMessageReceived: _handleWebSocketMessage);
ws.connect();
}

Expand Down
6 changes: 3 additions & 3 deletions Wox.UI.Flutter/wox/lib/utils/env.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Env {
static int serverPort = 34987;
static int serverPid = -1;
static bool isDev = true;
static late int serverPort;
static late int serverPid;
static late bool isDev;
}
3 changes: 2 additions & 1 deletion Wox.UI.Flutter/wox/lib/utils/wox_http_util.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import 'package:dio/dio.dart';
import 'package:wox/entity/wox_response.dart';
import 'package:wox/utils/entity_factory.dart';
import 'package:wox/utils/env.dart';

class WoxHttpUtil {
final Dio _dio = Dio();
final String _baseUrl = 'http://localhost:34987';
final String _baseUrl = 'http://localhost:${Env.serverPort}';

WoxHttpUtil._privateConstructor();

Expand Down

0 comments on commit c19042b

Please sign in to comment.