Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

url fixies #429

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions app/screens/ConnectToNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,26 @@ class ConnectToNode extends React.PureComponent {
onQRRead = data => {
if (data && typeof data === 'object') {
const { internalIP, externalIP, walletPort } = data
let finalInternalIP = internalIP
let finalExternalIP = externalIP
if (internalIP.startsWith('http://')) {
finalInternalIP = internalIP.replace('http://', '')
}
if (internalIP.startsWith('https://')) {
finalInternalIP = internalIP.replace('https://', '')
}
if (externalIP.startsWith('http://')) {
finalExternalIP = externalIP.replace('http://', '')
}
if (externalIP.startsWith('https://')) {
finalExternalIP = externalIP.replace('https://', '')
}
this.mounted &&
this.setState(
{
scanningQR: false,
nodeURL: internalIP + ':' + walletPort,
externalURL: `${externalIP}:${walletPort}`,
nodeURL: finalInternalIP + ':' + walletPort,
externalURL: `${finalExternalIP}:${walletPort}`,
},
() => {
this.onPressConnect()
Expand Down
5 changes: 1 addition & 4 deletions app/services/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ export const writeNodeURLOrIP = async urlOrIP => {
;[ip, port] = urlOrIP.split(':')
}

if (
port.length < 4 ||
!port.split('').every(c => '0123456789'.split('').includes(c))
) {
if (!port.split('').every(c => '0123456789'.split('').includes(c))) {
throw new TypeError('writeNodeURLOrIP() -> invalid port supplied')
}

Expand Down