mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 06:33:47 +01:00
Merge branch 'develop' of github.com:matrix-org/synapse into erikj-perf
This commit is contained in:
commit
96a5ba41f5
6 changed files with 46 additions and 7 deletions
|
@ -108,6 +108,9 @@ To install the synapse homeserver run::
|
|||
This installs synapse, along with the libraries it uses, into
|
||||
``$HOME/.local/lib/`` on Linux or ``$HOME/Library/Python/2.7/lib/`` on OSX.
|
||||
|
||||
For reliable VoIP calls to be routed via this homeserver, you MUST configure
|
||||
a TURN server. See docs/turn-howto.rst for details.
|
||||
|
||||
Troubleshooting Installation
|
||||
----------------------------
|
||||
|
||||
|
@ -239,6 +242,11 @@ Upgrading an existing homeserver
|
|||
IMPORTANT: Before upgrading an existing homeserver to a new version, please
|
||||
refer to UPGRADE.rst for any additional instructions.
|
||||
|
||||
Otherwise, simply re-install the new codebase over the current one - e.g.
|
||||
by ``pip install --user --process-dependency-links
|
||||
https://github.com/matrix-org/synapse/tarball/master``
|
||||
if using pip, or by ``git pull`` if running off a git working copy.
|
||||
|
||||
|
||||
Setting up Federation
|
||||
=====================
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
Media Repository
|
||||
Media Repository
|
||||
================
|
||||
|
||||
*Synapse implementation-specific details for the media repository*
|
||||
|
||||
The media repository is where attachments and avatar photos are stored.
|
||||
It stores attachment content and thumbnails for media uploaded by local users.
|
||||
It caches attachment content and thumbnails for media uploaded by remote users.
|
||||
|
|
18
synapse/http/agent_name.py
Normal file
18
synapse/http/agent_name.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 OpenMarket Ltd
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from synapse import __version__
|
||||
|
||||
AGENT_NAME = ("Synapse/%s" % (__version__,)).encode("ascii")
|
|
@ -14,6 +14,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
|
||||
from synapse.http.agent_name import AGENT_NAME
|
||||
from twisted.internet import defer, reactor
|
||||
from twisted.web.client import (
|
||||
Agent, readBody, FileBodyProducer, PartialDownloadError
|
||||
|
@ -51,7 +52,8 @@ class SimpleHttpClient(object):
|
|||
"POST",
|
||||
uri.encode("ascii"),
|
||||
headers=Headers({
|
||||
"Content-Type": ["application/x-www-form-urlencoded"]
|
||||
b"Content-Type": [b"application/x-www-form-urlencoded"],
|
||||
b"User-Agent": AGENT_NAME,
|
||||
}),
|
||||
bodyProducer=FileBodyProducer(StringIO(query_bytes))
|
||||
)
|
||||
|
@ -86,6 +88,9 @@ class SimpleHttpClient(object):
|
|||
response = yield self.agent.request(
|
||||
"GET",
|
||||
uri.encode("ascii"),
|
||||
headers=Headers({
|
||||
b"User-Agent": AGENT_NAME,
|
||||
})
|
||||
)
|
||||
|
||||
body = yield readBody(response)
|
||||
|
@ -108,7 +113,8 @@ class CaptchaServerHttpClient(SimpleHttpClient):
|
|||
url.encode("ascii"),
|
||||
bodyProducer=FileBodyProducer(StringIO(query_bytes)),
|
||||
headers=Headers({
|
||||
"Content-Type": ["application/x-www-form-urlencoded"]
|
||||
b"Content-Type": [b"application/x-www-form-urlencoded"],
|
||||
b"User-Agent": AGENT_NAME,
|
||||
})
|
||||
)
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ from twisted.web.client import readBody, _AgentBase, _URI
|
|||
from twisted.web.http_headers import Headers
|
||||
from twisted.web._newclient import ResponseDone
|
||||
|
||||
from synapse.http.agent_name import AGENT_NAME
|
||||
from synapse.http.endpoint import matrix_federation_endpoint
|
||||
from synapse.util.async import sleep
|
||||
from synapse.util.logcontext import PreserveLoggingContext
|
||||
|
@ -71,6 +72,7 @@ class MatrixFederationHttpClient(object):
|
|||
requests.
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self, hs):
|
||||
self.hs = hs
|
||||
self.signing_key = hs.config.signing_key[0]
|
||||
|
@ -83,7 +85,7 @@ class MatrixFederationHttpClient(object):
|
|||
query_bytes=b"", retry_on_dns_fail=True):
|
||||
""" Creates and sends a request to the given url
|
||||
"""
|
||||
headers_dict[b"User-Agent"] = [b"Synapse"]
|
||||
headers_dict[b"User-Agent"] = [AGENT_NAME]
|
||||
headers_dict[b"Host"] = [destination]
|
||||
|
||||
url_bytes = urlparse.urlunparse(
|
||||
|
|
|
@ -14,14 +14,16 @@
|
|||
# limitations under the License.
|
||||
|
||||
|
||||
from syutil.jsonutil import (
|
||||
encode_canonical_json, encode_pretty_printed_json
|
||||
)
|
||||
from synapse.http.agent_name import AGENT_NAME
|
||||
from synapse.api.errors import (
|
||||
cs_exception, SynapseError, CodeMessageException
|
||||
)
|
||||
from synapse.util.logcontext import LoggingContext
|
||||
|
||||
from syutil.jsonutil import (
|
||||
encode_canonical_json, encode_pretty_printed_json
|
||||
)
|
||||
|
||||
from twisted.internet import defer, reactor
|
||||
from twisted.web import server, resource
|
||||
from twisted.web.server import NOT_DONE_YET
|
||||
|
@ -230,6 +232,7 @@ def respond_with_json_bytes(request, code, json_bytes, send_cors=False,
|
|||
|
||||
request.setResponseCode(code, message=response_code_message)
|
||||
request.setHeader(b"Content-Type", b"application/json")
|
||||
request.setHeader(b"Server", AGENT_NAME)
|
||||
|
||||
if send_cors:
|
||||
request.setHeader("Access-Control-Allow-Origin", "*")
|
||||
|
|
Loading…
Reference in a new issue