闭社主体 forked from https://github.com/tootsuite/mastodon
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.

216 lines
7.6 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. # ES_ENABLED=true
  14. # ES_HOST=es
  15. # ES_PORT=9200
  16. # Federation
  17. # Note: Changing LOCAL_DOMAIN at a later time will cause unwanted side effects, including breaking all existing federation.
  18. # LOCAL_DOMAIN should *NOT* contain the protocol part of the domain e.g https://example.com.
  19. LOCAL_DOMAIN=example.com
  20. # Changing LOCAL_HTTPS in production is no longer supported. (Mastodon will always serve https:// links)
  21. # Use this only if you need to run mastodon on a different domain than the one used for federation.
  22. # You can read more about this option on https://github.com/tootsuite/documentation/blob/master/Running-Mastodon/Serving_a_different_domain.md
  23. # DO *NOT* USE THIS UNLESS YOU KNOW *EXACTLY* WHAT YOU ARE DOING.
  24. # WEB_DOMAIN=mastodon.example.com
  25. # Use this if you want to have several aliases handler@example1.com
  26. # handler@example2.com etc. for the same user. LOCAL_DOMAIN should not
  27. # be added. Comma separated values
  28. # ALTERNATE_DOMAINS=example1.com,example2.com
  29. # Application secrets
  30. # Generate each with the `RAILS_ENV=production bundle exec rake secret` task (`docker-compose run --rm web rake secret` if you use docker compose)
  31. SECRET_KEY_BASE=
  32. OTP_SECRET=
  33. # VAPID keys (used for push notifications
  34. # You can generate the keys using the following command (first is the private key, second is the public one)
  35. # You should only generate this once per instance. If you later decide to change it, all push subscription will
  36. # be invalidated, requiring the users to access the website again to resubscribe.
  37. #
  38. # 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)
  39. #
  40. # For more information visit https://rossta.net/blog/using-the-web-push-api-with-vapid.html
  41. VAPID_PRIVATE_KEY=
  42. VAPID_PUBLIC_KEY=
  43. # Registrations
  44. # Single user mode will disable registrations and redirect frontpage to the first profile
  45. # SINGLE_USER_MODE=true
  46. # Prevent registrations with following e-mail domains
  47. # EMAIL_DOMAIN_BLACKLIST=example1.com|example2.de|etc
  48. # Only allow registrations with the following e-mail domains
  49. # EMAIL_DOMAIN_WHITELIST=example1.com|example2.de|etc
  50. # Optionally change default language
  51. # DEFAULT_LOCALE=de
  52. # E-mail configuration
  53. # Note: Mailgun and SparkPost (https://sparkpo.st/smtp) each have good free tiers
  54. # If you want to use an SMTP server without authentication (e.g local Postfix relay)
  55. # then set SMTP_AUTH_METHOD and SMTP_OPENSSL_VERIFY_MODE to 'none' and
  56. # *comment* SMTP_LOGIN and SMTP_PASSWORD (leaving them blank is not enough).
  57. SMTP_SERVER=smtp.mailgun.org
  58. SMTP_PORT=587
  59. SMTP_LOGIN=
  60. SMTP_PASSWORD=
  61. SMTP_FROM_ADDRESS=notifications@example.com
  62. #SMTP_DOMAIN= # defaults to LOCAL_DOMAIN
  63. #SMTP_DELIVERY_METHOD=smtp # delivery method can also be sendmail
  64. #SMTP_AUTH_METHOD=plain
  65. #SMTP_CA_FILE=/etc/ssl/certs/ca-certificates.crt
  66. #SMTP_OPENSSL_VERIFY_MODE=peer
  67. #SMTP_ENABLE_STARTTLS_AUTO=true
  68. #SMTP_TLS=true
  69. # 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.
  70. # PAPERCLIP_ROOT_PATH=/var/lib/mastodon/public-system
  71. # PAPERCLIP_ROOT_URL=/system
  72. # Optional asset host for multi-server setups
  73. # The asset host must allow cross origin request from WEB_DOMAIN or LOCAL_DOMAIN
  74. # if WEB_DOMAIN is not set. For example, the server may have the
  75. # following header field:
  76. # Access-Control-Allow-Origin: https://example.com/
  77. # CDN_HOST=https://assets.example.com
  78. # S3 (optional)
  79. # S3_ENABLED=true
  80. # S3_BUCKET=
  81. # AWS_ACCESS_KEY_ID=
  82. # AWS_SECRET_ACCESS_KEY=
  83. # S3_REGION=
  84. # S3_PROTOCOL=http
  85. # S3_HOSTNAME=192.168.1.123:9000
  86. # S3 (Minio Config (optional) Please check Minio instance for details)
  87. # S3_ENABLED=true
  88. # S3_BUCKET=
  89. # AWS_ACCESS_KEY_ID=
  90. # AWS_SECRET_ACCESS_KEY=
  91. # S3_REGION=
  92. # S3_PROTOCOL=https
  93. # S3_HOSTNAME=
  94. # S3_ENDPOINT=
  95. # S3_SIGNATURE_VERSION=
  96. # Swift (optional)
  97. # SWIFT_ENABLED=true
  98. # SWIFT_USERNAME=
  99. # For Keystone V3, the value for SWIFT_TENANT should be the project name
  100. # SWIFT_TENANT=
  101. # SWIFT_PASSWORD=
  102. # Keystone V2 and V3 URLs are supported. Use a V3 URL if possible to avoid
  103. # issues with token rate-limiting during high load.
  104. # SWIFT_AUTH_URL=
  105. # SWIFT_CONTAINER=
  106. # SWIFT_OBJECT_URL=
  107. # SWIFT_REGION=
  108. # Defaults to 'default'
  109. # SWIFT_DOMAIN_NAME=
  110. # Defaults to 60 seconds. Set to 0 to disable
  111. # SWIFT_CACHE_TTL=
  112. # Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
  113. # S3_CLOUDFRONT_HOST=
  114. # Streaming API integration
  115. # STREAMING_API_BASE_URL=
  116. # Advanced settings
  117. # If you need to use pgBouncer, you need to disable prepared statements:
  118. # PREPARED_STATEMENTS=false
  119. # Cluster number setting for streaming API server.
  120. # If you comment out following line, cluster number will be `numOfCpuCores - 1`.
  121. STREAMING_CLUSTER_NUM=1
  122. # Docker mastodon user
  123. # If you use Docker, you may want to assign UID/GID manually.
  124. # UID=1000
  125. # GID=1000
  126. # LDAP authentication (optional)
  127. # LDAP_ENABLED=true
  128. # LDAP_HOST=localhost
  129. # LDAP_PORT=389
  130. # LDAP_METHOD=simple_tls
  131. # LDAP_BASE=
  132. # LDAP_BIND_DN=
  133. # LDAP_PASSWORD=
  134. # LDAP_UID=cn
  135. # PAM authentication (optional)
  136. # PAM authentication uses for the email generation the "email" pam variable
  137. # and optional as fallback PAM_DEFAULT_SUFFIX
  138. # The pam environment variable "email" is provided by:
  139. # https://github.com/devkral/pam_email_extractor
  140. # PAM_ENABLED=true
  141. # Fallback email domain for email address generation (LOCAL_DOMAIN by default)
  142. # PAM_EMAIL_DOMAIN=example.com
  143. # Name of the pam service (pam "auth" section is evaluated)
  144. # PAM_DEFAULT_SERVICE=rpam
  145. # Name of the pam service used for checking if an user can register (pam "account" section is evaluated) (nil (disabled) by default)
  146. # PAM_CONTROLLED_SERVICE=rpam
  147. # Global OAuth settings (optional) :
  148. # If you have only one strategy, you may want to enable this
  149. # OAUTH_REDIRECT_AT_SIGN_IN=true
  150. # Optional CAS authentication (cf. omniauth-cas) :
  151. # CAS_ENABLED=true
  152. # CAS_URL=https://sso.myserver.com/
  153. # CAS_HOST=sso.myserver.com/
  154. # CAS_PORT=443
  155. # CAS_SSL=true
  156. # CAS_VALIDATE_URL=
  157. # CAS_CALLBACK_URL=
  158. # CAS_LOGOUT_URL=
  159. # CAS_LOGIN_URL=
  160. # CAS_UID_FIELD='user'
  161. # CAS_CA_PATH=
  162. # CAS_DISABLE_SSL_VERIFICATION=false
  163. # CAS_UID_KEY='user'
  164. # CAS_NAME_KEY='name'
  165. # CAS_EMAIL_KEY='email'
  166. # CAS_NICKNAME_KEY='nickname'
  167. # CAS_FIRST_NAME_KEY='firstname'
  168. # CAS_LAST_NAME_KEY='lastname'
  169. # CAS_LOCATION_KEY='location'
  170. # CAS_IMAGE_KEY='image'
  171. # CAS_PHONE_KEY='phone'
  172. # Optional SAML authentication (cf. omniauth-saml)
  173. # SAML_ENABLED=true
  174. # SAML_ACS_URL=
  175. # SAML_ISSUER=http://localhost:3000/auth/auth/saml/callback
  176. # SAML_IDP_SSO_TARGET_URL=https://idp.testshib.org/idp/profile/SAML2/Redirect/SSO
  177. # SAML_IDP_CERT=
  178. # SAML_IDP_CERT_FINGERPRINT=
  179. # SAML_NAME_IDENTIFIER_FORMAT=
  180. # SAML_CERT=
  181. # SAML_PRIVATE_KEY=
  182. # SAML_SECURITY_WANT_ASSERTION_SIGNED=true
  183. # SAML_SECURITY_WANT_ASSERTION_ENCRYPTED=true
  184. # SAML_SECURITY_ASSUME_EMAIL_IS_VERIFIED=true
  185. # SAML_ATTRIBUTES_STATEMENTS_UID="urn:oid:0.9.2342.19200300.100.1.1"
  186. # SAML_ATTRIBUTES_STATEMENTS_EMAIL="urn:oid:1.3.6.1.4.1.5923.1.1.1.6"
  187. # SAML_ATTRIBUTES_STATEMENTS_FULL_NAME="urn:oid:2.16.840.1.113730.3.1.241"
  188. # SAML_ATTRIBUTES_STATEMENTS_FIRST_NAME="urn:oid:2.5.4.42"
  189. # SAML_ATTRIBUTES_STATEMENTS_LAST_NAME="urn:oid:2.5.4.4"
  190. # SAML_UID_ATTRIBUTE="urn:oid:0.9.2342.19200300.100.1.1"
  191. # SAML_ATTRIBUTES_STATEMENTS_VERIFIED=
  192. # SAML_ATTRIBUTES_STATEMENTS_VERIFIED_EMAIL=