use local copy of javascript files
This commit is contained in:
parent
f0e6f5bf64
commit
3da148f406
|
@ -1278,8 +1278,32 @@ class Abstract_Wallet(object):
|
||||||
self.receive_requests[key] = req
|
self.receive_requests[key] = req
|
||||||
self.storage.put('payment_requests', self.receive_requests)
|
self.storage.put('payment_requests', self.receive_requests)
|
||||||
|
|
||||||
|
def check_www_dir(self, config):
|
||||||
|
import urllib, urlparse, shutil, os
|
||||||
|
rdir = config.get('requests_dir')
|
||||||
|
if not os.path.exists(rdir):
|
||||||
|
os.mkdir(rdir)
|
||||||
|
index = os.path.join(rdir, 'index.html')
|
||||||
|
if not os.path.exists(index):
|
||||||
|
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 = urlparse.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.urlretrieve(URL, path)
|
||||||
|
|
||||||
|
|
||||||
def add_payment_request(self, req, config):
|
def add_payment_request(self, req, config):
|
||||||
import shutil, os
|
import os
|
||||||
addr = req['address']
|
addr = req['address']
|
||||||
amount = req.get('amount')
|
amount = req.get('amount')
|
||||||
message = req.get('memo')
|
message = req.get('memo')
|
||||||
|
@ -1289,12 +1313,7 @@ class Abstract_Wallet(object):
|
||||||
|
|
||||||
rdir = config.get('requests_dir')
|
rdir = config.get('requests_dir')
|
||||||
if rdir and amount is not None:
|
if rdir and amount is not None:
|
||||||
if not os.path.exists(rdir):
|
self.check_www_dir(config)
|
||||||
os.mkdir(rdir)
|
|
||||||
index = os.path.join(rdir, 'index.html')
|
|
||||||
if not os.path.exists(index):
|
|
||||||
src = os.path.join(os.path.dirname(__file__), 'www', 'index.html')
|
|
||||||
shutil.copy(src, index)
|
|
||||||
key = req.get('id', addr)
|
key = req.get('id', addr)
|
||||||
pr = paymentrequest.make_request(config, req)
|
pr = paymentrequest.make_request(config, req)
|
||||||
path = os.path.join(rdir, key)
|
path = os.path.join(rdir, key)
|
||||||
|
|
|
@ -2,11 +2,10 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Payment request</title>
|
<title>Payment request</title>
|
||||||
<script type="text/javascript" charset="utf-8" src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
|
<script type="text/javascript" charset="utf-8" src="jquery-1.9.1.min.js"></script>
|
||||||
<script type="text/javascript" src="https://raw.githubusercontent.com/davidshimjs/qrcodejs/master/qrcode.js"></script>
|
<script type="text/javascript" src="qrcode.js"></script>
|
||||||
<script type="text/javascript" src="https://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
|
<script type="text/javascript" src="jquery-ui.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
|
<link rel="stylesheet" type="text/css" href="jquery-ui.css">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function getUrlParameter(sParam)
|
function getUrlParameter(sParam)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue