Connection config and proxy updates.

This commit is contained in:
Simon Lindh 2020-02-24 03:43:00 +07:00 committed by wiz
parent d690511a08
commit 32fdb32792
No known key found for this signature in database
GPG Key ID: A394E332255A6173
3 changed files with 14 additions and 2 deletions

View File

@ -2,5 +2,17 @@
"/api": {
"target": "http://localhost:8999/",
"secure": false
},
"/ws": {
"target": "http://localhost:8999/",
"secure": false,
"ws": true
},
"/electrs": {
"target": "https://www.blockstream.info/api/",
"secure": false,
"pathRewrite": {
"^/electrs": ""
}
}
}

View File

@ -3,7 +3,7 @@ import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Block, Transaction, Address, Outspend, Recent } from '../interfaces/electrs.interface';
const API_BASE_URL = 'https://www.blockstream.info/testnet/api';
const API_BASE_URL = document.location.protocol + '//' + document.location.hostname + ':' + document.location.port + '/electrs';
@Injectable({
providedIn: 'root'

View File

@ -6,7 +6,7 @@ import { StateService } from './state.service';
import { Block, Transaction } from '../interfaces/electrs.interface';
const WEB_SOCKET_PROTOCOL = (document.location.protocol === 'https:') ? 'wss:' : 'ws:';
const WEB_SOCKET_URL = WEB_SOCKET_PROTOCOL + '//' + document.location.hostname + ':8999';
const WEB_SOCKET_URL = WEB_SOCKET_PROTOCOL + '//' + document.location.hostname + ':' + document.location.port + '/ws';
@Injectable({
providedIn: 'root'