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.

286 lines
8.8 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
4 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
4 years ago
  1. # This is a sample configuration file. You can generate your configuration
  2. # with the `rake mastodon:setup` interactive setup wizard, but to customize
  3. # your setup even further, you'll need to edit it manually. This sample does
  4. # not demonstrate all available configuration options. Please look at
  5. # https://docs.joinmastodon.org/admin/config/ for the full documentation.
  6. # Note that this file accepts slightly different syntax depending on whether
  7. # you are using `docker-compose` or not. In particular, if you use
  8. # `docker-compose`, the value of each declared variable will be taken verbatim,
  9. # including surrounding quotes.
  10. # See: https://github.com/mastodon/mastodon/issues/16895
  11. # Federation
  12. # ----------
  13. # This identifies your server and cannot be changed safely later
  14. # ----------
  15. LOCAL_DOMAIN=example.com
  16. # Use this only if you need to run mastodon on a different domain than the one used for federation.
  17. # You can read more about this option on https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Serving_a_different_domain.md
  18. # DO *NOT* USE THIS UNLESS YOU KNOW *EXACTLY* WHAT YOU ARE DOING.
  19. # WEB_DOMAIN=mastodon.example.com
  20. # Use this if you want to have several aliases handler@example1.com
  21. # handler@example2.com etc. for the same user. LOCAL_DOMAIN should not
  22. # be added. Comma separated values
  23. # ALTERNATE_DOMAINS=example1.com,example2.com
  24. # Use HTTP proxy for outgoing request (optional)
  25. # http_proxy=http://gateway.local:8118
  26. # Access control for hidden service.
  27. # ALLOW_ACCESS_TO_HIDDEN_SERVICE=true
  28. # Authorized fetch mode (optional)
  29. # Require remote servers to authentify when fetching toots, see
  30. # https://docs.joinmastodon.org/admin/config/#authorized_fetch
  31. # AUTHORIZED_FETCH=true
  32. # Limited federation mode (optional)
  33. # Only allow federation with specific domains, see
  34. # https://docs.joinmastodon.org/admin/config/#whitelist_mode
  35. # LIMITED_FEDERATION_MODE=true
  36. # Redis
  37. # -----
  38. REDIS_HOST=localhost
  39. REDIS_PORT=6379
  40. # PostgreSQL
  41. # ----------
  42. DB_HOST=/var/run/postgresql
  43. DB_USER=mastodon
  44. DB_NAME=mastodon_production
  45. DB_PASS=
  46. DB_PORT=5432
  47. # ElasticSearch (optional)
  48. # ------------------------
  49. #ES_ENABLED=true
  50. #ES_HOST=localhost
  51. #ES_PORT=9200
  52. # Authentication for ES (optional)
  53. #ES_USER=elastic
  54. #ES_PASS=password
  55. # Secrets
  56. # -------
  57. # Generate each with the `RAILS_ENV=production bundle exec rake secret` task (`docker-compose run --rm web bundle exec rake secret` if you use docker compose)
  58. # -------
  59. SECRET_KEY_BASE=
  60. OTP_SECRET=
  61. # Web Push
  62. # --------
  63. # Generate with `rake mastodon:webpush:generate_vapid_key` (first is the private key, second is the public one)
  64. # You should only generate this once per instance. If you later decide to change it, all push subscription will
  65. # be invalidated, requiring the users to access the website again to resubscribe.
  66. # --------
  67. VAPID_PRIVATE_KEY=
  68. VAPID_PUBLIC_KEY=
  69. # Registrations
  70. # -------------
  71. # Single user mode will disable registrations and redirect frontpage to the first profile
  72. # SINGLE_USER_MODE=true
  73. # Prevent registrations with following e-mail domains
  74. # EMAIL_DOMAIN_DENYLIST=example1.com|example2.de|etc
  75. # Only allow registrations with the following e-mail domains
  76. # EMAIL_DOMAIN_ALLOWLIST=example1.com|example2.de|etc
  77. #TODO move this
  78. # Optionally change default language
  79. # DEFAULT_LOCALE=de
  80. # Sending mail
  81. # ------------
  82. SMTP_SERVER=smtp.mailgun.org
  83. SMTP_PORT=587
  84. SMTP_LOGIN=
  85. SMTP_PASSWORD=
  86. SMTP_FROM_ADDRESS=notificatons@example.com
  87. # File storage (optional)
  88. # -----------------------
  89. # The attachment host must allow cross origin request from WEB_DOMAIN or
  90. # LOCAL_DOMAIN if WEB_DOMAIN is not set. For example, the server may have the
  91. # following header field:
  92. # Access-Control-Allow-Origin: https://192.168.1.123:9000/
  93. # -----------------------
  94. #S3_ENABLED=true
  95. #S3_BUCKET=files.example.com
  96. #AWS_ACCESS_KEY_ID=
  97. #AWS_SECRET_ACCESS_KEY=
  98. #S3_ALIAS_HOST=files.example.com
  99. # Swift (optional)
  100. # The attachment host must allow cross origin request - see the description
  101. # above.
  102. # SWIFT_ENABLED=true
  103. # SWIFT_USERNAME=
  104. # For Keystone V3, the value for SWIFT_TENANT should be the project name
  105. # SWIFT_TENANT=
  106. # SWIFT_PASSWORD=
  107. # Some OpenStack V3 providers require PROJECT_ID (optional)
  108. # SWIFT_PROJECT_ID=
  109. # Keystone V2 and V3 URLs are supported. Use a V3 URL if possible to avoid
  110. # issues with token rate-limiting during high load.
  111. # SWIFT_AUTH_URL=
  112. # SWIFT_CONTAINER=
  113. # SWIFT_OBJECT_URL=
  114. # SWIFT_REGION=
  115. # Defaults to 'default'
  116. # SWIFT_DOMAIN_NAME=
  117. # Defaults to 60 seconds. Set to 0 to disable
  118. # SWIFT_CACHE_TTL=
  119. # Optional asset host for multi-server setups
  120. # The asset host must allow cross origin request from WEB_DOMAIN or LOCAL_DOMAIN
  121. # if WEB_DOMAIN is not set. For example, the server may have the
  122. # following header field:
  123. # Access-Control-Allow-Origin: https://example.com/
  124. # CDN_HOST=https://assets.example.com
  125. # Optional list of hosts that are allowed to serve media for your instance
  126. # This is useful if you include external media in your custom CSS or about page,
  127. # or if your data storage provider makes use of redirects to other domains.
  128. # EXTRA_DATA_HOSTS=https://data.example1.com|https://data.example2.com
  129. # Optional alias for S3 (e.g. to serve files on a custom domain, possibly using Cloudfront or Cloudflare)
  130. # S3_ALIAS_HOST=
  131. # Streaming API integration
  132. # STREAMING_API_BASE_URL=
  133. # External authentication (optional)
  134. # ----------------------------------
  135. # LDAP authentication (optional)
  136. # LDAP_ENABLED=true
  137. # LDAP_HOST=localhost
  138. # LDAP_PORT=389
  139. # LDAP_METHOD=simple_tls
  140. # LDAP_BASE=
  141. # LDAP_BIND_DN=
  142. # LDAP_PASSWORD=
  143. # LDAP_UID=cn
  144. # LDAP_MAIL=mail
  145. # LDAP_SEARCH_FILTER=(|(%{uid}=%{email})(%{mail}=%{email}))
  146. # LDAP_UID_CONVERSION_ENABLED=true
  147. # LDAP_UID_CONVERSION_SEARCH=., -
  148. # LDAP_UID_CONVERSION_REPLACE=_
  149. # PAM authentication (optional)
  150. # PAM authentication uses for the email generation the "email" pam variable
  151. # and optional as fallback PAM_DEFAULT_SUFFIX
  152. # The pam environment variable "email" is provided by:
  153. # https://github.com/devkral/pam_email_extractor
  154. # PAM_ENABLED=true
  155. # Fallback email domain for email address generation (LOCAL_DOMAIN by default)
  156. # PAM_EMAIL_DOMAIN=example.com
  157. # Name of the pam service (pam "auth" section is evaluated)
  158. # PAM_DEFAULT_SERVICE=rpam
  159. # Name of the pam service used for checking if an user can register (pam "account" section is evaluated) (nil (disabled) by default)
  160. # PAM_CONTROLLED_SERVICE=rpam
  161. # Global OAuth settings (optional) :
  162. # If you have only one strategy, you may want to enable this
  163. # OAUTH_REDIRECT_AT_SIGN_IN=true
  164. # Optional CAS authentication (cf. omniauth-cas) :
  165. # CAS_ENABLED=true
  166. # CAS_URL=https://sso.myserver.com/
  167. # CAS_HOST=sso.myserver.com/
  168. # CAS_PORT=443
  169. # CAS_SSL=true
  170. # CAS_VALIDATE_URL=
  171. # CAS_CALLBACK_URL=
  172. # CAS_LOGOUT_URL=
  173. # CAS_LOGIN_URL=
  174. # CAS_UID_FIELD='user'
  175. # CAS_CA_PATH=
  176. # CAS_DISABLE_SSL_VERIFICATION=false
  177. # CAS_UID_KEY='user'
  178. # CAS_NAME_KEY='name'
  179. # CAS_EMAIL_KEY='email'
  180. # CAS_NICKNAME_KEY='nickname'
  181. # CAS_FIRST_NAME_KEY='firstname'
  182. # CAS_LAST_NAME_KEY='lastname'
  183. # CAS_LOCATION_KEY='location'
  184. # CAS_IMAGE_KEY='image'
  185. # CAS_PHONE_KEY='phone'
  186. # Optional SAML authentication (cf. omniauth-saml)
  187. # SAML_ENABLED=true
  188. # SAML_ACS_URL=http://localhost:3000/auth/auth/saml/callback
  189. # SAML_ISSUER=https://example.com
  190. # SAML_IDP_SSO_TARGET_URL=https://idp.testshib.org/idp/profile/SAML2/Redirect/SSO
  191. # SAML_IDP_CERT=
  192. # SAML_IDP_CERT_FINGERPRINT=
  193. # SAML_NAME_IDENTIFIER_FORMAT=
  194. # SAML_CERT=
  195. # SAML_PRIVATE_KEY=
  196. # SAML_SECURITY_WANT_ASSERTION_SIGNED=true
  197. # SAML_SECURITY_WANT_ASSERTION_ENCRYPTED=true
  198. # SAML_SECURITY_ASSUME_EMAIL_IS_VERIFIED=true
  199. # SAML_ATTRIBUTES_STATEMENTS_UID="urn:oid:0.9.2342.19200300.100.1.1"
  200. # SAML_ATTRIBUTES_STATEMENTS_EMAIL="urn:oid:1.3.6.1.4.1.5923.1.1.1.6"
  201. # SAML_ATTRIBUTES_STATEMENTS_FULL_NAME="urn:oid:2.16.840.1.113730.3.1.241"
  202. # SAML_ATTRIBUTES_STATEMENTS_FIRST_NAME="urn:oid:2.5.4.42"
  203. # SAML_ATTRIBUTES_STATEMENTS_LAST_NAME="urn:oid:2.5.4.4"
  204. # SAML_UID_ATTRIBUTE="urn:oid:0.9.2342.19200300.100.1.1"
  205. # SAML_ATTRIBUTES_STATEMENTS_VERIFIED=
  206. # SAML_ATTRIBUTES_STATEMENTS_VERIFIED_EMAIL=
  207. # Custom settings
  208. # ---------------
  209. # Various ways to customize Mastodon's behavior
  210. # ---------------
  211. # Maximum allowed character count
  212. MAX_TOOT_CHARS=500
  213. # Maximum number of pinned posts
  214. MAX_PINNED_TOOTS=5
  215. # Maximum allowed bio characters
  216. MAX_BIO_CHARS=500
  217. # Maximim number of profile fields allowed
  218. MAX_PROFILE_FIELDS=4
  219. # Maximum allowed display name characters
  220. MAX_DISPLAY_NAME_CHARS=30
  221. # Maximum allowed poll options
  222. MAX_POLL_OPTIONS=5
  223. # Maximum allowed poll option characters
  224. MAX_POLL_OPTION_CHARS=100
  225. # Maximum image and video/audio upload sizes
  226. # Units are in bytes
  227. # 1048576 bytes equals 1 megabyte
  228. # MAX_IMAGE_SIZE=8388608
  229. # MAX_VIDEO_SIZE=41943040
  230. # Maximum search results to display
  231. # Only relevant when elasticsearch is installed
  232. # MAX_SEARCH_RESULTS=20
  233. # Maximum custom emoji file sizes
  234. # If undefined or smaller than MAX_EMOJI_SIZE, the value
  235. # of MAX_EMOJI_SIZE will be used for MAX_REMOTE_EMOJI_SIZE
  236. # Units are in bytes
  237. MAX_EMOJI_SIZE=51200
  238. MAX_REMOTE_EMOJI_SIZE=204800