Adding possibility of websockets configuration
Up to now, websockets configuration was possible for the daemon only, this patch passes that information to the client via json file produced with the payment request.
This commit is contained in:
@@ -1052,6 +1052,8 @@ class Abstract_Wallet(PrintError):
|
||||
out['request_url'] = os.path.join(baseurl, key)
|
||||
out['URI'] += '&r=' + out['request_url']
|
||||
out['index_url'] = os.path.join(baseurl, 'index.html') + '?id=' + key
|
||||
out['websocket_server'] = config.get('websocket_server', 'localhost')
|
||||
out['websocket_port'] = config.get('websocket_port', 9999)
|
||||
return out
|
||||
|
||||
def get_request_status(self, key):
|
||||
|
||||
@@ -38,7 +38,9 @@ if (id) {
|
||||
var current;
|
||||
var max = 100;
|
||||
var initial = data.time;
|
||||
var duration = data.exp;
|
||||
var duration = data.exp;
|
||||
var websocket_server = data.websocket_server;
|
||||
var websocket_port = data.websocket_port;
|
||||
if(duration){
|
||||
var current = 100 * (Math.floor(Date.now()/1000) - initial)/duration;
|
||||
$("#progressbar").progressbar({
|
||||
@@ -64,7 +66,7 @@ if (id) {
|
||||
});
|
||||
};
|
||||
|
||||
var ws = new WebSocket("wss://" + window.location.hostname + ":9999/");
|
||||
var ws = new WebSocket("wss://" + websocket_server + ":" + websocket_port +"/");
|
||||
ws.onopen = function() {
|
||||
ws.send('id:' + id);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user