From 52e6d70658d02e2718a261b3ed3cdb969a4d5715 Mon Sep 17 00:00:00 2001 From: Vadim Rutkovsky Date: Oct 01 2019 09:27:22 +0000 Subject: Initial commit --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4bd922a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +secrets/ diff --git a/configs/config.json b/configs/config.json new file mode 100644 index 0000000..d7fa848 --- /dev/null +++ b/configs/config.json @@ -0,0 +1,23 @@ +{ + "default_hs_url": "https://$(SITE_HOSTNAME)", + "default_is_url": "https://$(SITE_HOSTNAME)", + "brand": "Riot", + "integrations_ui_url": "", + "integrations_rest_url": "", + "bug_report_endpoint_url": "https://riot.im/bugreports/submit", + "features": { + "feature_groups": "labs", + "feature_pinning": "labs" + }, + "default_federate": "true", + "roomDirectory": { + "servers": [ + "matrix.org" + ] + }, + "welcomeUserId": "@riot-bot:matrix.org", + "piwik": { + "url": "https://piwik.riot.im/", + "siteId": 1 + } +} diff --git a/configs/homeserver.yaml b/configs/homeserver.yaml new file mode 100644 index 0000000..961ecde --- /dev/null +++ b/configs/homeserver.yaml @@ -0,0 +1,465 @@ +# vim:ft=yaml +# PEM encoded X509 certificate for TLS. +# You can replace the self-signed certificate that synapse +# autogenerates on launch with your own SSL certificate + key pair +# if you like. Any required intermediary certificates can be +# appended after the primary certificate in hierarchical order. +tls_certificate_path: "/synapse/keys/tls.crt" + +# PEM encoded private key for TLS +tls_private_key_path: "/synapse/keys/tls.key" + +# PEM dh parameters for ephemeral keys +tls_dh_params_path: "/synapse/keys/tls.dh" + +# Don't bind to the https port +no_tls: True + +# List of allowed TLS fingerprints for this server to publish along +# with the signing keys for this server. Other matrix servers that +# make HTTPS requests to this server will check that the TLS +# certificates returned by this server match one of the fingerprints. +# +# Synapse automatically adds the fingerprint of its own certificate +# to the list. So if federation traffic is handle directly by synapse +# then no modification to the list is required. +# +# If synapse is run behind a load balancer that handles the TLS then it +# will be necessary to add the fingerprints of the certificates used by +# the loadbalancers to this list if they are different to the one +# synapse is using. +# +# Homeservers are permitted to cache the list of TLS fingerprints +# returned in the key responses up to the "valid_until_ts" returned in +# key. It may be necessary to publish the fingerprints of a new +# certificate and wait until the "valid_until_ts" of the previous key +# responses have passed before deploying it. +tls_fingerprints: [] +# tls_fingerprints: [{"sha256": ""}] + +## Server ## + +# The domain name of the server, with optional explicit port. +# This is used by remote servers to connect to this server, +# e.g. matrix.org, localhost:8080, etc. +# This is also the last part of your UserID. +server_name: $(SITE_HOSTNAME) + +# When running as a daemon, the file to store the pid in +pid_file: /data/homeserver.pid + +# Whether to serve a web client from the HTTP/HTTPS root resource. +web_client: false + +# The root directory to server for the above web client. +# If left undefined, synapse will serve the matrix-angular-sdk web client. +# Make sure matrix-angular-sdk is installed with pip if web_client is True +# and web_client_location is undefined +#web_client_location: "/riot" + +# The public-facing base URL for the client API (not including _matrix/...) +public_baseurl: https://$(SITE_HOSTNAME)/ + +# Set the soft limit on the number of file descriptors synapse can use +# Zero is used to indicate synapse should set the soft limit to the +# hard limit. +soft_file_limit: 0 + +# The GC threshold parameters to pass to `gc.set_threshold`, if defined +# gc_thresholds: [700, 10, 10] + +# Set the limit on the returned events in the timeline in the get +# and sync operations. The default value is -1, means no upper limit. +# filter_timeline_limit: 5000 + +# List of ports that Synapse should listen on, their purpose and their +# configuration. +listeners: + # Unsecure HTTP listener, + # For when matrix traffic passes through loadbalancer that unwraps TLS. + - port: 8008 + tls: false + bind_addresses: ["0.0.0.0"] + type: http + + x_forwarded: true + + resources: + - names: [client] + compress: true + - names: [federation] + compress: false + + # Metrics port + - type: metrics + port: 9092 + bind_addresses: + - "0.0.0.0" + + # Turn on the twisted ssh manhole service on localhost on the given + # port. + # - port: 9000 + # bind_address: 127.0.0.1 + # type: manhole + +# Database configuration + +#database: +# # The database engine name +# name: "sqlite3" +# # Arguments to pass to the engine +# args: +# # Path to the database +# database: "/data/homeserver.db" + +database: + name: "psycopg2" + args: + user: synapse + password: synapse + database: synapse + host: postgresql + cp_min: 5 + cp_max: 10 + +# Number of events to cache in memory. +event_cache_size: "10K" + +# Logging verbosity level. Ignored if log_config is specified. +verbose: 0 + +# File to write logging to. Ignored if log_config is specified. +log_file: "/data/homeserver.log" + +# A yaml python logging config file +log_config: "/synapse/config/log.config.yaml" + +## Ratelimiting ## + +# Number of messages a client can send per second +rc_messages_per_second: 0.2 + +# Number of message a client can send before being throttled +rc_message_burst_count: 10.0 + +# The federation window size in milliseconds +federation_rc_window_size: 1000 + +# The number of federation requests from a single server in a window +# before the server will delay processing the request. +federation_rc_sleep_limit: 10 + +# The duration in milliseconds to delay processing events from +# remote servers by if they go over the sleep limit. +federation_rc_sleep_delay: 500 + +# The maximum number of concurrent federation requests allowed +# from a single server +federation_rc_reject_limit: 50 + +# The number of federation requests to concurrently process from a +# single server +federation_rc_concurrent: 3 + +# Directory where uploaded images and attachments are stored. +media_store_path: "/synapse/data/media_store" + +# Directory where in-progress uploads are stored. +uploads_path: "/synapse/data/uploads" + +# The largest allowed upload size in bytes +max_upload_size: "10M" + +# Maximum number of pixels that will be thumbnailed +max_image_pixels: "32M" + +# Whether to generate new thumbnails on the fly to precisely match +# the resolution requested by the client. If true then whenever +# a new resolution is requested by the client the server will +# generate a new thumbnail. If false the server will pick a thumbnail +# from a precalculated list. +dynamic_thumbnails: false + +# List of thumbnail to precalculate when an image is uploaded. +thumbnail_sizes: + - width: 32 + height: 32 + method: crop + - width: 96 + height: 96 + method: crop + - width: 320 + height: 240 + method: scale + - width: 640 + height: 480 + method: scale + - width: 800 + height: 600 + method: scale + +# Is the preview URL API enabled? If enabled, you *must* specify +# an explicit url_preview_ip_range_blacklist of IPs that the spider is +# denied from accessing. +url_preview_enabled: False + +# List of IP address CIDR ranges that the URL preview spider is denied +# from accessing. There are no defaults: you must explicitly +# specify a list for URL previewing to work. You should specify any +# internal services in your network that you do not want synapse to try +# to connect to, otherwise anyone in any Matrix room could cause your +# synapse to issue arbitrary GET requests to your internal services, +# causing serious security issues. +# +# url_preview_ip_range_blacklist: +# - '127.0.0.0/8' +# - '10.0.0.0/8' +# - '172.16.0.0/12' +# - '192.168.0.0/16' +# - '100.64.0.0/10' +# - '169.254.0.0/16' +# +# List of IP address CIDR ranges that the URL preview spider is allowed +# to access even if they are specified in url_preview_ip_range_blacklist. +# This is useful for specifying exceptions to wide-ranging blacklisted +# target IP ranges - e.g. for enabling URL previews for a specific private +# website only visible in your network. +# +# url_preview_ip_range_whitelist: +# - '192.168.1.1' + +# Optional list of URL matches that the URL preview spider is +# denied from accessing. You should use url_preview_ip_range_blacklist +# in preference to this, otherwise someone could define a public DNS +# entry that points to a private IP address and circumvent the blacklist. +# This is more useful if you know there is an entire shape of URL that +# you know that will never want synapse to try to spider. +# +# Each list entry is a dictionary of url component attributes as returned +# by urlparse.urlsplit as applied to the absolute form of the URL. See +# https://docs.python.org/2/library/urlparse.html#urlparse.urlsplit +# The values of the dictionary are treated as an filename match pattern +# applied to that component of URLs, unless they start with a ^ in which +# case they are treated as a regular expression match. If all the +# specified component matches for a given list item succeed, the URL is +# blacklisted. +# +# url_preview_url_blacklist: +# # blacklist any URL with a username in its URI +# - username: '*' +# +# # blacklist all *.google.com URLs +# - netloc: 'google.com' +# - netloc: '*.google.com' +# +# # blacklist all plain HTTP URLs +# - scheme: 'http' +# +# # blacklist http(s)://www.acme.com/foo +# - netloc: 'www.acme.com' +# path: '/foo' +# +# # blacklist any URL with a literal IPv4 address +# - netloc: '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$' + +# The largest allowed URL preview spidering size in bytes +max_spider_size: "10M" + +## Captcha ## +# See docs/CAPTCHA_SETUP for full details of configuring this. + +# This Home Server's ReCAPTCHA public key. +recaptcha_public_key: "YOUR_PUBLIC_KEY" + +# This Home Server's ReCAPTCHA private key. +recaptcha_private_key: "YOUR_PRIVATE_KEY" + +# Enables ReCaptcha checks when registering, preventing signup +# unless a captcha is answered. Requires a valid ReCaptcha +# public/private key. +enable_registration_captcha: False + +# A secret key used to bypass the captcha test entirely. +#captcha_bypass_secret: "YOUR_SECRET_HERE" + +# The API endpoint to use for verifying m.login.recaptcha responses. +recaptcha_siteverify_api: "https://www.google.com/recaptcha/api/siteverify" + +## Turn ## + +# The public URIs of the TURN server to give to clients +turn_uris: ["turn:a6n.de:3478?transport=udp", "turn:a6n.de:3478?transport=tcp"] + +# The shared secret used to compute passwords for the TURN server +#turn_shared_secret: "o5321GEMJEKLKLT0b6w4Fb2UqEqGJWhyEMcERrlHmPhADO8eBNPM00NpXod28TWq" +turn_shared_secret: "fDdJ8eMbkNUX7CjYjLlYoqCty8Va2sRxx9u8brxriUF0CJLCxBYh3mAB4G5n9Up9" + +# The Username and password if the TURN server needs them and +# does not use a token +#turn_username: "TURNSERVER_USERNAME" +#turn_password: "TURNSERVER_PASSWORD" + +# How long generated TURN credentials last +turn_user_lifetime: "1h" + +# Whether guests should be allowed to use the TURN server. +# This defaults to True, otherwise VoIP will be unreliable for guests. +# However, it does introduce a slight security risk as it allows users to +# connect to arbitrary endpoints without having first signed up for a +# valid account (e.g. by passing a CAPTCHA). +turn_allow_guests: True + +## Registration ## + +# Enable registration for new users. +enable_registration: false + +# If set, allows registration by anyone who also has the shared +# secret, even if registration is otherwise disabled. +registration_shared_secret: "0:ThrG&rFv-psM^rtt_w4gzgt00Umo4lrT=lU67WYr@rpL4T0v" + +# Set the number of bcrypt rounds used to generate password hash. +# Larger numbers increase the work factor needed to generate the hash. +# The default number of rounds is 12. +bcrypt_rounds: 12 + +# Allows users to register as guests without a password/email/etc, and +# participate in rooms hosted on this server which have been made +# accessible to anonymous users. +allow_guest_access: False + +# The list of identity servers trusted to verify third party +# identifiers by this server. +trusted_third_party_id_servers: + - matrix.org + - vector.im + - riot.im + - $(SITE_HOSTNAME) + +## Metrics ### + +# Enable collection and rendering of performance metrics +enable_metrics: True +report_stats: True + +## API Configuration ## + +# A list of event types that will be included in the room_invite_state +room_invite_state_types: + - "m.room.join_rules" + - "m.room.canonical_alias" + - "m.room.avatar" + - "m.room.name" + +# A list of application service config file to use +app_service_config_files: +# - "/synapse/config/slack-registration.yaml" +# - "/irc-config/registration_file.yaml" +# - "/freenode-config/registration_file.yaml" + +macaroon_secret_key: "pYkphh_^ran5xWlGaUyPD^Y-1pWIw~:UKqymHSMEpFp7lh#j@V" + +# Used to enable access token expiration. +expire_access_token: False + +## Signing Keys ## + +# Path to the signing key to sign messages with +signing_key_path: "/synapse/keys/signing.key" + +# The keys that the server used to sign messages with but won't use +# to sign new messages. E.g. it has lost its private key +old_signing_keys: {} +# "ed25519:auto": +# # Base64 encoded public key +# key: "The public part of your old signing key." +# # Millisecond POSIX timestamp when the key expired. +# expired_ts: 123456789123 + +# How long key response published by this server is valid for. +# Used to set the valid_until_ts in /key/v2 APIs. +# Determines how quickly servers will query to check which keys +# are still valid. +key_refresh_interval: "1d" # 1 Day. + +# The trusted servers to download signing keys from. +perspectives: + servers: + "matrix.org": + verify_keys: + "ed25519:auto": + key: "Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw" + +# Enable SAML2 for registration and login. Uses pysaml2 +# config_path: Path to the sp_conf.py configuration file +# idp_redirect_url: Identity provider URL which will redirect +# the user back to /login/saml2 with proper info. +# See pysaml2 docs for format of config. +# saml2_config: +# sp_config: +# service: +# sp: +# allow_unsolicited: True +# organization: +# name: Fedora +# display_name: +# - ["Fedora", "en"] +# url: "https://id.fedoraproject.org" +# enabled: true +# config_path: "/synapse/config/sp_conf.py" +# idp_redirect_url: "https://id.fedoraproject.org/idp" + +# saml2_config: +# config_path: "/synapse/config/sp_conf.py" + +# Enable CAS for registration and login. +#cas_config: +# enabled: true +# server_url: "https://cas-server.com" +# service_url: "https://homesever.domain.com:8448" +# #required_attributes: +# # name: value + +cas_config: + enabled: true + server_url: "https://$(SITE_HOSTNAME)/_cas" + service_url: "" + #required_attributes: + # name: value + +# The JWT needs to contain a globally unique "sub" (subject) claim. +# +# jwt_config: +# enabled: true +# secret: "a secret" +# algorithm: "HS256" + +# Enable password for login. +password_config: + enabled: false + # Uncomment and change to a secret random string for extra security. + # DO NOT CHANGE THIS AFTER INITIAL SETUP! + #pepper: "" + +# Enable sending emails for notification events +# Defining a custom URL for Riot is only needed if email notifications +# should contain links to a self-hosted installation of Riot; when set +# the "app_name" setting is ignored. +# +# If your SMTP server requires authentication, the optional smtp_user & +# smtp_pass variables should be used +# +email: + enable_notifs: true + smtp_host: "vrutkovs.eu" + smtp_port: 25 + smtp_user: "bot" + smtp_pass: "hahanope" + require_transport_security: False + notif_from: "Your Friendly %(app)s Home Server " + app_name: Matrix + template_dir: /synapse/templates + notif_template_html: notif_mail.html + notif_template_text: notif_mail.txt + notif_for_new_users: True + riot_base_url: "https://$(SITE_HOSTNAME)/" diff --git a/configs/log.config.yaml b/configs/log.config.yaml new file mode 100644 index 0000000..c05f46e --- /dev/null +++ b/configs/log.config.yaml @@ -0,0 +1,36 @@ +version: 1 + +formatters: + precise: + format: "%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s" + +filters: + context: + (): synapse.util.logcontext.LoggingContextFilter + request: "" + +handlers: + file: + class: logging.handlers.RotatingFileHandler + formatter: precise + filename: /tmp/homeserver.log + maxBytes: 104857600 + backupCount: 10 + filters: [context] + console: + class: logging.StreamHandler + formatter: precise + filters: [context] + +loggers: + synapse: + level: DEBUG + + synapse.storage.SQL: + # beware: increasing this to DEBUG will make synapse log sensitive + # information such as access tokens. + level: INFO + +root: + level: DEBUG + handlers: [file, console] diff --git a/configs/well-known-config.yaml b/configs/well-known-config.yaml new file mode 100644 index 0000000..239e0b2 --- /dev/null +++ b/configs/well-known-config.yaml @@ -0,0 +1 @@ +{ "m.server": "$(SITE_HOSTNAME):443" } diff --git a/kustomization.yaml b/kustomization.yaml new file mode 100644 index 0000000..e82fe1d --- /dev/null +++ b/kustomization.yaml @@ -0,0 +1,47 @@ +# Use remote base +bases: + - https://github.com/vrutkovs/matrix-openshift//manifests?ref=master +# Apply patches to configure communishift instance +patchesStrategicMerge: + - routes.yaml +# Create configs and secrets +generatorOptions: + disableNameSuffixHash: true +configMapGenerator: + - name: matrix-configs + files: + - configs/homeserver.yaml + - configs/log.config.yaml + - name: notif-templates + files: + - templates/mail.css + - templates/mail-expiry.css + - templates/mail-Vector.css + - templates/notice_expiry.html + - templates/notice_expiry.txt + - templates/notif.html + - templates/notif_mail.html + - templates/notif_mail.txt + - templates/notif.txt + - templates/password_reset_failure.html + - templates/password_reset.html + - templates/password_reset_success.html + - templates/password_reset.txt + - templates/room.html + - templates/room.txt + - name: riot-configs + files: + - configs/config.json + - name: mxisd-config + files: + - configs/mxisd.yaml + - name: well-known-config + files: + - server=configs/well-known-config.yaml +secretGenerator: + - name: tls-secrets + files: + - secrets/signing.key + - secrets/tls.crt + - secrets/tls.dh + - secrets/tls.key diff --git a/routes.yaml b/routes.yaml new file mode 100644 index 0000000..65d998b --- /dev/null +++ b/routes.yaml @@ -0,0 +1,32 @@ +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: synapse + namespace: matrix +spec: + host: matrix.apps.os.fedorainfracloud.org +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: mxisd + namespace: matrix +spec: + host: matrix.apps.os.fedorainfracloud.org +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: riot + namespace: matrix +spec: + host: matrix.apps.os.fedorainfracloud.org +--- +apiVersion: route.openshift.io/v1 +kind: Route +metadata: + name: well-known-handler + namespace: matrix +spec: + host: matrix.apps.os.fedorainfracloud.org +--- diff --git a/templates/mail-Vector.css b/templates/mail-Vector.css new file mode 100644 index 0000000..f77e138 --- /dev/null +++ b/templates/mail-Vector.css @@ -0,0 +1,955 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + synapse/mail-Vector.css at master · matrix-org/synapse · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + +
+ +
+ + +
+ +
+ + + +
+
+
+ + + + + + + + + + + + + + +
+
+ + + +

+ + /synapse + + +

+ +
+ + + + + + +
+
+
+ + + + + + + Permalink + + + + + +
+ + +
+ + Branch: + master + + + + + + + +
+ +
+ + Find file + + + Copy path + +
+
+ + +
+ + Find file + + + Copy path + +
+
+ + + + +
+
+ + @richvdh + richvdh + + Ship the email templates as package_data + + + + 1519572 + Oct 17, 2018 + +
+ +
+
+ + 1 contributor + + +
+ +

+ Users who have contributed to this file +

+
+ +
+
+
+
+ + + + + +
+ +
+ +
+ 8 lines (6 sloc) + + 124 Bytes +
+ +
+ +
+ Raw + Blame + History +
+ + +
+ + + +
+
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
.header {
border-bottom: 4px solid #e4f7ed ! important;
}
+
.notif_link a, .footer a {
color: #76CFA6 ! important;
}
+ + + +
+ +
+ + + +
+ + +
+ + +
+
+ + + +
+ +
+ +
+
+ + +
+ + + + + + +
+ + + You can’t perform that action at this time. +
+ + + + + + + + + + + + + + +
+ + + + diff --git a/templates/mail-expiry.css b/templates/mail-expiry.css new file mode 100644 index 0000000..3dea486 --- /dev/null +++ b/templates/mail-expiry.css @@ -0,0 +1,4 @@ +.noticetext { + margin-top: 10px; + margin-bottom: 10px; +} diff --git a/templates/mail.css b/templates/mail.css new file mode 100644 index 0000000..5ab3e1b --- /dev/null +++ b/templates/mail.css @@ -0,0 +1,156 @@ +body { + margin: 0px; +} + +pre, code { + word-break: break-word; + white-space: pre-wrap; +} + +#page { + font-family: 'Open Sans', Helvetica, Arial, Sans-Serif; + font-color: #454545; + font-size: 12pt; + width: 100%; + padding: 20px; +} + +#inner { + width: 640px; +} + +.header { + width: 100%; + height: 87px; + color: #454545; + border-bottom: 4px solid #e5e5e5; +} + +.logo { + text-align: right; + margin-left: 20px; +} + +.salutation { + padding-top: 10px; + font-weight: bold; +} + +.summarytext { +} + +.room { + width: 100%; + color: #454545; + border-bottom: 1px solid #e5e5e5; +} + +.room_header td { + padding-top: 38px; + padding-bottom: 10px; + border-bottom: 1px solid #e5e5e5; +} + +.room_name { + vertical-align: middle; + font-size: 18px; + font-weight: bold; +} + +.room_header h2 { + margin-top: 0px; + margin-left: 75px; + font-size: 20px; +} + +.room_avatar { + width: 56px; + line-height: 0px; + text-align: center; + vertical-align: middle; +} + +.room_avatar img { + width: 48px; + height: 48px; + object-fit: cover; + border-radius: 24px; +} + +.notif { + border-bottom: 1px solid #e5e5e5; + margin-top: 16px; + padding-bottom: 16px; +} + +.historical_message .sender_avatar { + opacity: 0.3; +} + +/* spell out opacity and historical_message class names for Outlook aka Word */ +.historical_message .sender_name { + color: #e3e3e3; +} + +.historical_message .message_time { + color: #e3e3e3; +} + +.historical_message .message_body { + color: #c7c7c7; +} + +.historical_message td, +.message td { + padding-top: 10px; +} + +.sender_avatar { + width: 56px; + text-align: center; + vertical-align: top; +} + +.sender_avatar img { + margin-top: -2px; + width: 32px; + height: 32px; + border-radius: 16px; +} + +.sender_name { + display: inline; + font-size: 13px; + color: #a2a2a2; +} + +.message_time { + text-align: right; + width: 100px; + font-size: 11px; + color: #a2a2a2; +} + +.message_body { +} + +.notif_link td { + padding-top: 10px; + padding-bottom: 10px; + font-weight: bold; +} + +.notif_link a, .footer a { + color: #454545; + text-decoration: none; +} + +.debug { + font-size: 10px; + color: #888; +} + +.footer { + margin-top: 20px; + text-align: center; +} \ No newline at end of file diff --git a/templates/notice_expiry.html b/templates/notice_expiry.html new file mode 100644 index 0000000..f0d7c66 --- /dev/null +++ b/templates/notice_expiry.html @@ -0,0 +1,43 @@ + + + + + + + + + + + + +
+ + + + + + + + +
+
Hi {{ display_name }},
+
+
Your account will expire on {{ expiration_ts|format_ts("%d-%m-%Y") }}. This means that you will lose access to your account after this date.
+
To extend the validity of your account, please click on the link bellow (or copy and paste it into a new browser tab):
+ +
+
+ + diff --git a/templates/notice_expiry.txt b/templates/notice_expiry.txt new file mode 100644 index 0000000..41f1c42 --- /dev/null +++ b/templates/notice_expiry.txt @@ -0,0 +1,7 @@ +Hi {{ display_name }}, + +Your account will expire on {{ expiration_ts|format_ts("%d-%m-%Y") }}. This means that you will lose access to your account after this date. + +To extend the validity of your account, please click on the link bellow (or copy and paste it to a new browser tab): + +{{ url }} diff --git a/templates/notif.html b/templates/notif.html new file mode 100644 index 0000000..1a6c70b --- /dev/null +++ b/templates/notif.html @@ -0,0 +1,45 @@ +{% for message in notif.messages %} + + + {% if loop.index0 == 0 or notif.messages[loop.index0 - 1].sender_name != notif.messages[loop.index0].sender_name %} + {% if message.sender_avatar_url %} + + {% else %} + {% if message.sender_hash % 3 == 0 %} + + {% elif message.sender_hash % 3 == 1 %} + + {% else %} + + {% endif %} + {% endif %} + {% endif %} + + + {% if loop.index0 == 0 or notif.messages[loop.index0 - 1].sender_name != notif.messages[loop.index0].sender_name %} +
{% if message.msgtype == "m.emote" %}*{% endif %} {{ message.sender_name }}
+ {% endif %} +
+ {% if message.msgtype == "m.text" %} + {{ message.body_text_html }} + {% elif message.msgtype == "m.emote" %} + {{ message.body_text_html }} + {% elif message.msgtype == "m.notice" %} + {{ message.body_text_html }} + {% elif message.msgtype == "m.image" %} + + {% elif message.msgtype == "m.file" %} + {{ message.body_text_plain }} + {% endif %} +
+ + {{ message.ts|format_ts("%H:%M") }} + +{% endfor %} + + + + View {{ room.title }} + + + diff --git a/templates/notif.txt b/templates/notif.txt new file mode 100644 index 0000000..a37bee9 --- /dev/null +++ b/templates/notif.txt @@ -0,0 +1,16 @@ +{% for message in notif.messages %} +{% if message.msgtype == "m.emote" %}* {% endif %}{{ message.sender_name }} ({{ message.ts|format_ts("%H:%M") }}) +{% if message.msgtype == "m.text" %} +{{ message.body_text_plain }} +{% elif message.msgtype == "m.emote" %} +{{ message.body_text_plain }} +{% elif message.msgtype == "m.notice" %} +{{ message.body_text_plain }} +{% elif message.msgtype == "m.image" %} +{{ message.body_text_plain }} +{% elif message.msgtype == "m.file" %} +{{ message.body_text_plain }} +{% endif %} +{% endfor %} + +View {{ room.title }} at {{ notif.link }} diff --git a/templates/notif_mail.html b/templates/notif_mail.html new file mode 100644 index 0000000..019506e --- /dev/null +++ b/templates/notif_mail.html @@ -0,0 +1,55 @@ + + + + + + + + + + + + +
+ + + + + +
+
Hi {{ user_display_name }},
+
{{ summary_text }}
+
+ {% for room in rooms %} + {% include 'room.html' with context %} + {% endfor %} + +
+ + diff --git a/templates/notif_mail.txt b/templates/notif_mail.txt new file mode 100644 index 0000000..2484304 --- /dev/null +++ b/templates/notif_mail.txt @@ -0,0 +1,10 @@ +Hi {{ user_display_name }}, + +{{ summary_text }} + +{% for room in rooms %} +{% include 'room.txt' with context %} +{% endfor %} + +You can disable these notifications at {{ unsubscribe_link }} + diff --git a/templates/password_reset.html b/templates/password_reset.html new file mode 100644 index 0000000..4fa7b36 --- /dev/null +++ b/templates/password_reset.html @@ -0,0 +1,9 @@ + + +

A password reset request has been received for your Matrix account. If this was you, please click the link below to confirm resetting your password:

+ + {{ link }} + +

If this was not you, please disregard this email and contact your server administrator. Thank you.

+ + diff --git a/templates/password_reset.txt b/templates/password_reset.txt new file mode 100644 index 0000000..f0deff5 --- /dev/null +++ b/templates/password_reset.txt @@ -0,0 +1,7 @@ +A password reset request has been received for your Matrix account. If this +was you, please click the link below to confirm resetting your password: + +{{ link }} + +If this was not you, please disregard this email and contact your server +administrator. Thank you. diff --git a/templates/password_reset_failure.html b/templates/password_reset_failure.html new file mode 100644 index 0000000..0b132cf --- /dev/null +++ b/templates/password_reset_failure.html @@ -0,0 +1,6 @@ + + + +

{{ failure_reason }}. Your password has not been reset.

+ + diff --git a/templates/password_reset_success.html b/templates/password_reset_success.html new file mode 100644 index 0000000..7324d66 --- /dev/null +++ b/templates/password_reset_success.html @@ -0,0 +1,6 @@ + + + +

Your email has now been validated, please return to your client to reset your password. You may now close this window.

+ + diff --git a/templates/room.html b/templates/room.html new file mode 100644 index 0000000..b8525fe --- /dev/null +++ b/templates/room.html @@ -0,0 +1,33 @@ + + + + + + {% if room.invite %} + + + + + + {% else %} + {% for notif in room.notifs %} + {% include 'notif.html' with context %} + {% endfor %} + {% endif %} +
+ {% if room.avatar_url %} + + {% else %} + {% if room.hash % 3 == 0 %} + + {% elif room.hash % 3 == 1 %} + + {% else %} + + {% endif %} + {% endif %} + + {{ room.title }} +
+ Join the conversation. +
diff --git a/templates/room.txt b/templates/room.txt new file mode 100644 index 0000000..84648c7 --- /dev/null +++ b/templates/room.txt @@ -0,0 +1,9 @@ +{{ room.title }} + +{% if room.invite %} + You've been invited, join at {{ room.link }} +{% else %} + {% for notif in room.notifs %} + {% include 'notif.txt' with context %} + {% endfor %} +{% endif %}