Skip to content

Commit 140685b

Browse files
Merge pull request #36 from NAVCoin/v1.0.8
V1.0.8
2 parents adb6b50 + bd388ae commit 140685b

File tree

2 files changed

+51
-4
lines changed

2 files changed

+51
-4
lines changed

index.php

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,43 @@
2323
$bal2 = $coin->getbalance("*", 0);
2424
$bal3 = abs($bal1 - $bal2);
2525
$bal4 = abs("{$y['stake']}");
26-
if($primary!=""){
27-
$address = $primary;
26+
27+
$showMainAddressChangedMessage = false;
28+
$oldAddress = $primary;
29+
$newAddress;
30+
// Fixes bug when the main address is set to an address not in the wallet -----------------------------------------------------
31+
if($primary != ""){
32+
$hasPrimary = false;
33+
$addresses = $coin->getaddressesbyaccount("");
34+
35+
foreach($addresses as $add){
36+
if($add == $primary){
37+
$hasPrimary = true;
38+
}
39+
}
40+
if ($hasPrimary) {
41+
$address = $primary;
42+
} else {
43+
44+
$address = $coin->getaddressesbyaccount("")[0];
45+
46+
// Duplicated code from setPrimary, as we can't access the function ----------------
47+
$primaryLocation = "/home/stakebox/UI/primary".$currentWallet."address.php";
48+
// Open the file and erase the contents if any
49+
$fp = fopen($primaryLocation, "w");
50+
// Write the data to the file
51+
// CODE INJECTION WARNING!
52+
fwrite($fp, "<?php\n\$primary='';\n?>");
53+
// Close the file
54+
fclose($fp);
55+
$showMainAddressChangedMessage = true;
56+
$newAddress = $address;
57+
}
2858
}
2959
else{
30-
$address = $coin->getaddressesbyaccount("")[0];
60+
$address = $coin->getaddressesbyaccount("")[0];
3161
}
62+
//-------------------------------------------------------------
3263

3364
if ($currentWallet == NavCoin){
3465
$stakinginfo = $coin->getstakinginfo();
@@ -48,6 +79,22 @@
4879
$fiatValue = number_format($fiatValue);
4980
?>
5081
<div class="row">
82+
<?php
83+
if ($showMainAddressChangedMessage == true)
84+
echo "
85+
<div class='col-lg-12'>
86+
<div class='alert alert-info'>
87+
<strong>Primary Address Updated:</strong>We detected your saved primary address was not owned by your wallet. It has been replaced with a valid address.
88+
<p><small>This can occur when you restore your wallet after manually setting the primary address.</small></p>
89+
<small>
90+
New Address: \"{$address}\"
91+
<br>Old Address: \"{$oldAddress}\"
92+
</small>
93+
</div>
94+
</div>";
95+
96+
?>
97+
5198
<div class="col-lg-6">
5299
<h3>Available Balance: <font color='green'><?php echo number_format($bal1); ?></font> <?php echo $currentWallet; ?></h3>
53100
<h4>Unavailable Due To Staking: <font color='red'><?php echo $bal4; ?></font> <?php echo $currentWallet; ?></h4>

libs/release_setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
LOG_FILE="/home/pi/release_log.txt"
44
BOOTSTRAP_URL="https://build.nav.community/bootstrap/bootstrap-navcoin.tar"
5-
VERSION="1.0.7"
5+
VERSION="1.0.8"
66

77
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"
88
echo "TO CONTINUE ENTER 'DELETE' OR ENTER ANYTHING ELSE TO EXIT"

0 commit comments

Comments
 (0)