Add support for themes to riot-web
This commit is contained in:
parent
cebadf400d
commit
37f3a2d5a8
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
|||||||
/inventory/*
|
/inventory/*
|
||||||
!/inventory/.gitkeep
|
!/inventory/.gitkeep
|
||||||
!/inventory/host_vars/.gitkeep
|
!/inventory/host_vars/.gitkeep
|
||||||
|
/roles/*/files/scratchpad
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
# 2020-02-26
|
||||||
|
|
||||||
|
## Riot-web themes are here
|
||||||
|
|
||||||
|
The playbook now makes it easy to install custom riot-web themes.
|
||||||
|
|
||||||
|
To learn more, take a look at our [riot-web documentation on Themes](docs/configuring-playbook-riot-web.md#themes).
|
||||||
|
|
||||||
|
|
||||||
# 2020-02-24
|
# 2020-02-24
|
||||||
|
|
||||||
## Customize the server name in Riot's login page
|
## Customize the server name in Riot's login page
|
||||||
|
@ -27,3 +27,14 @@ Alternatively, **if there is no pre-defined variable** for a riot-web setting yo
|
|||||||
- or, you can **extend and override the default configuration** ([`config.json.j2`](../roles/matrix-riot-web/templates/config.json.j2)) by making use of the `matrix_riot_web_configuration_extension_json_` variable. You can find information about this in [`roles/matrix-riot-web/defaults/main.yml`](../roles/matrix-riot-web/defaults/main.yml).
|
- or, you can **extend and override the default configuration** ([`config.json.j2`](../roles/matrix-riot-web/templates/config.json.j2)) by making use of the `matrix_riot_web_configuration_extension_json_` variable. You can find information about this in [`roles/matrix-riot-web/defaults/main.yml`](../roles/matrix-riot-web/defaults/main.yml).
|
||||||
|
|
||||||
- or, if extending the configuration is still not powerful enough for your needs, you can **override the configuration completely** using `matrix_riot_web_configuration_default` (or `matrix_riot_web_configuration`). You can find information about this in [`roles/matrix-riot-web/defaults/main.yml`](../roles/matrix-riot-web/defaults/main.yml).
|
- or, if extending the configuration is still not powerful enough for your needs, you can **override the configuration completely** using `matrix_riot_web_configuration_default` (or `matrix_riot_web_configuration`). You can find information about this in [`roles/matrix-riot-web/defaults/main.yml`](../roles/matrix-riot-web/defaults/main.yml).
|
||||||
|
|
||||||
|
|
||||||
|
## Themes
|
||||||
|
|
||||||
|
To change the look of riot-web, you can define your own themes manually by using the `matrix_riot_web_settingDefaults_custom_themes` setting.
|
||||||
|
|
||||||
|
Or better yet, you can automatically pull it all themes provided by the [aaronraimist/riot-web-themes](https://github.com/aaronraimist/riot-web-themes) project by simply flipping a flag (`matrix_riot_web_themes_enabled: true`).
|
||||||
|
|
||||||
|
If you make your own theme, we encourage you to submit it to the **aaronraimist/riot-web-themes** project, so that the whole community could easily enjoy it.
|
||||||
|
|
||||||
|
Note that for a custom theme to work well, all riot-web/riot-desktop instances that you use must have the same theme installed.
|
||||||
|
@ -45,6 +45,21 @@ matrix_riot_web_registration_enabled: false
|
|||||||
# Controls whether Riot shows the presence features
|
# Controls whether Riot shows the presence features
|
||||||
matrix_riot_web_enable_presence_by_hs_url: ~
|
matrix_riot_web_enable_presence_by_hs_url: ~
|
||||||
|
|
||||||
|
# Controls whether custom riot-web themes will be installed.
|
||||||
|
# When enabled, all themes found in the `matrix_riot_web_themes_repository_url` repository
|
||||||
|
# will be installed and enabled automatically.
|
||||||
|
matrix_riot_web_themes_enabled: false
|
||||||
|
matrix_riot_web_themes_repository_url: https://github.com/aaronraimist/riot-web-themes
|
||||||
|
|
||||||
|
# Controls the `settingsDefault.custom_themes` setting of the riot-web configuration.
|
||||||
|
# You can use this setting to define custom themes.
|
||||||
|
#
|
||||||
|
# Also, look at `matrix_riot_web_themes_enabled` for a way to pull in a bunch of custom themes automatically.
|
||||||
|
# If you define your own themes here and set `matrix_riot_web_themes_enabled: true`, your themes will be preserved as well.
|
||||||
|
#
|
||||||
|
# Note that for a custom theme to work well, all riot-web/riot-desktop instances that you use must have the same theme installed.
|
||||||
|
matrix_riot_web_settingDefaults_custom_themes: []
|
||||||
|
|
||||||
# Default riot-web configuration template which covers the generic use case.
|
# Default riot-web configuration template which covers the generic use case.
|
||||||
# You can customize it by controlling the various variables inside it.
|
# You can customize it by controlling the various variables inside it.
|
||||||
#
|
#
|
||||||
|
@ -8,6 +8,12 @@
|
|||||||
- setup-all
|
- setup-all
|
||||||
- setup-riot-web
|
- setup-riot-web
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/prepare_riot_web_themes.yml"
|
||||||
|
when: run_setup|bool
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-riot-web
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/setup_riot_web.yml"
|
- import_tasks: "{{ role_path }}/tasks/setup_riot_web.yml"
|
||||||
when: run_setup|bool
|
when: run_setup|bool
|
||||||
tags:
|
tags:
|
||||||
|
48
roles/matrix-riot-web/tasks/prepare_riot_web_themes.yml
Normal file
48
roles/matrix-riot-web/tasks/prepare_riot_web_themes.yml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
#
|
||||||
|
# Tasks related to setting up riot-web themes
|
||||||
|
#
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: Ensure riot-web themes repository is pulled
|
||||||
|
git:
|
||||||
|
repo: "{{ matrix_riot_web_themes_repository_url }}"
|
||||||
|
dest: "{{ role_path }}/files/scratchpad/riot-web-themes"
|
||||||
|
|
||||||
|
- name: Find all riot-web theme files
|
||||||
|
find:
|
||||||
|
paths: "{{ role_path }}/files/scratchpad/riot-web-themes"
|
||||||
|
patterns: "*.json"
|
||||||
|
recurse: true
|
||||||
|
register: matrix_riot_web_theme_file_list
|
||||||
|
|
||||||
|
- name: Read riot-web theme
|
||||||
|
slurp:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
register: "matrix_riot_web_theme_file_contents"
|
||||||
|
with_items: "{{ matrix_riot_web_theme_file_list.files }}"
|
||||||
|
|
||||||
|
- name: Load riot-web theme
|
||||||
|
set_fact:
|
||||||
|
matrix_riot_web_settingDefaults_custom_themes: "{{ matrix_riot_web_settingDefaults_custom_themes + [item['content'] | b64decode | from_json] }}"
|
||||||
|
with_items: "{{ matrix_riot_web_theme_file_contents.results }}"
|
||||||
|
|
||||||
|
run_once: true
|
||||||
|
delegate_to: 127.0.0.1
|
||||||
|
become: false
|
||||||
|
when: matrix_riot_web_themes_enabled|bool
|
||||||
|
|
||||||
|
|
||||||
|
# #
|
||||||
|
# # Tasks related to getting rid of riot-web themes (if it was previously enabled)
|
||||||
|
# #
|
||||||
|
|
||||||
|
- name: Ensure riot-web themes repository is removed
|
||||||
|
file:
|
||||||
|
path: "{{ role_path }}/files/scratchpad/riot-web-themes"
|
||||||
|
state: absent
|
||||||
|
run_once: true
|
||||||
|
delegate_to: 127.0.0.1
|
||||||
|
become: false
|
||||||
|
when: "not matrix_riot_web_themes_enabled|bool"
|
@ -8,6 +8,9 @@
|
|||||||
"base_url": {{ matrix_riot_web_default_is_url|string|to_json }}
|
"base_url": {{ matrix_riot_web_default_is_url|string|to_json }}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"settingDefaults": {
|
||||||
|
"custom_themes": {{ matrix_riot_web_settingDefaults_custom_themes|to_json }}
|
||||||
|
},
|
||||||
"disable_custom_urls": {{ matrix_riot_web_disable_custom_urls|to_json }},
|
"disable_custom_urls": {{ matrix_riot_web_disable_custom_urls|to_json }},
|
||||||
"disable_guests": {{ matrix_riot_web_disable_guests|to_json }},
|
"disable_guests": {{ matrix_riot_web_disable_guests|to_json }},
|
||||||
"brand": {{ matrix_riot_web_brand|to_json }},
|
"brand": {{ matrix_riot_web_brand|to_json }},
|
||||||
|
Loading…
Reference in New Issue
Block a user