From 6c67ea9e9e88cee3d1850bd42568b9c067088ce6 Mon Sep 17 00:00:00 2001 From: fuwa Date: Wed, 24 Jul 2019 01:56:56 +0800 Subject: [PATCH] add host to config --- cyberwow/lib/config.dart | 5 ++++- cyberwow/lib/controller/rpc.dart | 4 ++-- cyberwow/lib/controller/syncing.dart | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cyberwow/lib/config.dart b/cyberwow/lib/config.dart index 631ac9f..490adce 100644 --- a/cyberwow/lib/config.dart +++ b/cyberwow/lib/config.dart @@ -32,5 +32,8 @@ const arch = 'arm64'; // const arch = 'x86_64'; const minimumHeight = 118361; -const isPC = arch == 'x86_64'; +const isEmu = arch == 'x86_64'; +const emuHost = '192.168.10.100'; + +const host = isEmu ? emuHost : '127.0.0.1'; diff --git a/cyberwow/lib/controller/rpc.dart b/cyberwow/lib/controller/rpc.dart index 6ec3bc7..c160c1d 100644 --- a/cyberwow/lib/controller/rpc.dart +++ b/cyberwow/lib/controller/rpc.dart @@ -30,7 +30,7 @@ import '../config.dart'; int rpcID = 0; Future rpc(String method) async { - final url = 'http://127.0.0.1:${config.port}/json_rpc'; + final url = 'http://${host}:${config.port}/json_rpc'; rpcID += 1; @@ -154,7 +154,7 @@ Future getConnectionsString() async => rpcString('get_connections', fiel Future rpcOther(String method) async { - final url = 'http://127.0.0.1:${config.port}/json_rpc'; + final url = 'http://${host}:${config.port}/json_rpc'; var response; try { diff --git a/cyberwow/lib/controller/syncing.dart b/cyberwow/lib/controller/syncing.dart index 9c09946..b91dc53 100644 --- a/cyberwow/lib/controller/syncing.dart +++ b/cyberwow/lib/controller/syncing.dart @@ -63,7 +63,7 @@ Stream runBinary (String name) async* { yield line; } - if (isPC) return; + if (isEmu) return; // the app should never reach here log.severe('Daemon is gone!');