diff options
author | clokep <clokep@users.noreply.github.com> | 2021-09-21 16:33:10 +0000 |
---|---|---|
committer | clokep <clokep@users.noreply.github.com> | 2021-09-21 16:33:10 +0000 |
commit | c0fd778fd47bde855bd9aa9f185afec2c3bc247e (patch) | |
tree | 7ddf9596f5f3365d4ddec53f2313c322da4b6f2a /develop | |
parent | deploy: ba7a91aea5fd624bf048f0fda0dca80da7a1945e (diff) | |
download | synapse-c0fd778fd47bde855bd9aa9f185afec2c3bc247e.tar.xz |
deploy: ebd8baf61ff8e00f8de3b63c00531765672000c8
Diffstat (limited to 'develop')
-rw-r--r-- | develop/admin_api/purge_room.html | 268 | ||||
-rw-r--r-- | develop/admin_api/shutdown_room.html | 343 | ||||
-rw-r--r-- | develop/dev/cas.html | 317 | ||||
-rw-r--r-- | develop/dev/git.html | 376 | ||||
-rw-r--r-- | develop/dev/git/branches.jpg | bin | 72228 -> 0 bytes | |||
-rw-r--r-- | develop/dev/git/clean.png | bin | 110840 -> 0 bytes | |||
-rw-r--r-- | develop/dev/git/squash.png | bin | 29667 -> 0 bytes | |||
-rw-r--r-- | develop/dev/saml.html | 294 | ||||
-rw-r--r-- | develop/modules.html | 555 | ||||
-rw-r--r-- | develop/presence_router_module.html | 461 | ||||
-rw-r--r-- | develop/spam_checker.html | 360 | ||||
-rw-r--r-- | develop/url_previews.html | 365 |
12 files changed, 0 insertions, 3339 deletions
diff --git a/develop/admin_api/purge_room.html b/develop/admin_api/purge_room.html deleted file mode 100644 index 26fba8ff11..0000000000 --- a/develop/admin_api/purge_room.html +++ /dev/null @@ -1,268 +0,0 @@ -<!DOCTYPE HTML> -<html lang="en" class="sidebar-visible no-js light"> - <head> - <!-- Book generated using mdBook --> - <meta charset="UTF-8"> - <title>Purge Rooms - Synapse</title> - - - - - <!-- Custom HTML head --> - - - - <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="theme-color" content="#ffffff" /> - - - <link rel="icon" href="../favicon.svg"> - - - <link rel="shortcut icon" href="../favicon.png"> - - <link rel="stylesheet" href="../css/variables.css"> - <link rel="stylesheet" href="../css/general.css"> - <link rel="stylesheet" href="../css/chrome.css"> - - <link rel="stylesheet" href="../css/print.css" media="print"> - - - <!-- Fonts --> - <link rel="stylesheet" href="../FontAwesome/css/font-awesome.css"> - - <link rel="stylesheet" href="../fonts/fonts.css"> - - - <!-- Highlight.js Stylesheets --> - <link rel="stylesheet" href="../highlight.css"> - <link rel="stylesheet" href="../tomorrow-night.css"> - <link rel="stylesheet" href="../ayu-highlight.css"> - - <!-- Custom theme stylesheets --> - - <link rel="stylesheet" href="../docs/website_files/table-of-contents.css"> - - <link rel="stylesheet" href="../docs/website_files/remove-nav-buttons.css"> - - <link rel="stylesheet" href="../docs/website_files/indent-section-headers.css"> - - - - </head> - <body> - <!-- Provide site root to javascript --> - <script type="text/javascript"> - var path_to_root = "../"; - var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; - </script> - - <!-- Work around some values being stored in localStorage wrapped in quotes --> - <script type="text/javascript"> - try { - var theme = localStorage.getItem('mdbook-theme'); - var sidebar = localStorage.getItem('mdbook-sidebar'); - if (theme.startsWith('"') && theme.endsWith('"')) { - localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); - } - if (sidebar.startsWith('"') && sidebar.endsWith('"')) { - localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); - } - } catch (e) { } - </script> - - <!-- Set the theme before any content is loaded, prevents flash --> - <script type="text/javascript"> - var theme; - try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } - if (theme === null || theme === undefined) { theme = default_theme; } - var html = document.querySelector('html'); - html.classList.remove('no-js') - html.classList.remove('light') - html.classList.add(theme); - html.classList.add('js'); - </script> - - <!-- Hide / unhide sidebar before it is displayed --> - <script type="text/javascript"> - var html = document.querySelector('html'); - var sidebar = 'hidden'; - if (document.body.clientWidth >= 1080) { - try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } - sidebar = sidebar || 'visible'; - } - html.classList.remove('sidebar-visible'); - html.classList.add("sidebar-" + sidebar); - </script> - - <nav id="sidebar" class="sidebar" aria-label="Table of contents"> - <div class="sidebar-scrollbox"> - <ol class="chapter"><li class="chapter-item expanded affix "><li class="part-title">Introduction</li><li class="chapter-item expanded "><a href="../welcome_and_overview.html">Welcome and Overview</a></li><li class="chapter-item expanded affix "><li class="part-title">Setup</li><li class="chapter-item expanded "><a href="../setup/installation.html">Installation</a></li><li class="chapter-item expanded "><a href="../postgres.html">Using Postgres</a></li><li class="chapter-item expanded "><a href="../reverse_proxy.html">Configuring a Reverse Proxy</a></li><li class="chapter-item expanded "><a href="../setup/forward_proxy.html">Configuring a Forward/Outbound Proxy</a></li><li class="chapter-item expanded "><a href="../turn-howto.html">Configuring a Turn Server</a></li><li class="chapter-item expanded "><a href="../delegate.html">Delegation</a></li><li class="chapter-item expanded affix "><li class="part-title">Upgrading</li><li class="chapter-item expanded "><a href="../upgrade.html">Upgrading between Synapse Versions</a></li><li class="chapter-item expanded "><a href="../MSC1711_certificates_FAQ.html">Upgrading from pre-Synapse 1.0</a></li><li class="chapter-item expanded affix "><li class="part-title">Usage</li><li class="chapter-item expanded "><a href="../federate.html">Federation</a></li><li class="chapter-item expanded "><a href="../usage/configuration/index.html">Configuration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/configuration/homeserver_sample_config.html">Homeserver Sample Config File</a></li><li class="chapter-item expanded "><a href="../usage/configuration/logging_sample_config.html">Logging Sample Config File</a></li><li class="chapter-item expanded "><a href="../structured_logging.html">Structured Logging</a></li><li class="chapter-item expanded "><a href="../usage/configuration/user_authentication/index.html">User Authentication</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single-Sign On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><div>SAML</div></li><li class="chapter-item expanded "><div>CAS</div></li><li class="chapter-item expanded "><a href="../sso_mapping_providers.html">SSO Mapping Providers</a></li></ol></li><li class="chapter-item expanded "><a href="../password_auth_providers.html">Password Auth Providers</a></li><li class="chapter-item expanded "><a href="../jwt.html">JSON Web Tokens</a></li></ol></li><li class="chapter-item expanded "><a href="../CAPTCHA_SETUP.html">Registration Captcha</a></li><li class="chapter-item expanded "><a href="../application_services.html">Application Services</a></li><li class="chapter-item expanded "><a href="../server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="../consent_tracking.html">Consent Tracking</a></li><li class="chapter-item expanded "><a href="../url_previews.html">URL Previews</a></li><li class="chapter-item expanded "><a href="../user_directory.html">User Directory</a></li><li class="chapter-item expanded "><a href="../message_retention_policies.html">Message Retention Policies</a></li><li class="chapter-item expanded "><a href="../modules.html">Pluggable Modules</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Third Party Rules</div></li><li class="chapter-item expanded "><a href="../spam_checker.html">Spam Checker</a></li><li class="chapter-item expanded "><a href="../presence_router_module.html">Presence Router</a></li><li class="chapter-item expanded "><div>Media Storage Providers</div></li></ol></li><li class="chapter-item expanded "><a href="../workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="../systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="../usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="../admin_api/delete_group.html">Delete Group</a></li><li class="chapter-item expanded "><a href="../admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="../admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="../admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="../admin_api/purge_room.html" class="active">Purge Rooms</a></li><li class="chapter-item expanded "><a href="../admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="../admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="../admin_api/rooms.html">Rooms</a></li><li class="chapter-item expanded "><a href="../admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="../admin_api/shutdown_room.html">Shutdown Room</a></li><li class="chapter-item expanded "><a href="../admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="../admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="../admin_api/version_api.html">Server Version</a></li></ol></li><li class="chapter-item expanded "><a href="../manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="../metrics-howto.html">Monitoring</a></li><li class="chapter-item expanded "><a href="../usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="../development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="../code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="../development/git.html">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li class="chapter-item expanded "><a href="../opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="../development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="../replication.html">Replication</a></li><li class="chapter-item expanded "><a href="../tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="../development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../development/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="../development/cas.html">CAS</a></li></ol></li><li class="chapter-item expanded "><a href="../development/room-dag-concepts.html">Room DAG concepts</a></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="../media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="../room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="../deprecation_policy.html">Dependency Deprecation Policy</a></li></ol> - </div> - <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> - </nav> - - <div id="page-wrapper" class="page-wrapper"> - - <div class="page"> - - <div id="menu-bar-hover-placeholder"></div> - <div id="menu-bar" class="menu-bar sticky bordered"> - <div class="left-buttons"> - <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> - <i class="fa fa-bars"></i> - </button> - <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> - <i class="fa fa-paint-brush"></i> - </button> - <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> - <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li> - <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> - <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> - <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> - <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> - </ul> - - <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> - <i class="fa fa-search"></i> - </button> - - </div> - - <h1 class="menu-title">Synapse</h1> - - <div class="right-buttons"> - - <a href="../print.html" title="Print this book" aria-label="Print this book"> - <i id="print-button" class="fa fa-print"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository"> - <i id="git-repository-button" class="fa fa-github"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse/edit/develop/docs/admin_api/purge_room.md" title="Suggest an edit" aria-label="Suggest an edit"> - <i id="git-edit-button" class="fa fa-edit"></i> - </a> - - - </div> - </div> - - - <div id="search-wrapper" class="hidden"> - <form id="searchbar-outer" class="searchbar-outer"> - <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> - </form> - <div id="searchresults-outer" class="searchresults-outer hidden"> - <div id="searchresults-header" class="searchresults-header"></div> - <ul id="searchresults"> - </ul> - </div> - </div> - - - <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> - <script type="text/javascript"> - document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); - document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); - Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { - link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); - }); - </script> - - <div id="content" class="content"> - <main> - <!-- Page table of contents --> - <div class="sidetoc"> - <nav class="pagetoc"></nav> - </div> - - <h1 id="deprecated-purge-room-api"><a class="header" href="#deprecated-purge-room-api">Deprecated: Purge room API</a></h1> -<p><strong>The old Purge room API is deprecated and will be removed in a future release. -See the new <a href="rooms.html#delete-room-api">Delete Room API</a> for more details.</strong></p> -<p>This API will remove all trace of a room from your database.</p> -<p>All local users must have left the room before it can be removed.</p> -<p>The API is:</p> -<pre><code>POST /_synapse/admin/v1/purge_room - -{ - "room_id": "!room:id" -} -</code></pre> -<p>You must authenticate using the access token of an admin user.</p> - - </main> - - <nav class="nav-wrapper" aria-label="Page navigation"> - <!-- Mobile navigation buttons --> - - <a rel="prev" href="../admin_api/purge_history_api.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="../admin_api/register_api.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - - <div style="clear: both"></div> - </nav> - </div> - </div> - - <nav class="nav-wide-wrapper" aria-label="Page navigation"> - - <a rel="prev" href="../admin_api/purge_history_api.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="../admin_api/register_api.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - </nav> - - </div> - - - - - - - - - <script type="text/javascript"> - window.playground_copyable = true; - </script> - - - - - - <script src="../elasticlunr.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../mark.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../searcher.js" type="text/javascript" charset="utf-8"></script> - - - <script src="../clipboard.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../highlight.js" type="text/javascript" charset="utf-8"></script> - <script src="../book.js" type="text/javascript" charset="utf-8"></script> - - <!-- Custom JS scripts --> - - <script type="text/javascript" src="../docs/website_files/table-of-contents.js"></script> - - - - - </body> -</html> \ No newline at end of file diff --git a/develop/admin_api/shutdown_room.html b/develop/admin_api/shutdown_room.html deleted file mode 100644 index ac030e876d..0000000000 --- a/develop/admin_api/shutdown_room.html +++ /dev/null @@ -1,343 +0,0 @@ -<!DOCTYPE HTML> -<html lang="en" class="sidebar-visible no-js light"> - <head> - <!-- Book generated using mdBook --> - <meta charset="UTF-8"> - <title>Shutdown Room - Synapse</title> - - - - - <!-- Custom HTML head --> - - - - <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="theme-color" content="#ffffff" /> - - - <link rel="icon" href="../favicon.svg"> - - - <link rel="shortcut icon" href="../favicon.png"> - - <link rel="stylesheet" href="../css/variables.css"> - <link rel="stylesheet" href="../css/general.css"> - <link rel="stylesheet" href="../css/chrome.css"> - - <link rel="stylesheet" href="../css/print.css" media="print"> - - - <!-- Fonts --> - <link rel="stylesheet" href="../FontAwesome/css/font-awesome.css"> - - <link rel="stylesheet" href="../fonts/fonts.css"> - - - <!-- Highlight.js Stylesheets --> - <link rel="stylesheet" href="../highlight.css"> - <link rel="stylesheet" href="../tomorrow-night.css"> - <link rel="stylesheet" href="../ayu-highlight.css"> - - <!-- Custom theme stylesheets --> - - <link rel="stylesheet" href="../docs/website_files/table-of-contents.css"> - - <link rel="stylesheet" href="../docs/website_files/remove-nav-buttons.css"> - - <link rel="stylesheet" href="../docs/website_files/indent-section-headers.css"> - - - - </head> - <body> - <!-- Provide site root to javascript --> - <script type="text/javascript"> - var path_to_root = "../"; - var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; - </script> - - <!-- Work around some values being stored in localStorage wrapped in quotes --> - <script type="text/javascript"> - try { - var theme = localStorage.getItem('mdbook-theme'); - var sidebar = localStorage.getItem('mdbook-sidebar'); - if (theme.startsWith('"') && theme.endsWith('"')) { - localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); - } - if (sidebar.startsWith('"') && sidebar.endsWith('"')) { - localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); - } - } catch (e) { } - </script> - - <!-- Set the theme before any content is loaded, prevents flash --> - <script type="text/javascript"> - var theme; - try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } - if (theme === null || theme === undefined) { theme = default_theme; } - var html = document.querySelector('html'); - html.classList.remove('no-js') - html.classList.remove('light') - html.classList.add(theme); - html.classList.add('js'); - </script> - - <!-- Hide / unhide sidebar before it is displayed --> - <script type="text/javascript"> - var html = document.querySelector('html'); - var sidebar = 'hidden'; - if (document.body.clientWidth >= 1080) { - try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } - sidebar = sidebar || 'visible'; - } - html.classList.remove('sidebar-visible'); - html.classList.add("sidebar-" + sidebar); - </script> - - <nav id="sidebar" class="sidebar" aria-label="Table of contents"> - <div class="sidebar-scrollbox"> - <ol class="chapter"><li class="chapter-item expanded affix "><li class="part-title">Introduction</li><li class="chapter-item expanded "><a href="../welcome_and_overview.html">Welcome and Overview</a></li><li class="chapter-item expanded affix "><li class="part-title">Setup</li><li class="chapter-item expanded "><a href="../setup/installation.html">Installation</a></li><li class="chapter-item expanded "><a href="../postgres.html">Using Postgres</a></li><li class="chapter-item expanded "><a href="../reverse_proxy.html">Configuring a Reverse Proxy</a></li><li class="chapter-item expanded "><a href="../setup/forward_proxy.html">Configuring a Forward/Outbound Proxy</a></li><li class="chapter-item expanded "><a href="../turn-howto.html">Configuring a Turn Server</a></li><li class="chapter-item expanded "><a href="../delegate.html">Delegation</a></li><li class="chapter-item expanded affix "><li class="part-title">Upgrading</li><li class="chapter-item expanded "><a href="../upgrade.html">Upgrading between Synapse Versions</a></li><li class="chapter-item expanded "><a href="../MSC1711_certificates_FAQ.html">Upgrading from pre-Synapse 1.0</a></li><li class="chapter-item expanded affix "><li class="part-title">Usage</li><li class="chapter-item expanded "><a href="../federate.html">Federation</a></li><li class="chapter-item expanded "><a href="../usage/configuration/index.html">Configuration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/configuration/homeserver_sample_config.html">Homeserver Sample Config File</a></li><li class="chapter-item expanded "><a href="../usage/configuration/logging_sample_config.html">Logging Sample Config File</a></li><li class="chapter-item expanded "><a href="../structured_logging.html">Structured Logging</a></li><li class="chapter-item expanded "><a href="../usage/configuration/user_authentication/index.html">User Authentication</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single-Sign On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><div>SAML</div></li><li class="chapter-item expanded "><div>CAS</div></li><li class="chapter-item expanded "><a href="../sso_mapping_providers.html">SSO Mapping Providers</a></li></ol></li><li class="chapter-item expanded "><a href="../password_auth_providers.html">Password Auth Providers</a></li><li class="chapter-item expanded "><a href="../jwt.html">JSON Web Tokens</a></li></ol></li><li class="chapter-item expanded "><a href="../CAPTCHA_SETUP.html">Registration Captcha</a></li><li class="chapter-item expanded "><a href="../application_services.html">Application Services</a></li><li class="chapter-item expanded "><a href="../server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="../consent_tracking.html">Consent Tracking</a></li><li class="chapter-item expanded "><a href="../url_previews.html">URL Previews</a></li><li class="chapter-item expanded "><a href="../user_directory.html">User Directory</a></li><li class="chapter-item expanded "><a href="../message_retention_policies.html">Message Retention Policies</a></li><li class="chapter-item expanded "><a href="../modules.html">Pluggable Modules</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Third Party Rules</div></li><li class="chapter-item expanded "><a href="../spam_checker.html">Spam Checker</a></li><li class="chapter-item expanded "><a href="../presence_router_module.html">Presence Router</a></li><li class="chapter-item expanded "><div>Media Storage Providers</div></li></ol></li><li class="chapter-item expanded "><a href="../workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="../systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="../usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="../admin_api/delete_group.html">Delete Group</a></li><li class="chapter-item expanded "><a href="../admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="../admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="../admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="../admin_api/purge_room.html">Purge Rooms</a></li><li class="chapter-item expanded "><a href="../admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="../admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="../admin_api/rooms.html">Rooms</a></li><li class="chapter-item expanded "><a href="../admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="../admin_api/shutdown_room.html" class="active">Shutdown Room</a></li><li class="chapter-item expanded "><a href="../admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="../admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="../admin_api/version_api.html">Server Version</a></li></ol></li><li class="chapter-item expanded "><a href="../manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="../metrics-howto.html">Monitoring</a></li><li class="chapter-item expanded "><a href="../usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="../development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="../code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="../development/git.html">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li class="chapter-item expanded "><a href="../opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="../development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="../replication.html">Replication</a></li><li class="chapter-item expanded "><a href="../tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="../development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../development/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="../development/cas.html">CAS</a></li></ol></li><li class="chapter-item expanded "><a href="../development/room-dag-concepts.html">Room DAG concepts</a></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="../media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="../room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="../deprecation_policy.html">Dependency Deprecation Policy</a></li></ol> - </div> - <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> - </nav> - - <div id="page-wrapper" class="page-wrapper"> - - <div class="page"> - - <div id="menu-bar-hover-placeholder"></div> - <div id="menu-bar" class="menu-bar sticky bordered"> - <div class="left-buttons"> - <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> - <i class="fa fa-bars"></i> - </button> - <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> - <i class="fa fa-paint-brush"></i> - </button> - <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> - <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li> - <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> - <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> - <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> - <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> - </ul> - - <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> - <i class="fa fa-search"></i> - </button> - - </div> - - <h1 class="menu-title">Synapse</h1> - - <div class="right-buttons"> - - <a href="../print.html" title="Print this book" aria-label="Print this book"> - <i id="print-button" class="fa fa-print"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository"> - <i id="git-repository-button" class="fa fa-github"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse/edit/develop/docs/admin_api/shutdown_room.md" title="Suggest an edit" aria-label="Suggest an edit"> - <i id="git-edit-button" class="fa fa-edit"></i> - </a> - - - </div> - </div> - - - <div id="search-wrapper" class="hidden"> - <form id="searchbar-outer" class="searchbar-outer"> - <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> - </form> - <div id="searchresults-outer" class="searchresults-outer hidden"> - <div id="searchresults-header" class="searchresults-header"></div> - <ul id="searchresults"> - </ul> - </div> - </div> - - - <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> - <script type="text/javascript"> - document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); - document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); - Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { - link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); - }); - </script> - - <div id="content" class="content"> - <main> - <!-- Page table of contents --> - <div class="sidetoc"> - <nav class="pagetoc"></nav> - </div> - - <h1 id="deprecated-shutdown-room-api"><a class="header" href="#deprecated-shutdown-room-api">Deprecated: Shutdown room API</a></h1> -<p><strong>The old Shutdown room API is deprecated and will be removed in a future release. -See the new <a href="rooms.html#delete-room-api">Delete Room API</a> for more details.</strong></p> -<p>Shuts down a room, preventing new joins and moves local users and room aliases automatically -to a new room. The new room will be created with the user specified by the -<code>new_room_user_id</code> parameter as room administrator and will contain a message -explaining what happened. Users invited to the new room will have power level --10 by default, and thus be unable to speak. The old room's power levels will be changed to -disallow any further invites or joins.</p> -<p>The local server will only have the power to move local user and room aliases to -the new room. Users on other servers will be unaffected.</p> -<h2 id="api"><a class="header" href="#api">API</a></h2> -<p>You will need to authenticate with an access token for an admin user.</p> -<h3 id="url"><a class="header" href="#url">URL</a></h3> -<p><code>POST /_synapse/admin/v1/shutdown_room/{room_id}</code></p> -<h3 id="url-parameters"><a class="header" href="#url-parameters">URL Parameters</a></h3> -<ul> -<li><code>room_id</code> - The ID of the room (e.g <code>!someroom:example.com</code>)</li> -</ul> -<h3 id="json-body-parameters"><a class="header" href="#json-body-parameters">JSON Body Parameters</a></h3> -<ul> -<li><code>new_room_user_id</code> - Required. A string representing the user ID of the user that will admin -the new room that all users in the old room will be moved to.</li> -<li><code>room_name</code> - Optional. A string representing the name of the room that new users will be -invited to.</li> -<li><code>message</code> - Optional. A string containing the first message that will be sent as -<code>new_room_user_id</code> in the new room. Ideally this will clearly convey why the -original room was shut down.</li> -</ul> -<p>If not specified, the default value of <code>room_name</code> is "Content Violation -Notification". The default value of <code>message</code> is "Sharing illegal content on -othis server is not permitted and rooms in violation will be blocked."</p> -<h3 id="response-parameters"><a class="header" href="#response-parameters">Response Parameters</a></h3> -<ul> -<li><code>kicked_users</code> - An integer number representing the number of users that -were kicked.</li> -<li><code>failed_to_kick_users</code> - An integer number representing the number of users -that were not kicked.</li> -<li><code>local_aliases</code> - An array of strings representing the local aliases that were migrated from -the old room to the new.</li> -<li><code>new_room_id</code> - A string representing the room ID of the new room.</li> -</ul> -<h2 id="example"><a class="header" href="#example">Example</a></h2> -<p>Request:</p> -<pre><code>POST /_synapse/admin/v1/shutdown_room/!somebadroom%3Aexample.com - -{ - "new_room_user_id": "@someuser:example.com", - "room_name": "Content Violation Notification", - "message": "Bad Room has been shutdown due to content violations on this server. Please review our Terms of Service." -} -</code></pre> -<p>Response:</p> -<pre><code>{ - "kicked_users": 5, - "failed_to_kick_users": 0, - "local_aliases": ["#badroom:example.com", "#evilsaloon:example.com], - "new_room_id": "!newroomid:example.com", -}, -</code></pre> -<h2 id="undoing-room-shutdowns"><a class="header" href="#undoing-room-shutdowns">Undoing room shutdowns</a></h2> -<p><em>Note</em>: This guide may be outdated by the time you read it. By nature of room shutdowns being performed at the database level, -the structure can and does change without notice.</p> -<p>First, it's important to understand that a room shutdown is very destructive. Undoing a shutdown is not as simple as pretending it -never happened - work has to be done to move forward instead of resetting the past. In fact, in some cases it might not be possible -to recover at all:</p> -<ul> -<li>If the room was invite-only, your users will need to be re-invited.</li> -<li>If the room no longer has any members at all, it'll be impossible to rejoin.</li> -<li>The first user to rejoin will have to do so via an alias on a different server.</li> -</ul> -<p>With all that being said, if you still want to try and recover the room:</p> -<ol> -<li>For safety reasons, shut down Synapse.</li> -<li>In the database, run <code>DELETE FROM blocked_rooms WHERE room_id = '!example:example.org';</code> -<ul> -<li>For caution: it's recommended to run this in a transaction: <code>BEGIN; DELETE ...;</code>, verify you got 1 result, then <code>COMMIT;</code>.</li> -<li>The room ID is the same one supplied to the shutdown room API, not the Content Violation room.</li> -</ul> -</li> -<li>Restart Synapse.</li> -</ol> -<p>You will have to manually handle, if you so choose, the following:</p> -<ul> -<li>Aliases that would have been redirected to the Content Violation room.</li> -<li>Users that would have been booted from the room (and will have been force-joined to the Content Violation room).</li> -<li>Removal of the Content Violation room if desired.</li> -</ul> - - </main> - - <nav class="nav-wrapper" aria-label="Page navigation"> - <!-- Mobile navigation buttons --> - - <a rel="prev" href="../admin_api/server_notices.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="../admin_api/statistics.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - - <div style="clear: both"></div> - </nav> - </div> - </div> - - <nav class="nav-wide-wrapper" aria-label="Page navigation"> - - <a rel="prev" href="../admin_api/server_notices.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="../admin_api/statistics.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - </nav> - - </div> - - - - - - - - - <script type="text/javascript"> - window.playground_copyable = true; - </script> - - - - - - <script src="../elasticlunr.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../mark.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../searcher.js" type="text/javascript" charset="utf-8"></script> - - - <script src="../clipboard.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../highlight.js" type="text/javascript" charset="utf-8"></script> - <script src="../book.js" type="text/javascript" charset="utf-8"></script> - - <!-- Custom JS scripts --> - - <script type="text/javascript" src="../docs/website_files/table-of-contents.js"></script> - - - - - </body> -</html> \ No newline at end of file diff --git a/develop/dev/cas.html b/develop/dev/cas.html deleted file mode 100644 index f70e1081e9..0000000000 --- a/develop/dev/cas.html +++ /dev/null @@ -1,317 +0,0 @@ -<!DOCTYPE HTML> -<html lang="en" class="sidebar-visible no-js light"> - <head> - <!-- Book generated using mdBook --> - <meta charset="UTF-8"> - <title>CAS - Synapse</title> - - - - - <!-- Custom HTML head --> - - - - <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="theme-color" content="#ffffff" /> - - - <link rel="icon" href="../favicon.svg"> - - - <link rel="shortcut icon" href="../favicon.png"> - - <link rel="stylesheet" href="../css/variables.css"> - <link rel="stylesheet" href="../css/general.css"> - <link rel="stylesheet" href="../css/chrome.css"> - - <link rel="stylesheet" href="../css/print.css" media="print"> - - - <!-- Fonts --> - <link rel="stylesheet" href="../FontAwesome/css/font-awesome.css"> - - <link rel="stylesheet" href="../fonts/fonts.css"> - - - <!-- Highlight.js Stylesheets --> - <link rel="stylesheet" href="../highlight.css"> - <link rel="stylesheet" href="../tomorrow-night.css"> - <link rel="stylesheet" href="../ayu-highlight.css"> - - <!-- Custom theme stylesheets --> - - <link rel="stylesheet" href="../docs/website_files/table-of-contents.css"> - - <link rel="stylesheet" href="../docs/website_files/remove-nav-buttons.css"> - - <link rel="stylesheet" href="../docs/website_files/indent-section-headers.css"> - - - - </head> - <body> - <!-- Provide site root to javascript --> - <script type="text/javascript"> - var path_to_root = "../"; - var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; - </script> - - <!-- Work around some values being stored in localStorage wrapped in quotes --> - <script type="text/javascript"> - try { - var theme = localStorage.getItem('mdbook-theme'); - var sidebar = localStorage.getItem('mdbook-sidebar'); - if (theme.startsWith('"') && theme.endsWith('"')) { - localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); - } - if (sidebar.startsWith('"') && sidebar.endsWith('"')) { - localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); - } - } catch (e) { } - </script> - - <!-- Set the theme before any content is loaded, prevents flash --> - <script type="text/javascript"> - var theme; - try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } - if (theme === null || theme === undefined) { theme = default_theme; } - var html = document.querySelector('html'); - html.classList.remove('no-js') - html.classList.remove('light') - html.classList.add(theme); - html.classList.add('js'); - </script> - - <!-- Hide / unhide sidebar before it is displayed --> - <script type="text/javascript"> - var html = document.querySelector('html'); - var sidebar = 'hidden'; - if (document.body.clientWidth >= 1080) { - try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } - sidebar = sidebar || 'visible'; - } - html.classList.remove('sidebar-visible'); - html.classList.add("sidebar-" + sidebar); - </script> - - <nav id="sidebar" class="sidebar" aria-label="Table of contents"> - <div class="sidebar-scrollbox"> - <ol class="chapter"><li class="chapter-item expanded affix "><li class="part-title">Introduction</li><li class="chapter-item expanded "><a href="../welcome_and_overview.html">Welcome and Overview</a></li><li class="chapter-item expanded affix "><li class="part-title">Setup</li><li class="chapter-item expanded "><a href="../setup/installation.html">Installation</a></li><li class="chapter-item expanded "><a href="../postgres.html">Using Postgres</a></li><li class="chapter-item expanded "><a href="../reverse_proxy.html">Configuring a Reverse Proxy</a></li><li class="chapter-item expanded "><a href="../turn-howto.html">Configuring a Turn Server</a></li><li class="chapter-item expanded "><a href="../delegate.html">Delegation</a></li><li class="chapter-item expanded affix "><li class="part-title">Upgrading</li><li class="chapter-item expanded "><a href="../upgrade.html">Upgrading between Synapse Versions</a></li><li class="chapter-item expanded "><a href="../MSC1711_certificates_FAQ.html">Upgrading from pre-Synapse 1.0</a></li><li class="chapter-item expanded affix "><li class="part-title">Usage</li><li class="chapter-item expanded "><a href="../federate.html">Federation</a></li><li class="chapter-item expanded "><a href="../usage/configuration/index.html">Configuration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/configuration/homeserver_sample_config.html">Homeserver Sample Config File</a></li><li class="chapter-item expanded "><a href="../usage/configuration/logging_sample_config.html">Logging Sample Config File</a></li><li class="chapter-item expanded "><a href="../structured_logging.html">Structured Logging</a></li><li class="chapter-item expanded "><a href="../usage/configuration/user_authentication/index.html">User Authentication</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single-Sign On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><div>SAML</div></li><li class="chapter-item expanded "><div>CAS</div></li><li class="chapter-item expanded "><a href="../sso_mapping_providers.html">SSO Mapping Providers</a></li></ol></li><li class="chapter-item expanded "><a href="../password_auth_providers.html">Password Auth Providers</a></li><li class="chapter-item expanded "><a href="../jwt.html">JSON Web Tokens</a></li></ol></li><li class="chapter-item expanded "><a href="../CAPTCHA_SETUP.html">Registration Captcha</a></li><li class="chapter-item expanded "><a href="../application_services.html">Application Services</a></li><li class="chapter-item expanded "><a href="../server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="../consent_tracking.html">Consent Tracking</a></li><li class="chapter-item expanded "><a href="../url_previews.html">URL Previews</a></li><li class="chapter-item expanded "><a href="../user_directory.html">User Directory</a></li><li class="chapter-item expanded "><a href="../message_retention_policies.html">Message Retention Policies</a></li><li class="chapter-item expanded "><a href="../modules.html">Pluggable Modules</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Third Party Rules</div></li><li class="chapter-item expanded "><a href="../spam_checker.html">Spam Checker</a></li><li class="chapter-item expanded "><a href="../presence_router_module.html">Presence Router</a></li><li class="chapter-item expanded "><div>Media Storage Providers</div></li></ol></li><li class="chapter-item expanded "><a href="../workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="../systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="../usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="../admin_api/delete_group.html">Delete Group</a></li><li class="chapter-item expanded "><a href="../admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="../admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="../admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="../admin_api/purge_room.html">Purge Rooms</a></li><li class="chapter-item expanded "><a href="../admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="../admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="../admin_api/rooms.html">Rooms</a></li><li class="chapter-item expanded "><a href="../admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="../admin_api/shutdown_room.html">Shutdown Room</a></li><li class="chapter-item expanded "><a href="../admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="../admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="../admin_api/version_api.html">Server Version</a></li></ol></li><li class="chapter-item expanded "><a href="../manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="../metrics-howto.html">Monitoring</a></li><li class="chapter-item expanded "><a href="../usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="../development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="../code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="../dev/git.html">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li class="chapter-item expanded "><a href="../opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="../development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="../replication.html">Replication</a></li><li class="chapter-item expanded "><a href="../tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="../development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../dev/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="../dev/cas.html" class="active">CAS</a></li></ol></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="../media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="../room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="../deprecation_policy.html">Dependency Deprecation Policy</a></li></ol> - </div> - <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> - </nav> - - <div id="page-wrapper" class="page-wrapper"> - - <div class="page"> - - <div id="menu-bar-hover-placeholder"></div> - <div id="menu-bar" class="menu-bar sticky bordered"> - <div class="left-buttons"> - <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> - <i class="fa fa-bars"></i> - </button> - <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> - <i class="fa fa-paint-brush"></i> - </button> - <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> - <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li> - <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> - <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> - <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> - <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> - </ul> - - <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> - <i class="fa fa-search"></i> - </button> - - </div> - - <h1 class="menu-title">Synapse</h1> - - <div class="right-buttons"> - - <a href="../print.html" title="Print this book" aria-label="Print this book"> - <i id="print-button" class="fa fa-print"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository"> - <i id="git-repository-button" class="fa fa-github"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse/edit/develop/docs/dev/cas.md" title="Suggest an edit" aria-label="Suggest an edit"> - <i id="git-edit-button" class="fa fa-edit"></i> - </a> - - - </div> - </div> - - - <div id="search-wrapper" class="hidden"> - <form id="searchbar-outer" class="searchbar-outer"> - <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> - </form> - <div id="searchresults-outer" class="searchresults-outer hidden"> - <div id="searchresults-header" class="searchresults-header"></div> - <ul id="searchresults"> - </ul> - </div> - </div> - - - <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> - <script type="text/javascript"> - document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); - document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); - Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { - link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); - }); - </script> - - <div id="content" class="content"> - <main> - <!-- Page table of contents --> - <div class="sidetoc"> - <nav class="pagetoc"></nav> - </div> - - <h1 id="how-to-test-cas-as-a-developer-without-a-server"><a class="header" href="#how-to-test-cas-as-a-developer-without-a-server">How to test CAS as a developer without a server</a></h1> -<p>The <a href="https://github.com/jbittel/django-mama-cas">django-mama-cas</a> project is an -easy to run CAS implementation built on top of Django.</p> -<h2 id="prerequisites"><a class="header" href="#prerequisites">Prerequisites</a></h2> -<ol> -<li>Create a new virtualenv: <code>python3 -m venv <your virtualenv></code></li> -<li>Activate your virtualenv: <code>source /path/to/your/virtualenv/bin/activate</code></li> -<li>Install Django and django-mama-cas: -<pre><code>python -m pip install "django<3" "django-mama-cas==2.4.0" -</code></pre> -</li> -<li>Create a Django project in the current directory: -<pre><code>django-admin startproject cas_test . -</code></pre> -</li> -<li>Follow the <a href="https://django-mama-cas.readthedocs.io/en/latest/installation.html#configuring">install directions</a> for django-mama-cas</li> -<li>Setup the SQLite database: <code>python manage.py migrate</code></li> -<li>Create a user: -<pre><code>python manage.py createsuperuser -</code></pre> -<ol> -<li>Use whatever you want as the username and password.</li> -<li>Leave the other fields blank.</li> -</ol> -</li> -<li>Use the built-in Django test server to serve the CAS endpoints on port 8000: -<pre><code>python manage.py runserver -</code></pre> -</li> -</ol> -<p>You should now have a Django project configured to serve CAS authentication with -a single user created.</p> -<h2 id="configure-synapse-and-element-to-use-cas"><a class="header" href="#configure-synapse-and-element-to-use-cas">Configure Synapse (and Element) to use CAS</a></h2> -<ol> -<li>Modify your <code>homeserver.yaml</code> to enable CAS and point it to your locally -running Django test server: -<pre><code class="language-yaml">cas_config: - enabled: true - server_url: "http://localhost:8000" - service_url: "http://localhost:8081" - #displayname_attribute: name - #required_attributes: - # name: value -</code></pre> -</li> -<li>Restart Synapse.</li> -</ol> -<p>Note that the above configuration assumes the homeserver is running on port 8081 -and that the CAS server is on port 8000, both on localhost.</p> -<h2 id="testing-the-configuration"><a class="header" href="#testing-the-configuration">Testing the configuration</a></h2> -<p>Then in Element:</p> -<ol> -<li>Visit the login page with a Element pointing at your homeserver.</li> -<li>Click the Single Sign-On button.</li> -<li>Login using the credentials created with <code>createsuperuser</code>.</li> -<li>You should be logged in.</li> -</ol> -<p>If you want to repeat this process you'll need to manually logout first:</p> -<ol> -<li>http://localhost:8000/admin/</li> -<li>Click "logout" in the top right.</li> -</ol> - - </main> - - <nav class="nav-wrapper" aria-label="Page navigation"> - <!-- Mobile navigation buttons --> - - <a rel="prev" href="../dev/saml.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="../auth_chain_difference_algorithm.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - - <div style="clear: both"></div> - </nav> - </div> - </div> - - <nav class="nav-wide-wrapper" aria-label="Page navigation"> - - <a rel="prev" href="../dev/saml.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="../auth_chain_difference_algorithm.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - </nav> - - </div> - - - - - - - - - <script type="text/javascript"> - window.playground_copyable = true; - </script> - - - - - - <script src="../elasticlunr.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../mark.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../searcher.js" type="text/javascript" charset="utf-8"></script> - - - <script src="../clipboard.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../highlight.js" type="text/javascript" charset="utf-8"></script> - <script src="../book.js" type="text/javascript" charset="utf-8"></script> - - <!-- Custom JS scripts --> - - <script type="text/javascript" src="../docs/website_files/table-of-contents.js"></script> - - - - - </body> -</html> \ No newline at end of file diff --git a/develop/dev/git.html b/develop/dev/git.html deleted file mode 100644 index 8c3c5bf7bb..0000000000 --- a/develop/dev/git.html +++ /dev/null @@ -1,376 +0,0 @@ -<!DOCTYPE HTML> -<html lang="en" class="sidebar-visible no-js light"> - <head> - <!-- Book generated using mdBook --> - <meta charset="UTF-8"> - <title>Git Usage - Synapse</title> - - - - - <!-- Custom HTML head --> - - - - <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="theme-color" content="#ffffff" /> - - - <link rel="icon" href="../favicon.svg"> - - - <link rel="shortcut icon" href="../favicon.png"> - - <link rel="stylesheet" href="../css/variables.css"> - <link rel="stylesheet" href="../css/general.css"> - <link rel="stylesheet" href="../css/chrome.css"> - - <link rel="stylesheet" href="../css/print.css" media="print"> - - - <!-- Fonts --> - <link rel="stylesheet" href="../FontAwesome/css/font-awesome.css"> - - <link rel="stylesheet" href="../fonts/fonts.css"> - - - <!-- Highlight.js Stylesheets --> - <link rel="stylesheet" href="../highlight.css"> - <link rel="stylesheet" href="../tomorrow-night.css"> - <link rel="stylesheet" href="../ayu-highlight.css"> - - <!-- Custom theme stylesheets --> - - <link rel="stylesheet" href="../docs/website_files/table-of-contents.css"> - - <link rel="stylesheet" href="../docs/website_files/remove-nav-buttons.css"> - - <link rel="stylesheet" href="../docs/website_files/indent-section-headers.css"> - - - - </head> - <body> - <!-- Provide site root to javascript --> - <script type="text/javascript"> - var path_to_root = "../"; - var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; - </script> - - <!-- Work around some values being stored in localStorage wrapped in quotes --> - <script type="text/javascript"> - try { - var theme = localStorage.getItem('mdbook-theme'); - var sidebar = localStorage.getItem('mdbook-sidebar'); - if (theme.startsWith('"') && theme.endsWith('"')) { - localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); - } - if (sidebar.startsWith('"') && sidebar.endsWith('"')) { - localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); - } - } catch (e) { } - </script> - - <!-- Set the theme before any content is loaded, prevents flash --> - <script type="text/javascript"> - var theme; - try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } - if (theme === null || theme === undefined) { theme = default_theme; } - var html = document.querySelector('html'); - html.classList.remove('no-js') - html.classList.remove('light') - html.classList.add(theme); - html.classList.add('js'); - </script> - - <!-- Hide / unhide sidebar before it is displayed --> - <script type="text/javascript"> - var html = document.querySelector('html'); - var sidebar = 'hidden'; - if (document.body.clientWidth >= 1080) { - try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } - sidebar = sidebar || 'visible'; - } - html.classList.remove('sidebar-visible'); - html.classList.add("sidebar-" + sidebar); - </script> - - <nav id="sidebar" class="sidebar" aria-label="Table of contents"> - <div class="sidebar-scrollbox"> - <ol class="chapter"><li class="chapter-item expanded affix "><li class="part-title">Introduction</li><li class="chapter-item expanded "><a href="../welcome_and_overview.html">Welcome and Overview</a></li><li class="chapter-item expanded affix "><li class="part-title">Setup</li><li class="chapter-item expanded "><a href="../setup/installation.html">Installation</a></li><li class="chapter-item expanded "><a href="../postgres.html">Using Postgres</a></li><li class="chapter-item expanded "><a href="../reverse_proxy.html">Configuring a Reverse Proxy</a></li><li class="chapter-item expanded "><a href="../turn-howto.html">Configuring a Turn Server</a></li><li class="chapter-item expanded "><a href="../delegate.html">Delegation</a></li><li class="chapter-item expanded affix "><li class="part-title">Upgrading</li><li class="chapter-item expanded "><a href="../upgrade.html">Upgrading between Synapse Versions</a></li><li class="chapter-item expanded "><a href="../MSC1711_certificates_FAQ.html">Upgrading from pre-Synapse 1.0</a></li><li class="chapter-item expanded affix "><li class="part-title">Usage</li><li class="chapter-item expanded "><a href="../federate.html">Federation</a></li><li class="chapter-item expanded "><a href="../usage/configuration/index.html">Configuration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/configuration/homeserver_sample_config.html">Homeserver Sample Config File</a></li><li class="chapter-item expanded "><a href="../usage/configuration/logging_sample_config.html">Logging Sample Config File</a></li><li class="chapter-item expanded "><a href="../structured_logging.html">Structured Logging</a></li><li class="chapter-item expanded "><a href="../usage/configuration/user_authentication/index.html">User Authentication</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single-Sign On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><div>SAML</div></li><li class="chapter-item expanded "><div>CAS</div></li><li class="chapter-item expanded "><a href="../sso_mapping_providers.html">SSO Mapping Providers</a></li></ol></li><li class="chapter-item expanded "><a href="../password_auth_providers.html">Password Auth Providers</a></li><li class="chapter-item expanded "><a href="../jwt.html">JSON Web Tokens</a></li></ol></li><li class="chapter-item expanded "><a href="../CAPTCHA_SETUP.html">Registration Captcha</a></li><li class="chapter-item expanded "><a href="../application_services.html">Application Services</a></li><li class="chapter-item expanded "><a href="../server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="../consent_tracking.html">Consent Tracking</a></li><li class="chapter-item expanded "><a href="../url_previews.html">URL Previews</a></li><li class="chapter-item expanded "><a href="../user_directory.html">User Directory</a></li><li class="chapter-item expanded "><a href="../message_retention_policies.html">Message Retention Policies</a></li><li class="chapter-item expanded "><a href="../modules.html">Pluggable Modules</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Third Party Rules</div></li><li class="chapter-item expanded "><a href="../spam_checker.html">Spam Checker</a></li><li class="chapter-item expanded "><a href="../presence_router_module.html">Presence Router</a></li><li class="chapter-item expanded "><div>Media Storage Providers</div></li></ol></li><li class="chapter-item expanded "><a href="../workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="../systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="../usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="../admin_api/delete_group.html">Delete Group</a></li><li class="chapter-item expanded "><a href="../admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="../admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="../admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="../admin_api/purge_room.html">Purge Rooms</a></li><li class="chapter-item expanded "><a href="../admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="../admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="../admin_api/rooms.html">Rooms</a></li><li class="chapter-item expanded "><a href="../admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="../admin_api/shutdown_room.html">Shutdown Room</a></li><li class="chapter-item expanded "><a href="../admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="../admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="../admin_api/version_api.html">Server Version</a></li></ol></li><li class="chapter-item expanded "><a href="../manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="../metrics-howto.html">Monitoring</a></li><li class="chapter-item expanded "><a href="../usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="../development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="../code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="../dev/git.html" class="active">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li class="chapter-item expanded "><a href="../opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="../development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="../replication.html">Replication</a></li><li class="chapter-item expanded "><a href="../tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="../development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../dev/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="../dev/cas.html">CAS</a></li></ol></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="../media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="../room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="../deprecation_policy.html">Dependency Deprecation Policy</a></li></ol> - </div> - <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> - </nav> - - <div id="page-wrapper" class="page-wrapper"> - - <div class="page"> - - <div id="menu-bar-hover-placeholder"></div> - <div id="menu-bar" class="menu-bar sticky bordered"> - <div class="left-buttons"> - <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> - <i class="fa fa-bars"></i> - </button> - <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> - <i class="fa fa-paint-brush"></i> - </button> - <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> - <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li> - <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> - <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> - <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> - <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> - </ul> - - <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> - <i class="fa fa-search"></i> - </button> - - </div> - - <h1 class="menu-title">Synapse</h1> - - <div class="right-buttons"> - - <a href="../print.html" title="Print this book" aria-label="Print this book"> - <i id="print-button" class="fa fa-print"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository"> - <i id="git-repository-button" class="fa fa-github"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse/edit/develop/docs/dev/git.md" title="Suggest an edit" aria-label="Suggest an edit"> - <i id="git-edit-button" class="fa fa-edit"></i> - </a> - - - </div> - </div> - - - <div id="search-wrapper" class="hidden"> - <form id="searchbar-outer" class="searchbar-outer"> - <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> - </form> - <div id="searchresults-outer" class="searchresults-outer hidden"> - <div id="searchresults-header" class="searchresults-header"></div> - <ul id="searchresults"> - </ul> - </div> - </div> - - - <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> - <script type="text/javascript"> - document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); - document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); - Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { - link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); - }); - </script> - - <div id="content" class="content"> - <main> - <!-- Page table of contents --> - <div class="sidetoc"> - <nav class="pagetoc"></nav> - </div> - - <h1 id="some-notes-on-how-we-use-git"><a class="header" href="#some-notes-on-how-we-use-git">Some notes on how we use git</a></h1> -<h2 id="on-keeping-the-commit-history-clean"><a class="header" href="#on-keeping-the-commit-history-clean">On keeping the commit history clean</a></h2> -<p>In an ideal world, our git commit history would be a linear progression of -commits each of which contains a single change building on what came -before. Here, by way of an arbitrary example, is the top of <code>git log --graph b2dba0607</code>:</p> -<img src="git/clean.png" alt="clean git graph" width="500px"> -<p>Note how the commit comment explains clearly what is changing and why. Also -note the <em>absence</em> of merge commits, as well as the absence of commits called -things like (to pick a few culprits): -<a href="https://github.com/matrix-org/synapse/commit/84691da6c">“pep8”</a>, <a href="https://github.com/matrix-org/synapse/commit/474810d9d">“fix broken -test”</a>, -<a href="https://github.com/matrix-org/synapse/commit/c9d72e457">“oops”</a>, -<a href="https://github.com/matrix-org/synapse/commit/836358823">“typo”</a>, or <a href="https://github.com/matrix-org/synapse/commit/707374d5d">“Who's -the president?”</a>.</p> -<p>There are a number of reasons why keeping a clean commit history is a good -thing:</p> -<ul> -<li> -<p>From time to time, after a change lands, it turns out to be necessary to -revert it, or to backport it to a release branch. Those operations are -<em>much</em> easier when the change is contained in a single commit.</p> -</li> -<li> -<p>Similarly, it's much easier to answer questions like “is the fix for -<code>/publicRooms</code> on the release branch?” if that change consists of a single -commit.</p> -</li> -<li> -<p>Likewise: “what has changed on this branch in the last week?” is much -clearer without merges and “pep8” commits everywhere.</p> -</li> -<li> -<p>Sometimes we need to figure out where a bug got introduced, or some -behaviour changed. One way of doing that is with <code>git bisect</code>: pick an -arbitrary commit between the known good point and the known bad point, and -see how the code behaves. However, that strategy fails if the commit you -chose is the middle of someone's epic branch in which they broke the world -before putting it back together again.</p> -</li> -</ul> -<p>One counterargument is that it is sometimes useful to see how a PR evolved as -it went through review cycles. This is true, but that information is always -available via the GitHub UI (or via the little-known <a href="https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/checking-out-pull-requests-locally">refs/pull -namespace</a>).</p> -<p>Of course, in reality, things are more complicated than that. We have release -branches as well as <code>develop</code> and <code>master</code>, and we deliberately merge changes -between them. Bugs often slip through and have to be fixed later. That's all -fine: this not a cast-iron rule which must be obeyed, but an ideal to aim -towards.</p> -<h2 id="merges-squashes-rebases-wtf"><a class="header" href="#merges-squashes-rebases-wtf">Merges, squashes, rebases: wtf?</a></h2> -<p>Ok, so that's what we'd like to achieve. How do we achieve it?</p> -<p>The TL;DR is: when you come to merge a pull request, you <em>probably</em> want to -“squash and merge”:</p> -<p><img src="git/squash.png" alt="squash and merge" />.</p> -<p>(This applies whether you are merging your own PR, or that of another -contributor.)</p> -<p>“Squash and merge”<sup id="a1"><a href="#f1">1</a></sup> takes all of the changes in the -PR, and bundles them into a single commit. GitHub gives you the opportunity to -edit the commit message before you confirm, and normally you should do so, -because the default will be useless (again: <code>* woops typo</code> is not a useful -thing to keep in the historical record).</p> -<p>The main problem with this approach comes when you have a series of pull -requests which build on top of one another: as soon as you squash-merge the -first PR, you'll end up with a stack of conflicts to resolve in all of the -others. In general, it's best to avoid this situation in the first place by -trying not to have multiple related PRs in flight at the same time. Still, -sometimes that's not possible and doing a regular merge is the lesser evil.</p> -<p>Another occasion in which a regular merge makes more sense is a PR where you've -deliberately created a series of commits each of which makes sense in its own -right. For example: <a href="https://github.com/matrix-org/synapse/pull/6837">a PR which gradually propagates a refactoring operation -through the codebase</a>, or <a href="https://github.com/matrix-org/synapse/pull/5987">a -PR which is the culmination of several other -PRs</a>. In this case the ability -to figure out when a particular change/bug was introduced could be very useful.</p> -<p>Ultimately: <strong>this is not a hard-and-fast-rule</strong>. If in doubt, ask yourself “do -each of the commits I am about to merge make sense in their own right”, but -remember that we're just doing our best to balance “keeping the commit history -clean” with other factors.</p> -<h2 id="git-branching-model"><a class="header" href="#git-branching-model">Git branching model</a></h2> -<p>A <a href="https://nvie.com/posts/a-successful-git-branching-model/">lot</a> -<a href="http://scottchacon.com/2011/08/31/github-flow.html">of</a> -<a href="https://www.endoflineblog.com/gitflow-considered-harmful">words</a> have been -written in the past about git branching models (no really, <a href="https://martinfowler.com/articles/branching-patterns.html">a -lot</a>). I tend to -think the whole thing is overblown. Fundamentally, it's not that -complicated. Here's how we do it.</p> -<p>Let's start with a picture:</p> -<p><img src="git/branches.jpg" alt="branching model" /></p> -<p>It looks complicated, but it's really not. There's one basic rule: <em>anyone</em> is -free to merge from <em>any</em> more-stable branch to <em>any</em> less-stable branch at -<em>any</em> time<sup id="a2"><a href="#f2">2</a></sup>. (The principle behind this is that if a -change is good enough for the more-stable branch, then it's also good enough go -put in a less-stable branch.)</p> -<p>Meanwhile, merging (or squashing, as per the above) from a less-stable to a -more-stable branch is a deliberate action in which you want to publish a change -or a set of changes to (some subset of) the world: for example, this happens -when a PR is landed, or as part of our release process.</p> -<p>So, what counts as a more- or less-stable branch? A little reflection will show -that our active branches are ordered thus, from more-stable to less-stable:</p> -<ul> -<li><code>master</code> (tracks our last release).</li> -<li><code>release-vX.Y</code> (the branch where we prepare the next release)<sup - id="a3"><a href="#f3">3</a></sup>.</li> -<li>PR branches which are targeting the release.</li> -<li><code>develop</code> (our "mainline" branch containing our bleeding-edge).</li> -<li>regular PR branches.</li> -</ul> -<p>The corollary is: if you have a bugfix that needs to land in both -<code>release-vX.Y</code> <em>and</em> <code>develop</code>, then you should base your PR on -<code>release-vX.Y</code>, get it merged there, and then merge from <code>release-vX.Y</code> to -<code>develop</code>. (If a fix lands in <code>develop</code> and we later need it in a -release-branch, we can of course cherry-pick it, but landing it in the release -branch first helps reduce the chance of annoying conflicts.)</p> -<hr /> -<p><b id="f1">[1]</b>: “Squash and merge” is GitHub's term for this -operation. Given that there is no merge involved, I'm not convinced it's the -most intuitive name. <a href="#a1">^</a></p> -<p><b id="f2">[2]</b>: Well, anyone with commit access.<a href="#a2">^</a></p> -<p><b id="f3">[3]</b>: Very, very occasionally (I think this has happened once in -the history of Synapse), we've had two releases in flight at once. Obviously, -<code>release-v1.2</code> is more-stable than <code>release-v1.3</code>. <a href="#a3">^</a></p> - - </main> - - <nav class="nav-wrapper" aria-label="Page navigation"> - <!-- Mobile navigation buttons --> - - <a rel="prev" href="../code_style.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="../opentracing.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - - <div style="clear: both"></div> - </nav> - </div> - </div> - - <nav class="nav-wide-wrapper" aria-label="Page navigation"> - - <a rel="prev" href="../code_style.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="../opentracing.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - </nav> - - </div> - - - - - - - - - <script type="text/javascript"> - window.playground_copyable = true; - </script> - - - - - - <script src="../elasticlunr.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../mark.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../searcher.js" type="text/javascript" charset="utf-8"></script> - - - <script src="../clipboard.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../highlight.js" type="text/javascript" charset="utf-8"></script> - <script src="../book.js" type="text/javascript" charset="utf-8"></script> - - <!-- Custom JS scripts --> - - <script type="text/javascript" src="../docs/website_files/table-of-contents.js"></script> - - - - - </body> -</html> \ No newline at end of file diff --git a/develop/dev/git/branches.jpg b/develop/dev/git/branches.jpg deleted file mode 100644 index 715ecc8cd0..0000000000 --- a/develop/dev/git/branches.jpg +++ /dev/null Binary files differdiff --git a/develop/dev/git/clean.png b/develop/dev/git/clean.png deleted file mode 100644 index 3accd7ccef..0000000000 --- a/develop/dev/git/clean.png +++ /dev/null Binary files differdiff --git a/develop/dev/git/squash.png b/develop/dev/git/squash.png deleted file mode 100644 index 234caca3e4..0000000000 --- a/develop/dev/git/squash.png +++ /dev/null Binary files differdiff --git a/develop/dev/saml.html b/develop/dev/saml.html deleted file mode 100644 index 749b12817b..0000000000 --- a/develop/dev/saml.html +++ /dev/null @@ -1,294 +0,0 @@ -<!DOCTYPE HTML> -<html lang="en" class="sidebar-visible no-js light"> - <head> - <!-- Book generated using mdBook --> - <meta charset="UTF-8"> - <title>SAML - Synapse</title> - - - - - <!-- Custom HTML head --> - - - - <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="theme-color" content="#ffffff" /> - - - <link rel="icon" href="../favicon.svg"> - - - <link rel="shortcut icon" href="../favicon.png"> - - <link rel="stylesheet" href="../css/variables.css"> - <link rel="stylesheet" href="../css/general.css"> - <link rel="stylesheet" href="../css/chrome.css"> - - <link rel="stylesheet" href="../css/print.css" media="print"> - - - <!-- Fonts --> - <link rel="stylesheet" href="../FontAwesome/css/font-awesome.css"> - - <link rel="stylesheet" href="../fonts/fonts.css"> - - - <!-- Highlight.js Stylesheets --> - <link rel="stylesheet" href="../highlight.css"> - <link rel="stylesheet" href="../tomorrow-night.css"> - <link rel="stylesheet" href="../ayu-highlight.css"> - - <!-- Custom theme stylesheets --> - - <link rel="stylesheet" href="../docs/website_files/table-of-contents.css"> - - <link rel="stylesheet" href="../docs/website_files/remove-nav-buttons.css"> - - <link rel="stylesheet" href="../docs/website_files/indent-section-headers.css"> - - - - </head> - <body> - <!-- Provide site root to javascript --> - <script type="text/javascript"> - var path_to_root = "../"; - var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; - </script> - - <!-- Work around some values being stored in localStorage wrapped in quotes --> - <script type="text/javascript"> - try { - var theme = localStorage.getItem('mdbook-theme'); - var sidebar = localStorage.getItem('mdbook-sidebar'); - if (theme.startsWith('"') && theme.endsWith('"')) { - localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); - } - if (sidebar.startsWith('"') && sidebar.endsWith('"')) { - localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); - } - } catch (e) { } - </script> - - <!-- Set the theme before any content is loaded, prevents flash --> - <script type="text/javascript"> - var theme; - try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } - if (theme === null || theme === undefined) { theme = default_theme; } - var html = document.querySelector('html'); - html.classList.remove('no-js') - html.classList.remove('light') - html.classList.add(theme); - html.classList.add('js'); - </script> - - <!-- Hide / unhide sidebar before it is displayed --> - <script type="text/javascript"> - var html = document.querySelector('html'); - var sidebar = 'hidden'; - if (document.body.clientWidth >= 1080) { - try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } - sidebar = sidebar || 'visible'; - } - html.classList.remove('sidebar-visible'); - html.classList.add("sidebar-" + sidebar); - </script> - - <nav id="sidebar" class="sidebar" aria-label="Table of contents"> - <div class="sidebar-scrollbox"> - <ol class="chapter"><li class="chapter-item expanded affix "><li class="part-title">Introduction</li><li class="chapter-item expanded "><a href="../welcome_and_overview.html">Welcome and Overview</a></li><li class="chapter-item expanded affix "><li class="part-title">Setup</li><li class="chapter-item expanded "><a href="../setup/installation.html">Installation</a></li><li class="chapter-item expanded "><a href="../postgres.html">Using Postgres</a></li><li class="chapter-item expanded "><a href="../reverse_proxy.html">Configuring a Reverse Proxy</a></li><li class="chapter-item expanded "><a href="../turn-howto.html">Configuring a Turn Server</a></li><li class="chapter-item expanded "><a href="../delegate.html">Delegation</a></li><li class="chapter-item expanded affix "><li class="part-title">Upgrading</li><li class="chapter-item expanded "><a href="../upgrade.html">Upgrading between Synapse Versions</a></li><li class="chapter-item expanded "><a href="../MSC1711_certificates_FAQ.html">Upgrading from pre-Synapse 1.0</a></li><li class="chapter-item expanded affix "><li class="part-title">Usage</li><li class="chapter-item expanded "><a href="../federate.html">Federation</a></li><li class="chapter-item expanded "><a href="../usage/configuration/index.html">Configuration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/configuration/homeserver_sample_config.html">Homeserver Sample Config File</a></li><li class="chapter-item expanded "><a href="../usage/configuration/logging_sample_config.html">Logging Sample Config File</a></li><li class="chapter-item expanded "><a href="../structured_logging.html">Structured Logging</a></li><li class="chapter-item expanded "><a href="../usage/configuration/user_authentication/index.html">User Authentication</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single-Sign On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><div>SAML</div></li><li class="chapter-item expanded "><div>CAS</div></li><li class="chapter-item expanded "><a href="../sso_mapping_providers.html">SSO Mapping Providers</a></li></ol></li><li class="chapter-item expanded "><a href="../password_auth_providers.html">Password Auth Providers</a></li><li class="chapter-item expanded "><a href="../jwt.html">JSON Web Tokens</a></li></ol></li><li class="chapter-item expanded "><a href="../CAPTCHA_SETUP.html">Registration Captcha</a></li><li class="chapter-item expanded "><a href="../application_services.html">Application Services</a></li><li class="chapter-item expanded "><a href="../server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="../consent_tracking.html">Consent Tracking</a></li><li class="chapter-item expanded "><a href="../url_previews.html">URL Previews</a></li><li class="chapter-item expanded "><a href="../user_directory.html">User Directory</a></li><li class="chapter-item expanded "><a href="../message_retention_policies.html">Message Retention Policies</a></li><li class="chapter-item expanded "><a href="../modules.html">Pluggable Modules</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Third Party Rules</div></li><li class="chapter-item expanded "><a href="../spam_checker.html">Spam Checker</a></li><li class="chapter-item expanded "><a href="../presence_router_module.html">Presence Router</a></li><li class="chapter-item expanded "><div>Media Storage Providers</div></li></ol></li><li class="chapter-item expanded "><a href="../workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="../systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="../usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="../admin_api/delete_group.html">Delete Group</a></li><li class="chapter-item expanded "><a href="../admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="../admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="../admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="../admin_api/purge_room.html">Purge Rooms</a></li><li class="chapter-item expanded "><a href="../admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="../admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="../admin_api/rooms.html">Rooms</a></li><li class="chapter-item expanded "><a href="../admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="../admin_api/shutdown_room.html">Shutdown Room</a></li><li class="chapter-item expanded "><a href="../admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="../admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="../admin_api/version_api.html">Server Version</a></li></ol></li><li class="chapter-item expanded "><a href="../manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="../metrics-howto.html">Monitoring</a></li><li class="chapter-item expanded "><a href="../usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="../development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="../code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="../dev/git.html">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li class="chapter-item expanded "><a href="../opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="../development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="../replication.html">Replication</a></li><li class="chapter-item expanded "><a href="../tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="../development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../dev/saml.html" class="active">SAML</a></li><li class="chapter-item expanded "><a href="../dev/cas.html">CAS</a></li></ol></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="../auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="../media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="../room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="../deprecation_policy.html">Dependency Deprecation Policy</a></li></ol> - </div> - <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> - </nav> - - <div id="page-wrapper" class="page-wrapper"> - - <div class="page"> - - <div id="menu-bar-hover-placeholder"></div> - <div id="menu-bar" class="menu-bar sticky bordered"> - <div class="left-buttons"> - <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> - <i class="fa fa-bars"></i> - </button> - <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> - <i class="fa fa-paint-brush"></i> - </button> - <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> - <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li> - <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> - <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> - <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> - <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> - </ul> - - <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> - <i class="fa fa-search"></i> - </button> - - </div> - - <h1 class="menu-title">Synapse</h1> - - <div class="right-buttons"> - - <a href="../print.html" title="Print this book" aria-label="Print this book"> - <i id="print-button" class="fa fa-print"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository"> - <i id="git-repository-button" class="fa fa-github"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse/edit/develop/docs/dev/saml.md" title="Suggest an edit" aria-label="Suggest an edit"> - <i id="git-edit-button" class="fa fa-edit"></i> - </a> - - - </div> - </div> - - - <div id="search-wrapper" class="hidden"> - <form id="searchbar-outer" class="searchbar-outer"> - <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> - </form> - <div id="searchresults-outer" class="searchresults-outer hidden"> - <div id="searchresults-header" class="searchresults-header"></div> - <ul id="searchresults"> - </ul> - </div> - </div> - - - <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> - <script type="text/javascript"> - document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); - document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); - Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { - link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); - }); - </script> - - <div id="content" class="content"> - <main> - <!-- Page table of contents --> - <div class="sidetoc"> - <nav class="pagetoc"></nav> - </div> - - <h1 id="how-to-test-saml-as-a-developer-without-a-server"><a class="header" href="#how-to-test-saml-as-a-developer-without-a-server">How to test SAML as a developer without a server</a></h1> -<p>https://capriza.github.io/samling/samling.html (https://github.com/capriza/samling) is a great -resource for being able to tinker with the SAML options within Synapse without needing to -deploy and configure a complicated software stack.</p> -<p>To make Synapse (and therefore Riot) use it:</p> -<ol> -<li>Use the samling.html URL above or deploy your own and visit the IdP Metadata tab.</li> -<li>Copy the XML to your clipboard.</li> -<li>On your Synapse server, create a new file <code>samling.xml</code> next to your <code>homeserver.yaml</code> with -the XML from step 2 as the contents.</li> -<li>Edit your <code>homeserver.yaml</code> to include: -<pre><code class="language-yaml">saml2_config: - sp_config: - allow_unknown_attributes: true # Works around a bug with AVA Hashes: https://github.com/IdentityPython/pysaml2/issues/388 - metadata: - local: ["samling.xml"] -</code></pre> -</li> -<li>Ensure that your <code>homeserver.yaml</code> has a setting for <code>public_baseurl</code>: -<pre><code class="language-yaml">public_baseurl: http://localhost:8080/ -</code></pre> -</li> -<li>Run <code>apt-get install xmlsec1</code> and <code>pip install --upgrade --force 'pysaml2>=4.5.0'</code> to ensure -the dependencies are installed and ready to go.</li> -<li>Restart Synapse.</li> -</ol> -<p>Then in Riot:</p> -<ol> -<li>Visit the login page with a Riot pointing at your homeserver.</li> -<li>Click the Single Sign-On button.</li> -<li>On the samling page, enter a Name Identifier and add a SAML Attribute for <code>uid=your_localpart</code>. -The response must also be signed.</li> -<li>Click "Next".</li> -<li>Click "Post Response" (change nothing).</li> -<li>You should be logged in.</li> -</ol> -<p>If you try and repeat this process, you may be automatically logged in using the information you -gave previously. To fix this, open your developer console (<code>F12</code> or <code>Ctrl+Shift+I</code>) while on the -samling page and clear the site data. In Chrome, this will be a button on the Application tab.</p> - - </main> - - <nav class="nav-wrapper" aria-label="Page navigation"> - <!-- Mobile navigation buttons --> - - <a rel="prev" href="../development/internal_documentation/index.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="../dev/cas.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - - <div style="clear: both"></div> - </nav> - </div> - </div> - - <nav class="nav-wide-wrapper" aria-label="Page navigation"> - - <a rel="prev" href="../development/internal_documentation/index.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="../dev/cas.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - </nav> - - </div> - - - - - - - - - <script type="text/javascript"> - window.playground_copyable = true; - </script> - - - - - - <script src="../elasticlunr.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../mark.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../searcher.js" type="text/javascript" charset="utf-8"></script> - - - <script src="../clipboard.min.js" type="text/javascript" charset="utf-8"></script> - <script src="../highlight.js" type="text/javascript" charset="utf-8"></script> - <script src="../book.js" type="text/javascript" charset="utf-8"></script> - - <!-- Custom JS scripts --> - - <script type="text/javascript" src="../docs/website_files/table-of-contents.js"></script> - - - - - </body> -</html> \ No newline at end of file diff --git a/develop/modules.html b/develop/modules.html deleted file mode 100644 index 1f1de14915..0000000000 --- a/develop/modules.html +++ /dev/null @@ -1,555 +0,0 @@ -<!DOCTYPE HTML> -<html lang="en" class="sidebar-visible no-js light"> - <head> - <!-- Book generated using mdBook --> - <meta charset="UTF-8"> - <title>Pluggable Modules - Synapse</title> - - - - - <!-- Custom HTML head --> - - - - <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="theme-color" content="#ffffff" /> - - - <link rel="icon" href="favicon.svg"> - - - <link rel="shortcut icon" href="favicon.png"> - - <link rel="stylesheet" href="css/variables.css"> - <link rel="stylesheet" href="css/general.css"> - <link rel="stylesheet" href="css/chrome.css"> - - <link rel="stylesheet" href="css/print.css" media="print"> - - - <!-- Fonts --> - <link rel="stylesheet" href="FontAwesome/css/font-awesome.css"> - - <link rel="stylesheet" href="fonts/fonts.css"> - - - <!-- Highlight.js Stylesheets --> - <link rel="stylesheet" href="highlight.css"> - <link rel="stylesheet" href="tomorrow-night.css"> - <link rel="stylesheet" href="ayu-highlight.css"> - - <!-- Custom theme stylesheets --> - - <link rel="stylesheet" href="docs/website_files/table-of-contents.css"> - - <link rel="stylesheet" href="docs/website_files/remove-nav-buttons.css"> - - <link rel="stylesheet" href="docs/website_files/indent-section-headers.css"> - - - - </head> - <body> - <!-- Provide site root to javascript --> - <script type="text/javascript"> - var path_to_root = ""; - var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; - </script> - - <!-- Work around some values being stored in localStorage wrapped in quotes --> - <script type="text/javascript"> - try { - var theme = localStorage.getItem('mdbook-theme'); - var sidebar = localStorage.getItem('mdbook-sidebar'); - if (theme.startsWith('"') && theme.endsWith('"')) { - localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); - } - if (sidebar.startsWith('"') && sidebar.endsWith('"')) { - localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); - } - } catch (e) { } - </script> - - <!-- Set the theme before any content is loaded, prevents flash --> - <script type="text/javascript"> - var theme; - try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } - if (theme === null || theme === undefined) { theme = default_theme; } - var html = document.querySelector('html'); - html.classList.remove('no-js') - html.classList.remove('light') - html.classList.add(theme); - html.classList.add('js'); - </script> - - <!-- Hide / unhide sidebar before it is displayed --> - <script type="text/javascript"> - var html = document.querySelector('html'); - var sidebar = 'hidden'; - if (document.body.clientWidth >= 1080) { - try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } - sidebar = sidebar || 'visible'; - } - html.classList.remove('sidebar-visible'); - html.classList.add("sidebar-" + sidebar); - </script> - - <nav id="sidebar" class="sidebar" aria-label="Table of contents"> - <div class="sidebar-scrollbox"> - <ol class="chapter"><li class="chapter-item expanded affix "><li class="part-title">Introduction</li><li class="chapter-item expanded "><a href="welcome_and_overview.html">Welcome and Overview</a></li><li class="chapter-item expanded affix "><li class="part-title">Setup</li><li class="chapter-item expanded "><a href="setup/installation.html">Installation</a></li><li class="chapter-item expanded "><a href="postgres.html">Using Postgres</a></li><li class="chapter-item expanded "><a href="reverse_proxy.html">Configuring a Reverse Proxy</a></li><li class="chapter-item expanded "><a href="setup/forward_proxy.html">Configuring a Forward/Outbound Proxy</a></li><li class="chapter-item expanded "><a href="turn-howto.html">Configuring a Turn Server</a></li><li class="chapter-item expanded "><a href="delegate.html">Delegation</a></li><li class="chapter-item expanded affix "><li class="part-title">Upgrading</li><li class="chapter-item expanded "><a href="upgrade.html">Upgrading between Synapse Versions</a></li><li class="chapter-item expanded "><a href="MSC1711_certificates_FAQ.html">Upgrading from pre-Synapse 1.0</a></li><li class="chapter-item expanded affix "><li class="part-title">Usage</li><li class="chapter-item expanded "><a href="federate.html">Federation</a></li><li class="chapter-item expanded "><a href="usage/configuration/index.html">Configuration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/configuration/homeserver_sample_config.html">Homeserver Sample Config File</a></li><li class="chapter-item expanded "><a href="usage/configuration/logging_sample_config.html">Logging Sample Config File</a></li><li class="chapter-item expanded "><a href="structured_logging.html">Structured Logging</a></li><li class="chapter-item expanded "><a href="templates.html">Templates</a></li><li class="chapter-item expanded "><a href="usage/configuration/user_authentication/index.html">User Authentication</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single-Sign On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><div>SAML</div></li><li class="chapter-item expanded "><div>CAS</div></li><li class="chapter-item expanded "><a href="sso_mapping_providers.html">SSO Mapping Providers</a></li></ol></li><li class="chapter-item expanded "><a href="password_auth_providers.html">Password Auth Providers</a></li><li class="chapter-item expanded "><a href="jwt.html">JSON Web Tokens</a></li></ol></li><li class="chapter-item expanded "><a href="CAPTCHA_SETUP.html">Registration Captcha</a></li><li class="chapter-item expanded "><a href="application_services.html">Application Services</a></li><li class="chapter-item expanded "><a href="server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="consent_tracking.html">Consent Tracking</a></li><li class="chapter-item expanded "><a href="development/url_previews.html">URL Previews</a></li><li class="chapter-item expanded "><a href="user_directory.html">User Directory</a></li><li class="chapter-item expanded "><a href="message_retention_policies.html">Message Retention Policies</a></li><li class="chapter-item expanded "><a href="modules.html" class="active">Pluggable Modules</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Third Party Rules</div></li><li class="chapter-item expanded "><a href="spam_checker.html">Spam Checker</a></li><li class="chapter-item expanded "><a href="presence_router_module.html">Presence Router</a></li><li class="chapter-item expanded "><div>Media Storage Providers</div></li></ol></li><li class="chapter-item expanded "><a href="workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="admin_api/delete_group.html">Delete Group</a></li><li class="chapter-item expanded "><a href="admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="usage/administration/admin_api/registration_tokens.html">Registration Tokens</a></li><li class="chapter-item expanded "><a href="admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="admin_api/rooms.html">Rooms</a></li><li class="chapter-item expanded "><a href="admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="admin_api/version_api.html">Server Version</a></li></ol></li><li class="chapter-item expanded "><a href="manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="metrics-howto.html">Monitoring</a></li><li class="chapter-item expanded "><a href="usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="development/git.html">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li class="chapter-item expanded "><a href="opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="replication.html">Replication</a></li><li class="chapter-item expanded "><a href="tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="development/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="development/cas.html">CAS</a></li></ol></li><li class="chapter-item expanded "><a href="development/room-dag-concepts.html">Room DAG concepts</a></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="deprecation_policy.html">Dependency Deprecation Policy</a></li></ol> - </div> - <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> - </nav> - - <div id="page-wrapper" class="page-wrapper"> - - <div class="page"> - - <div id="menu-bar-hover-placeholder"></div> - <div id="menu-bar" class="menu-bar sticky bordered"> - <div class="left-buttons"> - <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> - <i class="fa fa-bars"></i> - </button> - <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> - <i class="fa fa-paint-brush"></i> - </button> - <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> - <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li> - <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> - <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> - <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> - <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> - </ul> - - <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> - <i class="fa fa-search"></i> - </button> - - </div> - - <h1 class="menu-title">Synapse</h1> - - <div class="right-buttons"> - - <a href="print.html" title="Print this book" aria-label="Print this book"> - <i id="print-button" class="fa fa-print"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository"> - <i id="git-repository-button" class="fa fa-github"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse/edit/develop/docs/modules.md" title="Suggest an edit" aria-label="Suggest an edit"> - <i id="git-edit-button" class="fa fa-edit"></i> - </a> - - - </div> - </div> - - - <div id="search-wrapper" class="hidden"> - <form id="searchbar-outer" class="searchbar-outer"> - <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> - </form> - <div id="searchresults-outer" class="searchresults-outer hidden"> - <div id="searchresults-header" class="searchresults-header"></div> - <ul id="searchresults"> - </ul> - </div> - </div> - - - <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> - <script type="text/javascript"> - document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); - document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); - Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { - link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); - }); - </script> - - <div id="content" class="content"> - <main> - <!-- Page table of contents --> - <div class="sidetoc"> - <nav class="pagetoc"></nav> - </div> - - <h1 id="modules"><a class="header" href="#modules">Modules</a></h1> -<p>Synapse supports extending its functionality by configuring external modules.</p> -<h2 id="using-modules"><a class="header" href="#using-modules">Using modules</a></h2> -<p>To use a module on Synapse, add it to the <code>modules</code> section of the configuration file:</p> -<pre><code class="language-yaml">modules: - - module: my_super_module.MySuperClass - config: - do_thing: true - - module: my_other_super_module.SomeClass - config: {} -</code></pre> -<p>Each module is defined by a path to a Python class as well as a configuration. This -information for a given module should be available in the module's own documentation.</p> -<p><strong>Note</strong>: When using third-party modules, you effectively allow someone else to run -custom code on your Synapse homeserver. Server admins are encouraged to verify the -provenance of the modules they use on their homeserver and make sure the modules aren't -running malicious code on their instance.</p> -<p>Also note that we are currently in the process of migrating module interfaces to this -system. While some interfaces might be compatible with it, others still require -configuring modules in another part of Synapse's configuration file. Currently, only the -spam checker interface is compatible with this new system.</p> -<h2 id="writing-a-module"><a class="header" href="#writing-a-module">Writing a module</a></h2> -<p>A module is a Python class that uses Synapse's module API to interact with the -homeserver. It can register callbacks that Synapse will call on specific operations, as -well as web resources to attach to Synapse's web server.</p> -<p>When instantiated, a module is given its parsed configuration as well as an instance of -the <code>synapse.module_api.ModuleApi</code> class. The configuration is a dictionary, and is -either the output of the module's <code>parse_config</code> static method (see below), or the -configuration associated with the module in Synapse's configuration file.</p> -<p>See the documentation for the <code>ModuleApi</code> class -<a href="https://github.com/matrix-org/synapse/blob/master/synapse/module_api/__init__.py">here</a>.</p> -<h3 id="handling-the-modules-configuration"><a class="header" href="#handling-the-modules-configuration">Handling the module's configuration</a></h3> -<p>A module can implement the following static method:</p> -<pre><code class="language-python">@staticmethod -def parse_config(config: dict) -> dict -</code></pre> -<p>This method is given a dictionary resulting from parsing the YAML configuration for the -module. It may modify it (for example by parsing durations expressed as strings (e.g. -"5d") into milliseconds, etc.), and return the modified dictionary. It may also verify -that the configuration is correct, and raise an instance of -<code>synapse.module_api.errors.ConfigError</code> if not.</p> -<h3 id="registering-a-web-resource"><a class="header" href="#registering-a-web-resource">Registering a web resource</a></h3> -<p>Modules can register web resources onto Synapse's web server using the following module -API method:</p> -<pre><code class="language-python">def ModuleApi.register_web_resource(path: str, resource: IResource) -> None -</code></pre> -<p>The path is the full absolute path to register the resource at. For example, if you -register a resource for the path <code>/_synapse/client/my_super_module/say_hello</code>, Synapse -will serve it at <code>http(s)://[HS_URL]/_synapse/client/my_super_module/say_hello</code>. Note -that Synapse does not allow registering resources for several sub-paths in the <code>/_matrix</code> -namespace (such as anything under <code>/_matrix/client</code> for example). It is strongly -recommended that modules register their web resources under the <code>/_synapse/client</code> -namespace.</p> -<p>The provided resource is a Python class that implements Twisted's <a href="https://twistedmatrix.com/documents/current/api/twisted.web.resource.IResource.html">IResource</a> -interface (such as <a href="https://twistedmatrix.com/documents/current/api/twisted.web.resource.Resource.html">Resource</a>).</p> -<p>Only one resource can be registered for a given path. If several modules attempt to -register a resource for the same path, the module that appears first in Synapse's -configuration file takes priority.</p> -<p>Modules <strong>must</strong> register their web resources in their <code>__init__</code> method.</p> -<h3 id="registering-a-callback"><a class="header" href="#registering-a-callback">Registering a callback</a></h3> -<p>Modules can use Synapse's module API to register callbacks. Callbacks are functions that -Synapse will call when performing specific actions. Callbacks must be asynchronous, and -are split in categories. A single module may implement callbacks from multiple categories, -and is under no obligation to implement all callbacks from the categories it registers -callbacks for.</p> -<p>Modules can register callbacks using one of the module API's <code>register_[...]_callbacks</code> -methods. The callback functions are passed to these methods as keyword arguments, with -the callback name as the argument name and the function as its value. This is demonstrated -in the example below. A <code>register_[...]_callbacks</code> method exists for each module type -documented in this section.</p> -<h4 id="spam-checker-callbacks"><a class="header" href="#spam-checker-callbacks">Spam checker callbacks</a></h4> -<p>Spam checker callbacks allow module developers to implement spam mitigation actions for -Synapse instances. Spam checker callbacks can be registered using the module API's -<code>register_spam_checker_callbacks</code> method.</p> -<p>The available spam checker callbacks are:</p> -<pre><code class="language-python">async def check_event_for_spam(event: "synapse.events.EventBase") -> Union[bool, str] -</code></pre> -<p>Called when receiving an event from a client or via federation. The module can return -either a <code>bool</code> to indicate whether the event must be rejected because of spam, or a <code>str</code> -to indicate the event must be rejected because of spam and to give a rejection reason to -forward to clients.</p> -<pre><code class="language-python">async def user_may_invite(inviter: str, invitee: str, room_id: str) -> bool -</code></pre> -<p>Called when processing an invitation. The module must return a <code>bool</code> indicating whether -the inviter can invite the invitee to the given room. Both inviter and invitee are -represented by their Matrix user ID (e.g. <code>@alice:example.com</code>).</p> -<pre><code class="language-python">async def user_may_create_room(user: str) -> bool -</code></pre> -<p>Called when processing a room creation request. The module must return a <code>bool</code> indicating -whether the given user (represented by their Matrix user ID) is allowed to create a room.</p> -<pre><code class="language-python">async def user_may_create_room_alias(user: str, room_alias: "synapse.types.RoomAlias") -> bool -</code></pre> -<p>Called when trying to associate an alias with an existing room. The module must return a -<code>bool</code> indicating whether the given user (represented by their Matrix user ID) is allowed -to set the given alias.</p> -<pre><code class="language-python">async def user_may_publish_room(user: str, room_id: str) -> bool -</code></pre> -<p>Called when trying to publish a room to the homeserver's public rooms directory. The -module must return a <code>bool</code> indicating whether the given user (represented by their -Matrix user ID) is allowed to publish the given room.</p> -<pre><code class="language-python">async def check_username_for_spam(user_profile: Dict[str, str]) -> bool -</code></pre> -<p>Called when computing search results in the user directory. The module must return a -<code>bool</code> indicating whether the given user profile can appear in search results. The profile -is represented as a dictionary with the following keys:</p> -<ul> -<li><code>user_id</code>: The Matrix ID for this user.</li> -<li><code>display_name</code>: The user's display name.</li> -<li><code>avatar_url</code>: The <code>mxc://</code> URL to the user's avatar.</li> -</ul> -<p>The module is given a copy of the original dictionary, so modifying it from within the -module cannot modify a user's profile when included in user directory search results.</p> -<pre><code class="language-python">async def check_registration_for_spam( - email_threepid: Optional[dict], - username: Optional[str], - request_info: Collection[Tuple[str, str]], - auth_provider_id: Optional[str] = None, -) -> "synapse.spam_checker_api.RegistrationBehaviour" -</code></pre> -<p>Called when registering a new user. The module must return a <code>RegistrationBehaviour</code> -indicating whether the registration can go through or must be denied, or whether the user -may be allowed to register but will be shadow banned.</p> -<p>The arguments passed to this callback are:</p> -<ul> -<li><code>email_threepid</code>: The email address used for registering, if any.</li> -<li><code>username</code>: The username the user would like to register. Can be <code>None</code>, meaning that -Synapse will generate one later.</li> -<li><code>request_info</code>: A collection of tuples, which first item is a user agent, and which -second item is an IP address. These user agents and IP addresses are the ones that were -used during the registration process.</li> -<li><code>auth_provider_id</code>: The identifier of the SSO authentication provider, if any.</li> -</ul> -<pre><code class="language-python">async def check_media_file_for_spam( - file_wrapper: "synapse.rest.media.v1.media_storage.ReadableFileWrapper", - file_info: "synapse.rest.media.v1._base.FileInfo", -) -> bool -</code></pre> -<p>Called when storing a local or remote file. The module must return a boolean indicating -whether the given file can be stored in the homeserver's media store.</p> -<h4 id="account-validity-callbacks"><a class="header" href="#account-validity-callbacks">Account validity callbacks</a></h4> -<p>Account validity callbacks allow module developers to add extra steps to verify the -validity on an account, i.e. see if a user can be granted access to their account on the -Synapse instance. Account validity callbacks can be registered using the module API's -<code>register_account_validity_callbacks</code> method.</p> -<p>The available account validity callbacks are:</p> -<pre><code class="language-python">async def is_user_expired(user: str) -> Optional[bool] -</code></pre> -<p>Called when processing any authenticated request (except for logout requests). The module -can return a <code>bool</code> to indicate whether the user has expired and should be locked out of -their account, or <code>None</code> if the module wasn't able to figure it out. The user is -represented by their Matrix user ID (e.g. <code>@alice:example.com</code>).</p> -<p>If the module returns <code>True</code>, the current request will be denied with the error code -<code>ORG_MATRIX_EXPIRED_ACCOUNT</code> and the HTTP status code 403. Note that this doesn't -invalidate the user's access token.</p> -<pre><code class="language-python">async def on_user_registration(user: str) -> None -</code></pre> -<p>Called after successfully registering a user, in case the module needs to perform extra -operations to keep track of them. (e.g. add them to a database table). The user is -represented by their Matrix user ID.</p> -<h4 id="third-party-rules-callbacks"><a class="header" href="#third-party-rules-callbacks">Third party rules callbacks</a></h4> -<p>Third party rules callbacks allow module developers to add extra checks to verify the -validity of incoming events. Third party event rules callbacks can be registered using -the module API's <code>register_third_party_rules_callbacks</code> method.</p> -<p>The available third party rules callbacks are:</p> -<pre><code class="language-python">async def check_event_allowed( - event: "synapse.events.EventBase", - state_events: "synapse.types.StateMap", -) -> Tuple[bool, Optional[dict]] -</code></pre> -<p><strong><span style="color:red"> -This callback is very experimental and can and will break without notice. Module developers -are encouraged to implement <code>check_event_for_spam</code> from the spam checker category instead. -</span></strong></p> -<p>Called when processing any incoming event, with the event and a <code>StateMap</code> -representing the current state of the room the event is being sent into. A <code>StateMap</code> is -a dictionary that maps tuples containing an event type and a state key to the -corresponding state event. For example retrieving the room's <code>m.room.create</code> event from -the <code>state_events</code> argument would look like this: <code>state_events.get(("m.room.create", ""))</code>. -The module must return a boolean indicating whether the event can be allowed.</p> -<p>Note that this callback function processes incoming events coming via federation -traffic (on top of client traffic). This means denying an event might cause the local -copy of the room's history to diverge from that of remote servers. This may cause -federation issues in the room. It is strongly recommended to only deny events using this -callback function if the sender is a local user, or in a private federation in which all -servers are using the same module, with the same configuration.</p> -<p>If the boolean returned by the module is <code>True</code>, it may also tell Synapse to replace the -event with new data by returning the new event's data as a dictionary. In order to do -that, it is recommended the module calls <code>event.get_dict()</code> to get the current event as a -dictionary, and modify the returned dictionary accordingly.</p> -<p>Note that replacing the event only works for events sent by local users, not for events -received over federation.</p> -<pre><code class="language-python">async def on_create_room( - requester: "synapse.types.Requester", - request_content: dict, - is_requester_admin: bool, -) -> None -</code></pre> -<p>Called when processing a room creation request, with the <code>Requester</code> object for the user -performing the request, a dictionary representing the room creation request's JSON body -(see <a href="https://matrix.org/docs/spec/client_server/latest#post-matrix-client-r0-createroom">the spec</a> -for a list of possible parameters), and a boolean indicating whether the user performing -the request is a server admin.</p> -<p>Modules can modify the <code>request_content</code> (by e.g. adding events to its <code>initial_state</code>), -or deny the room's creation by raising a <code>module_api.errors.SynapseError</code>.</p> -<h4 id="presence-router-callbacks"><a class="header" href="#presence-router-callbacks">Presence router callbacks</a></h4> -<p>Presence router callbacks allow module developers to specify additional users (local or remote) -to receive certain presence updates from local users. Presence router callbacks can be -registered using the module API's <code>register_presence_router_callbacks</code> method.</p> -<p>The available presence router callbacks are:</p> -<pre><code class="language-python">async def get_users_for_states( - self, - state_updates: Iterable["synapse.api.UserPresenceState"], -) -> Dict[str, Set["synapse.api.UserPresenceState"]]: -</code></pre> -<p><strong>Requires</strong> <code>get_interested_users</code> to also be registered</p> -<p>Called when processing updates to the presence state of one or more users. This callback can -be used to instruct the server to forward that presence state to specific users. The module -must return a dictionary that maps from Matrix user IDs (which can be local or remote) to the -<code>UserPresenceState</code> changes that they should be forwarded.</p> -<p>Synapse will then attempt to send the specified presence updates to each user when possible.</p> -<pre><code class="language-python">async def get_interested_users( - self, - user_id: str -) -> Union[Set[str], "synapse.module_api.PRESENCE_ALL_USERS"] -</code></pre> -<p><strong>Requires</strong> <code>get_users_for_states</code> to also be registered</p> -<p>Called when determining which users someone should be able to see the presence state of. This -callback should return complementary results to <code>get_users_for_state</code> or the presence information -may not be properly forwarded.</p> -<p>The callback is given the Matrix user ID for a local user that is requesting presence data and -should return the Matrix user IDs of the users whose presence state they are allowed to -query. The returned users can be local or remote. </p> -<p>Alternatively the callback can return <code>synapse.module_api.PRESENCE_ALL_USERS</code> -to indicate that the user should receive updates from all known users.</p> -<p>For example, if the user <code>@alice:example.org</code> is passed to this method, and the Set -<code>{"@bob:example.com", "@charlie:somewhere.org"}</code> is returned, this signifies that Alice -should receive presence updates sent by Bob and Charlie, regardless of whether these users -share a room.</p> -<h3 id="porting-an-existing-module-that-uses-the-old-interface"><a class="header" href="#porting-an-existing-module-that-uses-the-old-interface">Porting an existing module that uses the old interface</a></h3> -<p>In order to port a module that uses Synapse's old module interface, its author needs to:</p> -<ul> -<li>ensure the module's callbacks are all asynchronous.</li> -<li>register their callbacks using one or more of the <code>register_[...]_callbacks</code> methods -from the <code>ModuleApi</code> class in the module's <code>__init__</code> method (see <a href="#registering-a-callback">this section</a> -for more info).</li> -</ul> -<p>Additionally, if the module is packaged with an additional web resource, the module -should register this resource in its <code>__init__</code> method using the <code>register_web_resource</code> -method from the <code>ModuleApi</code> class (see <a href="#registering-a-web-resource">this section</a> for -more info).</p> -<p>The module's author should also update any example in the module's configuration to only -use the new <code>modules</code> section in Synapse's configuration file (see <a href="#using-modules">this section</a> -for more info).</p> -<h3 id="example"><a class="header" href="#example">Example</a></h3> -<p>The example below is a module that implements the spam checker callback -<code>user_may_create_room</code> to deny room creation to user <code>@evilguy:example.com</code>, and registers -a web resource to the path <code>/_synapse/client/demo/hello</code> that returns a JSON object.</p> -<pre><code class="language-python">import json - -from twisted.web.resource import Resource -from twisted.web.server import Request - -from synapse.module_api import ModuleApi - - -class DemoResource(Resource): - def __init__(self, config): - super(DemoResource, self).__init__() - self.config = config - - def render_GET(self, request: Request): - name = request.args.get(b"name")[0] - request.setHeader(b"Content-Type", b"application/json") - return json.dumps({"hello": name}) - - -class DemoModule: - def __init__(self, config: dict, api: ModuleApi): - self.config = config - self.api = api - - self.api.register_web_resource( - path="/_synapse/client/demo/hello", - resource=DemoResource(self.config), - ) - - self.api.register_spam_checker_callbacks( - user_may_create_room=self.user_may_create_room, - ) - - @staticmethod - def parse_config(config): - return config - - async def user_may_create_room(self, user: str) -> bool: - if user == "@evilguy:example.com": - return False - - return True -</code></pre> - - </main> - - <nav class="nav-wrapper" aria-label="Page navigation"> - <!-- Mobile navigation buttons --> - - <a rel="prev" href="message_retention_policies.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="spam_checker.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - - <div style="clear: both"></div> - </nav> - </div> - </div> - - <nav class="nav-wide-wrapper" aria-label="Page navigation"> - - <a rel="prev" href="message_retention_policies.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="spam_checker.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - </nav> - - </div> - - - - - - - - - <script type="text/javascript"> - window.playground_copyable = true; - </script> - - - - - - <script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script> - <script src="mark.min.js" type="text/javascript" charset="utf-8"></script> - <script src="searcher.js" type="text/javascript" charset="utf-8"></script> - - - <script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script> - <script src="highlight.js" type="text/javascript" charset="utf-8"></script> - <script src="book.js" type="text/javascript" charset="utf-8"></script> - - <!-- Custom JS scripts --> - - <script type="text/javascript" src="docs/website_files/table-of-contents.js"></script> - - - - - </body> -</html> \ No newline at end of file diff --git a/develop/presence_router_module.html b/develop/presence_router_module.html deleted file mode 100644 index 2206fd8b75..0000000000 --- a/develop/presence_router_module.html +++ /dev/null @@ -1,461 +0,0 @@ -<!DOCTYPE HTML> -<html lang="en" class="sidebar-visible no-js light"> - <head> - <!-- Book generated using mdBook --> - <meta charset="UTF-8"> - <title>Presence Router - Synapse</title> - - - - - <!-- Custom HTML head --> - - - - <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="theme-color" content="#ffffff" /> - - - <link rel="icon" href="favicon.svg"> - - - <link rel="shortcut icon" href="favicon.png"> - - <link rel="stylesheet" href="css/variables.css"> - <link rel="stylesheet" href="css/general.css"> - <link rel="stylesheet" href="css/chrome.css"> - - <link rel="stylesheet" href="css/print.css" media="print"> - - - <!-- Fonts --> - <link rel="stylesheet" href="FontAwesome/css/font-awesome.css"> - - <link rel="stylesheet" href="fonts/fonts.css"> - - - <!-- Highlight.js Stylesheets --> - <link rel="stylesheet" href="highlight.css"> - <link rel="stylesheet" href="tomorrow-night.css"> - <link rel="stylesheet" href="ayu-highlight.css"> - - <!-- Custom theme stylesheets --> - - <link rel="stylesheet" href="docs/website_files/table-of-contents.css"> - - <link rel="stylesheet" href="docs/website_files/remove-nav-buttons.css"> - - <link rel="stylesheet" href="docs/website_files/indent-section-headers.css"> - - - - </head> - <body> - <!-- Provide site root to javascript --> - <script type="text/javascript"> - var path_to_root = ""; - var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; - </script> - - <!-- Work around some values being stored in localStorage wrapped in quotes --> - <script type="text/javascript"> - try { - var theme = localStorage.getItem('mdbook-theme'); - var sidebar = localStorage.getItem('mdbook-sidebar'); - if (theme.startsWith('"') && theme.endsWith('"')) { - localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); - } - if (sidebar.startsWith('"') && sidebar.endsWith('"')) { - localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); - } - } catch (e) { } - </script> - - <!-- Set the theme before any content is loaded, prevents flash --> - <script type="text/javascript"> - var theme; - try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } - if (theme === null || theme === undefined) { theme = default_theme; } - var html = document.querySelector('html'); - html.classList.remove('no-js') - html.classList.remove('light') - html.classList.add(theme); - html.classList.add('js'); - </script> - - <!-- Hide / unhide sidebar before it is displayed --> - <script type="text/javascript"> - var html = document.querySelector('html'); - var sidebar = 'hidden'; - if (document.body.clientWidth >= 1080) { - try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } - sidebar = sidebar || 'visible'; - } - html.classList.remove('sidebar-visible'); - html.classList.add("sidebar-" + sidebar); - </script> - - <nav id="sidebar" class="sidebar" aria-label="Table of contents"> - <div class="sidebar-scrollbox"> - <ol class="chapter"><li class="chapter-item expanded affix "><li class="part-title">Introduction</li><li class="chapter-item expanded "><a href="welcome_and_overview.html">Welcome and Overview</a></li><li class="chapter-item expanded affix "><li class="part-title">Setup</li><li class="chapter-item expanded "><a href="setup/installation.html">Installation</a></li><li class="chapter-item expanded "><a href="postgres.html">Using Postgres</a></li><li class="chapter-item expanded "><a href="reverse_proxy.html">Configuring a Reverse Proxy</a></li><li class="chapter-item expanded "><a href="setup/forward_proxy.html">Configuring a Forward/Outbound Proxy</a></li><li class="chapter-item expanded "><a href="turn-howto.html">Configuring a Turn Server</a></li><li class="chapter-item expanded "><a href="delegate.html">Delegation</a></li><li class="chapter-item expanded affix "><li class="part-title">Upgrading</li><li class="chapter-item expanded "><a href="upgrade.html">Upgrading between Synapse Versions</a></li><li class="chapter-item expanded "><a href="MSC1711_certificates_FAQ.html">Upgrading from pre-Synapse 1.0</a></li><li class="chapter-item expanded affix "><li class="part-title">Usage</li><li class="chapter-item expanded "><a href="federate.html">Federation</a></li><li class="chapter-item expanded "><a href="usage/configuration/index.html">Configuration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/configuration/homeserver_sample_config.html">Homeserver Sample Config File</a></li><li class="chapter-item expanded "><a href="usage/configuration/logging_sample_config.html">Logging Sample Config File</a></li><li class="chapter-item expanded "><a href="structured_logging.html">Structured Logging</a></li><li class="chapter-item expanded "><a href="templates.html">Templates</a></li><li class="chapter-item expanded "><a href="usage/configuration/user_authentication/index.html">User Authentication</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single-Sign On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><div>SAML</div></li><li class="chapter-item expanded "><div>CAS</div></li><li class="chapter-item expanded "><a href="sso_mapping_providers.html">SSO Mapping Providers</a></li></ol></li><li class="chapter-item expanded "><a href="password_auth_providers.html">Password Auth Providers</a></li><li class="chapter-item expanded "><a href="jwt.html">JSON Web Tokens</a></li></ol></li><li class="chapter-item expanded "><a href="CAPTCHA_SETUP.html">Registration Captcha</a></li><li class="chapter-item expanded "><a href="application_services.html">Application Services</a></li><li class="chapter-item expanded "><a href="server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="consent_tracking.html">Consent Tracking</a></li><li class="chapter-item expanded "><a href="development/url_previews.html">URL Previews</a></li><li class="chapter-item expanded "><a href="user_directory.html">User Directory</a></li><li class="chapter-item expanded "><a href="message_retention_policies.html">Message Retention Policies</a></li><li class="chapter-item expanded "><a href="modules.html">Pluggable Modules</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Third Party Rules</div></li><li class="chapter-item expanded "><a href="spam_checker.html">Spam Checker</a></li><li class="chapter-item expanded "><a href="presence_router_module.html" class="active">Presence Router</a></li><li class="chapter-item expanded "><div>Media Storage Providers</div></li></ol></li><li class="chapter-item expanded "><a href="workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="admin_api/delete_group.html">Delete Group</a></li><li class="chapter-item expanded "><a href="admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="usage/administration/admin_api/registration_tokens.html">Registration Tokens</a></li><li class="chapter-item expanded "><a href="admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="admin_api/rooms.html">Rooms</a></li><li class="chapter-item expanded "><a href="admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="admin_api/version_api.html">Server Version</a></li></ol></li><li class="chapter-item expanded "><a href="manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="metrics-howto.html">Monitoring</a></li><li class="chapter-item expanded "><a href="usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="development/git.html">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li class="chapter-item expanded "><a href="opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="replication.html">Replication</a></li><li class="chapter-item expanded "><a href="tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="development/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="development/cas.html">CAS</a></li></ol></li><li class="chapter-item expanded "><a href="development/room-dag-concepts.html">Room DAG concepts</a></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="deprecation_policy.html">Dependency Deprecation Policy</a></li></ol> - </div> - <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> - </nav> - - <div id="page-wrapper" class="page-wrapper"> - - <div class="page"> - - <div id="menu-bar-hover-placeholder"></div> - <div id="menu-bar" class="menu-bar sticky bordered"> - <div class="left-buttons"> - <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> - <i class="fa fa-bars"></i> - </button> - <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> - <i class="fa fa-paint-brush"></i> - </button> - <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> - <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li> - <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> - <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> - <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> - <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> - </ul> - - <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> - <i class="fa fa-search"></i> - </button> - - </div> - - <h1 class="menu-title">Synapse</h1> - - <div class="right-buttons"> - - <a href="print.html" title="Print this book" aria-label="Print this book"> - <i id="print-button" class="fa fa-print"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository"> - <i id="git-repository-button" class="fa fa-github"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse/edit/develop/docs/presence_router_module.md" title="Suggest an edit" aria-label="Suggest an edit"> - <i id="git-edit-button" class="fa fa-edit"></i> - </a> - - - </div> - </div> - - - <div id="search-wrapper" class="hidden"> - <form id="searchbar-outer" class="searchbar-outer"> - <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> - </form> - <div id="searchresults-outer" class="searchresults-outer hidden"> - <div id="searchresults-header" class="searchresults-header"></div> - <ul id="searchresults"> - </ul> - </div> - </div> - - - <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> - <script type="text/javascript"> - document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); - document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); - Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { - link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); - }); - </script> - - <div id="content" class="content"> - <main> - <!-- Page table of contents --> - <div class="sidetoc"> - <nav class="pagetoc"></nav> - </div> - - <h2 style="color:red"> -This page of the Synapse documentation is now deprecated. For up to date -documentation on setting up or writing a presence router module, please see -<a href="modules.html">this page</a>. -</h2> -<h1 id="presence-router-module"><a class="header" href="#presence-router-module">Presence Router Module</a></h1> -<p>Synapse supports configuring a module that can specify additional users -(local or remote) to should receive certain presence updates from local -users.</p> -<p>Note that routing presence via Application Service transactions is not -currently supported.</p> -<p>The presence routing module is implemented as a Python class, which will -be imported by the running Synapse.</p> -<h2 id="python-presence-router-class"><a class="header" href="#python-presence-router-class">Python Presence Router Class</a></h2> -<p>The Python class is instantiated with two objects:</p> -<ul> -<li>A configuration object of some type (see below).</li> -<li>An instance of <code>synapse.module_api.ModuleApi</code>.</li> -</ul> -<p>It then implements methods related to presence routing.</p> -<p>Note that one method of <code>ModuleApi</code> that may be useful is:</p> -<pre><code class="language-python">async def ModuleApi.send_local_online_presence_to(users: Iterable[str]) -> None -</code></pre> -<p>which can be given a list of local or remote MXIDs to broadcast known, online user -presence to (for those users that the receiving user is considered interested in). -It does not include state for users who are currently offline, and it can only be -called on workers that support sending federation. Additionally, this method must -only be called from the process that has been configured to write to the -the <a href="workers.html#stream-writers">presence stream</a>. -By default, this is the main process, but another worker can be configured to do -so.</p> -<h3 id="module-structure"><a class="header" href="#module-structure">Module structure</a></h3> -<p>Below is a list of possible methods that can be implemented, and whether they are -required.</p> -<h4 id="parse_config"><a class="header" href="#parse_config"><code>parse_config</code></a></h4> -<pre><code class="language-python">def parse_config(config_dict: dict) -> Any -</code></pre> -<p><strong>Required.</strong> A static method that is passed a dictionary of config options, and -should return a validated config object. This method is described further in -<a href="#configuration">Configuration</a>.</p> -<h4 id="get_users_for_states"><a class="header" href="#get_users_for_states"><code>get_users_for_states</code></a></h4> -<pre><code class="language-python">async def get_users_for_states( - self, - state_updates: Iterable[UserPresenceState], -) -> Dict[str, Set[UserPresenceState]]: -</code></pre> -<p><strong>Required.</strong> An asynchronous method that is passed an iterable of user presence -state. This method can determine whether a given presence update should be sent to certain -users. It does this by returning a dictionary with keys representing local or remote -Matrix User IDs, and values being a python set -of <code>synapse.handlers.presence.UserPresenceState</code> instances.</p> -<p>Synapse will then attempt to send the specified presence updates to each user when -possible.</p> -<h4 id="get_interested_users"><a class="header" href="#get_interested_users"><code>get_interested_users</code></a></h4> -<pre><code class="language-python">async def get_interested_users(self, user_id: str) -> Union[Set[str], str] -</code></pre> -<p><strong>Required.</strong> An asynchronous method that is passed a single Matrix User ID. This -method is expected to return the users that the passed in user may be interested in the -presence of. Returned users may be local or remote. The presence routed as a result of -what this method returns is sent in addition to the updates already sent between users -that share a room together. Presence updates are deduplicated.</p> -<p>This method should return a python set of Matrix User IDs, or the object -<code>synapse.events.presence_router.PresenceRouter.ALL_USERS</code> to indicate that the passed -user should receive presence information for <em>all</em> known users.</p> -<p>For clarity, if the user <code>@alice:example.org</code> is passed to this method, and the Set -<code>{"@bob:example.com", "@charlie:somewhere.org"}</code> is returned, this signifies that Alice -should receive presence updates sent by Bob and Charlie, regardless of whether these -users share a room.</p> -<h3 id="example"><a class="header" href="#example">Example</a></h3> -<p>Below is an example implementation of a presence router class.</p> -<pre><code class="language-python">from typing import Dict, Iterable, Set, Union -from synapse.events.presence_router import PresenceRouter -from synapse.handlers.presence import UserPresenceState -from synapse.module_api import ModuleApi - -class PresenceRouterConfig: - def __init__(self): - # Config options with their defaults - # A list of users to always send all user presence updates to - self.always_send_to_users = [] # type: List[str] - - # A list of users to ignore presence updates for. Does not affect - # shared-room presence relationships - self.blacklisted_users = [] # type: List[str] - -class ExamplePresenceRouter: - """An example implementation of synapse.presence_router.PresenceRouter. - Supports routing all presence to a configured set of users, or a subset - of presence from certain users to members of certain rooms. - - Args: - config: A configuration object. - module_api: An instance of Synapse's ModuleApi. - """ - def __init__(self, config: PresenceRouterConfig, module_api: ModuleApi): - self._config = config - self._module_api = module_api - - @staticmethod - def parse_config(config_dict: dict) -> PresenceRouterConfig: - """Parse a configuration dictionary from the homeserver config, do - some validation and return a typed PresenceRouterConfig. - - Args: - config_dict: The configuration dictionary. - - Returns: - A validated config object. - """ - # Initialise a typed config object - config = PresenceRouterConfig() - always_send_to_users = config_dict.get("always_send_to_users") - blacklisted_users = config_dict.get("blacklisted_users") - - # Do some validation of config options... otherwise raise a - # synapse.config.ConfigError. - config.always_send_to_users = always_send_to_users - config.blacklisted_users = blacklisted_users - - return config - - async def get_users_for_states( - self, - state_updates: Iterable[UserPresenceState], - ) -> Dict[str, Set[UserPresenceState]]: - """Given an iterable of user presence updates, determine where each one - needs to go. Returned results will not affect presence updates that are - sent between users who share a room. - - Args: - state_updates: An iterable of user presence state updates. - - Returns: - A dictionary of user_id -> set of UserPresenceState that the user should - receive. - """ - destination_users = {} # type: Dict[str, Set[UserPresenceState] - - # Ignore any updates for blacklisted users - desired_updates = set() - for update in state_updates: - if update.state_key not in self._config.blacklisted_users: - desired_updates.add(update) - - # Send all presence updates to specific users - for user_id in self._config.always_send_to_users: - destination_users[user_id] = desired_updates - - return destination_users - - async def get_interested_users( - self, - user_id: str, - ) -> Union[Set[str], PresenceRouter.ALL_USERS]: - """ - Retrieve a list of users that `user_id` is interested in receiving the - presence of. This will be in addition to those they share a room with. - Optionally, the object PresenceRouter.ALL_USERS can be returned to indicate - that this user should receive all incoming local and remote presence updates. - - Note that this method will only be called for local users. - - Args: - user_id: A user requesting presence updates. - - Returns: - A set of user IDs to return additional presence updates for, or - PresenceRouter.ALL_USERS to return presence updates for all other users. - """ - if user_id in self._config.always_send_to_users: - return PresenceRouter.ALL_USERS - - return set() -</code></pre> -<h4 id="a-note-on-get_users_for_states-and-get_interested_users"><a class="header" href="#a-note-on-get_users_for_states-and-get_interested_users">A note on <code>get_users_for_states</code> and <code>get_interested_users</code></a></h4> -<p>Both of these methods are effectively two different sides of the same coin. The logic -regarding which users should receive updates for other users should be the same -between them.</p> -<p><code>get_users_for_states</code> is called when presence updates come in from either federation -or local users, and is used to either direct local presence to remote users, or to -wake up the sync streams of local users to collect remote presence.</p> -<p>In contrast, <code>get_interested_users</code> is used to determine the users that presence should -be fetched for when a local user is syncing. This presence is then retrieved, before -being fed through <code>get_users_for_states</code> once again, with only the syncing user's -routing information pulled from the resulting dictionary.</p> -<p>Their routing logic should thus line up, else you may run into unintended behaviour.</p> -<h2 id="configuration"><a class="header" href="#configuration">Configuration</a></h2> -<p>Once you've crafted your module and installed it into the same Python environment as -Synapse, amend your homeserver config file with the following.</p> -<pre><code class="language-yaml">presence: - enabled: true - - presence_router: - module: my_module.ExamplePresenceRouter - config: - # Any configuration options for your module. The below is an example. - # of setting options for ExamplePresenceRouter. - always_send_to_users: ["@presence_gobbler:example.org"] - blacklisted_users: - - "@alice:example.com" - - "@bob:example.com" - ... -</code></pre> -<p>The contents of <code>config</code> will be passed as a Python dictionary to the static -<code>parse_config</code> method of your class. The object returned by this method will -then be passed to the <code>__init__</code> method of your module as <code>config</code>.</p> - - </main> - - <nav class="nav-wrapper" aria-label="Page navigation"> - <!-- Mobile navigation buttons --> - - <a rel="prev" href="spam_checker.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="workers.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - - <div style="clear: both"></div> - </nav> - </div> - </div> - - <nav class="nav-wide-wrapper" aria-label="Page navigation"> - - <a rel="prev" href="spam_checker.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="workers.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - </nav> - - </div> - - - - - - - - - <script type="text/javascript"> - window.playground_copyable = true; - </script> - - - - - - <script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script> - <script src="mark.min.js" type="text/javascript" charset="utf-8"></script> - <script src="searcher.js" type="text/javascript" charset="utf-8"></script> - - - <script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script> - <script src="highlight.js" type="text/javascript" charset="utf-8"></script> - <script src="book.js" type="text/javascript" charset="utf-8"></script> - - <!-- Custom JS scripts --> - - <script type="text/javascript" src="docs/website_files/table-of-contents.js"></script> - - - - - </body> -</html> \ No newline at end of file diff --git a/develop/spam_checker.html b/develop/spam_checker.html deleted file mode 100644 index 1186bdef1e..0000000000 --- a/develop/spam_checker.html +++ /dev/null @@ -1,360 +0,0 @@ -<!DOCTYPE HTML> -<html lang="en" class="sidebar-visible no-js light"> - <head> - <!-- Book generated using mdBook --> - <meta charset="UTF-8"> - <title>Spam Checker - Synapse</title> - - - - - <!-- Custom HTML head --> - - - - <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="theme-color" content="#ffffff" /> - - - <link rel="icon" href="favicon.svg"> - - - <link rel="shortcut icon" href="favicon.png"> - - <link rel="stylesheet" href="css/variables.css"> - <link rel="stylesheet" href="css/general.css"> - <link rel="stylesheet" href="css/chrome.css"> - - <link rel="stylesheet" href="css/print.css" media="print"> - - - <!-- Fonts --> - <link rel="stylesheet" href="FontAwesome/css/font-awesome.css"> - - <link rel="stylesheet" href="fonts/fonts.css"> - - - <!-- Highlight.js Stylesheets --> - <link rel="stylesheet" href="highlight.css"> - <link rel="stylesheet" href="tomorrow-night.css"> - <link rel="stylesheet" href="ayu-highlight.css"> - - <!-- Custom theme stylesheets --> - - <link rel="stylesheet" href="docs/website_files/table-of-contents.css"> - - <link rel="stylesheet" href="docs/website_files/remove-nav-buttons.css"> - - <link rel="stylesheet" href="docs/website_files/indent-section-headers.css"> - - - - </head> - <body> - <!-- Provide site root to javascript --> - <script type="text/javascript"> - var path_to_root = ""; - var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; - </script> - - <!-- Work around some values being stored in localStorage wrapped in quotes --> - <script type="text/javascript"> - try { - var theme = localStorage.getItem('mdbook-theme'); - var sidebar = localStorage.getItem('mdbook-sidebar'); - if (theme.startsWith('"') && theme.endsWith('"')) { - localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); - } - if (sidebar.startsWith('"') && sidebar.endsWith('"')) { - localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); - } - } catch (e) { } - </script> - - <!-- Set the theme before any content is loaded, prevents flash --> - <script type="text/javascript"> - var theme; - try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } - if (theme === null || theme === undefined) { theme = default_theme; } - var html = document.querySelector('html'); - html.classList.remove('no-js') - html.classList.remove('light') - html.classList.add(theme); - html.classList.add('js'); - </script> - - <!-- Hide / unhide sidebar before it is displayed --> - <script type="text/javascript"> - var html = document.querySelector('html'); - var sidebar = 'hidden'; - if (document.body.clientWidth >= 1080) { - try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } - sidebar = sidebar || 'visible'; - } - html.classList.remove('sidebar-visible'); - html.classList.add("sidebar-" + sidebar); - </script> - - <nav id="sidebar" class="sidebar" aria-label="Table of contents"> - <div class="sidebar-scrollbox"> - <ol class="chapter"><li class="chapter-item expanded affix "><li class="part-title">Introduction</li><li class="chapter-item expanded "><a href="welcome_and_overview.html">Welcome and Overview</a></li><li class="chapter-item expanded affix "><li class="part-title">Setup</li><li class="chapter-item expanded "><a href="setup/installation.html">Installation</a></li><li class="chapter-item expanded "><a href="postgres.html">Using Postgres</a></li><li class="chapter-item expanded "><a href="reverse_proxy.html">Configuring a Reverse Proxy</a></li><li class="chapter-item expanded "><a href="setup/forward_proxy.html">Configuring a Forward/Outbound Proxy</a></li><li class="chapter-item expanded "><a href="turn-howto.html">Configuring a Turn Server</a></li><li class="chapter-item expanded "><a href="delegate.html">Delegation</a></li><li class="chapter-item expanded affix "><li class="part-title">Upgrading</li><li class="chapter-item expanded "><a href="upgrade.html">Upgrading between Synapse Versions</a></li><li class="chapter-item expanded "><a href="MSC1711_certificates_FAQ.html">Upgrading from pre-Synapse 1.0</a></li><li class="chapter-item expanded affix "><li class="part-title">Usage</li><li class="chapter-item expanded "><a href="federate.html">Federation</a></li><li class="chapter-item expanded "><a href="usage/configuration/index.html">Configuration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/configuration/homeserver_sample_config.html">Homeserver Sample Config File</a></li><li class="chapter-item expanded "><a href="usage/configuration/logging_sample_config.html">Logging Sample Config File</a></li><li class="chapter-item expanded "><a href="structured_logging.html">Structured Logging</a></li><li class="chapter-item expanded "><a href="templates.html">Templates</a></li><li class="chapter-item expanded "><a href="usage/configuration/user_authentication/index.html">User Authentication</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single-Sign On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><div>SAML</div></li><li class="chapter-item expanded "><div>CAS</div></li><li class="chapter-item expanded "><a href="sso_mapping_providers.html">SSO Mapping Providers</a></li></ol></li><li class="chapter-item expanded "><a href="password_auth_providers.html">Password Auth Providers</a></li><li class="chapter-item expanded "><a href="jwt.html">JSON Web Tokens</a></li></ol></li><li class="chapter-item expanded "><a href="CAPTCHA_SETUP.html">Registration Captcha</a></li><li class="chapter-item expanded "><a href="application_services.html">Application Services</a></li><li class="chapter-item expanded "><a href="server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="consent_tracking.html">Consent Tracking</a></li><li class="chapter-item expanded "><a href="development/url_previews.html">URL Previews</a></li><li class="chapter-item expanded "><a href="user_directory.html">User Directory</a></li><li class="chapter-item expanded "><a href="message_retention_policies.html">Message Retention Policies</a></li><li class="chapter-item expanded "><a href="modules.html">Pluggable Modules</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Third Party Rules</div></li><li class="chapter-item expanded "><a href="spam_checker.html" class="active">Spam Checker</a></li><li class="chapter-item expanded "><a href="presence_router_module.html">Presence Router</a></li><li class="chapter-item expanded "><div>Media Storage Providers</div></li></ol></li><li class="chapter-item expanded "><a href="workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="admin_api/delete_group.html">Delete Group</a></li><li class="chapter-item expanded "><a href="admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="usage/administration/admin_api/registration_tokens.html">Registration Tokens</a></li><li class="chapter-item expanded "><a href="admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="admin_api/rooms.html">Rooms</a></li><li class="chapter-item expanded "><a href="admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="admin_api/version_api.html">Server Version</a></li></ol></li><li class="chapter-item expanded "><a href="manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="metrics-howto.html">Monitoring</a></li><li class="chapter-item expanded "><a href="usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="development/git.html">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li class="chapter-item expanded "><a href="opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="replication.html">Replication</a></li><li class="chapter-item expanded "><a href="tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="development/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="development/cas.html">CAS</a></li></ol></li><li class="chapter-item expanded "><a href="development/room-dag-concepts.html">Room DAG concepts</a></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="deprecation_policy.html">Dependency Deprecation Policy</a></li></ol> - </div> - <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> - </nav> - - <div id="page-wrapper" class="page-wrapper"> - - <div class="page"> - - <div id="menu-bar-hover-placeholder"></div> - <div id="menu-bar" class="menu-bar sticky bordered"> - <div class="left-buttons"> - <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> - <i class="fa fa-bars"></i> - </button> - <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> - <i class="fa fa-paint-brush"></i> - </button> - <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> - <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li> - <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> - <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> - <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> - <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> - </ul> - - <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> - <i class="fa fa-search"></i> - </button> - - </div> - - <h1 class="menu-title">Synapse</h1> - - <div class="right-buttons"> - - <a href="print.html" title="Print this book" aria-label="Print this book"> - <i id="print-button" class="fa fa-print"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository"> - <i id="git-repository-button" class="fa fa-github"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse/edit/develop/docs/spam_checker.md" title="Suggest an edit" aria-label="Suggest an edit"> - <i id="git-edit-button" class="fa fa-edit"></i> - </a> - - - </div> - </div> - - - <div id="search-wrapper" class="hidden"> - <form id="searchbar-outer" class="searchbar-outer"> - <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> - </form> - <div id="searchresults-outer" class="searchresults-outer hidden"> - <div id="searchresults-header" class="searchresults-header"></div> - <ul id="searchresults"> - </ul> - </div> - </div> - - - <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> - <script type="text/javascript"> - document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); - document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); - Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { - link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); - }); - </script> - - <div id="content" class="content"> - <main> - <!-- Page table of contents --> - <div class="sidetoc"> - <nav class="pagetoc"></nav> - </div> - - <h2 style="color:red"> -This page of the Synapse documentation is now deprecated. For up to date -documentation on setting up or writing a spam checker module, please see -<a href="modules.html">this page</a>. -</h2> -<h1 id="handling-spam-in-synapse"><a class="header" href="#handling-spam-in-synapse">Handling spam in Synapse</a></h1> -<p>Synapse has support to customize spam checking behavior. It can plug into a -variety of events and affect how they are presented to users on your homeserver.</p> -<p>The spam checking behavior is implemented as a Python class, which must be -able to be imported by the running Synapse.</p> -<h2 id="python-spam-checker-class"><a class="header" href="#python-spam-checker-class">Python spam checker class</a></h2> -<p>The Python class is instantiated with two objects:</p> -<ul> -<li>Any configuration (see below).</li> -<li>An instance of <code>synapse.module_api.ModuleApi</code>.</li> -</ul> -<p>It then implements methods which return a boolean to alter behavior in Synapse. -All the methods must be defined.</p> -<p>There's a generic method for checking every event (<code>check_event_for_spam</code>), as -well as some specific methods:</p> -<ul> -<li><code>user_may_invite</code></li> -<li><code>user_may_create_room</code></li> -<li><code>user_may_create_room_alias</code></li> -<li><code>user_may_publish_room</code></li> -<li><code>check_username_for_spam</code></li> -<li><code>check_registration_for_spam</code></li> -<li><code>check_media_file_for_spam</code></li> -</ul> -<p>The details of each of these methods (as well as their inputs and outputs) -are documented in the <code>synapse.events.spamcheck.SpamChecker</code> class.</p> -<p>The <code>ModuleApi</code> class provides a way for the custom spam checker class to -call back into the homeserver internals.</p> -<p>Additionally, a <code>parse_config</code> method is mandatory and receives the plugin config -dictionary. After parsing, It must return an object which will be -passed to <code>__init__</code> later.</p> -<h3 id="example"><a class="header" href="#example">Example</a></h3> -<pre><code class="language-python">from synapse.spam_checker_api import RegistrationBehaviour - -class ExampleSpamChecker: - def __init__(self, config, api): - self.config = config - self.api = api - - @staticmethod - def parse_config(config): - return config - - async def check_event_for_spam(self, foo): - return False # allow all events - - async def user_may_invite(self, inviter_userid, invitee_userid, room_id): - return True # allow all invites - - async def user_may_create_room(self, userid): - return True # allow all room creations - - async def user_may_create_room_alias(self, userid, room_alias): - return True # allow all room aliases - - async def user_may_publish_room(self, userid, room_id): - return True # allow publishing of all rooms - - async def check_username_for_spam(self, user_profile): - return False # allow all usernames - - async def check_registration_for_spam( - self, - email_threepid, - username, - request_info, - auth_provider_id, - ): - return RegistrationBehaviour.ALLOW # allow all registrations - - async def check_media_file_for_spam(self, file_wrapper, file_info): - return False # allow all media -</code></pre> -<h2 id="configuration"><a class="header" href="#configuration">Configuration</a></h2> -<p>Modify the <code>spam_checker</code> section of your <code>homeserver.yaml</code> in the following -manner:</p> -<p>Create a list entry with the keys <code>module</code> and <code>config</code>.</p> -<ul> -<li> -<p><code>module</code> should point to the fully qualified Python class that implements your -custom logic, e.g. <code>my_module.ExampleSpamChecker</code>.</p> -</li> -<li> -<p><code>config</code> is a dictionary that gets passed to the spam checker class.</p> -</li> -</ul> -<h3 id="example-1"><a class="header" href="#example-1">Example</a></h3> -<p>This section might look like:</p> -<pre><code class="language-yaml">spam_checker: - - module: my_module.ExampleSpamChecker - config: - # Enable or disable a specific option in ExampleSpamChecker. - my_custom_option: true -</code></pre> -<p>More spam checkers can be added in tandem by appending more items to the list. An -action is blocked when at least one of the configured spam checkers flags it.</p> -<h2 id="examples"><a class="header" href="#examples">Examples</a></h2> -<p>The <a href="https://github.com/matrix-org/mjolnir">Mjolnir</a> project is a full fledged -example using the Synapse spam checking API, including a bot for dynamic -configuration.</p> - - </main> - - <nav class="nav-wrapper" aria-label="Page navigation"> - <!-- Mobile navigation buttons --> - - <a rel="prev" href="modules.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="presence_router_module.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - - <div style="clear: both"></div> - </nav> - </div> - </div> - - <nav class="nav-wide-wrapper" aria-label="Page navigation"> - - <a rel="prev" href="modules.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="presence_router_module.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - </nav> - - </div> - - - - - - - - - <script type="text/javascript"> - window.playground_copyable = true; - </script> - - - - - - <script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script> - <script src="mark.min.js" type="text/javascript" charset="utf-8"></script> - <script src="searcher.js" type="text/javascript" charset="utf-8"></script> - - - <script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script> - <script src="highlight.js" type="text/javascript" charset="utf-8"></script> - <script src="book.js" type="text/javascript" charset="utf-8"></script> - - <!-- Custom JS scripts --> - - <script type="text/javascript" src="docs/website_files/table-of-contents.js"></script> - - - - - </body> -</html> \ No newline at end of file diff --git a/develop/url_previews.html b/develop/url_previews.html deleted file mode 100644 index 0d6d5ab232..0000000000 --- a/develop/url_previews.html +++ /dev/null @@ -1,365 +0,0 @@ -<!DOCTYPE HTML> -<html lang="en" class="sidebar-visible no-js light"> - <head> - <!-- Book generated using mdBook --> - <meta charset="UTF-8"> - <title>URL Previews - Synapse</title> - - - - - <!-- Custom HTML head --> - - - - <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> - <meta name="description" content=""> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <meta name="theme-color" content="#ffffff" /> - - - <link rel="icon" href="favicon.svg"> - - - <link rel="shortcut icon" href="favicon.png"> - - <link rel="stylesheet" href="css/variables.css"> - <link rel="stylesheet" href="css/general.css"> - <link rel="stylesheet" href="css/chrome.css"> - - <link rel="stylesheet" href="css/print.css" media="print"> - - - <!-- Fonts --> - <link rel="stylesheet" href="FontAwesome/css/font-awesome.css"> - - <link rel="stylesheet" href="fonts/fonts.css"> - - - <!-- Highlight.js Stylesheets --> - <link rel="stylesheet" href="highlight.css"> - <link rel="stylesheet" href="tomorrow-night.css"> - <link rel="stylesheet" href="ayu-highlight.css"> - - <!-- Custom theme stylesheets --> - - <link rel="stylesheet" href="docs/website_files/table-of-contents.css"> - - <link rel="stylesheet" href="docs/website_files/remove-nav-buttons.css"> - - <link rel="stylesheet" href="docs/website_files/indent-section-headers.css"> - - - - </head> - <body> - <!-- Provide site root to javascript --> - <script type="text/javascript"> - var path_to_root = ""; - var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; - </script> - - <!-- Work around some values being stored in localStorage wrapped in quotes --> - <script type="text/javascript"> - try { - var theme = localStorage.getItem('mdbook-theme'); - var sidebar = localStorage.getItem('mdbook-sidebar'); - if (theme.startsWith('"') && theme.endsWith('"')) { - localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); - } - if (sidebar.startsWith('"') && sidebar.endsWith('"')) { - localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); - } - } catch (e) { } - </script> - - <!-- Set the theme before any content is loaded, prevents flash --> - <script type="text/javascript"> - var theme; - try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } - if (theme === null || theme === undefined) { theme = default_theme; } - var html = document.querySelector('html'); - html.classList.remove('no-js') - html.classList.remove('light') - html.classList.add(theme); - html.classList.add('js'); - </script> - - <!-- Hide / unhide sidebar before it is displayed --> - <script type="text/javascript"> - var html = document.querySelector('html'); - var sidebar = 'hidden'; - if (document.body.clientWidth >= 1080) { - try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } - sidebar = sidebar || 'visible'; - } - html.classList.remove('sidebar-visible'); - html.classList.add("sidebar-" + sidebar); - </script> - - <nav id="sidebar" class="sidebar" aria-label="Table of contents"> - <div class="sidebar-scrollbox"> - <ol class="chapter"><li class="chapter-item expanded affix "><li class="part-title">Introduction</li><li class="chapter-item expanded "><a href="welcome_and_overview.html">Welcome and Overview</a></li><li class="chapter-item expanded affix "><li class="part-title">Setup</li><li class="chapter-item expanded "><a href="setup/installation.html">Installation</a></li><li class="chapter-item expanded "><a href="postgres.html">Using Postgres</a></li><li class="chapter-item expanded "><a href="reverse_proxy.html">Configuring a Reverse Proxy</a></li><li class="chapter-item expanded "><a href="setup/forward_proxy.html">Configuring a Forward/Outbound Proxy</a></li><li class="chapter-item expanded "><a href="turn-howto.html">Configuring a Turn Server</a></li><li class="chapter-item expanded "><a href="delegate.html">Delegation</a></li><li class="chapter-item expanded affix "><li class="part-title">Upgrading</li><li class="chapter-item expanded "><a href="upgrade.html">Upgrading between Synapse Versions</a></li><li class="chapter-item expanded "><a href="MSC1711_certificates_FAQ.html">Upgrading from pre-Synapse 1.0</a></li><li class="chapter-item expanded affix "><li class="part-title">Usage</li><li class="chapter-item expanded "><a href="federate.html">Federation</a></li><li class="chapter-item expanded "><a href="usage/configuration/index.html">Configuration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/configuration/homeserver_sample_config.html">Homeserver Sample Config File</a></li><li class="chapter-item expanded "><a href="usage/configuration/logging_sample_config.html">Logging Sample Config File</a></li><li class="chapter-item expanded "><a href="structured_logging.html">Structured Logging</a></li><li class="chapter-item expanded "><a href="templates.html">Templates</a></li><li class="chapter-item expanded "><a href="usage/configuration/user_authentication/index.html">User Authentication</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single-Sign On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="openid.html">OpenID Connect</a></li><li class="chapter-item expanded "><div>SAML</div></li><li class="chapter-item expanded "><div>CAS</div></li><li class="chapter-item expanded "><a href="sso_mapping_providers.html">SSO Mapping Providers</a></li></ol></li><li class="chapter-item expanded "><a href="password_auth_providers.html">Password Auth Providers</a></li><li class="chapter-item expanded "><a href="jwt.html">JSON Web Tokens</a></li></ol></li><li class="chapter-item expanded "><a href="CAPTCHA_SETUP.html">Registration Captcha</a></li><li class="chapter-item expanded "><a href="application_services.html">Application Services</a></li><li class="chapter-item expanded "><a href="server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="consent_tracking.html">Consent Tracking</a></li><li class="chapter-item expanded "><a href="url_previews.html" class="active">URL Previews</a></li><li class="chapter-item expanded "><a href="user_directory.html">User Directory</a></li><li class="chapter-item expanded "><a href="message_retention_policies.html">Message Retention Policies</a></li><li class="chapter-item expanded "><a href="modules.html">Pluggable Modules</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Third Party Rules</div></li><li class="chapter-item expanded "><a href="spam_checker.html">Spam Checker</a></li><li class="chapter-item expanded "><a href="presence_router_module.html">Presence Router</a></li><li class="chapter-item expanded "><div>Media Storage Providers</div></li></ol></li><li class="chapter-item expanded "><a href="workers.html">Workers</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="synctl_workers.html">Using synctl with Workers</a></li><li class="chapter-item expanded "><a href="systemd-with-workers/index.html">Systemd</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="usage/administration/index.html">Administration</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="usage/administration/admin_api/index.html">Admin API</a></li><li><ol class="section"><li class="chapter-item expanded "><a href="admin_api/account_validity.html">Account Validity</a></li><li class="chapter-item expanded "><a href="admin_api/delete_group.html">Delete Group</a></li><li class="chapter-item expanded "><a href="admin_api/event_reports.html">Event Reports</a></li><li class="chapter-item expanded "><a href="admin_api/media_admin_api.html">Media</a></li><li class="chapter-item expanded "><a href="admin_api/purge_history_api.html">Purge History</a></li><li class="chapter-item expanded "><a href="admin_api/register_api.html">Register Users</a></li><li class="chapter-item expanded "><a href="usage/administration/admin_api/registration_tokens.html">Registration Tokens</a></li><li class="chapter-item expanded "><a href="admin_api/room_membership.html">Manipulate Room Membership</a></li><li class="chapter-item expanded "><a href="admin_api/rooms.html">Rooms</a></li><li class="chapter-item expanded "><a href="admin_api/server_notices.html">Server Notices</a></li><li class="chapter-item expanded "><a href="admin_api/statistics.html">Statistics</a></li><li class="chapter-item expanded "><a href="admin_api/user_admin_api.html">Users</a></li><li class="chapter-item expanded "><a href="admin_api/version_api.html">Server Version</a></li></ol></li><li class="chapter-item expanded "><a href="manhole.html">Manhole</a></li><li class="chapter-item expanded "><a href="metrics-howto.html">Monitoring</a></li><li class="chapter-item expanded "><a href="usage/administration/request_log.html">Request log format</a></li><li class="chapter-item expanded "><div>Scripts</div></li></ol></li><li class="chapter-item expanded "><li class="part-title">Development</li><li class="chapter-item expanded "><a href="development/contributing_guide.html">Contributing Guide</a></li><li class="chapter-item expanded "><a href="code_style.html">Code Style</a></li><li class="chapter-item expanded "><a href="development/git.html">Git Usage</a></li><li class="chapter-item expanded "><div>Testing</div></li><li class="chapter-item expanded "><a href="opentracing.html">OpenTracing</a></li><li class="chapter-item expanded "><a href="development/database_schema.html">Database Schemas</a></li><li class="chapter-item expanded "><div>Synapse Architecture</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="log_contexts.html">Log Contexts</a></li><li class="chapter-item expanded "><a href="replication.html">Replication</a></li><li class="chapter-item expanded "><a href="tcp_replication.html">TCP Replication</a></li></ol></li><li class="chapter-item expanded "><a href="development/internal_documentation/index.html">Internal Documentation</a></li><li><ol class="section"><li class="chapter-item expanded "><div>Single Sign-On</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="development/saml.html">SAML</a></li><li class="chapter-item expanded "><a href="development/cas.html">CAS</a></li></ol></li><li class="chapter-item expanded "><a href="development/room-dag-concepts.html">Room DAG concepts</a></li><li class="chapter-item expanded "><div>State Resolution</div></li><li><ol class="section"><li class="chapter-item expanded "><a href="auth_chain_difference_algorithm.html">The Auth Chain Difference Algorithm</a></li></ol></li><li class="chapter-item expanded "><a href="media_repository.html">Media Repository</a></li><li class="chapter-item expanded "><a href="room_and_user_statistics.html">Room and User Statistics</a></li></ol></li><li class="chapter-item expanded "><div>Scripts</div></li><li class="chapter-item expanded affix "><li class="part-title">Other</li><li class="chapter-item expanded "><a href="deprecation_policy.html">Dependency Deprecation Policy</a></li></ol> - </div> - <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> - </nav> - - <div id="page-wrapper" class="page-wrapper"> - - <div class="page"> - - <div id="menu-bar-hover-placeholder"></div> - <div id="menu-bar" class="menu-bar sticky bordered"> - <div class="left-buttons"> - <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> - <i class="fa fa-bars"></i> - </button> - <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> - <i class="fa fa-paint-brush"></i> - </button> - <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> - <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li> - <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> - <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> - <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> - <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> - </ul> - - <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> - <i class="fa fa-search"></i> - </button> - - </div> - - <h1 class="menu-title">Synapse</h1> - - <div class="right-buttons"> - - <a href="print.html" title="Print this book" aria-label="Print this book"> - <i id="print-button" class="fa fa-print"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse" title="Git repository" aria-label="Git repository"> - <i id="git-repository-button" class="fa fa-github"></i> - </a> - - - <a href="https://github.com/matrix-org/synapse/edit/develop/docs/url_previews.md" title="Suggest an edit" aria-label="Suggest an edit"> - <i id="git-edit-button" class="fa fa-edit"></i> - </a> - - - </div> - </div> - - - <div id="search-wrapper" class="hidden"> - <form id="searchbar-outer" class="searchbar-outer"> - <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> - </form> - <div id="searchresults-outer" class="searchresults-outer hidden"> - <div id="searchresults-header" class="searchresults-header"></div> - <ul id="searchresults"> - </ul> - </div> - </div> - - - <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> - <script type="text/javascript"> - document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); - document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); - Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { - link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); - }); - </script> - - <div id="content" class="content"> - <main> - <!-- Page table of contents --> - <div class="sidetoc"> - <nav class="pagetoc"></nav> - </div> - - <h1 id="url-previews"><a class="header" href="#url-previews">URL Previews</a></h1> -<p>Design notes on a URL previewing service for Matrix:</p> -<p>Options are:</p> -<ol> -<li>Have an AS which listens for URLs, downloads them, and inserts an event that describes their metadata.</li> -</ol> -<ul> -<li>Pros: -<ul> -<li>Decouples the implementation entirely from Synapse.</li> -<li>Uses existing Matrix events & content repo to store the metadata.</li> -</ul> -</li> -<li>Cons: -<ul> -<li>Which AS should provide this service for a room, and why should you trust it?</li> -<li>Doesn't work well with E2E; you'd have to cut the AS into every room</li> -<li>the AS would end up subscribing to every room anyway.</li> -</ul> -</li> -</ul> -<ol start="2"> -<li>Have a generic preview API (nothing to do with Matrix) that provides a previewing service:</li> -</ol> -<ul> -<li>Pros: -<ul> -<li>Simple and flexible; can be used by any clients at any point</li> -</ul> -</li> -<li>Cons: -<ul> -<li>If each HS provides one of these independently, all the HSes in a room may needlessly DoS the target URI</li> -<li>We need somewhere to store the URL metadata rather than just using Matrix itself</li> -<li>We can't piggyback on matrix to distribute the metadata between HSes.</li> -</ul> -</li> -</ul> -<ol start="3"> -<li>Make the synapse of the sending user responsible for spidering the URL and inserting an event asynchronously which describes the metadata.</li> -</ol> -<ul> -<li>Pros: -<ul> -<li>Works transparently for all clients</li> -<li>Piggy-backs nicely on using Matrix for distributing the metadata.</li> -<li>No confusion as to which AS</li> -</ul> -</li> -<li>Cons: -<ul> -<li>Doesn't work with E2E</li> -<li>We might want to decouple the implementation of the spider from the HS, given spider behaviour can be quite complicated and evolve much more rapidly than the HS. It's more like a bot than a core part of the server.</li> -</ul> -</li> -</ul> -<ol start="4"> -<li>Make the sending client use the preview API and insert the event itself when successful.</li> -</ol> -<ul> -<li>Pros: -<ul> -<li>Works well with E2E</li> -<li>No custom server functionality</li> -<li>Lets the client customise the preview that they send (like on FB)</li> -</ul> -</li> -<li>Cons: -<ul> -<li>Entirely specific to the sending client, whereas it'd be nice if /any/ URL was correctly previewed if clients support it.</li> -</ul> -</li> -</ul> -<ol start="5"> -<li>Have the option of specifying a shared (centralised) previewing service used by a room, to avoid all the different HSes in the room DoSing the target.</li> -</ol> -<p>Best solution is probably a combination of both 2 and 4.</p> -<ul> -<li>Sending clients do their best to create and send a preview at the point of sending the message, perhaps delaying the message until the preview is computed? (This also lets the user validate the preview before sending)</li> -<li>Receiving clients have the option of going and creating their own preview if one doesn't arrive soon enough (or if the original sender didn't create one)</li> -</ul> -<p>This is a bit magical though in that the preview could come from two entirely different sources - the sending HS or your local one. However, this can always be exposed to users: "Generate your own URL previews if none are available?"</p> -<p>This is tantamount also to senders calculating their own thumbnails for sending in advance of the main content - we are trusting the sender not to lie about the content in the thumbnail. Whereas currently thumbnails are calculated by the receiving homeserver to avoid this attack.</p> -<p>However, this kind of phishing attack does exist whether we let senders pick their thumbnails or not, in that a malicious sender can send normal text messages around the attachment claiming it to be legitimate. We could rely on (future) reputation/abuse management to punish users who phish (be it with bogus metadata or bogus descriptions). Bogus metadata is particularly bad though, especially if it's avoidable.</p> -<p>As a first cut, let's do #2 and have the receiver hit the API to calculate its own previews (as it does currently for image thumbnails). We can then extend/optimise this to option 4 as a special extra if needed.</p> -<h2 id="api"><a class="header" href="#api">API</a></h2> -<pre><code>GET /_matrix/media/r0/preview_url?url=http://wherever.com -200 OK -{ - "og:type" : "article" - "og:url" : "https://twitter.com/matrixdotorg/status/684074366691356672" - "og:title" : "Matrix on Twitter" - "og:image" : "https://pbs.twimg.com/profile_images/500400952029888512/yI0qtFi7_400x400.png" - "og:description" : "“Synapse 0.12 is out! Lots of polishing, performance &amp;amp; bugfixes: /sync API, /r0 prefix, fulltext search, 3PID invites https://t.co/5alhXLLEGP”" - "og:site_name" : "Twitter" -} -</code></pre> -<ul> -<li>Downloads the URL -<ul> -<li>If HTML, just stores it in RAM and parses it for OG meta tags -<ul> -<li>Download any media OG meta tags to the media repo, and refer to them in the OG via mxc:// URIs.</li> -</ul> -</li> -<li>If a media filetype we know we can thumbnail: store it on disk, and hand it to the thumbnailer. Generate OG meta tags from the thumbnailer contents.</li> -<li>Otherwise, don't bother downloading further.</li> -</ul> -</li> -</ul> - - </main> - - <nav class="nav-wrapper" aria-label="Page navigation"> - <!-- Mobile navigation buttons --> - - <a rel="prev" href="consent_tracking.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="user_directory.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - - <div style="clear: both"></div> - </nav> - </div> - </div> - - <nav class="nav-wide-wrapper" aria-label="Page navigation"> - - <a rel="prev" href="consent_tracking.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> - <i class="fa fa-angle-left"></i> - </a> - - - - <a rel="next" href="user_directory.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> - <i class="fa fa-angle-right"></i> - </a> - - </nav> - - </div> - - - - - - - - - <script type="text/javascript"> - window.playground_copyable = true; - </script> - - - - - - <script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script> - <script src="mark.min.js" type="text/javascript" charset="utf-8"></script> - <script src="searcher.js" type="text/javascript" charset="utf-8"></script> - - - <script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script> - <script src="highlight.js" type="text/javascript" charset="utf-8"></script> - <script src="book.js" type="text/javascript" charset="utf-8"></script> - - <!-- Custom JS scripts --> - - <script type="text/javascript" src="docs/website_files/table-of-contents.js"></script> - - - - - </body> -</html> \ No newline at end of file |