diff --git a/ionic/src/assets/i18n/en.json b/ionic/src/assets/i18n/en.json index d630ca34..e6e3398b 100644 --- a/ionic/src/assets/i18n/en.json +++ b/ionic/src/assets/i18n/en.json @@ -30,12 +30,12 @@ "check5Ghz1": "Modern routers may create two separate networks.", "check5Ghz2": "You may need to allow communication between the two networks on the router page (usually http://192.168.1.1).", "check5Ghz3": "Alternatively, you can completely disable the 5 GHz Auto-join option on your mobile devices and use only 2.4 GHz that is better for long-distance communications.", - "checkFirewallTitle": "Check your Firewall/Antivirus", - "checkFirewall1": "Most antivirus software block local connections by default.", - "checkFirewall2": "Try to temporarely pause it, and then when you determine what was causing the issue add {{ appName }} to your antivirus exceptions list.", + "checkFirewallTitle": "Check your firewall and {{ av }}", + "checkFirewall1": "Most {{ av }} software block local connections by default.", + "checkFirewall2": "Try to temporarely pause it, and then when you determine what was causing the issue add {{ appName }} to your {{ av }} exceptions list.", "checkFirewall3": " See ", "checkFirewall4": "Windows Firewall instructions", - "checkFirewall5": "The procedure may differ based on what antivirus you have.", + "checkFirewall5": "The procedure may differ based on what {{ av }} you have.", "doneTitle": "Done", "done1": "At this point you should be able to connect the app to the server.", "done2": "Do you still have issues?", diff --git a/ionic/src/assets/i18n/es.json b/ionic/src/assets/i18n/es.json index 8f4aa27e..c4dcaafc 100644 --- a/ionic/src/assets/i18n/es.json +++ b/ionic/src/assets/i18n/es.json @@ -30,12 +30,12 @@ "check5Ghz1": "Los routers modernos pueden crear dos redes separadas.", "check5Ghz2": "Es probable que deba permitir la conexión entre ambas redes a traves de la página del router (generalmente http://192.168.1.1).", "check5Ghz3": "Como alternativa, puede deshabilitar por completo la opción de conexión automática a 5 GHz en sus dispositivos móviles y utilizar solamente 2.4 GHz, que es mejor para comunicaciones de larga distancia.", - "checkFirewallTitle": "Revise su firewall/antivirus", - "checkFirewall1": "La mayoría de los antivirus bloquean las conexiones locales por defecto.", - "checkFirewall2": "Intente pausar su antivirus temporalmente y luego, cuando determine la causa del problema, agregue {{ appName }} a la lista de excepciones.", + "checkFirewallTitle": "Revise su firewall/{{ av }}", + "checkFirewall1": "La mayoría de los {{ av }} bloquean las conexiones locales por defecto.", + "checkFirewall2": "Intente pausar su {{ av }} temporalmente y luego, cuando determine la causa del problema, agregue {{ appName }} a la lista de excepciones.", "checkFirewall3": " Revise ", "checkFirewall4": "las instrucciones del Firewall de Windows", - "checkFirewall5": "El procedimiento puede variar según el antivirus que utilice.", + "checkFirewall5": "El procedimiento puede variar según el {{ av }} que utilice.", "doneTitle": "Listo", "done1": "Ya debería poder conectar la aplicación al servidor.", "done2": "¿Todavía tiene inconvenientes?", diff --git a/ionic/src/pages/welcome-help/welcome-help.html b/ionic/src/pages/welcome-help/welcome-help.html index 6c86381b..935013a0 100644 --- a/ionic/src/pages/welcome-help/welcome-help.html +++ b/ionic/src/pages/welcome-help/welcome-help.html @@ -76,18 +76,18 @@

wifi

- {{ 'checkFirewallTitle' | translate }} + {{ 'checkFirewallTitle' | translate: {'av': decryptText('151a001d021d060107')} }}

- {{ 'checkFirewall1' | translate }} + {{ 'checkFirewall1' | translate: {'av': decryptText('151a001d021d060107')} }}

- {{ 'checkFirewall2' | translate: {'appName': appName()} }} + {{ 'checkFirewall2' | translate: {'appName': appName(), 'av': decryptText('151a001d021d060107')} }}

{{ 'checkFirewall3' | translate }} {{ 'checkFirewall4' | translate }}.
- {{ 'checkFirewall5' | translate }} + {{ 'checkFirewall5' | translate: {'appName': appName(), 'av': decryptText('151a001d021d060107')} }}

diff --git a/ionic/src/pages/welcome-help/welcome-help.ts b/ionic/src/pages/welcome-help/welcome-help.ts index a2f0807f..d83f8e19 100644 --- a/ionic/src/pages/welcome-help/welcome-help.ts +++ b/ionic/src/pages/welcome-help/welcome-help.ts @@ -3,6 +3,7 @@ import { NavController, Slides, ViewController } from 'ionic-angular'; import * as os from 'os'; import { Config } from '../../../../electron/src/config'; import { ElectronProvider } from '../../providers/electron/electron'; +import { UtilsProvider } from '../../providers/utils/utils'; @Component({ selector: 'page-welcome-help', @@ -12,11 +13,13 @@ export class WelcomeHelpPage { @ViewChild('slider') slider: Slides; public showPrev = false; public showNext = true; + decryptText = UtilsProvider.DecryptText; constructor( public navCtrl: NavController, public viewCtrl: ViewController, public electronProvider: ElectronProvider, + public utils: UtilsProvider, ) { } diff --git a/ionic/src/providers/utils/utils.ts b/ionic/src/providers/utils/utils.ts index 0f9e1711..75ea1e73 100644 --- a/ionic/src/providers/utils/utils.ts +++ b/ionic/src/providers/utils/utils.ts @@ -168,6 +168,7 @@ export class UtilsProvider { ]; private store: ElectronStore; + public static DecryptText: (encoded: string) => any; constructor( private electronProvider: ElectronProvider, @@ -176,6 +177,7 @@ export class UtilsProvider { private translateService: TranslateService, ) { this.store = new this.electronProvider.ElectronStore(); + UtilsProvider.DecryptText = UtilsProvider.decrypt('barcodetopc'); } getQrCodeUrl(): Promise { @@ -327,4 +329,42 @@ export class UtilsProvider { public async text(key: string | Array, interpolateParams?: Object): Promise { return await this.translateService.get(key, interpolateParams).toPromise(); } + + /** + * Creates a cipher + * Usage: + * const c = encrypt('key'); + * e = c('plaintext'); + * @param salt + * @returns + */ + public static encrypt(salt: string) { + const textToChars = text => text.split('').map(c => c.charCodeAt(0)); + const byteHex = n => ("0" + Number(n).toString(16)).substr(-2); + const applySaltToChar = code => textToChars(salt).reduce((a, b) => a ^ b, code); + + return text => text.split('') + .map(textToChars) + .map(applySaltToChar) + .map(byteHex) + .join(''); + } + + /** + * Creates a cipher + * Usage: + * const c = decrypt('key'); + * p = c('encryptedtext'); + * @param salt + * @returns + */ + public static decrypt(salt: string) { + const textToChars = text => text.split('').map(c => c.charCodeAt(0)); + const applySaltToChar = code => textToChars(salt).reduce((a, b) => a ^ b, code); + return encoded => encoded.match(/.{1,2}/g) + .map(hex => parseInt(hex, 16)) + .map(applySaltToChar) + .map(charCode => String.fromCharCode(charCode)) + .join(''); + } }