From 4a40b3a0b2522e6adad58631eba4f57341907d44 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 12 Jan 2018 10:37:14 +0100 Subject: [PATCH] separate merchant UI from main project --- electrum | 8 +++- lib/util.py | 22 --------- lib/www/example.php | 17 ------- lib/www/index.html | 111 -------------------------------------------- 4 files changed, 6 insertions(+), 152 deletions(-) delete mode 100644 lib/www/example.php delete mode 100644 lib/www/index.html diff --git a/electrum b/electrum index f47d2c682..d260952a6 100755 --- a/electrum +++ b/electrum @@ -92,7 +92,7 @@ from electrum import SimpleConfig, Network from electrum.wallet import Wallet, Imported_Wallet from electrum.storage import WalletStorage from electrum.util import print_msg, print_stderr, json_encode, json_decode -from electrum.util import set_verbosity, InvalidPassword, check_www_dir +from electrum.util import set_verbosity, InvalidPassword from electrum.commands import get_parser, known_commands, Commands, config_variables from electrum import daemon from electrum import keystore @@ -399,7 +399,11 @@ if __name__ == '__main__': from electrum import websockets websockets.WebSocketServer(config, d.network).start() if config.get('requests_dir'): - check_www_dir(config.get('requests_dir')) + path = os.path.join(config.get('requests_dir'), 'index.html') + if not os.path.exists(path): + print("Requests directory not configured.") + print("You can configure it using https://github.com/spesmilo/electrum-merchant") + sys.exit(1) d.join() sys.exit(0) else: diff --git a/lib/util.py b/lib/util.py index a8f2e2a6a..d9eaea6cc 100644 --- a/lib/util.py +++ b/lib/util.py @@ -703,25 +703,3 @@ class QueuePipe: self.send(request) -def check_www_dir(rdir): - import urllib, shutil, os - if not os.path.exists(rdir): - os.mkdir(rdir) - index = os.path.join(rdir, 'index.html') - if not os.path.exists(index): - print_error("copying index.html") - src = os.path.join(os.path.dirname(__file__), 'www', 'index.html') - shutil.copy(src, index) - files = [ - "https://code.jquery.com/jquery-1.9.1.min.js", - "https://raw.githubusercontent.com/davidshimjs/qrcodejs/master/qrcode.js", - "https://code.jquery.com/ui/1.10.3/jquery-ui.js", - "https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" - ] - for URL in files: - path = urllib.parse.urlsplit(URL).path - filename = os.path.basename(path) - path = os.path.join(rdir, filename) - if not os.path.exists(path): - print_error("downloading ", URL) - urllib.request.urlretrieve(URL, path) diff --git a/lib/www/example.php b/lib/www/example.php deleted file mode 100644 index be981b964..000000000 --- a/lib/www/example.php +++ /dev/null @@ -1,17 +0,0 @@ -Wallet balance
'."\n"; -try { - - $balance = $electrum->getbalance(); - echo 'confirmed: '.$balance['confirmed'].'
'."\n"; - echo 'unconfirmed: '.$balance['unconfirmed'].'
'."\n"; - -} catch (Exception $e) { - echo nl2br($e->getMessage()).'
'."\n"; -} - -?> diff --git a/lib/www/index.html b/lib/www/index.html deleted file mode 100644 index 14725b1fa..000000000 --- a/lib/www/index.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - Payment request - - - - - - - -
-

-

-

-
- Pay with Bitcoin -
-
-
-

-
-
- - -