customize (#17)

updates config, adds tags to deploy customization easily, adds the possibility to edit customization files, fixes the admin_keys issue.

Co-authored-by: meaz <meaz@disroot.org>
Reviewed-on: #17
Reviewed-by: muppeth <muppeth@no-reply@disroot.org>
This commit is contained in:
meaz 2023-05-16 12:33:44 +00:00
parent 63df2dd328
commit f56b55614d
10 changed files with 95 additions and 41 deletions

View file

@ -10,7 +10,9 @@ Add `192.168.33.20 cryptpad.example.org` to `/etc/hosts`
Then you can access cryptpad from your computer on https://cryptpad.example.org
## Customization
You can add your own logo by changing `logo.svg`in `files` by another logo (but keep the `logo.svg` name).
You can add your own logo by changing `CryptPad_logo.svg` and `CryptPad_logo_hero.svg` `files` in the `customize` folder by logos of your choice (but keep those names). (Note: CryptPad_logo_hero logo is used on main page, CryptPad_logo for loading pages).
You can also add/edit files in the `customize` folder as explained on https://docs.cryptpad.org/en/admin_guide/customization.html
## Playbook
@ -18,6 +20,8 @@ The playbook includes nginx role and deploys entire stack needed to run Cryptpad
## CHANGELOG
- **17.02.2023** -
- Add customization
- **26.03.2021** -
- Bumped version to 4.2.1
- Update readme

View file

@ -19,4 +19,4 @@
</g>
</g>
</g>
</svg>
</svg>

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,14 @@
<svg width="280" height="349" version="1.1" viewBox="0 0 74.083 92.34" xmlns="http://www.w3.org/2000/svg" xmlns:osb="http://www.openswatchbook.org/uri/2009/osb">
<g>
<g transform="translate(-125.38 -26.449)">
<path d="m128.98 30.355 0.55499 39.644h33.141l4e-3 -39.644z" style="fill-opacity:.39608;fill:#949494"/>
<path d="m162.69 70 3e-3 43.946c12.825-5.8796 32.762-17.077 33.127-43.157l0.0108-0.78911z" style="fill-opacity:.39608;fill:#949494"/>
<path d="m128.98 30.355h44.386l22.414 20.826v24.899c0 26.166-21.414 32.228-33.117 38.409-12.815-5.8945-32.794-12.329-33.117-38.409z" style="fill:none;stroke-width:5.2922;stroke:#949494"/>
<path d="m171.32 29.811v23.04h24.575" style="fill:none;stroke-width:5.292;stroke:#949494"/>
<g transform="matrix(1.1107 0 0 1.1107 18.926 21.932)" style="fill:#949494">
<path d="m137.23 42.719a8.1185 8.1185 0 0 1-8.1185 8.1185 8.1185 8.1185 0 0 1-8.1185-8.1185 8.1185 8.1185 0 0 1 8.1185-8.1185 8.1185 8.1185 0 0 1 8.1185 8.1185z" style="fill:#949494"/>
<path d="m127 42.651h4.2265l4.2333 22.354h-12.693z" style="fill:#949494"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,22 @@
<svg width="280" height="349" version="1.1" viewBox="0 0 74.083 92.34" xmlns="http://www.w3.org/2000/svg" xmlns:osb="http://www.openswatchbook.org/uri/2009/osb">
<g>
<g transform="translate(-640.42 -172.99)" style="fill:#ffffff">
<g style="fill:#ffffff">
<path d="m644.02 176.9h44.386l22.414 20.826v24.899c0 26.166-21.414 32.228-33.117 38.409-12.815-5.8945-32.794-12.329-33.117-38.409z" style="fill:#ffffff"/>
</g>
<g style="fill:#ffffff">
<path d="m644.02 176.9h44.386l22.414 20.826v24.899c0 26.166-21.414 32.228-33.117 38.409-12.815-5.8945-32.794-12.329-33.117-38.409z" style="fill:#ffffff"/>
</g>
</g>
<g transform="translate(-125.38 -26.449)">
<path d="m128.98 30.355 0.55499 39.644h33.141l4e-3 -39.644z" style="fill-opacity:.39608;fill:#0087ff"/>
<path d="m162.69 70 3e-3 43.946c12.825-5.8796 32.762-17.077 33.127-43.157l0.0108-0.78911z" style="fill-opacity:.39608;fill:#0087ff"/>
<path d="m128.98 30.355h44.386l22.414 20.826v24.899c0 26.166-21.414 32.228-33.117 38.409-12.815-5.8945-32.794-12.329-33.117-38.409z" style="fill:none;stroke-width:5.2922;stroke:#0087ff"/>
<path d="m171.32 29.811v23.04h24.575" style="fill:none;stroke-width:5.2917;stroke:#0087ff"/>
<g transform="matrix(1.1107 0 0 1.1107 18.926 21.932)" style="fill:#0087ff">
<path d="m137.23 42.719a8.1185 8.1185 0 0 1-8.1185 8.1185 8.1185 8.1185 0 0 1-8.1185-8.1185 8.1185 8.1185 0 0 1 8.1185-8.1185 8.1185 8.1185 0 0 1 8.1185 8.1185z" style="fill:#0087ff"/>
<path d="m127 42.651h4.2265l4.2333 22.354h-12.693z" style="fill:#0087ff"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
customize/main-favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

25
customize/readme.md Normal file
View file

@ -0,0 +1,25 @@
# Customizing CryptPad
In order allow a variety of features to be changed and to allow site-specific changes
to CryptPad apps while still keeping the git repository pristine, this directory exists
to allow a set of hooks to be run.
The server is configured to load files from the `/customize/` path preferentially from
`cryptpad/customize/`, and to fall back to `cryptpad/customize.dist/` if they are not found
If you wish to customize cryptpad, please **copy**
`/customize.dist/` to `/customize` and then edit it there, this way you will still be able
to pull from (and make pull requests to (!) the git repository.
## Files you may be interested in
* index.html is the main page
* main.js contains javascript for the home page
* application_config.js allows you to modify settings used by the various applications
* messages.js contains functions for applying translations to various pages
* look inside `/translations/` for the rest of the files which contain translated strings
* `/share/` implements an iframe RPC which allows multiple domains to access the same localStorage
* `/src/` contains source files for html and css (in the form of html templates and .less stylesheets)
All other content which is placed in this directory will be referencable at the `/customize/`
URL location.

View file

@ -1,5 +1,5 @@
---
cryptpad_extra_files_path: '../files'
cryptpad_extra_files_path: '../customize'
cryptpad_user: 'cryptpad'
cryptpad_group: 'cryptpad'
@ -18,7 +18,9 @@ cryptpad_httpAddress: "::"
cryptpad_httpPort: "3000"
cryptpad_httpSafePort: "3001"
cryptpad_maxWorkers: "4"
cryptpad_adminKeys: "cryptpad-user1@my.awesome.website/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo="
cryptpad_adminKeys:
- "[cryptpad-user1@my.awesome.website/eglegkejfizu#otoUFng55s64Are856URjvAHGGv-89=]"
- "[cryptpad-user2@my.awesome.website/jA-9c5iNuG7SyxzGCjwJXVnk5NPfAOO8fQuQ0dC83RE=]"
cryptpad_adminEmail: "i.did.not.read.my.config@cryptpad.fr"
cryptpad_removeDonateButton: "false"
cryptpad_blockDailyCheck: "true"
@ -46,9 +48,9 @@ cryptpad_verbose: "false"
cryptpad_LimitNOFILE: "1000000"
# Appication_config_internal.js
cryptpad_AppConfig_imprint: "false"
cryptpad_AppConfig_privacy: "false"
cryptpad_AppConfig_terms: "false"
cryptpad_AppConfig_imprint: ""
cryptpad_AppConfig_privacy: ""
cryptpad_AppConfig_terms: ""
#nginx
nginx_default_vhost: 'cryptpad'

View file

@ -1,6 +1,6 @@
---
- name: "[Config]- Deploy cryptpad configuration"
- name: "[Config] - Deploy cryptpad configuration"
template:
src: config/config.js.j2
dest: "{{ cryptpad_path }}/config/config.js"
@ -8,15 +8,27 @@
group: "{{ cryptpad_group }}"
mode: 0755
notify: restart cryptpad
tags: customize
- name: "[Config]- Create customize folder"
- name: "[Config] - Create customize folder"
file:
path: "{{ cryptpad_path }}/customize/"
state: 'directory'
owner: '{{ cryptpad_user }}'
group: '{{ cryptpad_group }}'
tags: customize
- name: "[Config] - Deploy cryptpad application configuration"
- name: "[Config] - Deploy customize folder"
copy:
src: '{{ cryptpad_extra_files_path }}/'
dest: "{{ cryptpad_path }}/customize/"
owner: "{{ cryptpad_user }}"
group: "{{ cryptpad_group }}"
mode: 0755
notify: restart cryptpad
tags: customize
- name: "[Config] - Deploy cryptpad application configuration"
template:
src: customize/application_config.js.j2
dest: "{{ cryptpad_path }}/customize/application_config.js"
@ -24,16 +36,11 @@
group: "{{ cryptpad_group }}"
mode: 0755
notify: restart cryptpad
tags: customize
- name: "[Config] - Generate static pages"
shell:
cmd: "sudo -u {{ cryptpad_user }} npm run build"
args:
chdir: "{{ cryptpad_path }}"
- name: "[Config] - Copy logo"
copy:
src: '{{ cryptpad_extra_files_path }}/logo.svg'
dest: "{{ cryptpad_path }}/customize/CryptPad_logo_hero.svg"
owner: "{{ cryptpad_user }}"
group: "{{ cryptpad_group }}"
tags: customize

View file

@ -18,6 +18,7 @@
- name: Deploy config
include_tasks: config.yml
tags: customize
- name: Systemd
include_tasks: systemd.yml

View file

@ -117,7 +117,9 @@ module.exports = {
*
*/
adminKeys: [
"[{{ cryptpad_adminKeys }}]",
{% for item in cryptpad_adminKeys %}
"{{ item }}",
{% endfor %}
],
/* CryptPad's administration panel includes a "support" tab
@ -224,29 +226,6 @@ module.exports = {
*/
maxUploadSize: {{ cryptpad_maxUploadSize }},
/*
* CryptPad allows administrators to give custom limits to their friends.
* add an entry for each friend, identified by their user id,
* which can be found on the settings page. Include a 'limit' (number of bytes),
* a 'plan' (string), and a 'note' (string).
*
* hint: 1GB is 1024 * 1024 * 1024 bytes
*/
/*
customLimits: {
"[cryptpad-user1@my.awesome.website/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo=]": {
limit: 20 * 1024 * 1024 * 1024,
plan: 'insider',
note: 'storage space donated by my.awesome.website'
},
"[cryptpad-user2@my.awesome.website/GdflkgdlkjeworijfkldfsdflkjeEAsdlEnkbx1vVOo=]": {
limit: 10 * 1024 * 1024 * 1024,
plan: 'insider',
note: 'storage space donated by my.awesome.website'
}
},
*/
/* Users with premium accounts (those with a plan included in their customLimit)
* can benefit from an increased upload size limit. By default they are restricted to the same
* upload size as any other registered user.