From c7c752e39010debdb463d914b926ce0103624f56 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 11:38:33 +1300 Subject: [PATCH 01/15] initial test fix --- index.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/index.php b/index.php index f30843d..9f43a66 100755 --- a/index.php +++ b/index.php @@ -24,12 +24,30 @@ $bal3 = abs($bal1 - $bal2); $bal4 = abs("{$y['stake']}"); if($primary!=""){ - $address = $primary; + $hasPrimary = false; + $addresses = $coin->getaddressesbyaccount("")[0]; + foreach($addresses as $add){ + + echo "
" . $add; + if($add == $primary){ + $hasPrimary = true; + } + echo "
Primary" . $hasPrimary; + } + if($hasPrimary){ + $address = $primary; + }else{ + $address = $coin->getaddressesbyaccount("")[0]; + } + echo "
" . $address; } else{ - $address = $coin->getaddressesbyaccount("")[0]; + $address = $coin->getaddressesbyaccount("")[0]; + echo "
" . $address; } +echo "
" . $address; + if ($currentWallet == NavCoin){ $stakinginfo = $coin->getstakinginfo(); $stakereport = $coin->getstakereport(); From afbc59ec8c6c5a425eaabaf04ac3c1003777bbe1 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 12:04:02 +1300 Subject: [PATCH 02/15] logging --- index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 9f43a66..df07caf 100755 --- a/index.php +++ b/index.php @@ -39,14 +39,14 @@ }else{ $address = $coin->getaddressesbyaccount("")[0]; } - echo "
" . $address; + echo "
1" . $address; } else{ $address = $coin->getaddressesbyaccount("")[0]; - echo "
" . $address; + echo "
2" . $address; } -echo "
" . $address; +echo "
3" . $address; if ($currentWallet == NavCoin){ $stakinginfo = $coin->getstakinginfo(); From daa0d6e969c8de1d555c0b97ca3a25cabaf9f53e Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 12:12:14 +1300 Subject: [PATCH 03/15] fix arry fetching --- index.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index df07caf..b54b72a 100755 --- a/index.php +++ b/index.php @@ -25,7 +25,8 @@ $bal4 = abs("{$y['stake']}"); if($primary!=""){ $hasPrimary = false; - $addresses = $coin->getaddressesbyaccount("")[0]; + $addresses = $coin->getaddressesbyaccount(""); + foreach($addresses as $add){ echo "
" . $add; @@ -39,14 +40,14 @@ }else{ $address = $coin->getaddressesbyaccount("")[0]; } - echo "
1" . $address; + echo "
1 " . $address; } else{ $address = $coin->getaddressesbyaccount("")[0]; - echo "
2" . $address; + echo "
2 " . $address; } -echo "
3" . $address; +echo "
3 " . $address; if ($currentWallet == NavCoin){ $stakinginfo = $coin->getstakinginfo(); From 3cd812fd6fbbdb895d53e5d533c5f5deafae5c28 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 12:31:11 +1300 Subject: [PATCH 04/15] set the primary address in file to be "" when we can't find the set address in the wallet's addresses --- index.php | 14 +++++++++++--- setprimary.php | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index b54b72a..a470c43 100755 --- a/index.php +++ b/index.php @@ -23,7 +23,7 @@ $bal2 = $coin->getbalance("*", 0); $bal3 = abs($bal1 - $bal2); $bal4 = abs("{$y['stake']}"); -if($primary!=""){ +if($primary != ""){ $hasPrimary = false; $addresses = $coin->getaddressesbyaccount(""); @@ -35,10 +35,18 @@ } echo "
Primary" . $hasPrimary; } - if($hasPrimary){ + if ($hasPrimary) { $address = $primary; - }else{ + } else { + + $address = $coin->getaddressesbyaccount("")[0]; + + // set the new primary address to the file system as per the rest of the app + global $newPrimary; + $newPrimary = ""; + changePrimary(); + } echo "
1 " . $address; } diff --git a/setprimary.php b/setprimary.php index 7d10a12..f9912e4 100755 --- a/setprimary.php +++ b/setprimary.php @@ -5,6 +5,8 @@ function changePrimary(){ + echo "
help~!!!!!!"; + global $primaryLocation; global $newPrimary; if(!file_exists("$primaryLocation")){ From fd42bdec2c0083c5bed3a67f9bb0b113b6e975f2 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 12:35:34 +1300 Subject: [PATCH 05/15] turn on error logging --- index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.php b/index.php index a470c43..c8aec84 100755 --- a/index.php +++ b/index.php @@ -1,4 +1,7 @@ Date: Mon, 12 Feb 2018 12:42:08 +1300 Subject: [PATCH 06/15] writes to the file --- index.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index c8aec84..ebb6edf 100755 --- a/index.php +++ b/index.php @@ -45,10 +45,15 @@ $address = $coin->getaddressesbyaccount("")[0]; - // set the new primary address to the file system as per the rest of the app - global $newPrimary; - $newPrimary = ""; - changePrimary(); + $primaryLocation = "/home/stakebox/UI/primary".$currentWallet."address.php"; + // Open the file and erase the contents if any + $fp = fopen($primaryLocation, "w"); + // Write the data to the file + // CODE INJECTION WARNING! + fwrite($fp, ""); + // Close the file + fclose($fp); + } echo "
1 " . $address; From 49a222ef6ae4420e99bf5dd71427ee0ef0c575de Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 14:05:14 +1300 Subject: [PATCH 07/15] added message display on primary address update --- index.php | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index ebb6edf..708aab6 100755 --- a/index.php +++ b/index.php @@ -1,6 +1,6 @@ getbalance("*", 0); $bal3 = abs($bal1 - $bal2); $bal4 = abs("{$y['stake']}"); + +$showMainAddressChangedMessage = false; +$oldAddress = $address; +$newAddress; +// Fixes bug when the main address is set to an address not in the wallet ----------------------------------------------------- if($primary != ""){ $hasPrimary = false; $addresses = $coin->getaddressesbyaccount(""); @@ -42,9 +47,9 @@ $address = $primary; } else { - $address = $coin->getaddressesbyaccount("")[0]; + // Duplicated code from setPrimary, as we can't access the function ---------------- $primaryLocation = "/home/stakebox/UI/primary".$currentWallet."address.php"; // Open the file and erase the contents if any $fp = fopen($primaryLocation, "w"); @@ -53,7 +58,8 @@ fwrite($fp, ""); // Close the file fclose($fp); - + $showMainAddressChangedMessage = true; + $newAddress = $address; } echo "
1 " . $address; @@ -62,7 +68,7 @@ $address = $coin->getaddressesbyaccount("")[0]; echo "
2 " . $address; } - +//------------------------------------------------------------- echo "
3 " . $address; if ($currentWallet == NavCoin){ @@ -83,6 +89,17 @@ $fiatValue = number_format($fiatValue); ?>
+ +

We have detected that your Primary Address (the one displayed on the front page) was not one of the addresses in your wallet.dat, + so we have swapped it for a new one. This can occur when you replace the NavPi's wallet.dat after you have manually set the primary address. +
+
+

"; + + ?> +

Available Balance:

Unavailable Due To Staking:

From 0997659d6d64dc1c4a6e1718db0d73ac068c7a7b Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 14:12:31 +1300 Subject: [PATCH 08/15] removed logging from setPrimary. Updated message in index --- index.php | 14 +++++++++----- setprimary.php | 2 -- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/index.php b/index.php index 708aab6..fa4ee42 100755 --- a/index.php +++ b/index.php @@ -92,11 +92,15 @@ -

We have detected that your Primary Address (the one displayed on the front page) was not one of the addresses in your wallet.dat, - so we have swapped it for a new one. This can occur when you replace the NavPi's wallet.dat after you have manually set the primary address. -
-
-

"; +

We detected that your Primary Address (the one displayed on the front page) was not one of the addresses in your wallet.dat, + so we have swapped it for a new one. +
This can occur when you replace the NavPi's wallet.dat after you have manually set the primary address. +

+

+
New Address: {$address} +
Old Address: {$oldAddress} +

+ "; ?> diff --git a/setprimary.php b/setprimary.php index f9912e4..7d10a12 100755 --- a/setprimary.php +++ b/setprimary.php @@ -5,8 +5,6 @@ function changePrimary(){ - echo "
help~!!!!!!"; - global $primaryLocation; global $newPrimary; if(!file_exists("$primaryLocation")){ From d5b63eae1f75c30cd8bcb3e721b861dd0871d8dd Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 14:16:08 +1300 Subject: [PATCH 09/15] fixing oldAddress variable --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index fa4ee42..bcdde18 100755 --- a/index.php +++ b/index.php @@ -28,7 +28,7 @@ $bal4 = abs("{$y['stake']}"); $showMainAddressChangedMessage = false; -$oldAddress = $address; +$oldAddress = $primary; $newAddress; // Fixes bug when the main address is set to an address not in the wallet ----------------------------------------------------- if($primary != ""){ From 443d13693be5d04c8cd639361a3bf6aabdfecc1d Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 14:22:01 +1300 Subject: [PATCH 10/15] formatting adjustments --- index.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index bcdde18..4346b50 100755 --- a/index.php +++ b/index.php @@ -91,16 +91,15 @@
-

We detected that your Primary Address (the one displayed on the front page) was not one of the addresses in your wallet.dat, - so we have swapped it for a new one. -
This can occur when you replace the NavPi's wallet.dat after you have manually set the primary address. -

-

-
New Address: {$address} -
Old Address: {$oldAddress} -

- "; + echo "
+ Primary Address we have detected your Primary Address (the one displayed on the front page) was not one of the addresses in your wallet.dat, + so we have replaced it with a valid address. +

This can occur when you replace the NavPi's wallet.dat after you have manually set the primary address.

+ +
New Address: {$address} +
Old Address: {$oldAddress} +
+
"; ?> From 6a8e62d69a43f39cf9fcc390958606908706887c Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 14:25:49 +1300 Subject: [PATCH 11/15] formatting --- index.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/index.php b/index.php index 4346b50..c12891a 100755 --- a/index.php +++ b/index.php @@ -91,14 +91,17 @@
- Primary Address we have detected your Primary Address (the one displayed on the front page) was not one of the addresses in your wallet.dat, - so we have replaced it with a valid address. -

This can occur when you replace the NavPi's wallet.dat after you have manually set the primary address.

- -
New Address: {$address} -
Old Address: {$oldAddress} -
+ echo " +
+
+ Primary Address we have detected your Primary Address (the one displayed on the front page) was not one of the addresses in your wallet.dat, + so we have replaced it with a valid address. +

This can occur when you replace the NavPi's wallet.dat after you have manually set the primary address.

+ +
New Address: {$address} +
Old Address: {$oldAddress} +
+
"; ?> From 2963f60b43ede3a280bd9137baac7d940e1357ef Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 14:29:50 +1300 Subject: [PATCH 12/15] commented logging, updated wording --- index.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/index.php b/index.php index c12891a..b501b8b 100755 --- a/index.php +++ b/index.php @@ -41,7 +41,7 @@ if($add == $primary){ $hasPrimary = true; } - echo "
Primary" . $hasPrimary; + // echo "
Primary" . $hasPrimary; } if ($hasPrimary) { $address = $primary; @@ -62,14 +62,14 @@ $newAddress = $address; } - echo "
1 " . $address; + // echo "
1 " . $address; } else{ $address = $coin->getaddressesbyaccount("")[0]; - echo "
2 " . $address; + // echo "
2 " . $address; } //------------------------------------------------------------- -echo "
3 " . $address; +// echo "
3 " . $address; if ($currentWallet == NavCoin){ $stakinginfo = $coin->getstakinginfo(); @@ -94,11 +94,11 @@ echo "
- Primary Address we have detected your Primary Address (the one displayed on the front page) was not one of the addresses in your wallet.dat, - so we have replaced it with a valid address. + Primary Address Changed: We detected your Primary Address (the one displayed on the front page) was not one of the addresses in your wallet.dat, + so it was replaced it with a valid wallet address.

This can occur when you replace the NavPi's wallet.dat after you have manually set the primary address.

-
New Address: {$address} + New Address: {$address}
Old Address: {$oldAddress}
From b128a0d693fe1d0cf4023aaf6f5cc3cd4abbb04f Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 12 Feb 2018 14:32:58 +1300 Subject: [PATCH 13/15] tidied code formatting, removed logging --- index.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/index.php b/index.php index b501b8b..1718d5a 100755 --- a/index.php +++ b/index.php @@ -1,7 +1,4 @@ getaddressesbyaccount(""); foreach($addresses as $add){ - - echo "
" . $add; if($add == $primary){ $hasPrimary = true; } - // echo "
Primary" . $hasPrimary; } if ($hasPrimary) { $address = $primary; @@ -60,16 +54,12 @@ fclose($fp); $showMainAddressChangedMessage = true; $newAddress = $address; - } - // echo "
1 " . $address; } else{ $address = $coin->getaddressesbyaccount("")[0]; - // echo "
2 " . $address; } //------------------------------------------------------------- -// echo "
3 " . $address; if ($currentWallet == NavCoin){ $stakinginfo = $coin->getstakinginfo(); From 5aff10c1147d29a01edcbeaf3981d19a94c4213d Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 16 Feb 2018 10:06:48 +1300 Subject: [PATCH 14/15] final text update, craig approved --- index.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/index.php b/index.php index 1718d5a..0565d0c 100755 --- a/index.php +++ b/index.php @@ -84,12 +84,11 @@ echo "
- Primary Address Changed: We detected your Primary Address (the one displayed on the front page) was not one of the addresses in your wallet.dat, - so it was replaced it with a valid wallet address. -

This can occur when you replace the NavPi's wallet.dat after you have manually set the primary address.

+ Primary Address Updated:We detected your saved primary address was not owned by your wallet. It has been replaced with a valid address. +

This can occur when you restore your wallet after manually setting the primary address.

- New Address: {$address} -
Old Address: {$oldAddress} + New Address: \"{$address}\" +
Old Address: \"{$oldAddress}\"
"; From 19180ed0390d8de5d13e10e1ac9076748120db6a Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 16 Feb 2018 10:12:52 +1300 Subject: [PATCH 15/15] updated versiion on release script --- libs/release_setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/release_setup.sh b/libs/release_setup.sh index 2e4f067..0626fa7 100644 --- a/libs/release_setup.sh +++ b/libs/release_setup.sh @@ -2,7 +2,7 @@ LOG_FILE="/home/pi/release_log.txt" BOOTSTRAP_URL="https://build.nav.community/bootstrap/bootstrap-navcoin.tar" -VERSION="1.0.7" +VERSION="1.0.8" echo "WARNING THIS SCRIPT WILL DELETE YOUR WALLET.DAT. THERE IS NO WAY TO RECOVER YOUR COINS WITHOUT A BACK UP. THIS SCRIPT IS ONLY FOR USE WHEN CREATING NEW NAVPI IMAGES" echo "TO CONTINUE ENTER 'DELETE' OR ENTER ANYTHING ELSE TO EXIT"