Ver código fonte

Allow setting of debug mode via URL with `/#converse?debug=true`

JC Brand 6 anos atrás
pai
commit
c26dde34f9
4 arquivos alterados com 21 adições e 1 exclusões
  1. 1 0
      CHANGES.md
  2. 8 0
      dist/converse.js
  3. 4 1
      docs/source/configuration.rst
  4. 8 0
      src/headless/converse-core.js

+ 1 - 0
CHANGES.md

@@ -2,6 +2,7 @@
 
 ## 4.1.3 (Unreleased)
 
+- Allow setting of debug mode via URL with `/#converse?debug=true`
 - New config setting [locked_muc_domain](https://conversejs.org/docs/html/configuration.html#locked-muc-domain)
 - New config setting [show_client_info](https://conversejs.org/docs/html/configuration.html#show-client-info)
 - #1373: Re-add support for the [muc_domain](https://conversejs.org/docs/html/configuration.html#muc-domain) setting

+ 8 - 0
dist/converse.js

@@ -63176,6 +63176,14 @@ _converse.initialize = async function (settings, callback) {
       throw new Error("Config Error: you need to provide the server's " + "domain via the 'jid' option when using anonymous " + "authentication with auto_login.");
     }
   }
+
+  _converse.router.route(/^converse\?debug=(true|false)$/, 'debug', debug => {
+    if (debug === "true") {
+      _converse.debug = true;
+    } else {
+      _converse.debug = false;
+    }
+  });
   /* Localisation */
 
 

+ 4 - 1
docs/source/configuration.rst

@@ -588,7 +588,10 @@ debug
 
 * Default:  ``false``
 
-If set to true, debugging output will be logged to the browser console.
+If set to ``true``, debugging output will be logged to the browser console.
+
+You can also set this value by changing the URL fragment to `#converse?debug=true` or `#converse?debug=false`.
+
 
 default_domain
 --------------

+ 8 - 0
src/headless/converse-core.js

@@ -495,6 +495,14 @@ _converse.initialize = async function (settings, callback) {
         }
     }
 
+    _converse.router.route(/^converse\?debug=(true|false)$/, 'debug', debug => {
+        if (debug === "true") {
+            _converse.debug = true;
+        } else {
+            _converse.debug = false;
+        }
+    });
+
     /* Localisation */
     if (!_.isUndefined(i18n)) {
         i18n.setLocales(settings.i18n, _converse);