Merge pull request #6 from fuwa0529/dev

more stuff
master v0.7.0.0-k
jw 4 years ago committed by GitHub
commit 647412fb81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,6 +38,10 @@ watch:
find cyberwow/lib/ -name '*.dart' | \
entr kill -USR1 `cat /tmp/flutter.pid`
watch-build:
find cyberwow/lib/ -name '*.dart' | \
entr $(MAKE) build-debug
run:
cd cyberwow && \
flutter run --debug --pid-file /tmp/flutter.pid
@ -67,7 +71,7 @@ collect:
build:
cd cyberwow && \
flutter build apk --target-platform android-arm64
flutter build apk --target-platform android-arm64 -v
build-debug:
cd cyberwow && \
@ -83,7 +87,7 @@ script := etc/scripts/build-external-libs
wow: clean-external-libs collect-wownero build
wow-fake: clean-external-libs collect-wownero-fake build
wow-no-native: build
clean-external-libs:
$(script)/clean.sh
@ -122,10 +126,6 @@ wownero: openssl boost sodium toolchain-wow
collect-wownero: wownero
$(script)/collect.sh
collect-wownero-fake:
$(script)/collect-fake.sh
# etc
remove-exif:

@ -64,3 +64,7 @@ The resulting apk is `cyberwow/build/app/outputs/apk/release/app-release.apk`.
Sending the arguments to an unopened CyberWOW app will cause `wownerod` to use them on start up, for example:
`--add-exclusive-node 192.168.1.3`
## F-droid build status
<https://f-droid.org/wiki/page/org.wownero.cyberwow/lastbuild>

@ -41,8 +41,8 @@ android {
applicationId "org.wownero.cyberwow"
minSdkVersion 26
targetSdkVersion 29
versionCode 23
versionName "0.7.0.0-j"
versionCode 24
versionName "0.7.0.0-k"
}
if(project.hasProperty("RELEASE_STORE_FILE")) {

@ -1,36 +0,0 @@
/*
Copyright 2019 fuwa
This file is part of CyberWOW.
CyberWOW is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CyberWOW is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CyberWOW. If not, see <https://www.gnu.org/licenses/>.
*/
import 'dart:async';
import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'package:flutter/foundation.dart';
Future<String> getBinaryPath(final String name) async {
final tmpDir = await getTemporaryDirectory();
return tmpDir.path + '/' + name;
}
Future<bool> binaryExists(final String name) async {
final binPath = await getBinaryPath(name);
return new File(binPath).exists();
}

@ -26,10 +26,9 @@ import 'dart:io';
import 'dart:async';
import 'dart:convert';
import '../helper.dart';
import '../../config.dart' as config;
import '../../logging.dart';
import '../../logic/sensor/helper.dart' as helper;
import '../../../config.dart' as config;
import '../../../logging.dart';
import '../../sensor/helper.dart' as helper;
typedef ShouldExit = bool Function();
@ -80,7 +79,11 @@ Stream<String> runBinary
if (input != null) {
printInput();
}
await for (final line in outputProcess.stdout.transform(utf8.decoder)) {
final _stdout = outputProcess.stdout
.transform(utf8.decoder).transform(const LineSplitter());
await for (final line in _stdout) {
log.finest('process output: ' + line);
yield line;
}

@ -23,11 +23,10 @@ import 'package:logging/logging.dart';
import 'dart:ui';
import 'dart:async';
import 'rpc/rpc.dart' as rpc;
import '../config.dart';
import '../logging.dart';
import '../helper.dart';
import '../../config.dart';
import '../../logging.dart';
import '../../helper.dart';
typedef GetNotificationFunc = AppLifecycleState Function();

@ -0,0 +1,79 @@
/*
Copyright 2019 fuwa
This file is part of CyberWOW.
CyberWOW is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CyberWOW is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CyberWOW. If not, see <https://www.gnu.org/licenses/>.
*/
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter/foundation.dart';
import '../../../config.dart' as config;
import '../../../helper.dart';
import '../../../logging.dart';
Future<http.Response> rpcHTTP(final String method) async {
final url = 'http://${config.host}:${config.c.port}/json_rpc';
final body = json.encode
(
{
'jsonrpc': '2.0',
'method': method,
}
);
try {
final response = await http.post
( url,
body: body
);
return response;
}
catch (e) {
log.warning(e);
return null;
}
}
dynamic jsonDecode(final String responseBody) => json.decode(responseBody);
Future<dynamic> rpc(final String method, {final String field}) async {
final response = await rpcHTTP(method);
if (response == null) return null;
if (response.statusCode != 200) {
return null;
} else {
final _body = await compute(jsonDecode, response.body);
final _result = _body['result'];
if (_result == null) return null;
final _field = field == null ? _result : _result[field];
return _field;
}
}
Future<String> rpcString(final String method, {final String field}) async {
final _field = await rpc(method, field: field);
return pretty(_field);
}

@ -0,0 +1,64 @@
/*
Copyright 2019 fuwa
This file is part of CyberWOW.
CyberWOW is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
CyberWOW is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with CyberWOW. If not, see <https://www.gnu.org/licenses/>.
*/
import 'dart:async';
import 'dart:convert';
import 'dart:math';
import 'package:http/http.dart' as http;
import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import '../../../config.dart' as config;
import '../../../helper.dart';
import '../../../logging.dart';
Future<http.Response> rpc2(final String method) async {
final url = 'http://${config.host}:${config.c.port}/${method}';
try {
final response = await http.post
( url,
);
return response;
}
catch (e) {
log.warning(e);
return null;
}
}
dynamic jsonDecode(final String responseBody) => json.decode(responseBody);
Future<String> rpc2String(final String method, {final String field}) async {
final response = await rpc2(method);
if (response == null) return '';
if (response.statusCode != 200) {
return '';
} else {
final _body = await compute(jsonDecode, response.body);
final _field = field == null ? _body: _body[field];
return pretty(_field);
}
}

@ -23,16 +23,13 @@ import 'dart:async';
import 'dart:convert';
import 'rpc/rpc.dart' as rpc;
import '../config.dart' as config;
import '../logging.dart';
import '../../config.dart' as config;
import '../../logging.dart';
Future<bool> isConnected() async {
final _outPeers = await rpc.outgoingConnectionsCount();
final _inPeers = await rpc.incomingConnectionsCount();
log.finest('outPeers: ${_outPeers}');
log.finest('inPeers: ${_inPeers}');
return _outPeers + _inPeers > 0;
final _connections = await rpc.getConnectionsSimple();
log.finer('cyberwow: _connections: ${_connections}');
return !_connections.isEmpty;
}
Future<bool> isSynced() async {

@ -23,65 +23,10 @@ import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter/foundation.dart';
import '../../config.dart' as config;
import '../../helper.dart';
import '../../logging.dart';
int rpcID = 0;
Future<http.Response> rpcHTTP(final String method) async {
final url = 'http://${config.host}:${config.c.port}/json_rpc';
rpcID += 1;
final body = json.encode
(
{
'jsonrpc': '2.0',
'id': rpcID.toString(),
'method': method,
}
);
try {
final response = await http.post
( url,
body: body
);
return response;
}
catch (e) {
log.warning(e);
return null;
}
}
dynamic jsonDecode(final String responseBody) => json.decode(responseBody);
Future<dynamic> rpc(final String method, {final String field}) async {
final response = await rpcHTTP(method);
if (response == null) return null;
if (response.statusCode != 200) {
return null;
} else {
final _body = await compute(jsonDecode, response.body);
final _result = _body['result'];
if (_result == null) return null;
final _field = field == null ? _result : _result[field];
return _field;
}
}
Future<String> rpcString(final String method, {final String field}) async {
final _field = await rpc(method, field: field);
return pretty(_field);
}
import '../../../helper.dart';
import '../../../logging.dart';
import '../../interface/rpc/rpc.dart';
Future<http.Response> syncInfo() => rpc('sync_info');
Future<String> syncInfoString() => rpcString('sync_info');

@ -25,45 +25,12 @@ import 'dart:math';
import 'package:http/http.dart' as http;
import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import '../../config.dart' as config;
import '../../helper.dart';
import '../../logging.dart';
import '../../../helper.dart';
import '../../../logging.dart';
import '../../interface/rpc/rpc2.dart' as rpc2;
Future<http.Response> rpc2(final String method) async {
final url = 'http://${config.host}:${config.c.port}/${method}';
try {
final response = await http.post
( url,
);
return response;
}
catch (e) {
log.warning(e);
return null;
}
}
dynamic jsonDecode(final String responseBody) => json.decode(responseBody);
Future<String> rpc2String(final String method, {final String field}) async {
final response = await rpc2(method);
if (response == null) return '';
if (response.statusCode != 200) {
return '';
} else {
final _body = await compute(jsonDecode, response.body);
final _field = field == null ? _body: _body[field];
return pretty(_field);
}
}
Future<http.Response> getTransactionPool() async => rpc2('get_transaction_pool');
Future<http.Response> getTransactionPool() async => rpc2.rpc2('get_transaction_pool');
Future<List<Map<String, dynamic>>> getTransactionPoolSimple() async {
final response = await getTransactionPool();

@ -21,8 +21,8 @@ along with CyberWOW. If not, see <https://www.gnu.org/licenses/>.
import 'package:intl/intl.dart';
import '../../config.dart' as config;
import '../../helper.dart';
import '../../../config.dart' as config;
import '../../../helper.dart';
Map<String, dynamic> getConnectionView(Map<String, dynamic> x) {
const _remove =

@ -23,8 +23,8 @@ import 'dart:math';
import 'package:intl/intl.dart';
import '../../config.dart' as config;
import '../../helper.dart';
import '../../../config.dart' as config;
import '../../../helper.dart';
Map<String, dynamic> txView(Map<String, dynamic> x) {
const _remove =

@ -28,7 +28,7 @@ import 'dart:io';
import 'dart:async';
import 'config.dart' as config;
import 'controller/process/run.dart' as process;
import 'logic/controller/process/run.dart' as process;
import 'logging.dart';
import 'state.dart' as state;
import 'widget.dart' as widget;

@ -21,7 +21,6 @@ along with CyberWOW. If not, see <https://www.gnu.org/licenses/>.
import 'package:shared_preferences/shared_preferences.dart';
import '../controller/helper.dart';
import '../config.dart' as config;
import '../logging.dart';
import '../helper.dart';

@ -22,9 +22,9 @@ along with CyberWOW. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'dart:collection';
import '../controller/rpc/rpc.dart' as rpc;
import '../controller/daemon.dart' as daemon;
import '../controller/refresh.dart' as refresh;
import '../logic/controller/refresh.dart' as refresh;
import '../logic/sensor/rpc/rpc.dart' as rpc;
import '../logic/sensor/daemon.dart' as daemon;
import '../config.dart' as config;
import '../logging.dart';

@ -26,12 +26,12 @@ import 'dart:collection';
import 'package:flutter/material.dart';
import '../config.dart' as config;
import '../controller/daemon.dart' as daemon;
import '../controller/refresh.dart' as refresh;
import '../controller/rpc/rpc.dart' as rpc;
import '../controller/rpc/rpc2.dart' as rpc;
import '../controller/rpc/rpc2View.dart' as rpc2View;
import '../controller/rpc/rpcView.dart' as rpcView;
import '../logic/sensor/daemon.dart' as daemon;
import '../logic/controller/refresh.dart' as refresh;
import '../logic/sensor/rpc/rpc.dart' as rpc;
import '../logic/sensor/rpc/rpc2.dart' as rpc;
import '../logic/view/rpc/rpc2.dart' as rpc2View;
import '../logic/view/rpc/rpc.dart' as rpcView;
import '../helper.dart';
import '../logging.dart';
@ -66,7 +66,7 @@ class SyncedState extends AppState {
}
void appendInput(final String line) {
stdout.addLast(config.c.promptString + line + '\n');
stdout.addLast(config.c.promptString + line);
syncState();
processInput.add(line);

@ -22,9 +22,9 @@ along with CyberWOW. If not, see <https://www.gnu.org/licenses/>.
import 'dart:async';
import 'dart:collection';
import '../controller/rpc/rpc.dart' as rpc;
import '../controller/daemon.dart' as daemon;
import '../controller/refresh.dart' as refresh;
import '../logic/sensor/rpc/rpc.dart' as rpc;
import '../logic/sensor/daemon.dart' as daemon;
import '../logic/controller/refresh.dart' as refresh;
import '../config.dart' as config;
import '../logging.dart';
@ -34,7 +34,7 @@ import 'exiting.dart';
class SyncingState extends AppState {
final Queue<String> stdout = Queue.from(['']);
final Queue<String> stdout = Queue();
bool synced = false;

@ -37,6 +37,6 @@ Widget build(final BuildContext context, final AppState state) {
case SyncedState: return synced.build(context, state);
case ReSyncingState: return resyncing.build(context, state);
case ExitingState: return exiting.build(context, state);
default: Placeholder();
default: return Placeholder();
}
}

@ -205,6 +205,8 @@ Widget terminalView(BuildContext context, String title, SyncedState state) {
textInputAction: TextInputAction.next,
autofocus: true,
autocorrect: false,
enableSuggestions: false,
keyboardType: TextInputType.visiblePassword,
decoration:
InputDecoration
(
@ -276,7 +278,7 @@ Widget terminalView(BuildContext context, String title, SyncedState state) {
Text
(
state.stdout.join(),
state.stdout.join('\n'),
style: Theme.of(context).textTheme.body2,
)
],

@ -52,7 +52,7 @@ Widget build(BuildContext context, SyncingState state) {
reverse: true,
child: Text
(
state.stdout.join(),
state.stdout.join('\n'),
style: Theme.of(context).textTheme.body1,
)
)

@ -78,14 +78,14 @@ packages:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.0+2"
version: "0.12.0+4"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
version: "3.1.4"
image:
dependency: transitive
description:
@ -99,14 +99,14 @@ packages:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.0"
version: "0.16.1"
logging:
dependency: "direct main"
description:
name: logging
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.3+2"
version: "0.11.4"
matcher:
dependency: transitive
description:
@ -134,14 +134,28 @@ packages:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.6.5"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
version: "1.9.0"
petitparser:
dependency: transitive
description:
@ -156,6 +170,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
quiver:
dependency: transitive
description:
@ -169,28 +190,28 @@ packages:
name: shared_preferences
url: "https://pub.dartlang.org"
source: hosted
version: "0.5.6+1"
version: "0.5.6+3"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+4"
version: "0.0.1+6"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.3"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2+3"
version: "0.1.2+4"
sky_engine:
dependency: transitive
description: flutter
@ -237,7 +258,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.11"
version: "0.2.15"
typed_data:
dependency: transitive
description:
@ -260,5 +281,5 @@ packages:
source: hosted
version: "3.5.0"
sdks:
dart: ">=2.4.0 <3.0.0"
dart: ">=2.5.0 <3.0.0"
flutter: ">=1.12.13+hotfix.4 <2.0.0"

@ -1,7 +1,7 @@
name: cyberwow
description: A new Flutter project.
version: 0.7.0+23
version: 0.7.0+24
environment:
sdk: ">=2.1.0 <3.0.0"

@ -18,10 +18,12 @@ let
pyasn1
pyasn1-modules
python-vagrant
libvirt
pyyaml
qrcode
requests
ruamel_yaml
libvirt
]
; python-with-fdroid-packages = pkgs.python3.withPackages fdroid-python-packages

@ -38,7 +38,7 @@ let
with nixpkgs;
(buildFHSUserEnv {
name = "sora-tuner-env"
name = "cyberwow-build-env"
; targetPkgs = pkgs: (with pkgs;
[
bash
@ -53,7 +53,7 @@ with nixpkgs;
# openjdk
# jetbrains.jdk
# zulu
jdk
jdk12
# dart_dev
gnumake
gcc
@ -82,10 +82,11 @@ with nixpkgs;
; profile = ''
export ANDROID_HOME=~/SDK/Android/Sdk
PATH=~/local/sdk/flutter/bin:$PATH
PATH=~/local/sdk/flutter/beta/bin:$PATH
PATH=~/SDK/Android/android-studio/bin:$PATH
PATH=~/SDK/Android/Sdk/tools/bin:$PATH
export ANDROID_NDK_VERSION=r20
export ANDROID_NDK_VERSION=r20b
export ANDROID_NDK_ROOT=~/SDK/Android/ndk-archive/android-ndk-$ANDROID_NDK_VERSION
export NDK=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64
PATH=$NDK/bin:$PATH
@ -99,6 +100,7 @@ with nixpkgs;
export ANDROID_NDK_VERSION_WOW=r17c
export ANDROID_NDK_ROOT_WOW=~/SDK/Android/ndk-archive/android-ndk-$ANDROID_NDK_VERSION_WOW
export ZSH_INIT=${nixpkgs.oh-my-zsh}/share/oh-my-zsh/oh-my-zsh.sh
exec zsh
''