From 1452f82e154db8ce5e672b80ca5d5bd524336e48 Mon Sep 17 00:00:00 2001 From: willweatherman Date: Fri, 11 Dec 2020 17:28:35 -0500 Subject: [PATCH] refactor yeti --- appyeticold.py | 22 ++++++++++++++-------- initialize.py | 4 ++-- templates/connection.html | 1 - templates/exportdescriptor.html | 9 ++++++--- templates/scandescriptor.html | 7 +++++++ utils/variables.py | 3 ++- 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/appyeticold.py b/appyeticold.py index 839d6a30..20f3e162 100644 --- a/appyeticold.py +++ b/appyeticold.py @@ -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(): @@ -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']) @@ -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']) @@ -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__": diff --git a/initialize.py b/initialize.py index a0fd5f64..8b47ff15 100644 --- a/initialize.py +++ b/initialize.py @@ -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]: @@ -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) diff --git a/templates/connection.html b/templates/connection.html index 4bcf9493..afd84d94 100644 --- a/templates/connection.html +++ b/templates/connection.html @@ -13,7 +13,6 @@

Yeti Bitcoin Cold Storage

Step {{step}}: Disconnect your Secondary laptop.

-

Now is the time to disconnect your wifi and/or eithernet cable.

  1. Make sure you don't have any cords or eithernet csables pluged in.
  2. Forget all wireless networks.
  3. diff --git a/templates/exportdescriptor.html b/templates/exportdescriptor.html index c9056be4..190a1959 100644 --- a/templates/exportdescriptor.html +++ b/templates/exportdescriptor.html @@ -12,12 +12,15 @@

    Yeti Bitcoin Cold Storage

    -

    Step {{step}}: Switch to your Primary laptop.

    +

    Step {{step}}: Copy the Descriptor to your Primary laptop.

      -
    1. Insert the file usb drive to laptop.
    2. -
    3. Remove the USB drive and place it with one of your paper seed packets.
    4. +
    5. Insert the usb drive labled "Transfer" to laptop.
    6. +
    7. Delete all visable files in the USB drive.
    8. +
    9. Copy the file labled Descriptor.txt to the inserted USB drive.
    10. +
    11. Eject the USB drive.
    12. {{instructions}}.
    13. +
    diff --git a/templates/scandescriptor.html b/templates/scandescriptor.html index 15527111..ba55f319 100644 --- a/templates/scandescriptor.html +++ b/templates/scandescriptor.html @@ -14,6 +14,13 @@

    Step {{step}}: Import descriptor

    {% if error %}

    {{ error }}

    {% endif %} +
      +
    1. Insert the usb drive labled "Transfer" to laptop.
    2. +
    3. Click the Browse button and select the Descriptor.txt from the usb drive.
    4. +
    5. After selecting the Descriptor.txt the text box should display a descriptor starting with the characters "wsh".
    6. +
    7. Click the Next button.
    8. +

      +
    diff --git a/utils/variables.py b/utils/variables.py index 2ed909e7..608fe69a 100644 --- a/utils/variables.py +++ b/utils/variables.py @@ -39,4 +39,5 @@ info = "" usb = False copied = False -nousb = False \ No newline at end of file +nousb = False +step = 0 \ No newline at end of file