Commit c3447dd2 authored by JC Brand's avatar JC Brand

New config option: ``persistent_store``

Allows for using IndexedDB as the persistent store, instead of localStorage
parent 5232019e
...@@ -8,8 +8,9 @@ ...@@ -8,8 +8,9 @@
- New API [\_converse.api.headlines](https://conversejs.org/docs/html/api/-_converse.api.headlines.html#.get) - New API [\_converse.api.headlines](https://conversejs.org/docs/html/api/-_converse.api.headlines.html#.get)
- New config option [allow_message_retraction](https://conversejs.org/docs/html/configuration.html#allow-message-retraction) - New config option [allow_message_retraction](https://conversejs.org/docs/html/configuration.html#allow-message-retraction)
- New config option [muc-show-logs-before-join](https://conversejs.org/docs/html/configuration.html#muc-show-logs-before-join) - New config option [muc-show-logs-before-join](https://conversejs.org/docs/html/configuration.html#muc-show-logs-before-join)
- New config option [muc_mention_autocomplete_filter](https://conversejs.org/docs/html/configuration.html#muc_mention_autocomplete_filter) - New config option [muc_mention_autocomplete_filter](https://conversejs.org/docs/html/configuration.html#muc-mention-autocomplete-filter)
- New config option [muc_mention_autocomplete_show_avatar](https://conversejs.org/docs/html/configuration.html#muc_mention_autocomplete_show_avatar) - New config option [muc_mention_autocomplete_show_avatar](https://conversejs.org/docs/html/configuration.html#muc-mention-autocomplete-show_avatar)
- New config option [persistent_store](https://conversejs.org/docs/html/configuration.html#persistent-store)
- Initial support for sending custom emojis. Currently only between Converse - Initial support for sending custom emojis. Currently only between Converse
instances. Still working out a wire protocol for compatibility with other clients. instances. Still working out a wire protocol for compatibility with other clients.
......
...@@ -1349,6 +1349,23 @@ compile time. ...@@ -1349,6 +1349,23 @@ compile time.
This configuration seting allows this value to be set at runtime as well. This configuration seting allows this value to be set at runtime as well.
persistent_store
----------------
* Default: ``localStorage``
* Valid options: ``localStorage``, ``IndexedDB``
Determines which store is used for storing persistent data.
From version 6.0.0 onwards, Converse supports storing data in
`IndexedDB <https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Basic_Concepts_Behind_IndexedDB>`_.
IndexedDB is not subjected to the same space constraints as localStorage and is
also a requirement for progressive web apps which don't need persistent a
internet connectivity to be functional.
push_app_servers push_app_servers
---------------- ----------------
...@@ -1514,16 +1531,6 @@ everywhere. ...@@ -1514,16 +1531,6 @@ everywhere.
This warning isn't applicable to all deployments of Converse and can therefore This warning isn't applicable to all deployments of Converse and can therefore
be turned off by setting this config variable to ``false``. be turned off by setting this config variable to ``false``.
use_system_emojis
-----------------
* Default: ``true``
Determines whether emojis should be rendered by the user's system.
Not all operating systems support (all) emojis. So alternatively you can let
Converse render the emojis with `Twemoji <https://twemoji.twitter.com/>`_.
See also `emoji_image_path`_.
send_chat_state_notifications send_chat_state_notifications
----------------------------- -----------------------------
...@@ -1635,8 +1642,7 @@ synchronize_availability ...@@ -1635,8 +1642,7 @@ synchronize_availability
------------------------ ------------------------
* Default: ``true`` * Default: ``true``
* Valid options: ``true``, ``false``, ``a resource name``.
Valid options: ``true``, ``false``, ``a resource name``.
This option lets you synchronize your chat status (`online`, `busy`, `away`) with other chat clients. In other words, This option lets you synchronize your chat status (`online`, `busy`, `away`) with other chat clients. In other words,
if you change your status to ``busy`` in a different chat client, your status will change to ``busy`` in Converse as well. if you change your status to ``busy`` in a different chat client, your status will change to ``busy`` in Converse as well.
...@@ -1651,8 +1657,7 @@ theme ...@@ -1651,8 +1657,7 @@ theme
----- -----
* Default: ``default`` * Default: ``default``
* Valid options: ``default``, ``concord``
Valid options: ``default``, ``concord``
Let's you set a color theme for Converse. Let's you set a color theme for Converse.
...@@ -1706,6 +1711,18 @@ description of time-format options available for ``DayJS`` you can check the ...@@ -1706,6 +1711,18 @@ description of time-format options available for ``DayJS`` you can check the
`default formatting options <https://github.com/iamkun/dayjs/blob/dev/docs/en/API-reference.md#displaying>`_ and the `default formatting options <https://github.com/iamkun/dayjs/blob/dev/docs/en/API-reference.md#displaying>`_ and the
`advanced options <https://github.com/iamkun/dayjs/blob/master/docs/en/Plugin.md#advancedformat>`_. `advanced options <https://github.com/iamkun/dayjs/blob/master/docs/en/Plugin.md#advancedformat>`_.
use_system_emojis
-----------------
* Default: ``true``
Determines whether emojis should be rendered by the user's system.
Not all operating systems support (all) emojis. So alternatively you can let
Converse render the emojis with `Twemoji <https://twemoji.twitter.com/>`_.
See also `emoji_image_path`_.
visible_toolbar_buttons visible_toolbar_buttons
----------------------- -----------------------
......
...@@ -268,6 +268,7 @@ _converse.default_settings = { ...@@ -268,6 +268,7 @@ _converse.default_settings = {
message_carbons: true, message_carbons: true,
nickname: undefined, nickname: undefined,
password: undefined, password: undefined,
persistent_store: 'localStorage',
priority: 0, priority: 0,
rid: undefined, rid: undefined,
root: window.document, root: window.document,
...@@ -448,10 +449,11 @@ function initClientConfig () { ...@@ -448,10 +449,11 @@ function initClientConfig () {
* user sessions. * user sessions.
*/ */
const id = 'converse.client-config'; const id = 'converse.client-config';
const store_map = { 'localStorage': 'local', 'IndexedDB': 'indexed' };
_converse.config = new Backbone.Model({ _converse.config = new Backbone.Model({
'id': id, 'id': id,
'trusted': _converse.trusted && true || false, 'trusted': _converse.trusted && true || false,
'storage': _converse.trusted ? 'local' : 'session' 'storage': _converse.trusted ? store_map[_converse.persistent_store] : 'session'
}); });
_converse.config.browserStorage = _converse.createStore(id, "session"); _converse.config.browserStorage = _converse.createStore(id, "session");
_converse.config.fetch(); _converse.config.fetch();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment