Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
fix: custom peer host validation (#1692)
Browse files Browse the repository at this point in the history
  • Loading branch information
dav1app authored Feb 26, 2020
1 parent 3545736 commit 743d7a0
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
10 changes: 8 additions & 2 deletions src/renderer/components/Modal/ModalPeer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,12 @@ export default {
mounted () {
if (this.currentPeer) {
const scheme = this.currentPeer.isHttps ? 'https://' : 'http://'
if (this.currentPeer.host) {
this.form.host = this.currentPeer.host
const hostname = new URL(this.currentPeer.host).hostname
this.form.host = `${scheme}${hostname}`
} else if (this.currentPeer.ip) {
const scheme = this.currentPeer.isHttps ? 'https://' : 'http://'
this.form.host = `${scheme}${this.currentPeer.ip}`
}
Expand All @@ -147,6 +149,10 @@ export default {
methods: {
emitConnect () {
const host = this.form.host
if (host.endsWith('/')) {
this.form.host = host.slice(0, -1)
}
this.$emit('connect', {
peer: this.form,
closeTrigger: this.closeTrigger
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/i18n/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ export default {
MODAL_PEER: {
CANCEL: 'Cancel',
CONNECT: 'Connect',
HOST: 'IP / Host',
HOST: 'Protocol + IP / Hostname',
PORT: 'Port',
VALIDATING: 'Validating peer details...',
PLACEHOLDER: {
Expand Down
12 changes: 12 additions & 0 deletions src/renderer/i18n/locales/es-ES.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ export default {
}
}
}
},

MODAL_PEER: {
CANCEL: 'Cancelar',
CONNECT: 'Conectar',
HOST: 'Protocol + IP / Hostname',
PORT: 'Puerta',
VALIDATING: 'Validando detalles de pares ...',
PLACEHOLDER: {
HOST: 'http://1.2.3.4',
PORT: '4003'
}
}

}
8 changes: 4 additions & 4 deletions src/renderer/i18n/locales/it-IT.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ export default {
MODAL_PEER: {
CANCEL: 'Annulla',
CONNECT: 'Connetti',
HOST: 'IP / Host',
HOST: 'Protocollo + IP / Hostname',
PORT: 'Porta',
TITLE: 'Connetti ad un peer personalizzato',
VALIDATING: 'Validazione dettagli peer...',
Expand Down Expand Up @@ -800,7 +800,7 @@ export default {
UNVOTE: 'Voto Rimosso',
MULTI_SIGNATURE: 'Firma-Multipla',
IPFS: 'IPFS',
HTLC_TRANSFER: 'Trasferimneto Timelock',
HTLC_TRANSFER: 'Trasferimneto Timelock',
MULTI_PAYMENT: 'Pagamento Multiplo',
DELEGATE_RESIGNATION: 'Dimissioni Delegato'
},
Expand All @@ -812,7 +812,7 @@ export default {
UNVOTE: 'Impossibile registrare la rimozione del voto',
MULTI_SIGNATURE: 'Impossibile creare firma-multipla',
IPFS: 'IPFS',
HTLC_TRANSFER: 'Impossibile creare trasferimento Timelock',
HTLC_TRANSFER: 'Impossibile creare trasferimento Timelock',
MULTI_PAYMENT: 'Impossibile creare pagamento multiplo',
DELEGATE_RESIGNATION: 'La dimissione del Delegato non è andata a buon fine',
SAVE_OFFLINE: 'Impossibile salvare il file transazione',
Expand All @@ -838,7 +838,7 @@ export default {
UNVOTE: 'Voto rimosso con successo',
MULTI_SIGNATURE: 'Firma-multipla creata con successo',
IPFS: 'IPFS',
HTLC_TRANSFER: 'Trasferimento Timelock creato con successo',
HTLC_TRANSFER: 'Trasferimento Timelock creato con successo',
MULTI_PAYMENT: 'Pagamento multiplo creato con successo',
DELEGATE_RESIGNATION: 'Dimissioni Delegato date con successo',
SAVE_OFFLINE: 'File transazione creato con successo in: {path}',
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/i18n/locales/pt-BR.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ export default {
MODAL_PEER: {
CANCEL: 'Cancelar',
CONNECT: 'Conectar',
HOST: 'IP / Hospedeiro',
HOST: 'Protocolo + IP / Hostname',
PORT: 'Porta',
TITLE: 'Conecte-se a um peer personalizado',
VALIDATING: 'Validando detalhes de peer ...',
Expand Down

0 comments on commit 743d7a0

Please sign in to comment.