You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

287 lines
10 KiB

Web Push Notifications (#3243) * feat: Register push subscription * feat: Notify when mentioned * feat: Boost, favourite, reply, follow, follow request * feat: Notification interaction * feat: Handle change of public key * feat: Unsubscribe if things go wrong * feat: Do not send normal notifications if push is enabled * feat: Focus client if open * refactor: Move push logic to WebPushSubscription * feat: Better title and body * feat: Localize messages * chore: Fix lint errors * feat: Settings * refactor: Lazy load * fix: Check if push settings exist * feat: Device-based preferences * refactor: Simplify logic * refactor: Pull request feedback * refactor: Pull request feedback * refactor: Create /api/web/push_subscriptions endpoint * feat: Spec PushSubscriptionController * refactor: WebPushSubscription => Web::PushSubscription * feat: Spec Web::PushSubscription * feat: Display first media attachment * feat: Support direction * fix: Stuff broken while rebasing * refactor: Integration with session activations * refactor: Cleanup * refactor: Simplify implementation * feat: Set VAPID keys via environment * chore: Comments * fix: Crash when no alerts * fix: Set VAPID keys in testing environment * fix: Follow link * feat: Notification actions * fix: Delete previous subscription * chore: Temporary logs * refactor: Move migration to a later date * fix: Fetch the correct session activation and misc bugs * refactor: Move migration to a later date * fix: Remove follow request (no notifications) * feat: Send administrator contact to push service * feat: Set time-to-live * fix: Do not show sensitive images * fix: Reducer crash in error handling * feat: Add badge * chore: Fix lint error * fix: Checkbox label overlap * fix: Check for payload support * fix: Rename action "type" (crash in latest Chrome) * feat: Action to expand notification * fix: Lint errors * fix: Unescape notification body * fix: Do not allow boosting if the status is hidden * feat: Add VAPID keys to the production sample environment * fix: Strip HTML tags from status * refactor: Better error messages * refactor: Handle browser not implementing the VAPID protocol (Samsung Internet) * fix: Error when target_status is nil * fix: Handle lack of image * fix: Delete reference to invalid subscriptions * feat: Better error handling * fix: Unescape HTML characters after tags are striped * refactor: Simpify code * fix: Modify to work with #4091 * Sort strings alphabetically * i18n: Updated Polish translation it annoys me that it's not fully localized :P * refactor: Use current_session in PushSubscriptionController * fix: Rebase mistake * fix: Set cacheName to mastodon * refactor: Pull request feedback * refactor: Remove logging statements * chore(yarn): Fix conflicts with master * chore(yarn): Copy latest from master * chore(yarn): Readd offline-plugin * refactor: Use save! and update! * refactor: Send notifications async * fix: Allow retry when push fails * fix: Save track for failed pushes * fix: Minify sw.js * fix: Remove account_id from fabricator
7 years ago
Web Push Notifications (#3243) * feat: Register push subscription * feat: Notify when mentioned * feat: Boost, favourite, reply, follow, follow request * feat: Notification interaction * feat: Handle change of public key * feat: Unsubscribe if things go wrong * feat: Do not send normal notifications if push is enabled * feat: Focus client if open * refactor: Move push logic to WebPushSubscription * feat: Better title and body * feat: Localize messages * chore: Fix lint errors * feat: Settings * refactor: Lazy load * fix: Check if push settings exist * feat: Device-based preferences * refactor: Simplify logic * refactor: Pull request feedback * refactor: Pull request feedback * refactor: Create /api/web/push_subscriptions endpoint * feat: Spec PushSubscriptionController * refactor: WebPushSubscription => Web::PushSubscription * feat: Spec Web::PushSubscription * feat: Display first media attachment * feat: Support direction * fix: Stuff broken while rebasing * refactor: Integration with session activations * refactor: Cleanup * refactor: Simplify implementation * feat: Set VAPID keys via environment * chore: Comments * fix: Crash when no alerts * fix: Set VAPID keys in testing environment * fix: Follow link * feat: Notification actions * fix: Delete previous subscription * chore: Temporary logs * refactor: Move migration to a later date * fix: Fetch the correct session activation and misc bugs * refactor: Move migration to a later date * fix: Remove follow request (no notifications) * feat: Send administrator contact to push service * feat: Set time-to-live * fix: Do not show sensitive images * fix: Reducer crash in error handling * feat: Add badge * chore: Fix lint error * fix: Checkbox label overlap * fix: Check for payload support * fix: Rename action "type" (crash in latest Chrome) * feat: Action to expand notification * fix: Lint errors * fix: Unescape notification body * fix: Do not allow boosting if the status is hidden * feat: Add VAPID keys to the production sample environment * fix: Strip HTML tags from status * refactor: Better error messages * refactor: Handle browser not implementing the VAPID protocol (Samsung Internet) * fix: Error when target_status is nil * fix: Handle lack of image * fix: Delete reference to invalid subscriptions * feat: Better error handling * fix: Unescape HTML characters after tags are striped * refactor: Simpify code * fix: Modify to work with #4091 * Sort strings alphabetically * i18n: Updated Polish translation it annoys me that it's not fully localized :P * refactor: Use current_session in PushSubscriptionController * fix: Rebase mistake * fix: Set cacheName to mastodon * refactor: Pull request feedback * refactor: Remove logging statements * chore(yarn): Fix conflicts with master * chore(yarn): Copy latest from master * chore(yarn): Readd offline-plugin * refactor: Use save! and update! * refactor: Send notifications async * fix: Allow retry when push fails * fix: Save track for failed pushes * fix: Minify sw.js * fix: Remove account_id from fabricator
7 years ago
  1. # Service dependencies
  2. # You may set REDIS_URL instead for more advanced options
  3. # You may also set REDIS_NAMESPACE to share Redis between multiple Mastodon servers
  4. REDIS_HOST=redis
  5. REDIS_PORT=6379
  6. # You may set DATABASE_URL instead for more advanced options
  7. DB_HOST=db
  8. DB_USER=postgres
  9. DB_NAME=postgres
  10. DB_PASS=
  11. DB_PORT=5432
  12. # Optional ElasticSearch configuration
  13. # You may also set ES_PREFIX to share the same cluster between multiple Mastodon servers (falls back to REDIS_NAMESPACE if not set)
  14. # ES_ENABLED=true
  15. # ES_HOST=es
  16. # ES_PORT=9200
  17. # Federation
  18. # Note: Changing LOCAL_DOMAIN at a later time will cause unwanted side effects, including breaking all existing federation.
  19. # LOCAL_DOMAIN should *NOT* contain the protocol part of the domain e.g https://example.com.
  20. LOCAL_DOMAIN=example.com
  21. # Changing LOCAL_HTTPS in production is no longer supported. (Mastodon will always serve https:// links)
  22. # Use this only if you need to run mastodon on a different domain than the one used for federation.
  23. # You can read more about this option on https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Serving_a_different_domain.md
  24. # DO *NOT* USE THIS UNLESS YOU KNOW *EXACTLY* WHAT YOU ARE DOING.
  25. # WEB_DOMAIN=mastodon.example.com
  26. # Use this if you want to have several aliases handler@example1.com
  27. # handler@example2.com etc. for the same user. LOCAL_DOMAIN should not
  28. # be added. Comma separated values
  29. # ALTERNATE_DOMAINS=example1.com,example2.com
  30. # Application secrets
  31. # Generate each with the `RAILS_ENV=production bundle exec rake secret` task (`docker-compose run --rm web rake secret` if you use docker compose)
  32. SECRET_KEY_BASE=
  33. OTP_SECRET=
  34. # VAPID keys (used for push notifications
  35. # You can generate the keys using the following command (first is the private key, second is the public one)
  36. # You should only generate this once per instance. If you later decide to change it, all push subscription will
  37. # be invalidated, requiring the users to access the website again to resubscribe.
  38. #
  39. # Generate with `RAILS_ENV=production bundle exec rake mastodon:webpush:generate_vapid_key` task (`docker-compose run --rm web rake mastodon:webpush:generate_vapid_key` if you use docker compose)
  40. #
  41. # For more information visit https://rossta.net/blog/using-the-web-push-api-with-vapid.html
  42. VAPID_PRIVATE_KEY=
  43. VAPID_PUBLIC_KEY=
  44. # Registrations
  45. # Single user mode will disable registrations and redirect frontpage to the first profile
  46. # SINGLE_USER_MODE=true
  47. # Prevent registrations with following e-mail domains
  48. # EMAIL_DOMAIN_BLACKLIST=example1.com|example2.de|etc
  49. # Only allow registrations with the following e-mail domains
  50. # EMAIL_DOMAIN_WHITELIST=example1.com|example2.de|etc
  51. # Optionally change default language
  52. # DEFAULT_LOCALE=de
  53. # E-mail configuration
  54. # Note: Mailgun and SparkPost (https://sparkpo.st/smtp) each have good free tiers
  55. # If you want to use an SMTP server without authentication (e.g local Postfix relay)
  56. # then set SMTP_AUTH_METHOD and SMTP_OPENSSL_VERIFY_MODE to 'none' and
  57. # *comment* SMTP_LOGIN and SMTP_PASSWORD (leaving them blank is not enough).
  58. SMTP_SERVER=smtp.mailgun.org
  59. SMTP_PORT=587
  60. SMTP_LOGIN=
  61. SMTP_PASSWORD=
  62. SMTP_FROM_ADDRESS=notifications@example.com
  63. #SMTP_REPLY_TO=
  64. #SMTP_DOMAIN= # defaults to LOCAL_DOMAIN
  65. #SMTP_DELIVERY_METHOD=smtp # delivery method can also be sendmail
  66. #SMTP_AUTH_METHOD=plain
  67. #SMTP_CA_FILE=/etc/ssl/certs/ca-certificates.crt
  68. #SMTP_OPENSSL_VERIFY_MODE=peer
  69. #SMTP_ENABLE_STARTTLS_AUTO=true
  70. #SMTP_TLS=true
  71. # Optional user upload path and URL (images, avatars). Default is :rails_root/public/system. If you set this variable, you are responsible for making your HTTP server (eg. nginx) serve these files.
  72. # PAPERCLIP_ROOT_PATH=/var/lib/mastodon/public-system
  73. # PAPERCLIP_ROOT_URL=/system
  74. # Optional asset host for multi-server setups
  75. # The asset host must allow cross origin request from WEB_DOMAIN or LOCAL_DOMAIN
  76. # if WEB_DOMAIN is not set. For example, the server may have the
  77. # following header field:
  78. # Access-Control-Allow-Origin: https://example.com/
  79. # CDN_HOST=https://assets.example.com
  80. # S3 (optional)
  81. # The attachment host must allow cross origin request from WEB_DOMAIN or
  82. # LOCAL_DOMAIN if WEB_DOMAIN is not set. For example, the server may have the
  83. # following header field:
  84. # Access-Control-Allow-Origin: https://192.168.1.123:9000/
  85. # S3_ENABLED=true
  86. # S3_BUCKET=
  87. # AWS_ACCESS_KEY_ID=
  88. # AWS_SECRET_ACCESS_KEY=
  89. # S3_REGION=
  90. # S3_PROTOCOL=http
  91. # S3_HOSTNAME=192.168.1.123:9000
  92. # S3 (Minio Config (optional) Please check Minio instance for details)
  93. # The attachment host must allow cross origin request - see the description
  94. # above.
  95. # S3_ENABLED=true
  96. # S3_BUCKET=
  97. # AWS_ACCESS_KEY_ID=
  98. # AWS_SECRET_ACCESS_KEY=
  99. # S3_REGION=
  100. # S3_PROTOCOL=https
  101. # S3_HOSTNAME=
  102. # S3_ENDPOINT=
  103. # S3_SIGNATURE_VERSION=
  104. # Google Cloud Storage (optional)
  105. # Use S3 compatible API. Since GCS does not support Multipart Upload,
  106. # increase the value of S3_MULTIPART_THRESHOLD to disable Multipart Upload.
  107. # The attachment host must allow cross origin request - see the description
  108. # above.
  109. # S3_ENABLED=true
  110. # AWS_ACCESS_KEY_ID=
  111. # AWS_SECRET_ACCESS_KEY=
  112. # S3_REGION=
  113. # S3_PROTOCOL=https
  114. # S3_HOSTNAME=storage.googleapis.com
  115. # S3_ENDPOINT=https://storage.googleapis.com
  116. # S3_MULTIPART_THRESHOLD=52428801 # 50.megabytes
  117. # Swift (optional)
  118. # The attachment host must allow cross origin request - see the description
  119. # above.
  120. # SWIFT_ENABLED=true
  121. # SWIFT_USERNAME=
  122. # For Keystone V3, the value for SWIFT_TENANT should be the project name
  123. # SWIFT_TENANT=
  124. # SWIFT_PASSWORD=
  125. # Some OpenStack V3 providers require PROJECT_ID (optional)
  126. # SWIFT_PROJECT_ID=
  127. # Keystone V2 and V3 URLs are supported. Use a V3 URL if possible to avoid
  128. # issues with token rate-limiting during high load.
  129. # SWIFT_AUTH_URL=
  130. # SWIFT_CONTAINER=
  131. # SWIFT_OBJECT_URL=
  132. # SWIFT_REGION=
  133. # Defaults to 'default'
  134. # SWIFT_DOMAIN_NAME=
  135. # Defaults to 60 seconds. Set to 0 to disable
  136. # SWIFT_CACHE_TTL=
  137. # Optional alias for S3 (e.g. to serve files on a custom domain, possibly using Cloudfront or Cloudflare)
  138. # S3_ALIAS_HOST=
  139. # Streaming API integration
  140. # STREAMING_API_BASE_URL=
  141. # Advanced settings
  142. # If you need to use pgBouncer, you need to disable prepared statements:
  143. # PREPARED_STATEMENTS=false
  144. # Cluster number setting for streaming API server.
  145. # If you comment out following line, cluster number will be `numOfCpuCores - 1`.
  146. STREAMING_CLUSTER_NUM=1
  147. # Docker mastodon user
  148. # If you use Docker, you may want to assign UID/GID manually.
  149. # UID=1000
  150. # GID=1000
  151. # Maximum allowed character count
  152. # MAX_TOOT_CHARS=500
  153. # Maximum number of pinned posts
  154. # MAX_PINNED_TOOTS=5
  155. # Maximum allowed bio characters
  156. # MAX_BIO_CHARS=500
  157. # Maximim number of profile fields allowed
  158. # MAX_PROFILE_FIELDS=4
  159. # Maximum allowed display name characters
  160. # MAX_DISPLAY_NAME_CHARS=30
  161. # Maximum image and video/audio upload sizes
  162. # Units are in bytes
  163. # 1048576 bytes equals 1 megabyte
  164. # MAX_IMAGE_SIZE=8388608
  165. # MAX_VIDEO_SIZE=41943040
  166. # Maximum search results to display
  167. # Only relevant when elasticsearch is installed
  168. # MAX_SEARCH_RESULTS=20
  169. # LDAP authentication (optional)
  170. # LDAP_ENABLED=true
  171. # LDAP_HOST=localhost
  172. # LDAP_PORT=389
  173. # LDAP_METHOD=simple_tls
  174. # LDAP_BASE=
  175. # LDAP_BIND_DN=
  176. # LDAP_PASSWORD=
  177. # LDAP_UID=cn
  178. # LDAP_MAIL=mail
  179. # LDAP_SEARCH_FILTER=(|(%{uid}=%{email})(%{mail}=%{email}))
  180. # LDAP_UID_CONVERSION_ENABLED=true
  181. # LDAP_UID_CONVERSION_SEARCH=., -
  182. # LDAP_UID_CONVERSION_REPLACE=_
  183. # PAM authentication (optional)
  184. # PAM authentication uses for the email generation the "email" pam variable
  185. # and optional as fallback PAM_DEFAULT_SUFFIX
  186. # The pam environment variable "email" is provided by:
  187. # https://github.com/devkral/pam_email_extractor
  188. # PAM_ENABLED=true
  189. # Fallback email domain for email address generation (LOCAL_DOMAIN by default)
  190. # PAM_EMAIL_DOMAIN=example.com
  191. # Name of the pam service (pam "auth" section is evaluated)
  192. # PAM_DEFAULT_SERVICE=rpam
  193. # Name of the pam service used for checking if an user can register (pam "account" section is evaluated) (nil (disabled) by default)
  194. # PAM_CONTROLLED_SERVICE=rpam
  195. # Global OAuth settings (optional) :
  196. # If you have only one strategy, you may want to enable this
  197. # OAUTH_REDIRECT_AT_SIGN_IN=true
  198. # Optional CAS authentication (cf. omniauth-cas) :
  199. # CAS_ENABLED=true
  200. # CAS_URL=https://sso.myserver.com/
  201. # CAS_HOST=sso.myserver.com/
  202. # CAS_PORT=443
  203. # CAS_SSL=true
  204. # CAS_VALIDATE_URL=
  205. # CAS_CALLBACK_URL=
  206. # CAS_LOGOUT_URL=
  207. # CAS_LOGIN_URL=
  208. # CAS_UID_FIELD='user'
  209. # CAS_CA_PATH=
  210. # CAS_DISABLE_SSL_VERIFICATION=false
  211. # CAS_UID_KEY='user'
  212. # CAS_NAME_KEY='name'
  213. # CAS_EMAIL_KEY='email'
  214. # CAS_NICKNAME_KEY='nickname'
  215. # CAS_FIRST_NAME_KEY='firstname'
  216. # CAS_LAST_NAME_KEY='lastname'
  217. # CAS_LOCATION_KEY='location'
  218. # CAS_IMAGE_KEY='image'
  219. # CAS_PHONE_KEY='phone'
  220. # Optional SAML authentication (cf. omniauth-saml)
  221. # SAML_ENABLED=true
  222. # SAML_ACS_URL=http://localhost:3000/auth/auth/saml/callback
  223. # SAML_ISSUER=https://example.com
  224. # SAML_IDP_SSO_TARGET_URL=https://idp.testshib.org/idp/profile/SAML2/Redirect/SSO
  225. # SAML_IDP_CERT=
  226. # SAML_IDP_CERT_FINGERPRINT=
  227. # SAML_NAME_IDENTIFIER_FORMAT=
  228. # SAML_CERT=
  229. # SAML_PRIVATE_KEY=
  230. # SAML_SECURITY_WANT_ASSERTION_SIGNED=true
  231. # SAML_SECURITY_WANT_ASSERTION_ENCRYPTED=true
  232. # SAML_SECURITY_ASSUME_EMAIL_IS_VERIFIED=true
  233. # SAML_ATTRIBUTES_STATEMENTS_UID="urn:oid:0.9.2342.19200300.100.1.1"
  234. # SAML_ATTRIBUTES_STATEMENTS_EMAIL="urn:oid:1.3.6.1.4.1.5923.1.1.1.6"
  235. # SAML_ATTRIBUTES_STATEMENTS_FULL_NAME="urn:oid:2.16.840.1.113730.3.1.241"
  236. # SAML_ATTRIBUTES_STATEMENTS_FIRST_NAME="urn:oid:2.5.4.42"
  237. # SAML_ATTRIBUTES_STATEMENTS_LAST_NAME="urn:oid:2.5.4.4"
  238. # SAML_UID_ATTRIBUTE="urn:oid:0.9.2342.19200300.100.1.1"
  239. # SAML_ATTRIBUTES_STATEMENTS_VERIFIED=
  240. # SAML_ATTRIBUTES_STATEMENTS_VERIFIED_EMAIL=
  241. # Use HTTP proxy for outgoing request (optional)
  242. # http_proxy=http://gateway.local:8118
  243. # Access control for hidden service.
  244. # ALLOW_ACCESS_TO_HIDDEN_SERVICE=true
  245. # Authorized fetch mode (optional)
  246. # Require remote servers to authentify when fetching toots, see
  247. # https://docs.joinmastodon.org/admin/config/#authorized_fetch
  248. # AUTHORIZED_FETCH=true
  249. # Whitelist mode (optional)
  250. # Only allow federation with whitelisted domains, see
  251. # https://docs.joinmastodon.org/admin/config/#whitelist_mode
  252. # WHITELIST_MODE=true