├── .ci ├── complement_package.gotpl ├── latest_deps_build_failed_issue_template.md ├── postgres-config.yaml ├── scripts │ ├── auditwheel_wrapper.py │ ├── calculate_jobs.py │ ├── check_lockfile.py │ ├── checkout_complement.sh │ ├── gotestfmt │ ├── prepare_old_deps.sh │ ├── setup_complement_prerequisites.sh │ ├── test_export_data_command.sh │ └── test_synapse_port_db.sh ├── sqlite-config.yaml ├── test_db.db ├── twisted_trunk_build_failed_issue_template.md └── worker-blacklist ├── .codecov.yml ├── .coveragerc ├── .dockerignore ├── .editorconfig ├── .git-blame-ignore-revs ├── .github ├── CODEOWNERS ├── FUNDING.yml ├── ISSUE_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── BUG_REPORT.yml │ ├── FEATURE_REQUEST.md │ └── SUPPORT_REQUEST.md ├── PULL_REQUEST_TEMPLATE.md ├── SUPPORT.md ├── dependabot.yml └── workflows │ ├── docker.yml │ ├── docs-add-version-picker.yaml │ ├── docs-pr-netlify.yaml │ ├── docs-pr.yaml │ ├── docs.yaml │ ├── fix_lint.yaml │ ├── latest_deps.yml │ ├── poetry_lockfile.yaml │ ├── push_complement_image.yml │ ├── release-artifacts.yml │ ├── tests.yml │ ├── triage-incoming.yml │ ├── triage_labelled.yml │ └── twisted_trunk.yml ├── .gitignore ├── .rustfmt.toml ├── AUTHORS.rst ├── CHANGES.md ├── CONTRIBUTING.md ├── Cargo.lock ├── Cargo.toml ├── INSTALL.md ├── LICENSE ├── README.rst ├── UPGRADE.rst ├── book.toml ├── build_rust.py ├── changelog.d ├── .gitignore ├── 16533.doc ├── 16679.feature ├── 16696.feature ├── 16726.misc ├── 16737.doc ├── 16738.feature └── 16740.bugfix ├── contrib ├── README.rst ├── cmdclient │ ├── console.py │ └── http.py ├── datagrip │ ├── README.md │ ├── common.sql │ ├── datagrip-aware-of-schema.png │ ├── main.sql │ ├── schema_version.sql │ └── state.sql ├── docker │ ├── README.md │ └── docker-compose.yml ├── docker_compose_workers │ ├── README.md │ ├── docker-compose.yaml │ └── workers │ │ ├── synapse-federation-sender-1.yaml │ │ └── synapse-generic-worker-1.yaml ├── example_log_config.yaml ├── grafana │ ├── README.md │ └── synapse.json ├── graph │ ├── graph.py │ ├── graph2.py │ └── graph3.py ├── lnav │ ├── README.md │ └── synapse-log-format.json ├── prometheus │ ├── README.md │ ├── consoles │ │ └── synapse.html │ └── synapse-v2.rules ├── purge_api │ ├── README.md │ ├── purge_history.sh │ └── purge_remote_media.sh ├── snap │ └── snapcraft.yaml ├── systemd-with-workers │ └── README.md ├── systemd │ ├── README.md │ ├── log_config.yaml │ ├── matrix-synapse.service │ └── override-hardened.conf ├── vertobot │ ├── .gitignore │ ├── bot.pl │ ├── bridge.pl │ ├── config.yaml │ ├── cpanfile │ └── verto-example.json └── workers-bash-scripts │ ├── create-multiple-generic-workers.md │ └── create-multiple-stream-writers.md ├── debian ├── .gitignore ├── NEWS ├── build_virtualenv ├── changelog ├── clean ├── control ├── copyright ├── dirs ├── hash_password.1 ├── hash_password.ronn ├── install ├── manage_debconf.pl ├── manpages ├── matrix-synapse-py3.config ├── matrix-synapse-py3.links ├── matrix-synapse-py3.postinst ├── matrix-synapse.service ├── po │ ├── POTFILES.in │ └── templates.pot ├── register_new_matrix_user.1 ├── register_new_matrix_user.ronn ├── rules ├── source │ └── format ├── synapse_port_db.1 ├── synapse_port_db.ronn ├── synapse_review_recent_signups.1 ├── synapse_review_recent_signups.ronn ├── synctl.1 ├── synctl.ronn └── templates ├── demo ├── .gitignore ├── clean.sh ├── start.sh └── stop.sh ├── dev-docs ├── Makefile ├── conf.py ├── index.rst └── modules │ └── federation_sender.md ├── docker ├── Dockerfile ├── Dockerfile-dhvirtualenv ├── Dockerfile-workers ├── README-testing.md ├── README.md ├── build_debian.sh ├── complement │ ├── Dockerfile │ ├── README.md │ └── conf │ │ ├── postgres.supervisord.conf │ │ ├── start_for_complement.sh │ │ └── workers-shared-extra.yaml.j2 ├── conf-workers │ ├── healthcheck.sh.j2 │ ├── nginx.conf.j2 │ ├── shared.yaml.j2 │ ├── supervisord.conf.j2 │ ├── synapse.supervisord.conf.j2 │ └── worker.yaml.j2 ├── conf │ ├── homeserver.yaml │ └── log.config ├── configure_workers_and_start.py ├── editable.Dockerfile ├── prefix-log └── start.py ├── docs ├── .sample_config_header.yaml ├── CAPTCHA_SETUP.md ├── README.md ├── SUMMARY.md ├── admin_api │ ├── README.rst │ ├── account_validity.md │ ├── event_reports.md │ ├── experimental_features.md │ ├── media_admin_api.md │ ├── purge_history_api.md │ ├── register_api.md │ ├── room_membership.md │ ├── rooms.md │ ├── server_notices.md │ ├── statistics.md │ ├── user_admin_api.md │ └── version_api.md ├── ancient_architecture_notes.md ├── application_services.md ├── architecture.md ├── auth_chain_diff.dot ├── auth_chain_diff.dot.png ├── auth_chain_difference_algorithm.md ├── changelogs │ ├── CHANGES-2019.md │ ├── CHANGES-2020.md │ ├── CHANGES-2021.md │ ├── CHANGES-2022.md │ ├── CHANGES-pre-1.0.md │ └── README.md ├── code_style.md ├── consent_tracking.md ├── delegate.md ├── deprecation_policy.md ├── development │ ├── cas.md │ ├── contributing_guide.md │ ├── database_schema.md │ ├── demo.md │ ├── dependencies.md │ ├── experimental_features.md │ ├── git.md │ ├── img │ │ └── git │ │ │ ├── branches.jpg │ │ │ ├── clean.png │ │ │ └── squash.png │ ├── internal_documentation │ │ └── README.md │ ├── releases.md │ ├── reviews.md │ ├── room-dag-concepts.md │ ├── saml.md │ └── synapse_architecture │ │ ├── cancellation.md │ │ ├── faster_joins.md │ │ └── streams.md ├── favicon.png ├── favicon.svg ├── federate.md ├── jwt.md ├── log_contexts.md ├── manhole.md ├── media_repository.md ├── message_retention_policies.md ├── metrics-howto.md ├── modules │ ├── account_data_callbacks.md │ ├── account_validity_callbacks.md │ ├── add_extra_fields_to_client_events_unsigned.md │ ├── background_update_controller_callbacks.md │ ├── index.md │ ├── password_auth_provider_callbacks.md │ ├── porting_legacy_module.md │ ├── presence_router_callbacks.md │ ├── spam_checker_callbacks.md │ ├── third_party_rules_callbacks.md │ └── writing_a_module.md ├── openid.md ├── opentracing.md ├── other │ └── running_synapse_on_single_board_computers.md ├── password_auth_providers.md ├── postgres.md ├── presence_router_module.md ├── privacy_policy_templates │ └── en │ │ ├── 1.0.html │ │ └── success.html ├── replication.md ├── reverse_proxy.md ├── room_and_user_statistics.md ├── sample_config.yaml ├── sample_log_config.yaml ├── server_notices.md ├── setup │ ├── forward_proxy.md │ ├── installation.md │ └── turn │ │ ├── coturn.md │ │ └── eturnal.md ├── spam_checker.md ├── sso_mapping_providers.md ├── structured_logging.md ├── synctl_workers.md ├── systemd-with-workers │ ├── README.md │ ├── system │ │ ├── matrix-synapse-worker@.service │ │ ├── matrix-synapse.service │ │ └── matrix-synapse.target │ └── workers │ │ ├── background_worker.yaml │ │ ├── event_persister.yaml │ │ ├── federation_sender.yaml │ │ ├── generic_worker.yaml │ │ ├── media_worker.yaml │ │ └── pusher_worker.yaml ├── tcp_replication.md ├── templates.md ├── turn-howto.md ├── upgrade.md ├── usage │ ├── administration │ │ ├── README.md │ │ ├── admin_api │ │ │ ├── README.md │ │ │ ├── background_updates.md │ │ │ ├── federation.md │ │ │ └── registration_tokens.md │ │ ├── admin_faq.md │ │ ├── database_maintenance_tools.md │ │ ├── monitoring │ │ │ └── reporting_homeserver_usage_statistics.md │ │ ├── monthly_active_users.md │ │ ├── request_log.md │ │ ├── state_groups.md │ │ ├── understanding_synapse_through_grafana_graphs.md │ │ └── useful_sql_for_admins.md │ └── configuration │ │ ├── README.md │ │ ├── config_documentation.md │ │ ├── homeserver_sample_config.md │ │ ├── logging_sample_config.md │ │ └── user_authentication │ │ ├── README.md │ │ ├── refresh_tokens.md │ │ └── single_sign_on │ │ ├── README.md │ │ ├── cas.md │ │ └── saml.md ├── user_directory.md ├── website_files │ ├── README.md │ ├── indent-section-headers.css │ ├── remove-nav-buttons.css │ ├── table-of-contents.css │ ├── table-of-contents.js │ ├── theme │ │ └── index.hbs │ ├── version-picker.css │ ├── version-picker.js │ └── version.js ├── welcome_and_overview.md └── workers.md ├── flake.lock ├── flake.nix ├── mypy.ini ├── poetry.lock ├── pylint.cfg ├── pyproject.toml ├── rust ├── Cargo.toml ├── benches │ ├── evaluator.rs │ └── glob.rs ├── build.rs └── src │ ├── acl │ └── mod.rs │ ├── lib.rs │ └── push │ ├── base_rules.rs │ ├── evaluator.rs │ ├── mod.rs │ └── utils.rs ├── scripts-dev ├── build_debian_packages.py ├── check-newsfragment.sh ├── check_line_terminators.sh ├── check_locked_deps_have_sdists.py ├── check_pydantic_models.py ├── check_schema_delta.py ├── complement.sh ├── config-lint.sh ├── database-save.sh ├── docker_update_debian_changelog.sh ├── dump_macaroon.py ├── federation_client.py ├── generate_sample_config.sh ├── lint.sh ├── make_full_schema.sh ├── mypy_synapse_plugin.py ├── next_github_number.sh ├── release.py ├── schema_versions.py └── sign_json.py ├── stubs ├── icu.pyi ├── sortedcontainers │ ├── __init__.pyi │ ├── sorteddict.pyi │ ├── sortedlist.pyi │ └── sortedset.pyi ├── synapse │ ├── __init__.pyi │ └── synapse_rust │ │ ├── __init__.pyi │ │ ├── acl.pyi │ │ └── push.pyi └── txredisapi.pyi ├── synapse ├── __init__.py ├── _pydantic_compat.py ├── _scripts │ ├── __init__.py │ ├── export_signing_key.py │ ├── generate_config.py │ ├── generate_log_config.py │ ├── generate_signing_key.py │ ├── generate_workers_map.py │ ├── hash_password.py │ ├── move_remote_media_to_new_store.py │ ├── register_new_matrix_user.py │ ├── review_recent_signups.py │ ├── synapse_port_db.py │ ├── synctl.py │ └── update_synapse_database.py ├── api │ ├── __init__.py │ ├── auth │ │ ├── __init__.py │ │ ├── base.py │ │ ├── internal.py │ │ └── msc3861_delegated.py │ ├── auth_blocking.py │ ├── constants.py │ ├── errors.py │ ├── filtering.py │ ├── presence.py │ ├── ratelimiting.py │ ├── room_versions.py │ └── urls.py ├── app │ ├── __init__.py │ ├── _base.py │ ├── admin_cmd.py │ ├── appservice.py │ ├── client_reader.py │ ├── complement_fork_starter.py │ ├── event_creator.py │ ├── federation_reader.py │ ├── federation_sender.py │ ├── frontend_proxy.py │ ├── generic_worker.py │ ├── homeserver.py │ ├── media_repository.py │ ├── phone_stats_home.py │ ├── pusher.py │ ├── synchrotron.py │ └── user_dir.py ├── appservice │ ├── __init__.py │ ├── api.py │ └── scheduler.py ├── config │ ├── __init__.py │ ├── __main__.py │ ├── _base.py │ ├── _base.pyi │ ├── _util.py │ ├── account_validity.py │ ├── api.py │ ├── appservice.py │ ├── auth.py │ ├── background_updates.py │ ├── cache.py │ ├── captcha.py │ ├── cas.py │ ├── consent.py │ ├── database.py │ ├── emailconfig.py │ ├── experimental.py │ ├── federation.py │ ├── homeserver.py │ ├── jwt.py │ ├── key.py │ ├── logger.py │ ├── metrics.py │ ├── modules.py │ ├── oembed.py │ ├── oidc.py │ ├── password_auth_providers.py │ ├── push.py │ ├── ratelimiting.py │ ├── redis.py │ ├── registration.py │ ├── repository.py │ ├── retention.py │ ├── room.py │ ├── room_directory.py │ ├── saml2.py │ ├── server.py │ ├── server_notices.py │ ├── spam_checker.py │ ├── sso.py │ ├── stats.py │ ├── third_party_event_rules.py │ ├── tls.py │ ├── tracer.py │ ├── user_directory.py │ ├── voip.py │ └── workers.py ├── crypto │ ├── __init__.py │ ├── context_factory.py │ ├── event_signing.py │ └── keyring.py ├── event_auth.py ├── events │ ├── __init__.py │ ├── builder.py │ ├── presence_router.py │ ├── snapshot.py │ ├── utils.py │ └── validator.py ├── federation │ ├── __init__.py │ ├── federation_base.py │ ├── federation_client.py │ ├── federation_server.py │ ├── persistence.py │ ├── send_queue.py │ ├── sender │ │ ├── __init__.py │ │ ├── per_destination_queue.py │ │ └── transaction_manager.py │ ├── transport │ │ ├── __init__.py │ │ ├── client.py │ │ └── server │ │ │ ├── __init__.py │ │ │ ├── _base.py │ │ │ └── federation.py │ └── units.py ├── handlers │ ├── __init__.py │ ├── account.py │ ├── account_data.py │ ├── account_validity.py │ ├── admin.py │ ├── appservice.py │ ├── auth.py │ ├── cas.py │ ├── deactivate_account.py │ ├── device.py │ ├── devicemessage.py │ ├── directory.py │ ├── e2e_keys.py │ ├── e2e_room_keys.py │ ├── event_auth.py │ ├── events.py │ ├── federation.py │ ├── federation_event.py │ ├── identity.py │ ├── initial_sync.py │ ├── jwt.py │ ├── message.py │ ├── oidc.py │ ├── pagination.py │ ├── password_policy.py │ ├── presence.py │ ├── profile.py │ ├── push_rules.py │ ├── read_marker.py │ ├── receipts.py │ ├── register.py │ ├── relations.py │ ├── room.py │ ├── room_list.py │ ├── room_member.py │ ├── room_member_worker.py │ ├── room_summary.py │ ├── saml.py │ ├── search.py │ ├── send_email.py │ ├── set_password.py │ ├── sso.py │ ├── state_deltas.py │ ├── stats.py │ ├── sync.py │ ├── typing.py │ ├── ui_auth │ │ ├── __init__.py │ │ └── checkers.py │ ├── user_directory.py │ └── worker_lock.py ├── http │ ├── __init__.py │ ├── additional_resource.py │ ├── client.py │ ├── connectproxyclient.py │ ├── federation │ │ ├── __init__.py │ │ ├── matrix_federation_agent.py │ │ ├── srv_resolver.py │ │ └── well_known_resolver.py │ ├── matrixfederationclient.py │ ├── proxy.py │ ├── proxyagent.py │ ├── replicationagent.py │ ├── request_metrics.py │ ├── server.py │ ├── servlet.py │ ├── site.py │ └── types.py ├── logging │ ├── __init__.py │ ├── _remote.py │ ├── _terse_json.py │ ├── context.py │ ├── filter.py │ ├── formatter.py │ ├── handlers.py │ ├── opentracing.py │ └── scopecontextmanager.py ├── media │ ├── _base.py │ ├── filepath.py │ ├── media_repository.py │ ├── media_storage.py │ ├── oembed.py │ ├── preview_html.py │ ├── storage_provider.py │ ├── thumbnailer.py │ └── url_previewer.py ├── metrics │ ├── __init__.py │ ├── _gc.py │ ├── _reactor_metrics.py │ ├── _twisted_exposition.py │ ├── _types.py │ ├── background_process_metrics.py │ ├── common_usage_metrics.py │ └── jemalloc.py ├── module_api │ ├── __init__.py │ ├── callbacks │ │ ├── __init__.py │ │ ├── account_validity_callbacks.py │ │ ├── spamchecker_callbacks.py │ │ └── third_party_event_rules_callbacks.py │ └── errors.py ├── notifier.py ├── push │ ├── __init__.py │ ├── bulk_push_rule_evaluator.py │ ├── clientformat.py │ ├── emailpusher.py │ ├── httppusher.py │ ├── mailer.py │ ├── presentable_names.py │ ├── push_tools.py │ ├── push_types.py │ ├── pusher.py │ ├── pusherpool.py │ └── rulekinds.py ├── py.typed ├── replication │ ├── __init__.py │ ├── http │ │ ├── __init__.py │ │ ├── _base.py │ │ ├── account_data.py │ │ ├── devices.py │ │ ├── federation.py │ │ ├── login.py │ │ ├── membership.py │ │ ├── presence.py │ │ ├── push.py │ │ ├── register.py │ │ ├── send_event.py │ │ ├── send_events.py │ │ ├── state.py │ │ └── streams.py │ └── tcp │ │ ├── __init__.py │ │ ├── client.py │ │ ├── commands.py │ │ ├── context.py │ │ ├── external_cache.py │ │ ├── handler.py │ │ ├── protocol.py │ │ ├── redis.py │ │ ├── resource.py │ │ └── streams │ │ ├── __init__.py │ │ ├── _base.py │ │ ├── events.py │ │ ├── federation.py │ │ └── partial_state.py ├── res │ ├── providers.json │ └── templates │ │ ├── _base.html │ │ ├── account_previously_renewed.html │ │ ├── account_renewed.html │ │ ├── add_threepid.html │ │ ├── add_threepid.txt │ │ ├── add_threepid_failure.html │ │ ├── add_threepid_success.html │ │ ├── auth_success.html │ │ ├── invalid_token.html │ │ ├── mail-Element.css │ │ ├── mail-Vector.css │ │ ├── mail-expiry.css │ │ ├── mail.css │ │ ├── notice_expiry.html │ │ ├── notice_expiry.txt │ │ ├── notif.html │ │ ├── notif.txt │ │ ├── notif_mail.html │ │ ├── notif_mail.txt │ │ ├── password_reset.html │ │ ├── password_reset.txt │ │ ├── password_reset_confirmation.html │ │ ├── password_reset_failure.html │ │ ├── password_reset_success.html │ │ ├── recaptcha.html │ │ ├── registration.html │ │ ├── registration.txt │ │ ├── registration_failure.html │ │ ├── registration_success.html │ │ ├── registration_token.html │ │ ├── room.html │ │ ├── room.txt │ │ ├── sso.css │ │ ├── sso_account_deactivated.html │ │ ├── sso_auth_account_details.html │ │ ├── sso_auth_account_details.js │ │ ├── sso_auth_bad_user.html │ │ ├── sso_auth_confirm.html │ │ ├── sso_auth_success.html │ │ ├── sso_error.html │ │ ├── sso_footer.html │ │ ├── sso_login_idp_picker.html │ │ ├── sso_new_user_consent.html │ │ ├── sso_partial_profile.html │ │ ├── sso_redirect_confirm.html │ │ ├── style.css │ │ └── terms.html ├── rest │ ├── __init__.py │ ├── admin │ │ ├── __init__.py │ │ ├── _base.py │ │ ├── background_updates.py │ │ ├── devices.py │ │ ├── event_reports.py │ │ ├── experimental_features.py │ │ ├── federation.py │ │ ├── media.py │ │ ├── registration_tokens.py │ │ ├── rooms.py │ │ ├── server_notice_servlet.py │ │ ├── statistics.py │ │ ├── username_available.py │ │ └── users.py │ ├── client │ │ ├── __init__.py │ │ ├── _base.py │ │ ├── account.py │ │ ├── account_data.py │ │ ├── account_validity.py │ │ ├── appservice_ping.py │ │ ├── auth.py │ │ ├── auth_issuer.py │ │ ├── capabilities.py │ │ ├── devices.py │ │ ├── directory.py │ │ ├── events.py │ │ ├── filter.py │ │ ├── initial_sync.py │ │ ├── keys.py │ │ ├── knock.py │ │ ├── login.py │ │ ├── login_token_request.py │ │ ├── logout.py │ │ ├── models.py │ │ ├── mutual_rooms.py │ │ ├── notifications.py │ │ ├── openid.py │ │ ├── password_policy.py │ │ ├── presence.py │ │ ├── profile.py │ │ ├── push_rule.py │ │ ├── pusher.py │ │ ├── read_marker.py │ │ ├── receipts.py │ │ ├── register.py │ │ ├── relations.py │ │ ├── rendezvous.py │ │ ├── report_event.py │ │ ├── room.py │ │ ├── room_keys.py │ │ ├── room_upgrade_rest_servlet.py │ │ ├── sendtodevice.py │ │ ├── sync.py │ │ ├── tags.py │ │ ├── thirdparty.py │ │ ├── tokenrefresh.py │ │ ├── transactions.py │ │ ├── user_directory.py │ │ ├── versions.py │ │ └── voip.py │ ├── consent │ │ ├── __init__.py │ │ └── consent_resource.py │ ├── health.py │ ├── key │ │ ├── __init__.py │ │ └── v2 │ │ │ ├── __init__.py │ │ │ ├── local_key_resource.py │ │ │ └── remote_key_resource.py │ ├── media │ │ ├── __init__.py │ │ ├── config_resource.py │ │ ├── create_resource.py │ │ ├── download_resource.py │ │ ├── media_repository_resource.py │ │ ├── preview_url_resource.py │ │ ├── thumbnail_resource.py │ │ ├── upload_resource.py │ │ └── v1 │ │ │ ├── __init__.py │ │ │ ├── _base.py │ │ │ ├── media_storage.py │ │ │ └── storage_provider.py │ ├── models.py │ ├── synapse │ │ ├── __init__.py │ │ └── client │ │ │ ├── __init__.py │ │ │ ├── jwks.py │ │ │ ├── new_user_consent.py │ │ │ ├── oidc │ │ │ ├── __init__.py │ │ │ ├── backchannel_logout_resource.py │ │ │ └── callback_resource.py │ │ │ ├── password_reset.py │ │ │ ├── pick_idp.py │ │ │ ├── pick_username.py │ │ │ ├── saml2 │ │ │ ├── __init__.py │ │ │ ├── metadata_resource.py │ │ │ └── response_resource.py │ │ │ ├── sso_register.py │ │ │ └── unsubscribe.py │ └── well_known.py ├── server.py ├── server_notices │ ├── __init__.py │ ├── consent_server_notices.py │ ├── resource_limits_server_notices.py │ ├── server_notices_manager.py │ ├── server_notices_sender.py │ └── worker_server_notices_sender.py ├── spam_checker_api │ └── __init__.py ├── state │ ├── __init__.py │ ├── v1.py │ └── v2.py ├── static │ ├── client │ │ └── login │ │ │ ├── index.html │ │ │ ├── js │ │ │ ├── jquery-3.4.1.min.js │ │ │ └── login.js │ │ │ ├── spinner.gif │ │ │ └── style.css │ └── index.html ├── storage │ ├── __init__.py │ ├── _base.py │ ├── background_updates.py │ ├── controllers │ │ ├── __init__.py │ │ ├── persist_events.py │ │ ├── purge_events.py │ │ ├── state.py │ │ └── stats.py │ ├── database.py │ ├── databases │ │ ├── __init__.py │ │ ├── main │ │ │ ├── __init__.py │ │ │ ├── account_data.py │ │ │ ├── appservice.py │ │ │ ├── cache.py │ │ │ ├── censor_events.py │ │ │ ├── client_ips.py │ │ │ ├── deviceinbox.py │ │ │ ├── devices.py │ │ │ ├── directory.py │ │ │ ├── e2e_room_keys.py │ │ │ ├── end_to_end_keys.py │ │ │ ├── event_federation.py │ │ │ ├── event_push_actions.py │ │ │ ├── events.py │ │ │ ├── events_bg_updates.py │ │ │ ├── events_forward_extremities.py │ │ │ ├── events_worker.py │ │ │ ├── experimental_features.py │ │ │ ├── filtering.py │ │ │ ├── keys.py │ │ │ ├── lock.py │ │ │ ├── media_repository.py │ │ │ ├── metrics.py │ │ │ ├── monthly_active_users.py │ │ │ ├── openid.py │ │ │ ├── presence.py │ │ │ ├── profile.py │ │ │ ├── purge_events.py │ │ │ ├── push_rule.py │ │ │ ├── pusher.py │ │ │ ├── receipts.py │ │ │ ├── registration.py │ │ │ ├── rejections.py │ │ │ ├── relations.py │ │ │ ├── room.py │ │ │ ├── roommember.py │ │ │ ├── search.py │ │ │ ├── session.py │ │ │ ├── signatures.py │ │ │ ├── state.py │ │ │ ├── state_deltas.py │ │ │ ├── stats.py │ │ │ ├── stream.py │ │ │ ├── tags.py │ │ │ ├── task_scheduler.py │ │ │ ├── transactions.py │ │ │ ├── ui_auth.py │ │ │ ├── user_directory.py │ │ │ └── user_erasure_store.py │ │ └── state │ │ │ ├── __init__.py │ │ │ ├── bg_updates.py │ │ │ └── store.py │ ├── engines │ │ ├── __init__.py │ │ ├── _base.py │ │ ├── postgres.py │ │ └── sqlite.py │ ├── keys.py │ ├── prepare_database.py │ ├── push_rule.py │ ├── roommember.py │ ├── schema │ │ ├── README.md │ │ ├── __init__.py │ │ ├── common │ │ │ ├── delta │ │ │ │ ├── 25 │ │ │ │ │ └── 00background_updates.sql │ │ │ │ ├── 35 │ │ │ │ │ └── 00background_updates_add_col.sql │ │ │ │ └── 58 │ │ │ │ │ └── 00background_update_ordering.sql │ │ │ ├── full_schemas │ │ │ │ └── 72 │ │ │ │ │ ├── full.sql.postgres │ │ │ │ │ └── full.sql.sqlite │ │ │ └── schema_version.sql │ │ ├── main │ │ │ ├── delta │ │ │ │ ├── 12 │ │ │ │ │ └── v12.sql │ │ │ │ ├── 13 │ │ │ │ │ └── v13.sql │ │ │ │ ├── 14 │ │ │ │ │ └── v14.sql │ │ │ │ ├── 15 │ │ │ │ │ ├── appservice_txns.sql │ │ │ │ │ ├── presence_indices.sql │ │ │ │ │ └── v15.sql │ │ │ │ ├── 16 │ │ │ │ │ ├── events_order_index.sql │ │ │ │ │ ├── remote_media_cache_index.sql │ │ │ │ │ ├── remove_duplicates.sql │ │ │ │ │ ├── room_alias_index.sql │ │ │ │ │ ├── unique_constraints.sql │ │ │ │ │ └── users.sql │ │ │ │ ├── 17 │ │ │ │ │ ├── drop_indexes.sql │ │ │ │ │ ├── server_keys.sql │ │ │ │ │ └── user_threepids.sql │ │ │ │ ├── 18 │ │ │ │ │ └── server_keys_bigger_ints.sql │ │ │ │ ├── 19 │ │ │ │ │ └── event_index.sql │ │ │ │ ├── 20 │ │ │ │ │ ├── dummy.sql │ │ │ │ │ └── pushers.py │ │ │ │ ├── 21 │ │ │ │ │ ├── end_to_end_keys.sql │ │ │ │ │ └── receipts.sql │ │ │ │ ├── 22 │ │ │ │ │ ├── receipts_index.sql │ │ │ │ │ └── user_threepids_unique.sql │ │ │ │ ├── 24 │ │ │ │ │ └── stats_reporting.sql │ │ │ │ ├── 25 │ │ │ │ │ ├── fts.py │ │ │ │ │ ├── guest_access.sql │ │ │ │ │ ├── history_visibility.sql │ │ │ │ │ └── tags.sql │ │ │ │ ├── 26 │ │ │ │ │ └── account_data.sql │ │ │ │ ├── 27 │ │ │ │ │ ├── account_data.sql │ │ │ │ │ ├── forgotten_memberships.sql │ │ │ │ │ └── ts.py │ │ │ │ ├── 28 │ │ │ │ │ ├── event_push_actions.sql │ │ │ │ │ ├── events_room_stream.sql │ │ │ │ │ ├── public_roms_index.sql │ │ │ │ │ ├── receipts_user_id_index.sql │ │ │ │ │ ├── upgrade_times.sql │ │ │ │ │ └── users_is_guest.sql │ │ │ │ ├── 29 │ │ │ │ │ └── push_actions.sql │ │ │ │ ├── 30 │ │ │ │ │ ├── alias_creator.sql │ │ │ │ │ ├── as_users.py │ │ │ │ │ ├── deleted_pushers.sql │ │ │ │ │ ├── presence_stream.sql │ │ │ │ │ ├── public_rooms.sql │ │ │ │ │ ├── push_rule_stream.sql │ │ │ │ │ └── threepid_guest_access_tokens.sql │ │ │ │ ├── 31 │ │ │ │ │ ├── invites.sql │ │ │ │ │ ├── local_media_repository_url_cache.sql │ │ │ │ │ ├── pushers_0.py │ │ │ │ │ ├── pushers_index.sql │ │ │ │ │ └── search_update.py │ │ │ │ ├── 32 │ │ │ │ │ ├── events.sql │ │ │ │ │ ├── openid.sql │ │ │ │ │ ├── pusher_throttle.sql │ │ │ │ │ ├── remove_indices.sql │ │ │ │ │ └── reports.sql │ │ │ │ ├── 33 │ │ │ │ │ ├── access_tokens_device_index.sql │ │ │ │ │ ├── devices.sql │ │ │ │ │ ├── devices_for_e2e_keys.sql │ │ │ │ │ ├── devices_for_e2e_keys_clear_unknown_device.sql │ │ │ │ │ ├── event_fields.py │ │ │ │ │ ├── remote_media_ts.py │ │ │ │ │ └── user_ips_index.sql │ │ │ │ ├── 34 │ │ │ │ │ ├── appservice_stream.sql │ │ │ │ │ ├── cache_stream.py │ │ │ │ │ ├── device_inbox.sql │ │ │ │ │ ├── push_display_name_rename.sql │ │ │ │ │ └── received_txn_purge.py │ │ │ │ ├── 35 │ │ │ │ │ ├── contains_url.sql │ │ │ │ │ ├── device_outbox.sql │ │ │ │ │ ├── device_stream_id.sql │ │ │ │ │ ├── event_push_actions_index.sql │ │ │ │ │ ├── public_room_list_change_stream.sql │ │ │ │ │ └── stream_order_to_extrem.sql │ │ │ │ ├── 36 │ │ │ │ │ └── readd_public_rooms.sql │ │ │ │ ├── 37 │ │ │ │ │ ├── remove_auth_idx.py │ │ │ │ │ └── user_threepids.sql │ │ │ │ ├── 38 │ │ │ │ │ └── postgres_fts_gist.sql │ │ │ │ ├── 39 │ │ │ │ │ ├── appservice_room_list.sql │ │ │ │ │ ├── device_federation_stream_idx.sql │ │ │ │ │ ├── event_push_index.sql │ │ │ │ │ ├── federation_out_position.sql │ │ │ │ │ └── membership_profile.sql │ │ │ │ ├── 40 │ │ │ │ │ ├── current_state_idx.sql │ │ │ │ │ ├── device_inbox.sql │ │ │ │ │ ├── device_list_streams.sql │ │ │ │ │ ├── event_push_summary.sql │ │ │ │ │ └── pushers.sql │ │ │ │ ├── 41 │ │ │ │ │ ├── device_list_stream_idx.sql │ │ │ │ │ ├── device_outbound_index.sql │ │ │ │ │ ├── event_search_event_id_idx.sql │ │ │ │ │ └── ratelimit.sql │ │ │ │ ├── 42 │ │ │ │ │ ├── current_state_delta.sql │ │ │ │ │ ├── device_list_last_id.sql │ │ │ │ │ ├── event_auth_state_only.sql │ │ │ │ │ └── user_dir.py │ │ │ │ ├── 43 │ │ │ │ │ ├── blocked_rooms.sql │ │ │ │ │ ├── quarantine_media.sql │ │ │ │ │ ├── url_cache.sql │ │ │ │ │ └── user_share.sql │ │ │ │ ├── 44 │ │ │ │ │ └── expire_url_cache.sql │ │ │ │ ├── 45 │ │ │ │ │ ├── group_server.sql │ │ │ │ │ └── profile_cache.sql │ │ │ │ ├── 46 │ │ │ │ │ ├── drop_refresh_tokens.sql │ │ │ │ │ ├── drop_unique_deleted_pushers.sql │ │ │ │ │ ├── group_server.sql │ │ │ │ │ ├── local_media_repository_url_idx.sql │ │ │ │ │ ├── user_dir_null_room_ids.sql │ │ │ │ │ └── user_dir_typos.sql │ │ │ │ ├── 47 │ │ │ │ │ ├── last_access_media.sql │ │ │ │ │ ├── postgres_fts_gin.sql │ │ │ │ │ └── push_actions_staging.sql │ │ │ │ ├── 48 │ │ │ │ │ ├── add_user_consent.sql │ │ │ │ │ ├── add_user_ips_last_seen_index.sql │ │ │ │ │ ├── deactivated_users.sql │ │ │ │ │ ├── group_unique_indexes.py │ │ │ │ │ └── groups_joinable.sql │ │ │ │ ├── 49 │ │ │ │ │ ├── add_user_consent_server_notice_sent.sql │ │ │ │ │ ├── add_user_daily_visits.sql │ │ │ │ │ └── add_user_ips_last_seen_only_index.sql │ │ │ │ ├── 50 │ │ │ │ │ ├── add_creation_ts_users_index.sql │ │ │ │ │ ├── erasure_store.sql │ │ │ │ │ └── make_event_content_nullable.py │ │ │ │ ├── 51 │ │ │ │ │ ├── e2e_room_keys.sql │ │ │ │ │ └── monthly_active_users.sql │ │ │ │ ├── 52 │ │ │ │ │ ├── add_event_to_state_group_index.sql │ │ │ │ │ ├── device_list_streams_unique_idx.sql │ │ │ │ │ └── e2e_room_keys.sql │ │ │ │ ├── 53 │ │ │ │ │ ├── add_user_type_to_users.sql │ │ │ │ │ ├── drop_sent_transactions.sql │ │ │ │ │ ├── event_format_version.sql │ │ │ │ │ ├── user_dir_populate.sql │ │ │ │ │ ├── user_ips_index.sql │ │ │ │ │ ├── user_share.sql │ │ │ │ │ ├── user_threepid_id.sql │ │ │ │ │ └── users_in_public_rooms.sql │ │ │ │ ├── 54 │ │ │ │ │ ├── account_validity_with_renewal.sql │ │ │ │ │ ├── add_validity_to_server_keys.sql │ │ │ │ │ ├── delete_forward_extremities.sql │ │ │ │ │ ├── drop_legacy_tables.sql │ │ │ │ │ ├── drop_presence_list.sql │ │ │ │ │ ├── relations.sql │ │ │ │ │ ├── stats.sql │ │ │ │ │ └── stats2.sql │ │ │ │ ├── 55 │ │ │ │ │ ├── access_token_expiry.sql │ │ │ │ │ ├── track_threepid_validations.sql │ │ │ │ │ └── users_alter_deactivated.sql │ │ │ │ ├── 56 │ │ │ │ │ ├── add_spans_to_device_lists.sql │ │ │ │ │ ├── current_state_events_membership.sql │ │ │ │ │ ├── current_state_events_membership_mk2.sql │ │ │ │ │ ├── delete_keys_from_deleted_backups.sql │ │ │ │ │ ├── destinations_failure_ts.sql │ │ │ │ │ ├── destinations_retry_interval_type.sql.postgres │ │ │ │ │ ├── device_stream_id_insert.sql │ │ │ │ │ ├── devices_last_seen.sql │ │ │ │ │ ├── drop_unused_event_tables.sql │ │ │ │ │ ├── event_expiry.sql │ │ │ │ │ ├── event_labels.sql │ │ │ │ │ ├── event_labels_background_update.sql │ │ │ │ │ ├── fix_room_keys_index.sql │ │ │ │ │ ├── hidden_devices.sql │ │ │ │ │ ├── hidden_devices_fix.sql.sqlite │ │ │ │ │ ├── nuke_empty_communities_from_db.sql │ │ │ │ │ ├── public_room_list_idx.sql │ │ │ │ │ ├── redaction_censor.sql │ │ │ │ │ ├── redaction_censor2.sql │ │ │ │ │ ├── redaction_censor3_fix_update.sql.postgres │ │ │ │ │ ├── redaction_censor4.sql │ │ │ │ │ ├── remove_tombstoned_rooms_from_directory.sql │ │ │ │ │ ├── room_key_etag.sql │ │ │ │ │ ├── room_membership_idx.sql │ │ │ │ │ ├── room_retention.sql │ │ │ │ │ ├── signing_keys.sql │ │ │ │ │ ├── signing_keys_nonunique_signatures.sql │ │ │ │ │ ├── stats_separated.sql │ │ │ │ │ ├── unique_user_filter_index.py │ │ │ │ │ ├── user_external_ids.sql │ │ │ │ │ └── users_in_public_rooms_idx.sql │ │ │ │ ├── 57 │ │ │ │ │ ├── delete_old_current_state_events.sql │ │ │ │ │ ├── device_list_remote_cache_stale.sql │ │ │ │ │ ├── local_current_membership.py │ │ │ │ │ ├── remove_sent_outbound_pokes.sql │ │ │ │ │ ├── rooms_version_column.sql │ │ │ │ │ ├── rooms_version_column_2.sql.postgres │ │ │ │ │ ├── rooms_version_column_2.sql.sqlite │ │ │ │ │ ├── rooms_version_column_3.sql.postgres │ │ │ │ │ └── rooms_version_column_3.sql.sqlite │ │ │ │ ├── 58 │ │ │ │ │ ├── 02remove_dup_outbound_pokes.sql │ │ │ │ │ ├── 03persist_ui_auth.sql │ │ │ │ │ ├── 05cache_instance.sql.postgres │ │ │ │ │ ├── 06dlols_unique_idx.py │ │ │ │ │ ├── 07add_method_to_thumbnail_constraint.sql.postgres │ │ │ │ │ ├── 07add_method_to_thumbnail_constraint.sql.sqlite │ │ │ │ │ ├── 07persist_ui_auth_ips.sql │ │ │ │ │ ├── 08_media_safe_from_quarantine.sql.postgres │ │ │ │ │ ├── 08_media_safe_from_quarantine.sql.sqlite │ │ │ │ │ ├── 09shadow_ban.sql │ │ │ │ │ ├── 10_pushrules_enabled_delete_obsolete.sql │ │ │ │ │ ├── 10drop_local_rejections_stream.sql │ │ │ │ │ ├── 10federation_pos_instance_name.sql │ │ │ │ │ ├── 11dehydration.sql │ │ │ │ │ ├── 11fallback.sql │ │ │ │ │ ├── 11user_id_seq.py │ │ │ │ │ ├── 12room_stats.sql │ │ │ │ │ ├── 13remove_presence_allow_inbound.sql │ │ │ │ │ ├── 14events_instance_name.sql │ │ │ │ │ ├── 14events_instance_name.sql.postgres │ │ │ │ │ ├── 15_catchup_destination_rooms.sql │ │ │ │ │ ├── 15unread_count.sql │ │ │ │ │ ├── 16populate_stats_process_rooms_fix.sql │ │ │ │ │ ├── 17_catchup_last_successful.sql │ │ │ │ │ ├── 18stream_positions.sql │ │ │ │ │ ├── 19instance_map.sql.postgres │ │ │ │ │ ├── 19txn_id.sql │ │ │ │ │ ├── 20instance_name_event_tables.sql │ │ │ │ │ ├── 20user_daily_visits.sql │ │ │ │ │ ├── 21as_device_stream.sql │ │ │ │ │ ├── 21drop_device_max_stream_id.sql │ │ │ │ │ ├── 22puppet_token.sql │ │ │ │ │ ├── 22users_have_local_media.sql │ │ │ │ │ ├── 23e2e_cross_signing_keys_idx.sql │ │ │ │ │ ├── 24drop_event_json_index.sql │ │ │ │ │ ├── 25user_external_ids_user_id_idx.sql │ │ │ │ │ ├── 26access_token_last_validated.sql │ │ │ │ │ ├── 27local_invites.sql │ │ │ │ │ ├── 28drop_last_used_column.sql.postgres │ │ │ │ │ └── 28drop_last_used_column.sql.sqlite │ │ │ │ ├── 59 │ │ │ │ │ ├── 01ignored_user.py │ │ │ │ │ ├── 02shard_send_to_device.sql │ │ │ │ │ ├── 03shard_send_to_device_sequence.sql.postgres │ │ │ │ │ ├── 04_event_auth_chains.sql │ │ │ │ │ ├── 04_event_auth_chains.sql.postgres │ │ │ │ │ ├── 04drop_account_data.sql │ │ │ │ │ ├── 05cache_invalidation.sql │ │ │ │ │ ├── 06chain_cover_index.sql │ │ │ │ │ ├── 06shard_account_data.sql │ │ │ │ │ ├── 06shard_account_data.sql.postgres │ │ │ │ │ ├── 07shard_account_data_fix.sql │ │ │ │ │ ├── 08delete_pushers_for_deactivated_accounts.sql │ │ │ │ │ ├── 08delete_stale_pushers.sql │ │ │ │ │ ├── 09rejected_events_metadata.sql │ │ │ │ │ ├── 10delete_purged_chain_cover.sql │ │ │ │ │ ├── 11add_knock_members_to_stats.sql │ │ │ │ │ ├── 11drop_thumbnail_constraint.sql.postgres │ │ │ │ │ ├── 12account_validity_token_used_ts_ms.sql │ │ │ │ │ ├── 12presence_stream_instance.sql │ │ │ │ │ ├── 12presence_stream_instance_seq.sql.postgres │ │ │ │ │ ├── 13users_to_send_full_presence_to.sql │ │ │ │ │ ├── 14refresh_tokens.sql │ │ │ │ │ ├── 15locks.sql │ │ │ │ │ └── 16federation_inbound_staging.sql │ │ │ │ ├── 60 │ │ │ │ │ ├── 01recreate_stream_ordering.sql.postgres │ │ │ │ │ └── 02change_stream_ordering_columns.sql.postgres │ │ │ │ ├── 61 │ │ │ │ │ ├── 01change_appservices_txns.sql.postgres │ │ │ │ │ ├── 01insertion_event_lookups.sql │ │ │ │ │ ├── 02drop_redundant_room_depth_index.sql │ │ │ │ │ └── 03recreate_min_depth.py │ │ │ │ ├── 62 │ │ │ │ │ └── 01insertion_event_extremities.sql │ │ │ │ ├── 63 │ │ │ │ │ ├── 01create_registration_tokens.sql │ │ │ │ │ ├── 02delete_unlinked_email_pushers.sql │ │ │ │ │ ├── 02populate-rooms-creator.sql │ │ │ │ │ ├── 03session_store.sql │ │ │ │ │ └── 04add_presence_stream_not_offline_index.sql │ │ │ │ ├── 64 │ │ │ │ │ ├── 01msc2716_chunk_to_batch_rename.sql.postgres │ │ │ │ │ └── 01msc2716_chunk_to_batch_rename.sql.sqlite │ │ │ │ ├── 65 │ │ │ │ │ ├── 01msc2716_insertion_event_edges.sql │ │ │ │ │ ├── 03remove_hidden_devices_from_device_inbox.sql │ │ │ │ │ ├── 04_local_group_updates.sql │ │ │ │ │ ├── 05_remove_room_stats_historical_and_user_stats_historical.sql │ │ │ │ │ ├── 06remove_deleted_devices_from_device_inbox.sql │ │ │ │ │ ├── 07_arbitrary_relations.sql │ │ │ │ │ ├── 08_device_inbox_background_updates.sql │ │ │ │ │ ├── 10_expirable_refresh_tokens.sql │ │ │ │ │ └── 11_devices_auth_provider_session.sql │ │ │ │ ├── 67 │ │ │ │ │ └── 01drop_public_room_list_stream.sql │ │ │ │ ├── 68 │ │ │ │ │ ├── 01event_columns.sql │ │ │ │ │ ├── 02_msc2409_add_device_id_appservice_stream_type.sql │ │ │ │ │ ├── 03_delete_account_data_for_deactivated_accounts.sql │ │ │ │ │ ├── 04_refresh_tokens_index_next_token_id.sql │ │ │ │ │ ├── 04partial_state_rooms.sql │ │ │ │ │ ├── 05_delete_non_strings_from_event_search.sql.sqlite │ │ │ │ │ ├── 05partial_state_rooms_triggers.py │ │ │ │ │ └── 06_msc3202_add_device_list_appservice_stream_type.sql │ │ │ │ ├── 69 │ │ │ │ │ ├── 01as_txn_seq.py │ │ │ │ │ ├── 01device_list_oubound_by_room.sql │ │ │ │ │ └── 02cache_invalidation_index.sql │ │ │ │ ├── 70 │ │ │ │ │ └── 01clean_table_purged_rooms.sql │ │ │ │ ├── 71 │ │ │ │ │ ├── 01rebuild_event_edges.sql.postgres │ │ │ │ │ ├── 01rebuild_event_edges.sql.sqlite │ │ │ │ │ ├── 01remove_noop_background_updates.sql │ │ │ │ │ └── 02event_push_summary_unique.sql │ │ │ │ ├── 72 │ │ │ │ │ ├── 01add_room_type_to_state_stats.sql │ │ │ │ │ ├── 01event_push_summary_receipt.sql │ │ │ │ │ ├── 02event_push_actions_index.sql │ │ │ │ │ ├── 03bg_populate_events_columns.py │ │ │ │ │ ├── 03drop_event_reference_hashes.sql │ │ │ │ │ ├── 03remove_groups.sql │ │ │ │ │ ├── 04drop_column_application_services_state_last_txn.sql.postgres │ │ │ │ │ ├── 04drop_column_application_services_state_last_txn.sql.sqlite │ │ │ │ │ ├── 05receipts_event_stream_ordering.sql │ │ │ │ │ ├── 05remove_unstable_private_read_receipts.sql │ │ │ │ │ ├── 06add_consent_ts_to_users.sql │ │ │ │ │ ├── 06thread_notifications.sql │ │ │ │ │ ├── 07force_update_current_state_events_membership.py │ │ │ │ │ ├── 07thread_receipts.sql.postgres │ │ │ │ │ ├── 07thread_receipts.sql.sqlite │ │ │ │ │ ├── 08begin_cache_invalidation_seq_at_2.sql.postgres │ │ │ │ │ ├── 08thread_receipts.sql │ │ │ │ │ └── 09partial_indices.sql.sqlite │ │ │ │ ├── 73 │ │ │ │ │ ├── 01event_failed_pull_attempts.sql │ │ │ │ │ ├── 02add_pusher_enabled.sql │ │ │ │ │ ├── 02room_id_indexes_for_purging.sql │ │ │ │ │ ├── 03pusher_device_id.sql │ │ │ │ │ ├── 03users_approved_column.sql │ │ │ │ │ ├── 04partial_join_details.sql │ │ │ │ │ ├── 04pending_device_list_updates.sql │ │ │ │ │ ├── 05old_push_actions.sql.postgres │ │ │ │ │ ├── 05old_push_actions.sql.sqlite │ │ │ │ │ ├── 06thread_notifications_thread_id_idx.sql │ │ │ │ │ ├── 08thread_receipts_non_null.sql.postgres │ │ │ │ │ ├── 08thread_receipts_non_null.sql.sqlite │ │ │ │ │ ├── 09partial_joined_via_destination.sql │ │ │ │ │ ├── 09threads_table.sql │ │ │ │ │ ├── 10_update_sqlite_fts4_tokenizer.py │ │ │ │ │ ├── 10login_tokens.sql │ │ │ │ │ ├── 11event_search_room_id_n_distinct.sql.postgres │ │ │ │ │ ├── 12refactor_device_list_outbound_pokes.sql │ │ │ │ │ ├── 13add_device_lists_index.sql │ │ │ │ │ ├── 20_un_partial_stated_room_stream.sql │ │ │ │ │ ├── 21_un_partial_stated_room_stream_seq.sql.postgres │ │ │ │ │ ├── 22_rebuild_user_dir_stats.sql │ │ │ │ │ ├── 22_un_partial_stated_event_stream.sql │ │ │ │ │ ├── 23_fix_thread_index.sql │ │ │ │ │ ├── 23_un_partial_stated_room_stream_seq.sql.postgres │ │ │ │ │ ├── 24_events_jump_to_date_index.sql │ │ │ │ │ └── 25drop_presence.sql │ │ │ │ ├── 74 │ │ │ │ │ ├── 01_user_directory_stale_remote_users.sql │ │ │ │ │ ├── 02_set_device_id_for_pushers_bg_update.sql │ │ │ │ │ ├── 03_membership_tables_event_stream_ordering.sql.postgres │ │ │ │ │ ├── 03_membership_tables_event_stream_ordering.sql.sqlite │ │ │ │ │ ├── 03_room_membership_index.sql │ │ │ │ │ ├── 04_delete_e2e_backup_keys_for_deactivated_users.sql │ │ │ │ │ ├── 04_membership_tables_event_stream_ordering_triggers.py │ │ │ │ │ ├── 05_events_txn_id_device_id.sql │ │ │ │ │ └── 90COMMENTS_destinations.sql.postgres │ │ │ │ ├── 76 │ │ │ │ │ ├── 01_add_profiles_full_user_id_column.sql │ │ │ │ │ ├── 02_add_user_filters_full_user_id_column.sql │ │ │ │ │ ├── 03_per_user_experimental_features.sql │ │ │ │ │ └── 04_add_room_forgetter.sql │ │ │ │ ├── 77 │ │ │ │ │ ├── 01_add_profiles_not_valid_check.sql.postgres │ │ │ │ │ ├── 02_add_user_filters_not_valid_check.sql.postgres │ │ │ │ │ ├── 03bg_populate_full_user_id_profiles.sql │ │ │ │ │ ├── 04bg_populate_full_user_id_user_filters.sql │ │ │ │ │ ├── 05thread_notifications_backfill.sql │ │ │ │ │ ├── 06thread_notifications_not_null.sql.sqlite │ │ │ │ │ ├── 06thread_notifications_not_null_event_push_actions.sql.postgres │ │ │ │ │ ├── 06thread_notifications_not_null_event_push_actions_staging.sql.postgres │ │ │ │ │ ├── 06thread_notifications_not_null_event_push_summary.sql.postgres │ │ │ │ │ └── 14bg_indices_event_stream_ordering.sql │ │ │ │ ├── 78 │ │ │ │ │ ├── 01_validate_and_update_profiles.py │ │ │ │ │ ├── 02_validate_and_update_user_filters.py │ │ │ │ │ ├── 03_remove_unused_indexes_user_filters.py │ │ │ │ │ ├── 03event_extremities_constraints.py │ │ │ │ │ └── 04_add_full_user_id_index_user_filters.py │ │ │ │ ├── 79 │ │ │ │ │ ├── 03_read_write_locks_triggers.sql.postgres │ │ │ │ │ ├── 03_read_write_locks_triggers.sql.sqlite │ │ │ │ │ ├── 04_mitigate_stream_ordering_update_race.py │ │ │ │ │ ├── 05_read_write_locks_triggers.sql.postgres │ │ │ │ │ └── 05_read_write_locks_triggers.sql.sqlite │ │ │ │ ├── 80 │ │ │ │ │ ├── 01_users_alter_locked.sql │ │ │ │ │ ├── 02_read_write_locks_unlogged.sql.postgres │ │ │ │ │ ├── 02_scheduled_tasks.sql │ │ │ │ │ ├── 03_read_write_locks_triggers.sql.postgres │ │ │ │ │ └── 04_read_write_locks_deadlock.sql.postgres │ │ │ │ ├── 82 │ │ │ │ │ ├── 02_scheduled_tasks_index.sql │ │ │ │ │ ├── 04_add_indices_for_purging_rooms.sql │ │ │ │ │ └── 05gaps.sql │ │ │ │ └── 83 │ │ │ │ │ ├── 01_drop_old_tables.sql │ │ │ │ │ ├── 03_instance_name_receipts.sql.sqlite │ │ │ │ │ ├── 05_cross_signing_key_update_grant.sql │ │ │ │ │ └── 06_event_push_summary_room.sql │ │ │ └── full_schemas │ │ │ │ └── 72 │ │ │ │ ├── full.sql.postgres │ │ │ │ └── full.sql.sqlite │ │ └── state │ │ │ ├── delta │ │ │ ├── 23 │ │ │ │ └── drop_state_index.sql │ │ │ ├── 32 │ │ │ │ └── remove_state_indices.sql │ │ │ ├── 35 │ │ │ │ ├── add_state_index.sql │ │ │ │ ├── state.sql │ │ │ │ └── state_dedupe.sql │ │ │ ├── 47 │ │ │ │ └── state_group_seq.py │ │ │ ├── 56 │ │ │ │ └── state_group_room_idx.sql │ │ │ ├── 61 │ │ │ │ └── 02state_groups_state_n_distinct.sql.postgres │ │ │ └── 70 │ │ │ │ └── 08_state_group_edges_unique.sql │ │ │ └── full_schemas │ │ │ └── 72 │ │ │ ├── full.sql.postgres │ │ │ └── full.sql.sqlite │ ├── types.py │ └── util │ │ ├── __init__.py │ │ ├── id_generators.py │ │ ├── partial_state_events_tracker.py │ │ └── sequence.py ├── streams │ ├── __init__.py │ ├── config.py │ └── events.py ├── types │ ├── __init__.py │ └── state.py ├── util │ ├── __init__.py │ ├── async_helpers.py │ ├── batching_queue.py │ ├── caches │ │ ├── __init__.py │ │ ├── cached_call.py │ │ ├── deferred_cache.py │ │ ├── descriptors.py │ │ ├── dictionary_cache.py │ │ ├── expiringcache.py │ │ ├── lrucache.py │ │ ├── response_cache.py │ │ ├── stream_change_cache.py │ │ ├── treecache.py │ │ └── ttlcache.py │ ├── cancellation.py │ ├── check_dependencies.py │ ├── daemonize.py │ ├── distributor.py │ ├── file_consumer.py │ ├── frozenutils.py │ ├── gai_resolver.py │ ├── hash.py │ ├── httpresourcetree.py │ ├── iterutils.py │ ├── linked_list.py │ ├── logcontext.py │ ├── logformatter.py │ ├── macaroons.py │ ├── manhole.py │ ├── metrics.py │ ├── module_loader.py │ ├── msisdn.py │ ├── patch_inline_callbacks.py │ ├── ratelimitutils.py │ ├── retryutils.py │ ├── rlimit.py │ ├── rust.py │ ├── stringutils.py │ ├── task_scheduler.py │ ├── templates.py │ ├── threepids.py │ └── wheel_timer.py └── visibility.py ├── synmark ├── __init__.py ├── __main__.py └── suites │ ├── __init__.py │ ├── logging.py │ ├── lrucache.py │ └── lrucache_evict.py ├── sytest-blacklist ├── tests ├── __init__.py ├── api │ ├── __init__.py │ ├── test_auth.py │ ├── test_errors.py │ ├── test_filtering.py │ └── test_ratelimiting.py ├── app │ ├── __init__.py │ ├── test_homeserver_start.py │ ├── test_openid_listener.py │ └── test_phone_stats_home.py ├── appservice │ ├── __init__.py │ ├── test_api.py │ ├── test_appservice.py │ └── test_scheduler.py ├── config │ ├── __init__.py │ ├── test___main__.py │ ├── test_api.py │ ├── test_appservice.py │ ├── test_background_update.py │ ├── test_base.py │ ├── test_cache.py │ ├── test_database.py │ ├── test_generate.py │ ├── test_load.py │ ├── test_oauth_delegation.py │ ├── test_ratelimiting.py │ ├── test_registration_config.py │ ├── test_room_directory.py │ ├── test_server.py │ ├── test_tls.py │ ├── test_util.py │ ├── test_workers.py │ └── utils.py ├── crypto │ ├── __init__.py │ ├── test_event_signing.py │ └── test_keyring.py ├── events │ ├── __init__.py │ ├── test_presence_router.py │ ├── test_snapshot.py │ └── test_utils.py ├── federation │ ├── __init__.py │ ├── test_complexity.py │ ├── test_federation_catch_up.py │ ├── test_federation_client.py │ ├── test_federation_sender.py │ ├── test_federation_server.py │ └── transport │ │ ├── __init__.py │ │ ├── server │ │ ├── __init__.py │ │ └── test__base.py │ │ ├── test_client.py │ │ ├── test_knocking.py │ │ └── test_server.py ├── handlers │ ├── __init__.py │ ├── oidc_test_key.p8 │ ├── oidc_test_key.pub.pem │ ├── test_admin.py │ ├── test_appservice.py │ ├── test_auth.py │ ├── test_cas.py │ ├── test_deactivate_account.py │ ├── test_device.py │ ├── test_directory.py │ ├── test_e2e_keys.py │ ├── test_e2e_room_keys.py │ ├── test_federation.py │ ├── test_federation_event.py │ ├── test_message.py │ ├── test_oauth_delegation.py │ ├── test_oidc.py │ ├── test_password_providers.py │ ├── test_presence.py │ ├── test_profile.py │ ├── test_receipts.py │ ├── test_register.py │ ├── test_room.py │ ├── test_room_member.py │ ├── test_room_summary.py │ ├── test_saml.py │ ├── test_send_email.py │ ├── test_sso.py │ ├── test_stats.py │ ├── test_sync.py │ ├── test_typing.py │ ├── test_user_directory.py │ └── test_worker_lock.py ├── http │ ├── __init__.py │ ├── ca.crt │ ├── ca.key │ ├── federation │ │ ├── __init__.py │ │ ├── test_matrix_federation_agent.py │ │ └── test_srv_resolver.py │ ├── server.key │ ├── server │ │ ├── __init__.py │ │ └── _base.py │ ├── test_additional_resource.py │ ├── test_client.py │ ├── test_endpoint.py │ ├── test_matrixfederationclient.py │ ├── test_proxy.py │ ├── test_proxyagent.py │ ├── test_servlet.py │ ├── test_simple_client.py │ └── test_site.py ├── logging │ ├── __init__.py │ ├── test_opentracing.py │ ├── test_remote_handler.py │ └── test_terse_json.py ├── media │ ├── __init__.py │ ├── test_base.py │ ├── test_filepath.py │ ├── test_html_preview.py │ ├── test_media_retention.py │ ├── test_media_storage.py │ ├── test_oembed.py │ └── test_url_previewer.py ├── metrics │ ├── __init__.py │ ├── test_background_process_metrics.py │ └── test_metrics.py ├── module_api │ ├── __init__.py │ ├── test_account_data_manager.py │ ├── test_api.py │ └── test_event_unsigned_addition.py ├── push │ ├── __init__.py │ ├── test_bulk_push_rule_evaluator.py │ ├── test_email.py │ ├── test_http.py │ ├── test_presentable_names.py │ └── test_push_rule_evaluator.py ├── replication │ ├── __init__.py │ ├── _base.py │ ├── http │ │ ├── __init__.py │ │ └── test__base.py │ ├── storage │ │ ├── __init__.py │ │ ├── _base.py │ │ └── test_events.py │ ├── tcp │ │ ├── __init__.py │ │ ├── streams │ │ │ ├── __init__.py │ │ │ ├── test_account_data.py │ │ │ ├── test_events.py │ │ │ ├── test_federation.py │ │ │ ├── test_partial_state.py │ │ │ ├── test_receipts.py │ │ │ ├── test_to_device.py │ │ │ └── test_typing.py │ │ ├── test_commands.py │ │ └── test_handler.py │ ├── test_auth.py │ ├── test_client_reader_shard.py │ ├── test_federation_ack.py │ ├── test_federation_sender_shard.py │ ├── test_module_cache_invalidation.py │ ├── test_multi_media_repo.py │ ├── test_pusher_shard.py │ ├── test_sharded_event_persister.py │ └── test_sharded_receipts.py ├── rest │ ├── __init__.py │ ├── admin │ │ ├── __init__.py │ │ ├── test_admin.py │ │ ├── test_background_updates.py │ │ ├── test_device.py │ │ ├── test_event_reports.py │ │ ├── test_federation.py │ │ ├── test_jwks.py │ │ ├── test_media.py │ │ ├── test_registration_tokens.py │ │ ├── test_room.py │ │ ├── test_server_notice.py │ │ ├── test_statistics.py │ │ ├── test_user.py │ │ └── test_username_available.py │ ├── client │ │ ├── __init__.py │ │ ├── test_account.py │ │ ├── test_account_data.py │ │ ├── test_auth.py │ │ ├── test_auth_issuer.py │ │ ├── test_capabilities.py │ │ ├── test_consent.py │ │ ├── test_devices.py │ │ ├── test_directory.py │ │ ├── test_ephemeral_message.py │ │ ├── test_events.py │ │ ├── test_filter.py │ │ ├── test_identity.py │ │ ├── test_keys.py │ │ ├── test_login.py │ │ ├── test_login_token_request.py │ │ ├── test_models.py │ │ ├── test_mutual_rooms.py │ │ ├── test_notifications.py │ │ ├── test_password_policy.py │ │ ├── test_power_levels.py │ │ ├── test_presence.py │ │ ├── test_profile.py │ │ ├── test_push_rule_attrs.py │ │ ├── test_read_marker.py │ │ ├── test_receipts.py │ │ ├── test_redactions.py │ │ ├── test_register.py │ │ ├── test_relations.py │ │ ├── test_rendezvous.py │ │ ├── test_report_event.py │ │ ├── test_retention.py │ │ ├── test_rooms.py │ │ ├── test_sendtodevice.py │ │ ├── test_shadow_banned.py │ │ ├── test_sync.py │ │ ├── test_third_party_rules.py │ │ ├── test_transactions.py │ │ ├── test_typing.py │ │ ├── test_upgrade_room.py │ │ └── utils.py │ ├── key │ │ ├── __init__.py │ │ └── v2 │ │ │ ├── __init__.py │ │ │ └── test_remote_key_resource.py │ ├── media │ │ ├── __init__.py │ │ ├── test_domain_blocking.py │ │ └── test_url_preview.py │ ├── test_health.py │ └── test_well_known.py ├── scripts │ ├── __init__.py │ └── test_new_matrix_user.py ├── server.py ├── server_notices │ ├── __init__.py │ ├── test_consent.py │ └── test_resource_limits_server_notices.py ├── state │ ├── __init__.py │ └── test_v2.py ├── storage │ ├── __init__.py │ ├── databases │ │ ├── __init__.py │ │ └── main │ │ │ ├── __init__.py │ │ │ ├── test_cache.py │ │ │ ├── test_deviceinbox.py │ │ │ ├── test_end_to_end_keys.py │ │ │ ├── test_events_worker.py │ │ │ ├── test_lock.py │ │ │ ├── test_receipts.py │ │ │ └── test_room.py │ ├── test__base.py │ ├── test_account_data.py │ ├── test_appservice.py │ ├── test_background_update.py │ ├── test_base.py │ ├── test_cleanup_extrems.py │ ├── test_client_ips.py │ ├── test_database.py │ ├── test_devices.py │ ├── test_directory.py │ ├── test_e2e_room_keys.py │ ├── test_end_to_end_keys.py │ ├── test_event_chain.py │ ├── test_event_federation.py │ ├── test_event_metrics.py │ ├── test_event_push_actions.py │ ├── test_events.py │ ├── test_id_generators.py │ ├── test_main.py │ ├── test_monthly_active_users.py │ ├── test_profile.py │ ├── test_purge.py │ ├── test_receipts.py │ ├── test_redaction.py │ ├── test_registration.py │ ├── test_relations.py │ ├── test_rollback_worker.py │ ├── test_room.py │ ├── test_room_search.py │ ├── test_roommember.py │ ├── test_state.py │ ├── test_stream.py │ ├── test_transactions.py │ ├── test_txn_limit.py │ ├── test_unsafe_locale.py │ ├── test_user_directory.py │ ├── test_user_filters.py │ └── util │ │ ├── __init__.py │ │ └── test_partial_state_events_tracker.py ├── test_distributor.py ├── test_event_auth.py ├── test_federation.py ├── test_mau.py ├── test_phone_home.py ├── test_rust.py ├── test_server.py ├── test_state.py ├── test_terms_auth.py ├── test_test_utils.py ├── test_types.py ├── test_utils │ ├── __init__.py │ ├── event_injection.py │ ├── html_parsers.py │ ├── logging_setup.py │ └── oidc.py ├── test_visibility.py ├── types │ ├── __init__.py │ └── test_state.py ├── unittest.py ├── util │ ├── __init__.py │ ├── caches │ │ ├── __init__.py │ │ ├── test_cached_call.py │ │ ├── test_deferred_cache.py │ │ ├── test_descriptors.py │ │ ├── test_response_cache.py │ │ └── test_ttlcache.py │ ├── test_async_helpers.py │ ├── test_batching_queue.py │ ├── test_check_dependencies.py │ ├── test_dict_cache.py │ ├── test_expiring_cache.py │ ├── test_file_consumer.py │ ├── test_itertools.py │ ├── test_linearizer.py │ ├── test_logcontext.py │ ├── test_logformatter.py │ ├── test_lrucache.py │ ├── test_macaroons.py │ ├── test_ratelimitutils.py │ ├── test_retryutils.py │ ├── test_rwlock.py │ ├── test_stream_change_cache.py │ ├── test_stringutils.py │ ├── test_task_scheduler.py │ ├── test_threepids.py │ ├── test_treecache.py │ └── test_wheel_timer.py └── utils.py └── tox.ini /.ci/latest_deps_build_failed_issue_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CI run against latest deps is failing 3 | --- 4 | See https://github.com/{{env.GITHUB_REPOSITORY}}/actions/runs/{{env.GITHUB_RUN_ID}} 5 | -------------------------------------------------------------------------------- /.ci/postgres-config.yaml: -------------------------------------------------------------------------------- 1 | # Configuration file used for testing the 'synapse_port_db' script. 2 | # Tells the script to connect to the postgresql database that will be available in the 3 | # CI's Docker setup at the point where this file is considered. 4 | server_name: "localhost:8800" 5 | 6 | signing_key_path: ".ci/test.signing.key" 7 | 8 | report_stats: false 9 | 10 | database: 11 | name: "psycopg2" 12 | args: 13 | user: postgres 14 | host: localhost 15 | password: postgres 16 | database: synapse 17 | 18 | # Suppress the key server warning. 19 | trusted_key_servers: [] 20 | -------------------------------------------------------------------------------- /.ci/scripts/check_lockfile.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | import sys 3 | 4 | if sys.version_info < (3, 11): 5 | raise RuntimeError("Requires at least Python 3.11, to import tomllib") 6 | 7 | import tomllib 8 | 9 | with open("poetry.lock", "rb") as f: 10 | lockfile = tomllib.load(f) 11 | 12 | try: 13 | lock_version = lockfile["metadata"]["lock-version"] 14 | assert lock_version == "2.0" 15 | except Exception: 16 | print( 17 | """\ 18 | Lockfile is not version 2.0. You probably need to upgrade poetry on your local box 19 | and re-run `poetry lock --no-update`. See the Poetry cheat sheet at 20 | https://matrix-org.github.io/synapse/develop/development/dependencies.html 21 | """ 22 | ) 23 | raise 24 | -------------------------------------------------------------------------------- /.ci/scripts/gotestfmt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # wraps `gotestfmt`, hiding output from successful packages unless 4 | # all tests passed. 5 | 6 | set -o pipefail 7 | set -e 8 | 9 | # tee the test results to a log, whilst also piping them into gotestfmt, 10 | # telling it to hide successful results, so that we can clearly see 11 | # unsuccessful results. 12 | tee complement.log | gotestfmt -hide successful-packages 13 | 14 | # gotestfmt will exit non-zero if there were any failures, so if we got to this 15 | # point, we must have had a successful result. 16 | echo "All tests successful; showing all test results" 17 | 18 | # Pipe the test results back through gotestfmt, showing all results. 19 | # The log file consists of JSON lines giving the test results, interspersed 20 | # with regular stdout lines (including reports of downloaded packages). 21 | grep '^{"Time":' complement.log | gotestfmt 22 | -------------------------------------------------------------------------------- /.ci/sqlite-config.yaml: -------------------------------------------------------------------------------- 1 | # Configuration file used for testing the 'synapse_port_db' script. 2 | # Tells the 'update_database' script to connect to the test SQLite database to upgrade its 3 | # schema and run background updates on it. 4 | server_name: "localhost:8800" 5 | 6 | signing_key_path: ".ci/test.signing.key" 7 | 8 | report_stats: false 9 | 10 | database: 11 | name: "sqlite3" 12 | args: 13 | database: ".ci/test_db.db" 14 | 15 | # Suppress the key server warning. 16 | trusted_key_servers: [] 17 | -------------------------------------------------------------------------------- /.ci/test_db.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/.ci/test_db.db -------------------------------------------------------------------------------- /.ci/twisted_trunk_build_failed_issue_template.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: CI run against Twisted trunk is failing 3 | --- 4 | See https://github.com/{{env.GITHUB_REPOSITORY}}/actions/runs/{{env.GITHUB_RUN_ID}} 5 | -------------------------------------------------------------------------------- /.ci/worker-blacklist: -------------------------------------------------------------------------------- 1 | # This file serves as a blacklist for SyTest tests that we expect will fail in 2 | # Synapse when run under worker mode. For more details, see sytest-blacklist. 3 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | comment: off 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: 0 # Target % coverage, can be auto. Turned off for now 8 | threshold: null 9 | base: auto 10 | patch: 11 | default: 12 | target: 0 13 | threshold: null 14 | base: auto 15 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | branch = True 3 | parallel = True 4 | include=$TOP/synapse/* 5 | data_file = $TOP/.coverage 6 | 7 | [report] 8 | precision = 2 9 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # ignore everything by default 2 | * 3 | 4 | # things to include 5 | !docker 6 | !synapse 7 | !rust 8 | !README.rst 9 | !pyproject.toml 10 | !poetry.lock 11 | !Cargo.lock 12 | !Cargo.toml 13 | !build_rust.py 14 | 15 | rust/target 16 | synapse/*.so 17 | 18 | **/__pycache__ 19 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # 4 space indentation 7 | [*.{py,pyi}] 8 | indent_style = space 9 | indent_size = 4 10 | max_line_length = 88 11 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Automatically request reviews from the synapse-core team when a pull request comes in. 2 | * @matrix-org/synapse-core -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # One username per supported platform and one custom link 2 | patreon: matrixdotorg 3 | liberapay: matrixdotorg 4 | custom: https://paypal.me/matrixdotorg 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **If you are looking for support** please ask in **#synapse:matrix.org** 2 | (using a matrix.org account if necessary). We do not use GitHub issues for 3 | support. 4 | 5 | **If you want to report a security issue** please see https://matrix.org/security-disclosure-policy/ 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Description:** 8 | 9 | 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/SUPPORT_REQUEST.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Support request 3 | about: I need support for Synapse 4 | 5 | --- 6 | 7 | Please don't file github issues asking for support. 8 | 9 | Instead, please join [`#synapse:matrix.org`](https://matrix.to/#/#synapse:matrix.org) 10 | (from a matrix.org account if necessary), and ask there. 11 | -------------------------------------------------------------------------------- /.github/SUPPORT.md: -------------------------------------------------------------------------------- 1 | [**#synapse:matrix.org**](https://matrix.to/#/#synapse:matrix.org) is the official support room for 2 | Synapse, and can be accessed by any client from https://matrix.org/docs/projects/try-matrix-now.html. 3 | Please ask for support there, rather than filing github issues. 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - # "pip" is the correct setting for poetry, per https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem 4 | package-ecosystem: "pip" 5 | directory: "/" 6 | schedule: 7 | interval: "weekly" 8 | 9 | - package-ecosystem: "docker" 10 | directory: "/docker" 11 | schedule: 12 | interval: "weekly" 13 | 14 | - package-ecosystem: "github-actions" 15 | directory: "/" 16 | schedule: 17 | interval: "weekly" 18 | 19 | - package-ecosystem: "cargo" 20 | directory: "/" 21 | versioning-strategy: "lockfile-only" 22 | schedule: 23 | interval: "weekly" 24 | -------------------------------------------------------------------------------- /.github/workflows/poetry_lockfile.yaml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: ["develop", "release-*"] 4 | paths: 5 | - poetry.lock 6 | pull_request: 7 | paths: 8 | - poetry.lock 9 | 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.ref }} 12 | cancel-in-progress: true 13 | 14 | jobs: 15 | check-sdists: 16 | name: "Check locked dependencies have sdists" 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@v4 20 | - uses: actions/setup-python@v5 21 | with: 22 | python-version: '3.x' 23 | - run: pip install tomli 24 | - run: ./scripts-dev/check_locked_deps_have_sdists.py 25 | -------------------------------------------------------------------------------- /.github/workflows/triage-incoming.yml: -------------------------------------------------------------------------------- 1 | name: Move new issues into the issue triage board 2 | 3 | on: 4 | issues: 5 | types: [ opened ] 6 | 7 | jobs: 8 | triage: 9 | uses: matrix-org/backend-meta/.github/workflows/triage-incoming.yml@v2 10 | with: 11 | project_id: 'PVT_kwDOAIB0Bs4AFDdZ' 12 | content_id: ${{ github.event.issue.node_id }} 13 | secrets: 14 | github_access_token: ${{ secrets.ELEMENT_BOT_TOKEN }} 15 | 16 | -------------------------------------------------------------------------------- /.rustfmt.toml: -------------------------------------------------------------------------------- 1 | group_imports = "StdExternalCrate" 2 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Welcome to Synapse 2 | 3 | Please see the [contributors' guide](https://matrix-org.github.io/synapse/latest/development/contributing_guide.html) in our rendered documentation. 4 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | # We make the whole Synapse folder a workspace so that we can run `cargo` 2 | # commands from the root (rather than having to cd into rust/). 3 | 4 | [workspace] 5 | members = ["rust"] 6 | resolver = "2" 7 | -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | # Installation Instructions 2 | 3 | This document has moved to the 4 | [Synapse documentation website](https://matrix-org.github.io/synapse/latest/setup/installation.html). 5 | Please update your links. 6 | 7 | The markdown source is available in [docs/setup/installation.md](docs/setup/installation.md). 8 | -------------------------------------------------------------------------------- /UPGRADE.rst: -------------------------------------------------------------------------------- 1 | Upgrading Synapse 2 | ================= 3 | 4 | This document has moved to the `Synapse documentation website `_. 5 | Please update your links. 6 | 7 | The markdown source is available in `docs/upgrade.md `_. 8 | -------------------------------------------------------------------------------- /build_rust.py: -------------------------------------------------------------------------------- 1 | # A build script for poetry that adds the rust extension. 2 | 3 | import os 4 | from typing import Any, Dict 5 | 6 | from setuptools_rust import Binding, RustExtension 7 | 8 | 9 | def build(setup_kwargs: Dict[str, Any]) -> None: 10 | original_project_dir = os.path.dirname(os.path.realpath(__file__)) 11 | cargo_toml_path = os.path.join(original_project_dir, "rust", "Cargo.toml") 12 | 13 | extension = RustExtension( 14 | target="synapse.synapse_rust", 15 | path=cargo_toml_path, 16 | binding=Binding.PyO3, 17 | py_limited_api=True, 18 | # We force always building in release mode, as we can't tell the 19 | # difference between using `poetry` in development vs production. 20 | debug=False, 21 | ) 22 | setup_kwargs.setdefault("rust_extensions", []).append(extension) 23 | setup_kwargs["zip_safe"] = False 24 | -------------------------------------------------------------------------------- /changelog.d/.gitignore: -------------------------------------------------------------------------------- 1 | !.gitignore 2 | -------------------------------------------------------------------------------- /changelog.d/16533.doc: -------------------------------------------------------------------------------- 1 | Added version picker for Synapse documentation. Contributed by @Dmytro27Ind. -------------------------------------------------------------------------------- /changelog.d/16679.feature: -------------------------------------------------------------------------------- 1 | Add config options to set the avatar and the topic of the server notices room. 2 | -------------------------------------------------------------------------------- /changelog.d/16696.feature: -------------------------------------------------------------------------------- 1 | Add a setting to be able to tweak the delay without interaction before an email is sent following a notification. 2 | -------------------------------------------------------------------------------- /changelog.d/16726.misc: -------------------------------------------------------------------------------- 1 | Update the implementation of [MSC2965](https://github.com/matrix-org/matrix-spec-proposals/pull/2965) (OIDC Provider discovery). 2 | -------------------------------------------------------------------------------- /changelog.d/16737.doc: -------------------------------------------------------------------------------- 1 | Clarify that `password_config.enabled: "only_for_reauth"` does not allow new logins to be created using password auth. -------------------------------------------------------------------------------- /changelog.d/16738.feature: -------------------------------------------------------------------------------- 1 | Add new Sentry configuration option `environment` for improved system monitoring. Contributed by @zeeshanrafiqrana. -------------------------------------------------------------------------------- /changelog.d/16740.bugfix: -------------------------------------------------------------------------------- 1 | Fix a long-standing bug where the signing keys generated by Synapse were world-readable. Contributed by Fabian Klemp. 2 | -------------------------------------------------------------------------------- /contrib/README.rst: -------------------------------------------------------------------------------- 1 | Community Contributions 2 | ======================= 3 | 4 | Everything in this directory are projects submitted by the community that may be useful 5 | to others. As such, the project maintainers cannot guarantee support, stability 6 | or backwards compatibility of these projects. 7 | 8 | Files in this directory should *not* be relied on directly, as they may not 9 | continue to work or exist in future. If you wish to use any of these files then 10 | they should be copied to avoid them breaking from underneath you. 11 | -------------------------------------------------------------------------------- /contrib/datagrip/common.sql: -------------------------------------------------------------------------------- 1 | ../../synapse/storage/schema/common/full_schemas/72/full.sql.postgres -------------------------------------------------------------------------------- /contrib/datagrip/datagrip-aware-of-schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/contrib/datagrip/datagrip-aware-of-schema.png -------------------------------------------------------------------------------- /contrib/datagrip/main.sql: -------------------------------------------------------------------------------- 1 | ../../synapse/storage/schema/main/full_schemas/72/full.sql.postgres -------------------------------------------------------------------------------- /contrib/datagrip/schema_version.sql: -------------------------------------------------------------------------------- 1 | ../../synapse/storage/schema/common/schema_version.sql -------------------------------------------------------------------------------- /contrib/datagrip/state.sql: -------------------------------------------------------------------------------- 1 | ../../synapse/storage/schema/state/full_schemas/72/full.sql.postgres -------------------------------------------------------------------------------- /contrib/docker_compose_workers/workers/synapse-federation-sender-1.yaml: -------------------------------------------------------------------------------- 1 | worker_app: synapse.app.federation_sender 2 | worker_name: synapse-federation-sender-1 3 | 4 | # The replication listener on the main synapse process. 5 | worker_replication_host: synapse 6 | worker_replication_http_port: 9093 7 | 8 | worker_log_config: /data/federation_sender.log.config 9 | -------------------------------------------------------------------------------- /contrib/docker_compose_workers/workers/synapse-generic-worker-1.yaml: -------------------------------------------------------------------------------- 1 | worker_app: synapse.app.generic_worker 2 | worker_name: synapse-generic-worker-1 3 | 4 | # The replication listener on the main synapse process. 5 | worker_replication_host: synapse 6 | worker_replication_http_port: 9093 7 | 8 | worker_listeners: 9 | - type: http 10 | port: 8081 11 | x_forwarded: true 12 | resources: 13 | - names: [client, federation] 14 | 15 | worker_log_config: /data/worker.log.config 16 | -------------------------------------------------------------------------------- /contrib/grafana/README.md: -------------------------------------------------------------------------------- 1 | # Using the Synapse Grafana dashboard 2 | 3 | 0. Set up Prometheus and Grafana. Out of scope for this readme. Useful documentation about using Grafana with Prometheus: http://docs.grafana.org/features/datasources/prometheus/ 4 | 1. Have your Prometheus scrape your Synapse. https://matrix-org.github.io/synapse/latest/metrics-howto.html 5 | 2. Import dashboard into Grafana. Download `synapse.json`. Import it to Grafana and select the correct Prometheus datasource. http://docs.grafana.org/reference/export_import/ 6 | 3. Set up required recording rules. [contrib/prometheus](../prometheus) 7 | -------------------------------------------------------------------------------- /contrib/purge_api/README.md: -------------------------------------------------------------------------------- 1 | Purge history API examples 2 | ========================== 3 | 4 | # `purge_history.sh` 5 | 6 | A bash file, that uses the 7 | [purge history API](https://matrix-org.github.io/synapse/latest/admin_api/purge_history_api.html) 8 | to purge all messages in a list of rooms up to a certain event. You can select a 9 | timeframe or a number of messages that you want to keep in the room. 10 | 11 | Just configure the variables DOMAIN, ADMIN, ROOMS_ARRAY and TIME at the top of 12 | the script. 13 | 14 | # `purge_remote_media.sh` 15 | 16 | A bash file, that uses the 17 | [purge history API](https://matrix-org.github.io/synapse/latest/admin_api/purge_history_api.html) 18 | to purge all old cached remote media. 19 | -------------------------------------------------------------------------------- /contrib/systemd-with-workers/README.md: -------------------------------------------------------------------------------- 1 | The documentation for using systemd to manage synapse workers is now part of 2 | the main synapse distribution. See 3 | [docs/systemd-with-workers](https://matrix-org.github.io/synapse/latest/systemd-with-workers/index.html). 4 | -------------------------------------------------------------------------------- /contrib/systemd/log_config.yaml: -------------------------------------------------------------------------------- 1 | version: 1 2 | 3 | # In systemd's journal, loglevel is implicitly stored, so let's omit it 4 | # from the message text. 5 | formatters: 6 | journal_fmt: 7 | format: '%(name)s: [%(request)s] %(message)s' 8 | 9 | filters: 10 | context: 11 | (): synapse.logging.context.LoggingContextFilter 12 | request: "" 13 | 14 | handlers: 15 | journal: 16 | class: systemd.journal.JournalHandler 17 | formatter: journal_fmt 18 | filters: [context] 19 | SYSLOG_IDENTIFIER: synapse 20 | 21 | root: 22 | level: INFO 23 | handlers: [journal] 24 | 25 | disable_existing_loggers: False 26 | -------------------------------------------------------------------------------- /contrib/vertobot/.gitignore: -------------------------------------------------------------------------------- 1 | vucbot.yaml 2 | vertobot.yaml 3 | -------------------------------------------------------------------------------- /contrib/vertobot/config.yaml: -------------------------------------------------------------------------------- 1 | # Generic Matrix connection params 2 | matrix: 3 | server: 'matrix.org' 4 | SSL: 1 5 | 6 | # Bot-user connection details 7 | matrix-bot: 8 | user_id: '@vertobot:matrix.org' 9 | password: '' 10 | domain: 'matrix.org" 11 | as_url: 'http://localhost:8009' 12 | as_token: 'vertobot123' 13 | 14 | verto-bot: 15 | host: webrtc.freeswitch.org 16 | service: 8081 17 | url: "ws://webrtc.freeswitch.org:8081/" 18 | 19 | verto-config: 20 | passwd: 1234 21 | 22 | verto-dialog-params: 23 | useVideo: false 24 | useStereo: false 25 | tag: "webcam" 26 | login: "1008@webrtc.freeswitch.org" 27 | destination_number: "9664" 28 | caller_id_name: "FreeSWITCH User" 29 | caller_id_number: "1008" 30 | callID: "" 31 | remote_caller_id_name: "Outbound Call" 32 | remote_caller_id_number: "9664" 33 | -------------------------------------------------------------------------------- /contrib/vertobot/cpanfile: -------------------------------------------------------------------------------- 1 | requires 'parent', 0; 2 | requires 'Future', '>= 0.29'; 3 | requires 'Net::Async::Matrix', '>= 0.11_002'; 4 | requires 'Net::Async::Matrix::Utils'; 5 | requires 'Net::Async::WebSocket::Protocol', 0; 6 | requires 'Data::UUID', 0; 7 | requires 'IO::Async', '>= 0.63'; 8 | requires 'IO::Async::SSL', 0; 9 | requires 'IO::Socket::SSL', 0; 10 | requires 'YAML', 0; 11 | requires 'JSON', 0; 12 | requires 'Getopt::Long', 0; 13 | 14 | 15 | -------------------------------------------------------------------------------- /debian/.gitignore: -------------------------------------------------------------------------------- 1 | /matrix-synapse-py3.*.debhelper 2 | /matrix-synapse-py3.debhelper.log 3 | /matrix-synapse-py3.substvars 4 | /matrix-synapse-*/ 5 | /files 6 | /debhelper-build-stamp 7 | /.debhelper 8 | -------------------------------------------------------------------------------- /debian/clean: -------------------------------------------------------------------------------- 1 | exported_requirements.txt 2 | -------------------------------------------------------------------------------- /debian/dirs: -------------------------------------------------------------------------------- 1 | etc/matrix-synapse 2 | var/lib/matrix-synapse 3 | var/log/matrix-synapse 4 | -------------------------------------------------------------------------------- /debian/install: -------------------------------------------------------------------------------- 1 | debian/manage_debconf.pl /opt/venvs/matrix-synapse/lib/ 2 | -------------------------------------------------------------------------------- /debian/manpages: -------------------------------------------------------------------------------- 1 | debian/hash_password.1 2 | debian/register_new_matrix_user.1 3 | debian/synapse_port_db.1 4 | debian/synapse_review_recent_signups.1 5 | debian/synctl.1 6 | -------------------------------------------------------------------------------- /debian/matrix-synapse-py3.config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | # shellcheck disable=SC1091 6 | . /usr/share/debconf/confmodule 7 | 8 | # try to update the debconf db according to whatever is in the config files 9 | # 10 | # note that we may get run during preconfiguration, in which case the script 11 | # will not yet be installed. 12 | [ -x /opt/venvs/matrix-synapse/lib/manage_debconf.pl ] && \ 13 | /opt/venvs/matrix-synapse/lib/manage_debconf.pl read 14 | 15 | db_input high matrix-synapse/server-name || true 16 | db_input high matrix-synapse/report-stats || true 17 | db_go 18 | -------------------------------------------------------------------------------- /debian/matrix-synapse-py3.links: -------------------------------------------------------------------------------- 1 | opt/venvs/matrix-synapse/bin/hash_password usr/bin/hash_password 2 | opt/venvs/matrix-synapse/bin/register_new_matrix_user usr/bin/register_new_matrix_user 3 | opt/venvs/matrix-synapse/bin/synapse_port_db usr/bin/synapse_port_db 4 | opt/venvs/matrix-synapse/bin/synapse_review_recent_signups usr/bin/synapse_review_recent_signups 5 | opt/venvs/matrix-synapse/bin/synctl usr/bin/synctl 6 | opt/venvs/matrix-synapse/bin/update_synapse_database usr/bin/update_synapse_database 7 | -------------------------------------------------------------------------------- /debian/matrix-synapse.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Synapse Matrix homeserver 3 | 4 | [Service] 5 | Type=notify 6 | User=matrix-synapse 7 | WorkingDirectory=/var/lib/matrix-synapse 8 | ExecStartPre=/opt/venvs/matrix-synapse/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ --generate-keys 9 | ExecStart=/opt/venvs/matrix-synapse/bin/python -m synapse.app.homeserver --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ 10 | ExecReload=/bin/kill -HUP $MAINPID 11 | Restart=always 12 | RestartSec=3 13 | SyslogIdentifier=matrix-synapse 14 | 15 | # The environment file is not shipped by default anymore and the below directive 16 | # is for backwards compatibility only. Please use your homeserver.yaml if 17 | # possible. 18 | EnvironmentFile=-/etc/default/matrix-synapse 19 | 20 | [Install] 21 | WantedBy=multi-user.target 22 | -------------------------------------------------------------------------------- /debian/po/POTFILES.in: -------------------------------------------------------------------------------- 1 | [type: gettext/rfc822deb] templates 2 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /demo/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore all the temporary files from the demo servers. 2 | 8080/ 3 | 8081/ 4 | 8082/ 5 | -------------------------------------------------------------------------------- /demo/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | DIR="$( cd "$( dirname "$0" )" && pwd )" 6 | 7 | # Ensure that the servers are stopped. 8 | $DIR/stop.sh 9 | 10 | PID_FILE="$DIR/servers.pid" 11 | 12 | if [ -f "$PID_FILE" ]; then 13 | echo "servers.pid exists!" 14 | exit 1 15 | fi 16 | 17 | for port in 8080 8081 8082; do 18 | rm -rf "${DIR:?}/$port" 19 | rm -rf "$DIR/media_store.$port" 20 | done 21 | 22 | rm -rf "${DIR:?}/etc" 23 | -------------------------------------------------------------------------------- /demo/stop.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR="$( cd "$( dirname "$0" )" && pwd )" 4 | 5 | FILES=$(find "$DIR" -name "*.pid" -type f); 6 | 7 | for pid_file in $FILES; do 8 | pid=$(cat "$pid_file") 9 | if [[ $pid ]]; then 10 | echo "Killing $pid_file with $pid" 11 | kill "$pid" 12 | fi 13 | done 14 | 15 | -------------------------------------------------------------------------------- /dev-docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /dev-docs/index.rst: -------------------------------------------------------------------------------- 1 | .. Synapse Developer Documentation documentation master file, created by 2 | sphinx-quickstart on Mon Mar 13 08:59:51 2023. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to the Synapse Developer Documentation! 7 | =========================================================== 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :caption: Contents: 12 | 13 | modules/federation_sender 14 | 15 | 16 | 17 | Indices and tables 18 | ================== 19 | 20 | * :ref:`genindex` 21 | * :ref:`modindex` 22 | * :ref:`search` 23 | -------------------------------------------------------------------------------- /dev-docs/modules/federation_sender.md: -------------------------------------------------------------------------------- 1 | Federation Sender 2 | ================= 3 | 4 | ```{autodoc2-docstring} synapse.federation.sender 5 | ``` 6 | -------------------------------------------------------------------------------- /docker/complement/conf/postgres.supervisord.conf: -------------------------------------------------------------------------------- 1 | [program:postgres] 2 | command=/usr/local/bin/prefix-log gosu postgres postgres 3 | 4 | # Only start if START_POSTGRES=1 5 | autostart=%(ENV_START_POSTGRES)s 6 | 7 | # Lower priority number = starts first 8 | priority=1 9 | 10 | autorestart=unexpected 11 | stdout_logfile=/dev/stdout 12 | stdout_logfile_maxbytes=0 13 | stderr_logfile=/dev/stderr 14 | stderr_logfile_maxbytes=0 15 | 16 | # Use 'Fast Shutdown' mode which aborts current transactions and closes connections quickly. 17 | # (Default (TERM) is 'Smart Shutdown' which stops accepting new connections but 18 | # lets existing connections close gracefully.) 19 | stopsignal=INT 20 | -------------------------------------------------------------------------------- /docker/conf-workers/healthcheck.sh.j2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This healthcheck script is designed to return OK when every 3 | # host involved returns OK 4 | {%- for healthcheck_url in healthcheck_urls %} 5 | curl -fSs {{ healthcheck_url }} || exit 1 6 | {%- endfor %} 7 | -------------------------------------------------------------------------------- /docker/conf-workers/shared.yaml.j2: -------------------------------------------------------------------------------- 1 | # This file contains the base for the shared homeserver config file between Synapse workers, 2 | # as part of ./Dockerfile-workers. 3 | # configure_workers_and_start.py uses and amends to this file depending on the workers 4 | # that have been selected. 5 | 6 | {% if enable_redis %} 7 | redis: 8 | enabled: true 9 | {% if using_unix_sockets %} 10 | path: /tmp/redis.sock 11 | {% endif %} 12 | {% endif %} 13 | 14 | {% if appservice_registrations is not none %} 15 | ## Application Services ## 16 | # A list of application service config files to use. 17 | app_service_config_files: 18 | {%- for path in appservice_registrations %} 19 | - "{{ path }}" 20 | {%- endfor %} 21 | {%- endif %} 22 | 23 | {{ shared_worker_config }} 24 | -------------------------------------------------------------------------------- /docker/conf-workers/worker.yaml.j2: -------------------------------------------------------------------------------- 1 | # This is a configuration template for a single worker instance, and is 2 | # used by Dockerfile-workers. 3 | # Values will be change depending on whichever workers are selected when 4 | # running that image. 5 | 6 | worker_app: "{{ app }}" 7 | worker_name: "{{ name }}" 8 | 9 | worker_listeners: 10 | - type: http 11 | {% if using_unix_sockets %} 12 | path: "/run/worker.{{ port }}" 13 | {% else %} 14 | port: {{ port }} 15 | {% endif %} 16 | {% if listener_resources %} 17 | resources: 18 | - names: 19 | {%- for resource in listener_resources %} 20 | - {{ resource }} 21 | {%- endfor %} 22 | {% endif %} 23 | 24 | worker_log_config: {{ worker_log_config_filepath }} 25 | 26 | {{ worker_extra_conf }} 27 | -------------------------------------------------------------------------------- /docker/prefix-log: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Prefixes all lines on stdout and stderr with the process name (as determined by 4 | # the SUPERVISOR_PROCESS_NAME env var, which is automatically set by Supervisor). 5 | # 6 | # Usage: 7 | # prefix-log command [args...] 8 | # 9 | 10 | exec 1> >(awk '{print "'"${SUPERVISOR_PROCESS_NAME}"' | "$0}' >&1) 11 | exec 2> >(awk '{print "'"${SUPERVISOR_PROCESS_NAME}"' | "$0}' >&2) 12 | exec "$@" 13 | -------------------------------------------------------------------------------- /docs/.sample_config_header.yaml: -------------------------------------------------------------------------------- 1 | # This file is maintained as an up-to-date snapshot of the default 2 | # homeserver.yaml configuration generated by Synapse. You can find a 3 | # complete accounting of possible configuration options at 4 | # https://matrix-org.github.io/synapse/latest/usage/configuration/config_documentation.html 5 | # 6 | # It is *not* intended to be copied and used as the basis for a real 7 | # homeserver.yaml. Instead, if you are starting from scratch, please generate 8 | # a fresh config using Synapse by following the instructions in 9 | # https://matrix-org.github.io/synapse/latest/setup/installation.html. 10 | # 11 | ################################################################################ 12 | 13 | -------------------------------------------------------------------------------- /docs/admin_api/README.rst: -------------------------------------------------------------------------------- 1 | Admin APIs 2 | ========== 3 | 4 | **Note**: The latest documentation can be viewed `here `_. 5 | See `docs/README.md <../README.md>`_ for more information. 6 | 7 | **Please update links to point to the website instead.** Existing files in this directory 8 | are preserved to maintain historical links, but may be moved in the future. 9 | 10 | This directory includes documentation for the various synapse specific admin 11 | APIs available. Updates to the existing Admin API documentation should still 12 | be made to these files, but any new documentation files should instead be placed under 13 | `docs/usage/administration/admin_api <../usage/administration/admin_api>`_. 14 | 15 | -------------------------------------------------------------------------------- /docs/admin_api/version_api.md: -------------------------------------------------------------------------------- 1 | # Version API 2 | 3 | This API returns the running Synapse version. 4 | This is useful when a Synapse instance 5 | is behind a proxy that does not forward the 'Server' header (which also 6 | contains Synapse version information). 7 | 8 | The api is: 9 | 10 | ``` 11 | GET /_synapse/admin/v1/server_version 12 | ``` 13 | 14 | It returns a JSON body like the following: 15 | 16 | ```json 17 | { 18 | "server_version": "0.99.2rc1 (b=develop, abcdef123)" 19 | } 20 | ``` 21 | 22 | *Changed in Synapse 1.94.0:* The `python_version` key was removed from the 23 | response body. 24 | -------------------------------------------------------------------------------- /docs/auth_chain_diff.dot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/docs/auth_chain_diff.dot.png -------------------------------------------------------------------------------- /docs/changelogs/README.md: -------------------------------------------------------------------------------- 1 | This directory contains changelogs for previous years. 2 | -------------------------------------------------------------------------------- /docs/development/img/git/branches.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/docs/development/img/git/branches.jpg -------------------------------------------------------------------------------- /docs/development/img/git/clean.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/docs/development/img/git/clean.png -------------------------------------------------------------------------------- /docs/development/img/git/squash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/docs/development/img/git/squash.png -------------------------------------------------------------------------------- /docs/development/internal_documentation/README.md: -------------------------------------------------------------------------------- 1 | # Internal Documentation 2 | 3 | This section covers implementation documentation for various parts of Synapse. 4 | 5 | If a developer is planning to make a change to a feature of Synapse, it can be useful for 6 | general documentation of how that feature is implemented to be available. This saves the 7 | developer time in place of needing to understand how the feature works by reading the 8 | code. 9 | 10 | Documentation that would be more useful for the perspective of a system administrator, 11 | rather than a developer who's intending to change to code, should instead be placed 12 | under the Usage section of the documentation. -------------------------------------------------------------------------------- /docs/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/docs/favicon.png -------------------------------------------------------------------------------- /docs/privacy_policy_templates/en/1.0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Matrix.org Privacy policy 5 | 6 | 7 | {% if has_consented %} 8 |

9 | Your base already belong to us. 10 |

11 | {% else %} 12 |

13 | All your base are belong to us. 14 |

15 | {% if not public_version %} 16 | 17 |
18 | 19 | 20 | 21 | 22 |
23 | {% endif %} 24 | {% endif %} 25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/privacy_policy_templates/en/success.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Matrix.org Privacy policy 5 | 6 | 7 |

8 | Sweet. 9 |

10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/room_and_user_statistics.md: -------------------------------------------------------------------------------- 1 | Room and User Statistics 2 | ======================== 3 | 4 | Synapse maintains room and user statistics in various tables. These can be used 5 | for administrative purposes but are also used when generating the public room 6 | directory. 7 | 8 | 9 | # Synapse Developer Documentation 10 | 11 | ## High-Level Concepts 12 | 13 | ### Definitions 14 | 15 | * **subject**: Something we are tracking stats about – currently a room or user. 16 | * **current row**: An entry for a subject in the appropriate current statistics 17 | table. Each subject can have only one. 18 | 19 | ### Overview 20 | 21 | Stats correspond to the present values. Current rows contain the most up-to-date 22 | statistics for a room. Each subject can only have one entry. 23 | -------------------------------------------------------------------------------- /docs/systemd-with-workers/system/matrix-synapse.target: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Synapse parent target 3 | After=network.target 4 | 5 | [Install] 6 | WantedBy=multi-user.target 7 | -------------------------------------------------------------------------------- /docs/systemd-with-workers/workers/background_worker.yaml: -------------------------------------------------------------------------------- 1 | worker_app: synapse.app.generic_worker 2 | worker_name: background_worker 3 | 4 | worker_log_config: /etc/matrix-synapse/background-worker-log.yaml 5 | -------------------------------------------------------------------------------- /docs/systemd-with-workers/workers/event_persister.yaml: -------------------------------------------------------------------------------- 1 | worker_app: synapse.app.generic_worker 2 | worker_name: event_persister1 3 | 4 | worker_listeners: 5 | - type: http 6 | port: 8034 7 | resources: 8 | - names: [replication] 9 | 10 | # Enable listener if this stream writer handles endpoints for the `typing` or 11 | # `to_device` streams. Uses a different port to the `replication` listener to 12 | # avoid exposing the `replication` listener publicly. 13 | # 14 | #- type: http 15 | # port: 8035 16 | # x_forwarded: true 17 | # resources: 18 | # - names: [client] 19 | 20 | worker_log_config: /etc/matrix-synapse/event-persister-log.yaml 21 | -------------------------------------------------------------------------------- /docs/systemd-with-workers/workers/federation_sender.yaml: -------------------------------------------------------------------------------- 1 | worker_app: synapse.app.federation_sender 2 | worker_name: federation_sender1 3 | 4 | worker_log_config: /etc/matrix-synapse/federation-sender-log.yaml 5 | -------------------------------------------------------------------------------- /docs/systemd-with-workers/workers/generic_worker.yaml: -------------------------------------------------------------------------------- 1 | worker_app: synapse.app.generic_worker 2 | worker_name: generic_worker1 3 | 4 | worker_listeners: 5 | - type: http 6 | port: 8083 7 | x_forwarded: true 8 | resources: 9 | - names: [client, federation] 10 | 11 | worker_log_config: /etc/matrix-synapse/generic-worker-log.yaml 12 | -------------------------------------------------------------------------------- /docs/systemd-with-workers/workers/media_worker.yaml: -------------------------------------------------------------------------------- 1 | worker_app: synapse.app.media_repository 2 | worker_name: media_worker 3 | 4 | worker_listeners: 5 | - type: http 6 | port: 8085 7 | x_forwarded: true 8 | resources: 9 | - names: [media] 10 | 11 | worker_log_config: /etc/matrix-synapse/media-worker-log.yaml 12 | -------------------------------------------------------------------------------- /docs/systemd-with-workers/workers/pusher_worker.yaml: -------------------------------------------------------------------------------- 1 | worker_app: synapse.app.pusher 2 | worker_name: pusher_worker1 3 | 4 | worker_log_config: /etc/matrix-synapse/pusher-worker-log.yaml 5 | -------------------------------------------------------------------------------- /docs/usage/administration/README.md: -------------------------------------------------------------------------------- 1 | # Administration 2 | 3 | This section contains information on managing your Synapse homeserver. This includes: 4 | 5 | * Managing users, rooms and media via the Admin API. 6 | * Setting up metrics and monitoring to give you insight into your homeserver's health. 7 | * Configuring structured logging. -------------------------------------------------------------------------------- /docs/usage/configuration/README.md: -------------------------------------------------------------------------------- 1 | # Configuration 2 | 3 | This section contains information on tweaking Synapse via the various options in the configuration file. A configuration 4 | file should have been generated when you [installed Synapse](../../setup/installation.html). 5 | -------------------------------------------------------------------------------- /docs/usage/configuration/homeserver_sample_config.md: -------------------------------------------------------------------------------- 1 | # Homeserver Sample Configuration File 2 | 3 | Below is a sample homeserver configuration file. The homeserver configuration file 4 | can be tweaked to change the behaviour of your homeserver. A restart of the server is 5 | generally required to apply any changes made to this file. 6 | 7 | Note that the contents below are *not* intended to be copied and used as the basis for 8 | a real homeserver.yaml. Instead, if you are starting from scratch, please generate 9 | a fresh config using Synapse by following the instructions in 10 | [Installation](../../setup/installation.md). 11 | 12 | Documentation for all configuration options can be found in the 13 | [Configuration Manual](./config_documentation.md). 14 | 15 | ```yaml 16 | {{#include ../../sample_config.yaml}} 17 | ``` 18 | -------------------------------------------------------------------------------- /docs/usage/configuration/logging_sample_config.md: -------------------------------------------------------------------------------- 1 | # Logging Sample Configuration File 2 | 3 | Below is a sample logging configuration file. This file can be tweaked to control how your 4 | homeserver will output logs. The value of the `log_config` option in your homeserver config 5 | should be the path to this file. 6 | 7 | To apply changes made to this file, send Synapse a SIGHUP signal (or, if using `systemd`, run 8 | `systemctl reload` on the Synapse service). 9 | 10 | Note that a default logging configuration (shown below) is created automatically alongside 11 | the homeserver config when following the [installation instructions](../../setup/installation.md). 12 | It should be named `.log.config` by default. 13 | 14 | ```yaml 15 | {{#include ../../sample_log_config.yaml}} 16 | ``` 17 | -------------------------------------------------------------------------------- /docs/usage/configuration/user_authentication/README.md: -------------------------------------------------------------------------------- 1 | # User Authentication 2 | 3 | Synapse supports multiple methods of authenticating users, either out-of-the-box or through custom pluggable 4 | authentication modules. 5 | 6 | Included in Synapse is support for authenticating users via: 7 | 8 | * A username and password. 9 | * An email address and password. 10 | * Single Sign-On through the SAML, Open ID Connect or CAS protocols. 11 | * JSON Web Tokens. 12 | * An administrator's shared secret. 13 | 14 | Synapse can additionally be extended to support custom authentication schemes through optional "password auth provider" 15 | modules. -------------------------------------------------------------------------------- /docs/usage/configuration/user_authentication/single_sign_on/README.md: -------------------------------------------------------------------------------- 1 | # Single Sign-On 2 | 3 | Synapse supports single sign-on through the SAML, Open ID Connect or CAS protocols. 4 | LDAP and other login methods are supported through first and third-party password 5 | auth provider modules. -------------------------------------------------------------------------------- /docs/usage/configuration/user_authentication/single_sign_on/cas.md: -------------------------------------------------------------------------------- 1 | # CAS 2 | 3 | Synapse supports authenticating users via the [Central Authentication 4 | Service protocol](https://en.wikipedia.org/wiki/Central_Authentication_Service) 5 | (CAS) natively. 6 | 7 | Please see the [cas_config](../../../configuration/config_documentation.md#cas_config) and [sso](../../../configuration/config_documentation.md#sso) 8 | sections of the configuration manual for more details. -------------------------------------------------------------------------------- /docs/usage/configuration/user_authentication/single_sign_on/saml.md: -------------------------------------------------------------------------------- 1 | # SAML 2 | 3 | Synapse supports authenticating users via the [Security Assertion 4 | Markup Language](https://en.wikipedia.org/wiki/Security_Assertion_Markup_Language) 5 | (SAML) protocol natively. 6 | 7 | Please see the `saml2_config` and `sso` sections of the [Synapse configuration 8 | file](../../../configuration/homeserver_sample_config.md) for more details. -------------------------------------------------------------------------------- /docs/website_files/indent-section-headers.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Indents each chapter title in the left sidebar so that they aren't 3 | * at the same level as the section headers. 4 | */ 5 | .chapter-item { 6 | margin-left: 1em; 7 | } -------------------------------------------------------------------------------- /docs/website_files/remove-nav-buttons.css: -------------------------------------------------------------------------------- 1 | /* Remove the prev, next chapter buttons as they interfere with the 2 | * table of contents. 3 | * Note that the table of contents only appears on desktop, thus we 4 | * only remove the desktop (wide) chapter buttons. 5 | */ 6 | .nav-wide-wrapper { 7 | display: none 8 | } -------------------------------------------------------------------------------- /docs/website_files/version.js: -------------------------------------------------------------------------------- 1 | window.SYNAPSE_VERSION = "latest"; 2 | -------------------------------------------------------------------------------- /scripts-dev/config-lint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Find linting errors in Synapse's default config file. 3 | # Exits with 0 if there are no problems, or another code otherwise. 4 | 5 | # cd to the root of the repository 6 | cd "$(dirname "$0")/.." || exit 7 | 8 | # Restore backup of sample config upon script exit 9 | trap "mv docs/sample_config.yaml.bak docs/sample_config.yaml" EXIT 10 | 11 | # Fix non-lowercase true/false values 12 | sed -i.bak -E "s/: +True/: true/g; s/: +False/: false/g;" docs/sample_config.yaml 13 | 14 | # Check if anything changed 15 | diff docs/sample_config.yaml docs/sample_config.yaml.bak 16 | -------------------------------------------------------------------------------- /scripts-dev/database-save.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # This script will write a dump file of local user state if you want to splat 4 | # your entire server database and start again but preserve the identity of 5 | # local users and their access tokens. 6 | # 7 | # To restore it, use 8 | # 9 | # $ sqlite3 homeserver.db < table-save.sql 10 | 11 | sqlite3 "$1" <<'EOF' >table-save.sql 12 | .dump users 13 | .dump access_tokens 14 | .dump profiles 15 | EOF 16 | -------------------------------------------------------------------------------- /scripts-dev/dump_macaroon.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import sys 4 | 5 | import pymacaroons 6 | 7 | if len(sys.argv) == 1: 8 | sys.stderr.write("usage: %s macaroon [key]\n" % (sys.argv[0],)) 9 | sys.exit(1) 10 | 11 | macaroon_string = sys.argv[1] 12 | key = sys.argv[2] if len(sys.argv) > 2 else None 13 | 14 | macaroon = pymacaroons.Macaroon.deserialize(macaroon_string) 15 | print(macaroon.inspect()) 16 | 17 | print("") 18 | 19 | verifier = pymacaroons.Verifier() 20 | verifier.satisfy_general(lambda c: True) 21 | try: 22 | verifier.verify(macaroon, key) 23 | print("Signature is correct") 24 | except Exception as e: 25 | print(str(e)) 26 | -------------------------------------------------------------------------------- /scripts-dev/next_github_number.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # Fetch the current GitHub issue number, add one to it -- presto! The likely 6 | # next PR number. 7 | CURRENT_NUMBER=$(curl -s "https://api.github.com/repos/matrix-org/synapse/issues?state=all&per_page=1" | jq -r ".[0].number") 8 | CURRENT_NUMBER=$((CURRENT_NUMBER+1)) 9 | echo $CURRENT_NUMBER 10 | -------------------------------------------------------------------------------- /stubs/sortedcontainers/__init__.pyi: -------------------------------------------------------------------------------- 1 | from .sorteddict import SortedDict, SortedItemsView, SortedKeysView, SortedValuesView 2 | from .sortedlist import SortedKeyList, SortedList, SortedListWithKey 3 | from .sortedset import SortedSet 4 | 5 | __all__ = [ 6 | "SortedDict", 7 | "SortedKeysView", 8 | "SortedItemsView", 9 | "SortedValuesView", 10 | "SortedKeyList", 11 | "SortedList", 12 | "SortedListWithKey", 13 | "SortedSet", 14 | ] 15 | -------------------------------------------------------------------------------- /stubs/synapse/__init__.pyi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/stubs/synapse/__init__.pyi -------------------------------------------------------------------------------- /stubs/synapse/synapse_rust/__init__.pyi: -------------------------------------------------------------------------------- 1 | def sum_as_string(a: int, b: int) -> str: ... 2 | def get_rust_file_digest() -> str: ... 3 | def reset_logging_config() -> None: ... 4 | -------------------------------------------------------------------------------- /stubs/synapse/synapse_rust/acl.pyi: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import List 16 | 17 | class ServerAclEvaluator: 18 | def __init__( 19 | self, allow_ip_literals: bool, allow: List[str], deny: List[str] 20 | ) -> None: ... 21 | def server_matches_acl_event(self, server_name: str) -> bool: ... 22 | -------------------------------------------------------------------------------- /synapse/_scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/synapse/_scripts/__init__.py -------------------------------------------------------------------------------- /synapse/api/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /synapse/app/appservice.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import sys 16 | 17 | from synapse.app.generic_worker import start 18 | from synapse.util.logcontext import LoggingContext 19 | 20 | 21 | def main() -> None: 22 | with LoggingContext("main"): 23 | start(sys.argv[1:]) 24 | 25 | 26 | if __name__ == "__main__": 27 | main() 28 | -------------------------------------------------------------------------------- /synapse/app/pusher.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import sys 16 | 17 | from synapse.app.generic_worker import start 18 | from synapse.util.logcontext import LoggingContext 19 | 20 | 21 | def main() -> None: 22 | with LoggingContext("main"): 23 | start(sys.argv[1:]) 24 | 25 | 26 | if __name__ == "__main__": 27 | main() 28 | -------------------------------------------------------------------------------- /synapse/config/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from ._base import ConfigError, find_config_files 16 | 17 | # export ConfigError and find_config_files if somebody does 18 | # import * 19 | # this is largely a fudge to stop PEP8 moaning about the import 20 | __all__ = ["ConfigError", "find_config_files"] 21 | -------------------------------------------------------------------------------- /synapse/crypto/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /synapse/federation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ This package includes all the federation specific logic. 16 | """ 17 | -------------------------------------------------------------------------------- /synapse/handlers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /synapse/http/federation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 New Vector Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /synapse/push/rulekinds.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015, 2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | PRIORITY_CLASS_MAP = { 16 | "underride": 1, 17 | "sender": 2, 18 | "room": 3, 19 | "content": 4, 20 | "override": 5, 21 | } 22 | PRIORITY_CLASS_INVERSE_MAP = {v: k for k, v in PRIORITY_CLASS_MAP.items()} 23 | -------------------------------------------------------------------------------- /synapse/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/synapse/py.typed -------------------------------------------------------------------------------- /synapse/replication/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /synapse/res/providers.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "provider_name": "Twitter", 4 | "provider_url": "http://www.twitter.com/", 5 | "endpoints": [ 6 | { 7 | "schemes": [ 8 | "https://twitter.com/*/moments/*", 9 | "https://*.twitter.com/*/moments/*" 10 | ], 11 | "url": "https://publish.twitter.com/oembed" 12 | } 13 | ] 14 | }, 15 | { 16 | "provider_name": "YouTube Shorts", 17 | "provider_url": "http://www.youtube.com/", 18 | "endpoints": [ 19 | { 20 | "schemes": [ 21 | "https://youtube.com/shorts/*", 22 | "https://*.youtube.com/shorts/*" 23 | ], 24 | "url": "https://www.youtube.com/oembed" 25 | } 26 | ] 27 | } 28 | ] 29 | -------------------------------------------------------------------------------- /synapse/res/templates/account_previously_renewed.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Your account is valid until {{ expiration_ts|format_ts("%d-%m-%Y") }}.{% endblock %} 3 | 4 | {% block body %} 5 |

Your account is valid until {{ expiration_ts|format_ts("%d-%m-%Y") }}.

6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /synapse/res/templates/account_renewed.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Your account has been successfully renewed and is valid until {{ expiration_ts|format_ts("%d-%m-%Y") }}.{% endblock %} 3 | 4 | {% block body %} 5 |

Your account has been successfully renewed and is valid until {{ expiration_ts|format_ts("%d-%m-%Y") }}.

6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /synapse/res/templates/add_threepid.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Request to add an email address to your Matrix account{% endblock %} 3 | 4 | {% block body %} 5 |

A request to add an email address to your Matrix account has been received. If this was you, please click the link below to confirm adding this email:

6 | {{ link }} 7 |

If this was not you, you can safely ignore this email. Thank you.

8 | {% endblock %} 9 | -------------------------------------------------------------------------------- /synapse/res/templates/add_threepid.txt: -------------------------------------------------------------------------------- 1 | A request to add an email address to your Matrix account has been received. If this was you, 2 | please click the link below to confirm adding this email: 3 | 4 | {{ link }} 5 | 6 | If this was not you, you can safely ignore this email. Thank you. 7 | -------------------------------------------------------------------------------- /synapse/res/templates/add_threepid_failure.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Request failed{% endblock %} 3 | 4 | {% block body %} 5 |

The request failed for the following reason: {{ failure_reason }}.

6 |

No changes have been made to your account.

7 | {% endblock %} 8 | -------------------------------------------------------------------------------- /synapse/res/templates/add_threepid_success.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Your email has now been validated{% endblock %} 3 | 4 | {% block body %} 5 |

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

6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /synapse/res/templates/auth_success.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Success!{% endblock %} 3 | 4 | {% block header %} 5 | 6 | 13 | {% endblock %} 14 | 15 | {% block body %} 16 |
17 |

Thank you

18 |

You may now close this window and return to the application

19 |
20 | 21 | {% endblock %} 22 | -------------------------------------------------------------------------------- /synapse/res/templates/invalid_token.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Invalid renewal token.{% endblock %} 3 | 4 | {% block body %} 5 |

Invalid renewal token.

6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /synapse/res/templates/mail-Element.css: -------------------------------------------------------------------------------- 1 | .header { 2 | border-bottom: 4px solid #e4f7ed ! important; 3 | } 4 | 5 | .notif_link a, .footer a { 6 | color: #76CFA6 ! important; 7 | } 8 | -------------------------------------------------------------------------------- /synapse/res/templates/mail-Vector.css: -------------------------------------------------------------------------------- 1 | .header { 2 | border-bottom: 4px solid #e4f7ed ! important; 3 | } 4 | 5 | .notif_link a, .footer a { 6 | color: #76CFA6 ! important; 7 | } 8 | -------------------------------------------------------------------------------- /synapse/res/templates/mail-expiry.css: -------------------------------------------------------------------------------- 1 | .noticetext { 2 | margin-top: 10px; 3 | margin-bottom: 10px; 4 | } 5 | -------------------------------------------------------------------------------- /synapse/res/templates/notice_expiry.txt: -------------------------------------------------------------------------------- 1 | Hi {{ display_name }}, 2 | 3 | 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. 4 | 5 | To extend the validity of your account, please click on the link below (or copy and paste it to a new browser tab): 6 | 7 | {{ url }} 8 | -------------------------------------------------------------------------------- /synapse/res/templates/notif.txt: -------------------------------------------------------------------------------- 1 | {%- for message in notif.messages %} 2 | {%- if message.event_type == "m.room.encrypted" %} 3 | An encrypted message. 4 | {%- elif message.event_type == "m.room.message" %} 5 | {%- if message.msgtype == "m.emote" %}* {%- endif %}{{ message.sender_name }} ({{ message.ts|format_ts("%H:%M") }}) 6 | {%- if message.msgtype == "m.text" %} 7 | {{ message.body_text_plain }} 8 | {%- elif message.msgtype == "m.emote" %} 9 | {{ message.body_text_plain }} 10 | {%- elif message.msgtype == "m.notice" %} 11 | {{ message.body_text_plain }} 12 | {%- elif message.msgtype == "m.image" %} 13 | {{ message.body_text_plain }} 14 | {%- elif message.msgtype == "m.file" %} 15 | {{ message.body_text_plain }} 16 | {%- else %} 17 | A message with unrecognised content. 18 | {%- endif %} 19 | {%- endif %} 20 | {%- endfor %} 21 | 22 | View {{ room.title }} at {{ notif.link }} 23 | -------------------------------------------------------------------------------- /synapse/res/templates/notif_mail.txt: -------------------------------------------------------------------------------- 1 | Hi {{ user_display_name }}, 2 | 3 | {{ summary_text }} 4 | 5 | {%- for room in rooms %} 6 | {%- include 'room.txt' with context %} 7 | {%- endfor %} 8 | 9 | You can disable these notifications at {{ unsubscribe_link }} 10 | 11 | -------------------------------------------------------------------------------- /synapse/res/templates/password_reset.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Password reset{% endblock %} 3 | 4 | {% block body %} 5 |

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:

6 | 7 | {{ link }} 8 | 9 |

If this was not you, do not click the link above and instead contact your server administrator. Thank you.

10 | {% endblock %} 11 | -------------------------------------------------------------------------------- /synapse/res/templates/password_reset.txt: -------------------------------------------------------------------------------- 1 | A password reset request has been received for your Matrix account. If this 2 | was you, please click the link below to confirm resetting your password: 3 | 4 | {{ link }} 5 | 6 | If this was not you, DO NOT click the link above and instead contact your 7 | server administrator. Thank you. 8 | -------------------------------------------------------------------------------- /synapse/res/templates/password_reset_confirmation.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Password reset confirmation{% endblock %} 3 | 4 | {% block body %} 5 | 6 |
7 | 8 | 9 | 10 | 11 |

You have requested to reset your Matrix account password. Click the link below to confirm this action.

12 | If you did not mean to do this, please close this page and your password will not be changed.

13 |

14 |
15 | {% endblock %} 16 | -------------------------------------------------------------------------------- /synapse/res/templates/password_reset_failure.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Password reset failure{% endblock %} 3 | 4 | {% block body %} 5 |

The request failed for the following reason: {{ failure_reason }}.

6 |

Your password has not been reset.

7 | {% endblock %} 8 | -------------------------------------------------------------------------------- /synapse/res/templates/password_reset_success.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Password reset success{% endblock %} 3 | 4 | {% block body %} 5 |

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

6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /synapse/res/templates/registration.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Registration{% endblock %} 3 | 4 | {% block body %} 5 |

You have asked us to register this email with a new Matrix account. If this was you, please click the link below to confirm your email address:

6 | 7 | Verify Your Email Address 8 | 9 |

If this was not you, you can safely disregard this email.

10 | 11 |

Thank you.

12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /synapse/res/templates/registration.txt: -------------------------------------------------------------------------------- 1 | Hello there, 2 | 3 | You have asked us to register this email with a new Matrix account. If this 4 | was you, please click the link below to confirm your email address: 5 | 6 | {{ link }} 7 | 8 | If this was not you, you can safely disregard this email. 9 | 10 | Thank you. 11 | -------------------------------------------------------------------------------- /synapse/res/templates/registration_failure.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Registration failure{% endblock %} 3 | 4 | {% block body %} 5 |

Validation failed for the following reason: {{ failure_reason }}.

6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /synapse/res/templates/registration_success.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Your email has now been validated{% endblock %} 3 | 4 | {% block body %} 5 |

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

6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /synapse/res/templates/registration_token.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Authentication{% endblock %} 3 | 4 | {% block body %} 5 |
6 |
7 | {% if error is defined %} 8 |

Error: {{ error }}

9 | {% endif %} 10 |

11 | Please enter a registration token. 12 |

13 | 14 | 15 | 16 |
17 |
18 | {% endblock %} 19 | -------------------------------------------------------------------------------- /synapse/res/templates/room.txt: -------------------------------------------------------------------------------- 1 | {{ room.title }} 2 | 3 | {%- if room.invite %} 4 | You've been invited, join at {{ room.link }} 5 | {%- else %} 6 | {%- for notif in room.notifs %} 7 | {%- include 'notif.txt' with context %} 8 | {%- endfor %} 9 | {%- endif %} 10 | -------------------------------------------------------------------------------- /synapse/res/templates/sso_account_deactivated.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}SSO account deactivated{% endblock %} 3 | 4 | {% block header %} 5 | 8 | {% endblock %} 9 | 10 | {% block body %} 11 |
12 |
13 |

Your account has been deactivated

14 |

15 | No account found 16 |

17 |

18 | Your account might have been deactivated by the server administrator. 19 | You can either try to create a new account or contact the server’s 20 | administrator. 21 |

22 |
23 |
24 | {% include "sso_footer.html" without context %} 25 | {% endblock %} 26 | -------------------------------------------------------------------------------- /synapse/res/templates/sso_auth_confirm.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Confirm it's you{% endblock %} 3 | 4 | {% block header %} 5 | 8 | {% endblock %} 9 | 10 | {% block body %} 11 |
12 |

Confirm it's you to continue

13 |

14 | A client is trying to {{ description }}. To confirm this action 15 | re-authorize your account with single sign-on. 16 |

17 |

18 | If you did not expect this, your account may be compromised. 19 |

20 |
21 |
22 | 23 | Continue with {{ idp.idp_name }} 24 | 25 |
26 | {% include "sso_footer.html" without context %} 27 | {% endblock %} 28 | -------------------------------------------------------------------------------- /synapse/res/templates/sso_auth_success.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Authentication successful{% endblock %} 3 | 4 | {% block header %} 5 | 8 | 15 | {% endblock %} 16 | 17 | {% block body %} 18 |
19 |

Thank you

20 |

21 | Now we know it’s you, you can close this window and return to the 22 | application. 23 |

24 |
25 | {% include "sso_footer.html" without context %} 26 | {% endblock %} 27 | -------------------------------------------------------------------------------- /synapse/res/templates/style.css: -------------------------------------------------------------------------------- 1 | html { 2 | height: 100%; 3 | } 4 | 5 | body { 6 | background: #f9fafb; 7 | max-width: 680px; 8 | margin: auto; 9 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; 10 | } 11 | 12 | .mx_Header { 13 | border-bottom: 3px solid #ddd; 14 | margin-bottom: 1rem; 15 | padding-top: 1rem; 16 | padding-bottom: 1rem; 17 | text-align: center; 18 | } 19 | 20 | @media screen and (max-width: 1120px) { 21 | body { 22 | font-size: 20px; 23 | } 24 | 25 | h1 { font-size: 1rem; } 26 | h2 { font-size: .9rem; } 27 | h3 { font-size: .85rem; } 28 | h4 { font-size: .8rem; } 29 | } 30 | 31 | .error { 32 | color: red; 33 | } 34 | -------------------------------------------------------------------------------- /synapse/res/templates/terms.html: -------------------------------------------------------------------------------- 1 | {% extends "_base.html" %} 2 | {% block title %}Authentication{% endblock %} 3 | 4 | {% block header %} 5 | 11 | {% endblock %} 12 | 13 | {% block body %} 14 |
15 |
16 | {% if error is defined %} 17 |

Error: {{ error }}

18 | {% endif %} 19 |

20 | Please click the button below if you agree to the 21 | privacy policy of this homeserver. 22 |

23 | 24 | 25 |
26 |
27 | {% endblock %} 28 | -------------------------------------------------------------------------------- /synapse/rest/client/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2016 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /synapse/rest/consent/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/synapse/rest/consent/__init__.py -------------------------------------------------------------------------------- /synapse/rest/key/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015, 2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /synapse/rest/media/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/synapse/rest/media/__init__.py -------------------------------------------------------------------------------- /synapse/rest/media/v1/_base.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # This exists purely for backwards compatibility with media providers and spam checkers. 17 | from synapse.media._base import FileInfo, Responder # noqa: F401 18 | -------------------------------------------------------------------------------- /synapse/rest/media/v1/media_storage.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # This exists purely for backwards compatibility with spam checkers. 17 | from synapse.media.media_storage import ReadableFileWrapper # noqa: F401 18 | -------------------------------------------------------------------------------- /synapse/rest/media/v1/storage_provider.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | 16 | # This exists purely for backwards compatibility with media providers. 17 | from synapse.media.storage_provider import StorageProvider # noqa: F401 18 | -------------------------------------------------------------------------------- /synapse/rest/synapse/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2020 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /synapse/server_notices/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/synapse/server_notices/__init__.py -------------------------------------------------------------------------------- /synapse/static/client/login/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/synapse/static/client/login/spinner.gif -------------------------------------------------------------------------------- /synapse/storage/databases/state/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from synapse.storage.databases.state.store import StateGroupDataStore # noqa: F401 16 | -------------------------------------------------------------------------------- /synapse/storage/push_rule.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2016 OpenMarket Ltd 2 | # Copyright 2018 New Vector Ltd 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | 17 | class RuleNotFoundException(Exception): 18 | pass 19 | 20 | 21 | class InconsistentRuleException(Exception): 22 | pass 23 | -------------------------------------------------------------------------------- /synapse/storage/schema/README.md: -------------------------------------------------------------------------------- 1 | # Synapse Database Schemas 2 | 3 | This directory contains the schema files used to build Synapse databases. For more 4 | information, see https://matrix-org.github.io/synapse/develop/development/database_schema.html. 5 | -------------------------------------------------------------------------------- /synapse/storage/schema/common/delta/35/00background_updates_add_col.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | 17 | ALTER TABLE background_updates ADD COLUMN depends_on TEXT; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/common/full_schemas/72/full.sql.postgres: -------------------------------------------------------------------------------- 1 | CREATE TABLE background_updates ( 2 | update_name text NOT NULL, 3 | progress_json text NOT NULL, 4 | depends_on text, 5 | ordering integer DEFAULT 0 NOT NULL 6 | ); 7 | ALTER TABLE ONLY background_updates 8 | ADD CONSTRAINT background_updates_uniqueness UNIQUE (update_name); 9 | -------------------------------------------------------------------------------- /synapse/storage/schema/common/full_schemas/72/full.sql.sqlite: -------------------------------------------------------------------------------- 1 | CREATE TABLE background_updates ( 2 | update_name text NOT NULL, 3 | progress_json text NOT NULL, 4 | depends_on text, ordering INT NOT NULL DEFAULT 0, 5 | CONSTRAINT background_updates_uniqueness UNIQUE (update_name) 6 | ); 7 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/13/v13.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2015, 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | /* We used to create a tables called application_services and 17 | * application_services_regex, but these are no longer used and are removed in 18 | * delta 54. 19 | */ 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/15/presence_indices.sql: -------------------------------------------------------------------------------- 1 | 2 | CREATE INDEX IF NOT EXISTS presence_list_user_id ON presence_list (user_id); 3 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/16/events_order_index.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX events_order ON events (topological_ordering, stream_ordering); 2 | CREATE INDEX events_order_room ON events ( 3 | room_id, topological_ordering, stream_ordering 4 | ); 5 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/16/remote_media_cache_index.sql: -------------------------------------------------------------------------------- 1 | CREATE INDEX IF NOT EXISTS remote_media_cache_thumbnails_media_id 2 | ON remote_media_cache_thumbnails (media_id); -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/16/remove_duplicates.sql: -------------------------------------------------------------------------------- 1 | 2 | 3 | DELETE FROM event_to_state_groups WHERE state_group not in ( 4 | SELECT MAX(state_group) FROM event_to_state_groups GROUP BY event_id 5 | ); 6 | 7 | DELETE FROM event_to_state_groups WHERE rowid not in ( 8 | SELECT MIN(rowid) FROM event_to_state_groups GROUP BY event_id 9 | ); 10 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/16/room_alias_index.sql: -------------------------------------------------------------------------------- 1 | 2 | CREATE INDEX IF NOT EXISTS room_aliases_id ON room_aliases(room_id); 3 | CREATE INDEX IF NOT EXISTS room_alias_servers_alias ON room_alias_servers(room_alias); 4 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/17/drop_indexes.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2015, 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | DROP INDEX IF EXISTS sent_transaction_dest; 17 | DROP INDEX IF EXISTS sent_transaction_sent; 18 | DROP INDEX IF EXISTS user_ips_user; 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/17/user_threepids.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE user_threepids ( 2 | user_id TEXT NOT NULL, 3 | medium TEXT NOT NULL, 4 | address TEXT NOT NULL, 5 | validated_at BIGINT NOT NULL, 6 | added_at BIGINT NOT NULL, 7 | CONSTRAINT user_medium_address UNIQUE (user_id, medium, address) 8 | ); 9 | CREATE INDEX user_threepids_user_id ON user_threepids(user_id); 10 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/19/event_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2015, 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | 17 | CREATE INDEX events_order_topo_stream_room ON events( 18 | topological_ordering, stream_ordering, room_id 19 | ); 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/20/dummy.sql: -------------------------------------------------------------------------------- 1 | SELECT 1; 2 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/22/user_threepids_unique.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS user_threepids2 ( 2 | user_id TEXT NOT NULL, 3 | medium TEXT NOT NULL, 4 | address TEXT NOT NULL, 5 | validated_at BIGINT NOT NULL, 6 | added_at BIGINT NOT NULL, 7 | CONSTRAINT medium_address UNIQUE (medium, address) 8 | ); 9 | 10 | INSERT INTO user_threepids2 11 | SELECT * FROM user_threepids WHERE added_at IN ( 12 | SELECT max(added_at) FROM user_threepids GROUP BY medium, address 13 | ) 14 | ; 15 | 16 | DROP TABLE user_threepids; 17 | ALTER TABLE user_threepids2 RENAME TO user_threepids; 18 | 19 | CREATE INDEX user_threepids_user_id ON user_threepids(user_id); 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/24/stats_reporting.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | /* We used to create a table called stats_reporting, but this is no longer 17 | * used and is removed in delta 54. 18 | */ -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/26/account_data.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2015, 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | 17 | ALTER TABLE private_user_data_max_stream_id RENAME TO account_data_max_stream_id; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/28/upgrade_times.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | /* 17 | * Stores the timestamp when a user upgraded from a guest to a full user, if 18 | * that happened. 19 | */ 20 | 21 | ALTER TABLE users ADD COLUMN upgrade_ts BIGINT; 22 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/30/alias_creator.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE room_aliases ADD COLUMN creator TEXT; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/32/events.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE events ADD COLUMN received_ts BIGINT; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/32/openid.sql: -------------------------------------------------------------------------------- 1 | 2 | CREATE TABLE open_id_tokens ( 3 | token TEXT NOT NULL PRIMARY KEY, 4 | ts_valid_until_ms bigint NOT NULL, 5 | user_id TEXT NOT NULL, 6 | UNIQUE (token) 7 | ); 8 | 9 | CREATE index open_id_tokens_ts_valid_until_ms ON open_id_tokens(ts_valid_until_ms); 10 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/32/pusher_throttle.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | 17 | CREATE TABLE pusher_throttle( 18 | pusher BIGINT NOT NULL, 19 | room_id TEXT NOT NULL, 20 | last_sent_ts BIGINT, 21 | throttle_ms BIGINT, 22 | PRIMARY KEY (pusher, room_id) 23 | ); 24 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/33/access_tokens_device_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (update_name, progress_json) VALUES 17 | ('access_tokens_device_index', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/33/devices.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE TABLE devices ( 17 | user_id TEXT NOT NULL, 18 | device_id TEXT NOT NULL, 19 | display_name TEXT, 20 | CONSTRAINT device_uniqueness UNIQUE (user_id, device_id) 21 | ); 22 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/33/devices_for_e2e_keys.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- make sure that we have a device record for each set of E2E keys, so that the 17 | -- user can delete them if they like. 18 | INSERT INTO devices 19 | SELECT user_id, device_id, NULL FROM e2e_device_keys_json; 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/33/user_ips_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (update_name, progress_json) VALUES 17 | ('user_ips_device_index', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/35/contains_url.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT into background_updates (update_name, progress_json) 17 | VALUES ('event_contains_url_index', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/35/device_stream_id.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE TABLE device_max_stream_id ( 17 | stream_id BIGINT NOT NULL 18 | ); 19 | 20 | INSERT INTO device_max_stream_id (stream_id) 21 | SELECT COALESCE(MAX(stream_id), 0) FROM device_inbox; 22 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/35/event_push_actions_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT into background_updates (update_name, progress_json) 17 | VALUES ('epa_highlight_index', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/38/postgres_fts_gist.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- We no longer do this given we back it out again in schema 47 17 | 18 | -- INSERT into background_updates (update_name, progress_json) 19 | -- VALUES ('event_search_postgres_gist', '{}'); 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/39/device_federation_stream_idx.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE INDEX device_federation_outbox_id ON device_federation_outbox(stream_id); 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/39/event_push_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (update_name, progress_json) VALUES 17 | ('event_push_actions_highlights_index', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/40/current_state_idx.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (update_name, progress_json) VALUES 17 | ('current_state_members_idx', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/41/device_list_stream_idx.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Vector Creations Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT into background_updates (update_name, progress_json) 17 | VALUES ('device_lists_stream_idx', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/41/device_outbound_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Vector Creations Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE INDEX device_lists_outbound_pokes_stream ON device_lists_outbound_pokes(stream_id); 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/41/event_search_event_id_idx.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Vector Creations Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT into background_updates (update_name, progress_json) 17 | VALUES ('event_search_event_id_idx', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/41/ratelimit.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Vector Creations Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE TABLE ratelimit_override ( 17 | user_id TEXT NOT NULL, 18 | messages_per_second BIGINT, 19 | burst_count BIGINT 20 | ); 21 | 22 | CREATE UNIQUE INDEX ratelimit_override_idx ON ratelimit_override(user_id); 23 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/42/event_auth_state_only.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Vector Creations Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (update_name, progress_json) VALUES 17 | ('event_auth_state_only', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/43/blocked_rooms.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Vector Creations Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE TABLE blocked_rooms ( 17 | room_id TEXT NOT NULL, 18 | user_id TEXT NOT NULL -- Admin who blocked the room 19 | ); 20 | 21 | CREATE UNIQUE INDEX blocked_rooms_idx ON blocked_rooms(room_id); 22 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/43/quarantine_media.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Vector Creations Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE local_media_repository ADD COLUMN quarantined_by TEXT; 17 | ALTER TABLE remote_media_cache ADD COLUMN quarantined_by TEXT; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/43/url_cache.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 Vector Creations Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE local_media_repository ADD COLUMN url_cache TEXT; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/46/drop_refresh_tokens.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | /* we no longer use (or create) the refresh_tokens table */ 17 | DROP TABLE IF EXISTS refresh_tokens; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/47/last_access_media.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE local_media_repository ADD COLUMN last_access_ts BIGINT; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/47/postgres_fts_gin.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT into background_updates (update_name, progress_json) 17 | VALUES ('event_search_postgres_gin', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/48/add_user_consent.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | /* record the version of the privacy policy the user has consented to 17 | */ 18 | ALTER TABLE users ADD COLUMN consent_version TEXT; 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/48/add_user_ips_last_seen_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT into background_updates (update_name, progress_json) 17 | VALUES ('user_ips_last_seen_index', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/49/add_user_ips_last_seen_only_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT into background_updates (update_name, progress_json) 17 | VALUES ('user_ips_last_seen_only_index', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/50/add_creation_ts_users_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | 17 | 18 | INSERT into background_updates (update_name, progress_json) 19 | VALUES ('users_creation_ts', '{}'); 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/50/erasure_store.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- a table of users who have requested that their details be erased 17 | CREATE TABLE erased_users ( 18 | user_id TEXT NOT NULL 19 | ); 20 | 21 | CREATE UNIQUE INDEX erased_users_user ON erased_users(user_id); 22 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/53/add_user_type_to_users.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | /* The type of the user: NULL for a regular user, or one of the constants in 17 | * synapse.api.constants.UserTypes 18 | */ 19 | ALTER TABLE users ADD COLUMN user_type TEXT DEFAULT NULL; 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/53/drop_sent_transactions.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2018 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | DROP TABLE IF EXISTS sent_transactions; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/53/event_format_version.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE event_json ADD COLUMN format_version INTEGER; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/54/drop_presence_list.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | DROP TABLE IF EXISTS presence_list; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/55/access_token_expiry.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- when this access token can be used until, in ms since the epoch. NULL means the token 17 | -- never expires. 18 | ALTER TABLE access_tokens ADD COLUMN valid_until_ms BIGINT; 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/55/users_alter_deactivated.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE users ADD deactivated SMALLINT DEFAULT 0 NOT NULL; 17 | 18 | INSERT INTO background_updates (update_name, progress_json) VALUES 19 | ('users_set_deactivated_flag', '{}'); 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/56/drop_unused_event_tables.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- these tables are never used. 17 | DROP TABLE IF EXISTS room_names; 18 | DROP TABLE IF EXISTS topics; 19 | DROP TABLE IF EXISTS history_visibility; 20 | DROP TABLE IF EXISTS guest_access; 21 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/56/event_expiry.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE TABLE IF NOT EXISTS event_expiry ( 17 | event_id TEXT PRIMARY KEY, 18 | expiry_ts BIGINT NOT NULL 19 | ); 20 | 21 | CREATE INDEX event_expiry_expiry_ts_idx ON event_expiry(expiry_ts); 22 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/56/event_labels_background_update.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (update_name, progress_json) VALUES 17 | ('event_store_labels', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/56/fix_room_keys_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Matrix.org Foundation CIC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- version is supposed to be part of the room keys index 17 | CREATE UNIQUE INDEX e2e_room_keys_with_version_idx ON e2e_room_keys(user_id, version, room_id, session_id); 18 | DROP INDEX IF EXISTS e2e_room_keys_idx; 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/56/hidden_devices.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 New Vector Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- device list needs to know which ones are "real" devices, and which ones are 17 | -- just used to avoid collisions 18 | ALTER TABLE devices ADD COLUMN hidden BOOLEAN DEFAULT FALSE; 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/56/public_room_list_idx.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE INDEX public_room_list_stream_network ON public_room_list_stream (appservice_id, network_id, room_id); 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/56/redaction_censor.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE redactions ADD COLUMN have_censored BOOL NOT NULL DEFAULT false; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/56/redaction_censor4.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | DROP INDEX IF EXISTS redactions_have_censored; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/56/room_key_etag.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- store the current etag of backup version 17 | ALTER TABLE e2e_room_keys_versions ADD COLUMN etag BIGINT; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/56/room_membership_idx.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- Adds an index on room_memberships for fetching all forgotten rooms for a user 17 | INSERT INTO background_updates (update_name, progress_json) VALUES 18 | ('room_membership_forgotten_idx', '{}'); 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/56/users_in_public_rooms_idx.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 Matrix.org Foundation CIC 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- this was apparently forgotten when the table was created back in delta 53. 17 | CREATE INDEX users_in_public_rooms_r_idx ON users_in_public_rooms(room_id); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/09shadow_ban.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- A shadow-banned user may be told that their requests succeeded when they were 17 | -- actually ignored. 18 | ALTER TABLE users ADD COLUMN shadow_banned BOOLEAN; 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/11dehydration.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE TABLE IF NOT EXISTS dehydrated_devices( 17 | user_id TEXT NOT NULL PRIMARY KEY, 18 | device_id TEXT NOT NULL, 19 | device_data TEXT NOT NULL -- JSON-encoded client-defined data 20 | ); 21 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/13remove_presence_allow_inbound.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- This table is no longer used. 17 | DROP TABLE IF EXISTS presence_allow_inbound; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/14events_instance_name.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE events ADD COLUMN instance_name TEXT; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/20instance_name_event_tables.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE current_state_delta_stream ADD COLUMN instance_name TEXT; 17 | ALTER TABLE ex_outlier_stream ADD COLUMN instance_name TEXT; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/20user_daily_visits.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- Add new column to user_daily_visits to track user agent 17 | ALTER TABLE user_daily_visits 18 | ADD COLUMN user_agent TEXT; 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/21as_device_stream.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE application_services_state ADD COLUMN read_receipt_stream_id INT; 17 | ALTER TABLE application_services_state ADD COLUMN presence_stream_id INT; -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/21drop_device_max_stream_id.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE device_max_stream_id; 2 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/22puppet_token.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- Whether the access token is an admin token for controlling another user. 17 | ALTER TABLE access_tokens ADD COLUMN puppets_user_id TEXT; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/22users_have_local_media.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 2 | (5822, 'users_have_local_media', '{}'); 3 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/23e2e_cross_signing_keys_idx.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 17 | (5823, 'e2e_cross_signing_keys_idx', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/24drop_event_json_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- this index is essentially redundant. The only time it was ever used was when purging 17 | -- rooms - and Synapse 1.24 will change that. 18 | 19 | DROP INDEX IF EXISTS event_json_room_id; 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/25user_external_ids_user_id_idx.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 17 | (5825, 'user_external_ids_user_id_idx', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/26access_token_last_validated.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- The last time this access token was "validated" (i.e. logged in or succeeded 17 | -- at user-interactive authentication). 18 | ALTER TABLE access_tokens ADD COLUMN last_validated BIGINT; 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/27local_invites.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 The Matrix.org Foundation C.I.C. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | -- This is unused since Synapse v1.17.0. 18 | DROP TABLE local_invites; 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/58/28drop_last_used_column.sql.postgres: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE access_tokens DROP COLUMN last_used; -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/59/02shard_send_to_device.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE device_inbox ADD COLUMN instance_name TEXT; 17 | ALTER TABLE device_federation_inbox ADD COLUMN instance_name TEXT; 18 | ALTER TABLE device_federation_outbox ADD COLUMN instance_name TEXT; 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/59/04_event_auth_chains.sql.postgres: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE SEQUENCE IF NOT EXISTS event_auth_chain_id; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/59/04drop_account_data.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- This is no longer used and was only kept until we bumped the schema version. 17 | DROP TABLE IF EXISTS account_data_max_stream_id; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/59/05cache_invalidation.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- This is no longer used and was only kept until we bumped the schema version. 17 | DROP TABLE IF EXISTS cache_invalidation_stream; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/59/06chain_cover_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2020 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (ordering, update_name, progress_json, depends_on) VALUES 17 | (5906, 'chain_cover', '{}', 'rejected_events_metadata'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/59/07shard_account_data_fix.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- We incorrectly populated these, so we delete them and let the 17 | -- MultiWriterIdGenerator repopulate it. 18 | DELETE FROM stream_positions WHERE stream_name = 'receipts' OR stream_name = 'account_data'; 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/59/10delete_purged_chain_cover.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 17 | (5910, 'purged_chain_cover', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/59/12presence_stream_instance_seq.sql.postgres: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE SEQUENCE IF NOT EXISTS presence_stream_sequence; 17 | 18 | SELECT setval('presence_stream_sequence', ( 19 | SELECT COALESCE(MAX(stream_id), 1) FROM presence_stream 20 | )); 21 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/61/02drop_redundant_room_depth_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- this index is redundant; there is another UNIQUE index on this table. 17 | DROP INDEX IF EXISTS room_depth_room; 18 | 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/63/02populate-rooms-creator.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (ordering, update_name, progress_json) 17 | VALUES (6302, 'populate_rooms_creator_column', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/63/04add_presence_stream_not_offline_index.sql: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 The Matrix.org Foundation C.I.C. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 18 | (6304, 'presence_stream_not_offline_index', '{}'); 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/65/04_local_group_updates.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- Check index on `local_group_updates.stream_id`. 17 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 18 | (6504, 'local_group_updates_index', '{}'); 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/65/07_arbitrary_relations.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2021 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- Check old events for thread relations. 17 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 18 | (6507, 'event_arbitrary_relations', '{}'); 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/67/01drop_public_room_list_stream.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- this table is unused as of Synapse 1.41 17 | DROP TABLE public_room_list_stream; 18 | 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/71/02event_push_summary_unique.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- Add a unique index to `event_push_summary` 17 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 18 | (7002, 'event_push_summary_unique_index', '{}'); 19 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/72/01add_room_type_to_state_stats.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE room_stats_state ADD room_type TEXT; 17 | 18 | INSERT INTO background_updates (update_name, progress_json) 19 | VALUES ('add_room_type_column', '{}'); 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/72/03drop_event_reference_hashes.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- event_reference_hashes is unused, so we can drop it 17 | DROP TABLE event_reference_hashes; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/72/04drop_column_application_services_state_last_txn.sql.postgres: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- Drop unused column application_services_state.last_txn 17 | ALTER table application_services_state DROP COLUMN last_txn; -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/72/05receipts_event_stream_ordering.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 Beeper 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE receipts_linearized ADD COLUMN event_stream_ordering BIGINT; 17 | 18 | INSERT INTO background_updates (update_name, progress_json) VALUES 19 | ('populate_event_stream_ordering', '{}'); 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/72/06add_consent_ts_to_users.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE users ADD consent_ts bigint; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/73/02add_pusher_enabled.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE pushers ADD COLUMN enabled BOOLEAN; -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/73/24_events_jump_to_date_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 17 | (7324, 'events_jump_to_date_index', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/73/25drop_presence.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- this table is unused 17 | DROP TABLE presence; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/74/04_delete_e2e_backup_keys_for_deactivated_users.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 17 | (7404, 'delete_e2e_backup_keys_for_deactivated_users', '{}'); -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/77/01_add_profiles_not_valid_check.sql.postgres: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE profiles ADD CONSTRAINT full_user_id_not_null CHECK (full_user_id IS NOT NULL) NOT VALID; -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/77/02_add_user_filters_not_valid_check.sql.postgres: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE user_filters ADD CONSTRAINT full_user_id_not_null CHECK (full_user_id IS NOT NULL) NOT VALID; -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/77/03bg_populate_full_user_id_profiles.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES (7703, 'populate_full_user_id_profiles', '{}'); -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/77/04bg_populate_full_user_id_user_filters.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES (7704, 'populate_full_user_id_user_filters', '{}'); -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/80/01_users_alter_locked.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | ALTER TABLE users ADD locked BOOLEAN DEFAULT FALSE NOT NULL; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/82/02_scheduled_tasks_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | CREATE INDEX IF NOT EXISTS scheduled_tasks_timestamp ON scheduled_tasks(timestamp); 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/83/03_instance_name_receipts.sql.sqlite: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | -- This already exists on Postgres. 17 | ALTER TABLE receipts_linearized ADD COLUMN instance_name TEXT; 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/83/05_cross_signing_key_update_grant.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | ALTER TABLE e2e_cross_signing_keys ADD COLUMN updatable_without_uia_before_ms bigint DEFAULT NULL; -------------------------------------------------------------------------------- /synapse/storage/schema/main/delta/83/06_event_push_summary_room.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2023 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 17 | (8306, 'event_push_summary_index_room_id', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/state/delta/23/drop_state_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2015, 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | DROP INDEX IF EXISTS state_groups_state_tuple; 17 | -------------------------------------------------------------------------------- /synapse/storage/schema/state/delta/32/remove_state_indices.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | 17 | -- The following indices are redundant, other indices are equivalent or 18 | -- supersets 19 | DROP INDEX IF EXISTS state_groups_id; -- Duplicate of PRIMARY KEY 20 | -------------------------------------------------------------------------------- /synapse/storage/schema/state/delta/35/add_state_index.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT into background_updates (update_name, progress_json, depends_on) 17 | VALUES ('state_group_state_type_index', '{}', 'state_group_state_deduplication'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/state/delta/35/state_dedupe.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2016 OpenMarket Ltd 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT into background_updates (update_name, progress_json) 17 | VALUES ('state_group_state_deduplication', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/state/delta/56/state_group_room_idx.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The Matrix.org Foundation C.I.C. 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (update_name, progress_json) VALUES 17 | ('state_groups_room_id_idx', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/state/delta/70/08_state_group_edges_unique.sql: -------------------------------------------------------------------------------- 1 | /* Copyright 2022 The Matrix.org Foundation C.I.C 2 | * 3 | * Licensed under the Apache License, Version 2.0 (the "License"); 4 | * you may not use this file except in compliance with the License. 5 | * You may obtain a copy of the License at 6 | * 7 | * http://www.apache.org/licenses/LICENSE-2.0 8 | * 9 | * Unless required by applicable law or agreed to in writing, software 10 | * distributed under the License is distributed on an "AS IS" BASIS, 11 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | * See the License for the specific language governing permissions and 13 | * limitations under the License. 14 | */ 15 | 16 | INSERT INTO background_updates (ordering, update_name, progress_json) VALUES 17 | (7008, 'state_group_edges_unique_idx', '{}'); 18 | -------------------------------------------------------------------------------- /synapse/storage/schema/state/full_schemas/72/full.sql.sqlite: -------------------------------------------------------------------------------- 1 | CREATE TABLE state_groups ( 2 | id BIGINT PRIMARY KEY, 3 | room_id TEXT NOT NULL, 4 | event_id TEXT NOT NULL 5 | ); 6 | CREATE TABLE state_groups_state ( 7 | state_group BIGINT NOT NULL, 8 | room_id TEXT NOT NULL, 9 | type TEXT NOT NULL, 10 | state_key TEXT NOT NULL, 11 | event_id TEXT NOT NULL 12 | ); 13 | CREATE TABLE state_group_edges ( 14 | state_group BIGINT NOT NULL, 15 | prev_state_group BIGINT NOT NULL 16 | ); 17 | CREATE INDEX state_group_edges_prev_idx ON state_group_edges (prev_state_group); 18 | CREATE INDEX state_groups_state_type_idx ON state_groups_state (state_group, type, state_key); 19 | CREATE INDEX state_groups_room_id_idx ON state_groups (room_id) ; 20 | CREATE UNIQUE INDEX state_group_edges_unique_idx ON state_group_edges (state_group, prev_state_group) ; 21 | -------------------------------------------------------------------------------- /synapse/storage/util/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /synapse/util/logformatter.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | """ 16 | Backwards compatibility re-exports of ``synapse.logging.formatter`` functionality. 17 | """ 18 | 19 | from synapse.logging.formatter import LogFormatter 20 | 21 | __all__ = ["LogFormatter"] 22 | -------------------------------------------------------------------------------- /synmark/suites/__init__.py: -------------------------------------------------------------------------------- 1 | from . import logging, lrucache, lrucache_evict 2 | 3 | SUITES = [ 4 | (logging, 1000), 5 | (logging, 10000), 6 | (logging, None), 7 | (lrucache, None), 8 | (lrucache_evict, None), 9 | ] 10 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2016 OpenMarket Ltd 2 | # Copyright 2018 New Vector Ltd 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | from twisted.trial import util 17 | 18 | from synapse.util.patch_inline_callbacks import do_patch 19 | 20 | # attempt to do the patch before we load any synapse code 21 | do_patch() 22 | 23 | util.DEFAULT_TIMEOUT_DURATION = 20 24 | -------------------------------------------------------------------------------- /tests/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/api/__init__.py -------------------------------------------------------------------------------- /tests/app/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/app/__init__.py -------------------------------------------------------------------------------- /tests/appservice/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015, 2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/config/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/crypto/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/events/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/events/__init__.py -------------------------------------------------------------------------------- /tests/federation/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/federation/__init__.py -------------------------------------------------------------------------------- /tests/federation/transport/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/federation/transport/__init__.py -------------------------------------------------------------------------------- /tests/federation/transport/server/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2022 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/handlers/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/handlers/__init__.py -------------------------------------------------------------------------------- /tests/handlers/oidc_test_key.p8: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgrHMvFcFjFhei6gHp 3 | Gfy4C8+6z7634MZbC7SSx4a17GahRANCAATp0YxEzGUXuqszggiFxczDdPgDpCJA 4 | P18rRuN7FLwZDuzYQPb8zVd8eGh4BqxjiVocICnVWyaSWD96N00I96SW 5 | -----END PRIVATE KEY----- 6 | -------------------------------------------------------------------------------- /tests/handlers/oidc_test_key.pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE6dGMRMxlF7qrM4IIhcXMw3T4A6Qi 3 | QD9fK0bjexS8GQ7s2ED2/M1XfHhoeAasY4laHCAp1Vsmklg/ejdNCPeklg== 4 | -----END PUBLIC KEY----- 5 | -------------------------------------------------------------------------------- /tests/http/federation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 New Vector Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/http/server/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2022 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/media/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2023 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/metrics/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/metrics/__init__.py -------------------------------------------------------------------------------- /tests/metrics/test_background_process_metrics.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase as StdlibTestCase 2 | from unittest.mock import Mock 3 | 4 | from synapse.logging.context import ContextResourceUsage, LoggingContext 5 | from synapse.metrics.background_process_metrics import _BackgroundProcess 6 | 7 | 8 | class TestBackgroundProcessMetrics(StdlibTestCase): 9 | def test_update_metrics_with_negative_time_diff(self) -> None: 10 | """We should ignore negative reported utime and stime differences""" 11 | usage = ContextResourceUsage() 12 | usage.ru_stime = usage.ru_utime = -1.0 13 | 14 | mock_logging_context = Mock(spec=LoggingContext) 15 | mock_logging_context.get_resource_usage.return_value = usage 16 | 17 | process = _BackgroundProcess("test process", mock_logging_context) 18 | # Should not raise 19 | process.update_metrics() 20 | -------------------------------------------------------------------------------- /tests/module_api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/module_api/__init__.py -------------------------------------------------------------------------------- /tests/push/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/push/__init__.py -------------------------------------------------------------------------------- /tests/replication/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/replication/http/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2022 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/replication/storage/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/replication/tcp/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 New Vector Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/replication/tcp/streams/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 New Vector Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/rest/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015, 2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/rest/admin/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 New Vector Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/rest/client/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015, 2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/rest/key/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/rest/key/__init__.py -------------------------------------------------------------------------------- /tests/rest/key/v2/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/rest/key/v2/__init__.py -------------------------------------------------------------------------------- /tests/rest/media/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2018 New Vector Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/scripts/__init__.py -------------------------------------------------------------------------------- /tests/server_notices/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/server_notices/__init__.py -------------------------------------------------------------------------------- /tests/state/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/state/__init__.py -------------------------------------------------------------------------------- /tests/storage/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/storage/__init__.py -------------------------------------------------------------------------------- /tests/storage/databases/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2021 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/storage/databases/main/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2021 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/storage/util/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2022 The Matrix.org Foundation C.I.C. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/test_rust.py: -------------------------------------------------------------------------------- 1 | from synapse.synapse_rust import sum_as_string 2 | 3 | from tests import unittest 4 | 5 | 6 | class RustTestCase(unittest.TestCase): 7 | """Basic tests to ensure that we can call into Rust code.""" 8 | 9 | def test_basic(self) -> None: 10 | result = sum_as_string(1, 2) 11 | self.assertEqual("3", result) 12 | -------------------------------------------------------------------------------- /tests/types/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matrix-org/synapse/be65a8ec0195955c15fdb179c9158b187638e39a/tests/types/__init__.py -------------------------------------------------------------------------------- /tests/util/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2014-2016 OpenMarket Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/util/caches/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2017 Vector Creations Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --------------------------------------------------------------------------------