Skip to content

Commit

Permalink
refactor yeti
Browse files Browse the repository at this point in the history
  • Loading branch information
willweatherman committed Dec 11, 2020
1 parent 327a69c commit 1452f82
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
22 changes: 14 additions & 8 deletions appyeticold.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,21 @@ def blockchain():

@app.route("/openbitcoin", methods=['GET', 'POST'])
def YCopenbitcoin():
if v.info == 'yetiColdImp':
step = 1
else:
step = 5
route = openBitcoin(request, '/openbitcoin', v.route, v.info, offline=False, yeti='cold')
if route:
return route
return render_template('openbitcoin.html', progress=v.progress, IBD=v.IBD, step=5, switch=True, url=v.url)
return render_template('openbitcoin.html', progress=v.progress, IBD=v.IBD, step=step, switch=True, url=v.url)

@app.route("/rescanwalletImp", methods=['GET', 'POST'])
def rescanwalletImp():
if request.method == 'POST':
handleResponse('~/yeticold/bitcoin/bin/bitcoin-cli -rpcwallet=yetiwalletpub rescanblockchain '+blockheight())
return redirect('/coldwalletguide')
return render_template('rescanwallet.html')
return render_template('rescanwallet.html',step=6)

@app.route("/blockchainOff", methods=['GET', 'POST'])
def blockchainOff():
Expand All @@ -93,16 +97,18 @@ def blockchainOff():
#OFF
@app.route("/openbitcoinOff", methods=['GET', 'POST'])
def openbitcoinOff():
v.step = 7
if v.info == "yetiColdOffRec":
v.route = '/scandescriptorOffRec'
elif v.info == 'yetiColdOffImp':
v.route = '/switchlaptopOffImp'
v.step = 3
else:
v.route = '/getseedsOff'
route = openBitcoin(request, '/openbitcoinOff', '/connectionOff', v.info, offline=True)
if route:
return route
return render_template('openbitcoin.html', progress=v.progress, IBD=v.IBD, step=7)
return render_template('openbitcoin.html', progress=v.progress, IBD=v.IBD, step=v.step)

#OFF
@app.route("/connectionOff", methods=['GET', 'POST'])
Expand All @@ -111,11 +117,11 @@ def connection():
subprocess.call(['python3 ~/yeticold/utils/forgetnetworks.py'],shell=True)
subprocess.call(['nmcli n off'],shell=True)
return redirect(v.route)
return render_template('connection.html', step=8)
return render_template('connection.html', step=v.step+1)

@app.route("/switchlaptopOffImp", methods=['GET', 'POST'])
def switchlaptopOffImp():
return render_template('switchlaptop.html', step=14, instructions="Switch to your Primary laptop currently Showing step 5. Click next to show step 15.", laptop="Primary")
return render_template('switchlaptop.html', step=5, instructions="Switch to your Primary laptop currently Showing step 1. Click next to show step 6.", laptop="Primary")

#OFF
@app.route("/scandescriptorOffRec", methods=['GET', 'POST'])
Expand Down Expand Up @@ -235,18 +241,18 @@ def checkseedsOff():
route = checkSeeds(request, '/checkseedsOff', '/copyseedsOff')
if route:
return route
return render_template('checkseeds.html', x=v.privkeycount + 1, error=v.error,step=20+v.privkeycount,oldkeys=v.oldkeys)
return render_template('checkseeds.html', x=v.privkeycount + 1, error=v.error,step=21+v.privkeycount,oldkeys=v.oldkeys)

#OFF
@app.route("/copyseedsOff", methods=['GET', 'POST'])
def copyseedsOff():
if request.method == 'POST':
return redirect('/switchlaptopOff')
return render_template('copyseeds.html', step=26)
return render_template('copyseeds.html', step=27)

@app.route("/switchlaptopOff", methods=['GET', 'POST'])
def switchlaptopOff():
return render_template('switchlaptop.html', step=13, instructions="Switch to your Primary laptop currently showing step 13, click next to show your cold wallet guide", laptop="Secondary")
return render_template('switchlaptop.html', step=28, instructions="Switch to your Primary laptop currently showing step 13, click next to show your cold wallet guide", laptop="Secondary")


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import subprocess

# Define constant input argument for valid processing modes
VALIDMODES = ['YetiColdPrimary', 'YetiColdSecondaryCreate', 'YetiColdSecondaryRecover', 'YetiHot', 'YetiWarm', 'BitcoinCoreOfflinePrimary', 'BitcoinCoreOfflineSecondary', 'YetiColdSecondaryImport']
VALIDMODES = ['YetiColdPrimary', 'YetiColdSecondaryCreate', 'YetiColdSecondaryRecover', 'YetiHot', 'YetiWarm', 'BitcoinCoreOfflinePrimary', 'BitcoinCoreOfflineSecondary', 'YeticoldSecondaryLoad']

# Check for number of input arguments and whether arguments are valid
if len(sys.argv) == 1 or sys.argv[1].lower() not in [x.lower() for x in VALIDMODES]:
Expand Down Expand Up @@ -87,7 +87,7 @@
subprocess.run('sleep 3', shell=True, check=False)
subprocess.run('xdg-open http://localhost:5000/offrec', shell=True, check=False)

elif sys.argv[1].lower() == 'yeticoldsecondaryimport':
elif sys.argv[1].lower() == 'yeticoldsecondaryload':
print('********************')
print('Running YetiCold Import Wallet on Secondary PC')
print('********************' + os.linesep)
Expand Down
1 change: 0 additions & 1 deletion templates/connection.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ <h3 style="color:white;margin:0;">Yeti Bitcoin Cold Storage</h3>
</nav>
<div class="container" style="margin-top: 3rem;">
<h2>Step {{step}}: Disconnect your <b>Secondary</b> laptop.</h2>
<p>Now is the time to disconnect your wifi and/or eithernet cable.</p>
<ol>
<li>Make sure you don't have any cords or eithernet csables pluged in.</li>
<li>Forget all wireless networks.</li>
Expand Down
9 changes: 6 additions & 3 deletions templates/exportdescriptor.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@
<h3 style="color:white;margin:0;">Yeti Bitcoin Cold Storage</h3>
</nav>
<div class="container" style="margin-top: 3rem;">
<h2>Step {{step}}: Switch to your <b>Primary</b> laptop.</h2>
<h2>Step {{step}}: Copy the Descriptor to your <b>Primary</b> laptop.</h2>
<ol>
<li>Insert the file usb drive to laptop.</li>
<li>Remove the USB drive and place it with one of your paper seed packets.</li>
<li>Insert the usb drive labled "Transfer" to laptop.</li>
<li>Delete all visable files in the USB drive.</li>
<li>Copy the file labled <b>Descriptor.txt</b> to the inserted USB drive.</li>
<li>Eject the USB drive.</li>
<li>{{instructions}}.</li>
<p></p>
</ol>
<form action="" method="post" style="margin-top:35px;">
<input style="display: none;" name="option" value="VALUE">
<input class="btn btn-primary" type="submit" id="next" value="Next">
Expand Down
7 changes: 7 additions & 0 deletions templates/scandescriptor.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ <h2>Step {{step}}: Import descriptor</h2>
{% if error %}
<p style="color:red;">{{ error }}</p>
{% endif %}
<ol>
<li>Insert the usb drive labled "Transfer" to laptop.</li>
<li>Click the Browse button and select the <b>Descriptor.txt</b> from the usb drive.</li>
<li>After selecting the <b>Descriptor.txt</b> the text box should display a descriptor starting with the characters <b>"wsh"</b>.</li>
<li>Click the <b>Next</b> button.</li>
<p></p>
</ol>
<input id="filepath" type="file" name="path">
<input style="display:none;" id="line" value="{{line}}">
<form autocomplete="off" action="" method="post" style="border: solid #f8f9fa;padding: 1.5rem;">
Expand Down
3 changes: 2 additions & 1 deletion utils/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@
info = ""
usb = False
copied = False
nousb = False
nousb = False
step = 0

0 comments on commit 1452f82

Please sign in to comment.