Skip to content

Commit

Permalink
Merge branch 'release/v2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
kellya committed May 11, 2021
2 parents f1d044c + 92f1af7 commit 61a45fb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ You must first register a site with [cactus.chat](https://cactus.chat) (or your

In your pelicanconf.py, you will need at least the `CACTUS_SITNAME` variable set. If you set nothing else, this will use cactus.chat as the host.

As of version 0.9.0 of the cactus webclient, you may optionally use HTML Data
attributes to display the chat. This is supported by setting the `CACTUS_HTML_DATA`
variable to `True`. The default is False.

### Self-hosting

If you are self-hosting you must set the following variables
Expand All @@ -29,6 +33,8 @@ directly (true) or via a matrix.to link (false).
`CACTUS_GUEST_POSTING` (true or false) Boolean to allow/disallow guest posting
`CACTUS_UPDATE_INTERVAL` (integer) The number of seconds to auto-refresh the
comments. Zero or negative number disabled
`CACTUS_HTML_DATA` (true or false) Option to display chat via HTML data
attributes (true) or not (**false**)

## Article metadata variables

Expand Down
32 changes: 32 additions & 0 deletions cactus_script.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,33 @@
{% if CACTUS_SERVERNAME is not defined %}
{% set CACTUS_SERVERNAME = 'cactus.chat' %}
{% endif %}
{% if CACTUS_HTML_DATA %}
<script type="text/javascript" src="{{ CACTUS_JS_URL }}"
data-default-homeserver-url="{{ CACTUS_HOMESERVER }}"
data-server-name="{{ CACTUS_SERVERNAME }}"
data-site-name="{{ CACTUS_SITENAME }}"
{% if not article.metadata['cactus_comment_section_id'] %}
data-comment-section-id="{{ article.slug }}"
{% else %}
data-comment-section-id="{{ article.metadata['cactus_comment_section_id'] }}"
{% endif %}
{% if CACTUS_PAGE_SIZE %}
data-page-size="{{ CACTUS_PAGE_SIZE }}"
{% endif %}
{% if CACTUS_LOGIN_ENABLED %}
data-page-size="{{ CACTUS_LOGIN_ENABLED }}"
% endif %}
{% if CACTUS_GUEST_POSTING %}
data-guest-posting-enabled="{{ CACTUS_GUEST_POSTING }}"
{% endif %}
{% if CACTUS_UPDATE_INTERVAL %}
data-update-interval="{{ CACTUS_UPDATE_INTERVAL }}"
{% endif %}
</script>
{% endif %}
{% else %}


<script type="text/javascript" src="{{ CACTUS_JS_URL }}"></script>
<link rel="stylesheet" href="{{ CACTUS_CSS_URL }}" type="text/css">

Expand All @@ -23,15 +50,19 @@
{% if CACTUS_LOGIN_ENABLED %}
loginEnabled: {{ CACTUS_LOGIN_ENABLED }},
{% endif %}

{% if CACTUS_GUEST_POSTING %}
guestPostingEnabled: {{ CACTUS_GUEST_POSTING }},
{% endif %}

{% if CACTUS_UPDATE_INTERVAL %}
updateInterval: {{ CACTUS_UPDATE_INTERVAL }},
{% endif %}

defaultHomeserverUrl: "{{ CACTUS_HOMESERVER }} ",
serverName: "{{ CACTUS_SERVERNAME }}",
siteName: "{{ CACTUS_SITENAME }}",

{% if not article.metadata['cactus_comment_section_id'] %}
commentSectionId: "{{ article.slug }}"
{% else %}
Expand All @@ -40,3 +71,4 @@
})
</script>
{%- endif %}
{%- endif %}

0 comments on commit 61a45fb

Please sign in to comment.