Browse Source

New config setting `allow_public_bookmarks`

JC Brand 7 năm trước cách đây
mục cha
commit
055c4d2104

+ 4 - 0
CHANGES.md

@@ -17,6 +17,10 @@ though they should be private._
 ### API changes
 ### API changes
 - New API method `_converse.disco.getIdentity` to check whether a JID has a given identity.
 - New API method `_converse.disco.getIdentity` to check whether a JID has a given identity.
 
 
+### New configuration settings
+- New configuration setting [allow_public_bookmarks](https://conversejs.org/docs/html/configurations.html#allow-public-bookmarks)
+
+
 ## 3.3.2 (2018-01-29)
 ## 3.3.2 (2018-01-29)
 
 
 ### Bugfixes
 ### Bugfixes

+ 20 - 0
docs/source/configuration.rst

@@ -118,6 +118,8 @@ allow_bookmarks
 Enables/disables chatroom bookmarks functionality.
 Enables/disables chatroom bookmarks functionality.
 This setting is only applicable if the ``converse-bookmarks`` plugin is loaded.
 This setting is only applicable if the ``converse-bookmarks`` plugin is loaded.
 
 
+See also: `allow_public_bookmarks`_
+
 allow_chat_pending_contacts
 allow_chat_pending_contacts
 ---------------------------
 ---------------------------
 
 
@@ -190,6 +192,24 @@ allow_otr
 
 
 Allow Off-the-record encryption of single-user chat messages.
 Allow Off-the-record encryption of single-user chat messages.
 
 
+allow_public_bookmarks
+----------------------
+
+* Default: ``false``
+
+Some XMPP servers don't support private PEP/PubSub nodes, as required for
+private bookmarks and outlined in `XEP-0223 <https://xmpp.org/extensions/xep-0223.html>`_.
+
+Even though Converse.js asks for the bookmarks to be kept private (via the
+`<publish-options>` XML node), the server simply ignores the privacy settings
+and publishes the node contents under the default privacy setting, which makes
+the information available to all roster contacts.
+
+If your your XMPP server does not support `XEP-0223`'s ``#publish-options``
+feature and you don't mind that your room bookmarks are visible to all
+contacts, then you can set this setting to ``true``. Otherwise you won't be
+able to have any room bookmarks at all for an account on that XMPP server.
+
 allow_registration
 allow_registration
 ------------------
 ------------------
 
 

+ 2 - 1
src/converse-bookmarks.js

@@ -218,6 +218,7 @@
             // configuration settings.
             // configuration settings.
             _converse.api.settings.update({
             _converse.api.settings.update({
                 allow_bookmarks: true,
                 allow_bookmarks: true,
+                allow_public_bookmarks: false,
                 hide_open_bookmarks: true
                 hide_open_bookmarks: true
             });
             });
             // Promises exposed by this plugin
             // Promises exposed by this plugin
@@ -540,7 +541,7 @@
                     const identity = args[0],
                     const identity = args[0],
                           options_support = args[1];
                           options_support = args[1];
 
 
-                    if (_.isNil(identity) || !options_support.supported) {
+                    if (_.isNil(identity) || (!options_support.supported && !_converse.allow_public_bookmarks)) {
                         _converse.emit('bookmarksInitialized');
                         _converse.emit('bookmarksInitialized');
                         return;
                         return;
                     }
                     }