add host to config

This commit is contained in:
fuwa
2019-07-24 02:23:46 +08:00
parent e7f8ee17f9
commit 6c67ea9e9e
3 changed files with 7 additions and 4 deletions
+4 -1
View File
@@ -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';
+2 -2
View File
@@ -30,7 +30,7 @@ import '../config.dart';
int rpcID = 0;
Future<http.Response> 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<String> getConnectionsString() async => rpcString('get_connections', fiel
Future<http.Response> 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 {
+1 -1
View File
@@ -63,7 +63,7 @@ Stream<String> runBinary (String name) async* {
yield line;
}
if (isPC) return;
if (isEmu) return;
// the app should never reach here
log.severe('Daemon is gone!');