From a5d9f4770910f322276aaccbca86549d5395c0cd Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Wed, 2 Jan 2019 13:04:19 +0100 Subject: [PATCH] [enh] Allow to open DEV tool, on desktop installation - fix #789 --- www/i18n/locale-en-GB.json | 5 ++++- www/i18n/locale-en.json | 5 ++++- www/i18n/locale-fr-FR.json | 5 ++++- www/js/services/device-services.js | 10 +++++++++- www/templates/modal_about.html | 5 +++++ www/templates/settings/settings.html | 9 +++++++++ 6 files changed, 35 insertions(+), 4 deletions(-) diff --git a/www/i18n/locale-en-GB.json b/www/i18n/locale-en-GB.json index 911923da..b504543a 100644 --- a/www/i18n/locale-en-GB.json +++ b/www/i18n/locale-en-GB.json @@ -113,7 +113,8 @@ "DEVELOPERS": "Developers:", "FORUM": "Forum:", "PLEASE_REPORT_ISSUE": "Please report any issue to us!", - "REPORT_ISSUE": "Report an issue" + "REPORT_ISSUE": "Report an issue", + "BTN_OPEN_DEV_WINDOW": "Open the debug window" }, "HOME": { "TITLE": "Cesium", @@ -151,6 +152,8 @@ "HOUR": "After {{value}}h of inactivity", "ALWAYS": "At the end of the session" }, + "KEYRING_FILE": "Keyring file", + "KEYRING_FILE_HELP": "Allow auto-connect at startup, or to authenticate (only if \"Expiration of authentication\" is \"at the end of the session\"", "REMEMBER_ME": "Remember me ?", "REMEMBER_ME_HELP": "Allows to remain identified from one session to another, keeping the public key locally.", "PLUGINS_SETTINGS": "Extensions", diff --git a/www/i18n/locale-en.json b/www/i18n/locale-en.json index 9d726d5e..3cbf4b1f 100644 --- a/www/i18n/locale-en.json +++ b/www/i18n/locale-en.json @@ -113,7 +113,8 @@ "DEVELOPERS": "Developers:", "FORUM": "Forum:", "PLEASE_REPORT_ISSUE": "Please report any issue to us!", - "REPORT_ISSUE": "Report an issue" + "REPORT_ISSUE": "Report an issue", + "BTN_OPEN_DEV_WINDOW": "Open the debug window" }, "HOME": { "TITLE": "Cesium", @@ -151,6 +152,8 @@ "HOUR": "After {{value}}h of inactivity", "ALWAYS": "At the end of the session" }, + "KEYRING_FILE": "Keyring file", + "KEYRING_FILE_HELP": "Allow auto-connect at startup, or to authenticate (only if \"Expiration of authentication\" is \"at the end of the session\"", "REMEMBER_ME": "Remember me ?", "REMEMBER_ME_HELP": "Allows to remain identified from one session to another, keeping the public key locally.", "PLUGINS_SETTINGS": "Extensions", diff --git a/www/i18n/locale-fr-FR.json b/www/i18n/locale-fr-FR.json index 3277b48e..cb74c985 100644 --- a/www/i18n/locale-fr-FR.json +++ b/www/i18n/locale-fr-FR.json @@ -113,7 +113,8 @@ "DEVELOPERS": "Développé par :", "FORUM": "Forum :", "PLEASE_REPORT_ISSUE": "N'hésitez pas à nous remonter les anomalies rencontrées", - "REPORT_ISSUE": "Remonter un problème" + "REPORT_ISSUE": "Remonter un problème", + "BTN_OPEN_DEV_WINDOW": "Ouvrir la fenêtre de debuggage" }, "HOME": { "TITLE": "Cesium", @@ -151,6 +152,8 @@ "HOUR": "Après {{value}}h d'inactivité", "ALWAYS": "A la fin de la session" }, + "KEYRING_FILE": "Fichier de trousseau", + "KEYRING_FILE_HELP": "Permet de vous <b>connecter</b> automatiquement à chaque lancement<br/>et même de vous <b>authentifier</b> (seulement si \"Expiration de l'authentification\" est configurée \"à la fin de la session\").", "REMEMBER_ME": "Se souvenir de moi ?", "REMEMBER_ME_HELP": "Permet de rester identifié d'une session à l'autre, en conservant localement la clé publique.", "PLUGINS_SETTINGS": "Extensions", diff --git a/www/js/services/device-services.js b/www/js/services/device-services.js index 1a1877f6..621fe5dc 100644 --- a/www/js/services/device-services.js +++ b/www/js/services/device-services.js @@ -209,7 +209,7 @@ angular.module('cesium.device.services', ['cesium.utils.services', 'cesium.setti if (!angular.isDefined(cache.isDesktop)) { try { // Should have NodeJs and NW - cache.isDesktop = !exports.enable && !!process && !!App; + cache.isDesktop = !exports.enable && !!process && !!nw && !!nw.App; } catch (err) { cache.isDesktop = false; } @@ -221,6 +221,14 @@ angular.module('cesium.device.services', ['cesium.utils.services', 'cesium.setti return !exports.enable && !exports.isDesktop(); }; + exports.openDevTool = function() { + if (exports.isDesktop()) { + // Get the current window + var win = nw && nw.Window && nw.Window.get(); + if (win) win.showDevTools(); + } + }; + exports.ready = function() { if (started) return $q.when(); return startPromise || exports.start(); diff --git a/www/templates/modal_about.html b/www/templates/modal_about.html index fb73558c..da1c6304 100644 --- a/www/templates/modal_about.html +++ b/www/templates/modal_about.html @@ -34,6 +34,11 @@ <span translate>ABOUT.PLEASE_REPORT_ISSUE</span> <h3> <a ng-click="openLink($event, $root.settings.newIssueUrl)" translate>ABOUT.REPORT_ISSUE</a> + <span class="hidden-sm hidden-xs" ng-if="::$root.device.isDesktop()"> | <a + ng-click="$root.device.openDevTool()"> + {{'ABOUT.BTN_OPEN_DEV_WINDOW' | translate}} + </a> + </span> </h3> </ion-item> diff --git a/www/templates/settings/settings.html b/www/templates/settings/settings.html index 41f1a961..5a0ba402 100644 --- a/www/templates/settings/settings.html +++ b/www/templates/settings/settings.html @@ -118,6 +118,15 @@ </label> </div> + <div class="item item-input hidden-xs hidden-sm" ng-class="{'gray': (!formData.useLocalStorage || !formData.rememberMe)}" ng-if="::$root.device.isDesktop()"> + <div class="input-label"> + <span class="input-label" translate>SETTINGS.KEYRING_FILE</span> + <h4 class="gray text-wrap" ng-bind-html="'SETTINGS.KEYRING_FILE_HELP' | translate"></h4> + </div> + + <div class="item-note dark">{{formData.keyringFile}}</div> + </div> + <span class="item item-divider" translate>SETTINGS.HISTORY_SETTINGS</span> <div class="item item-toggle dark"> -- GitLab