summary refs log tree commit diff
path: root/synapse/config/repository.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Provide more info why we don't have any thumbnails to serve (#13038)Eric Eastwood2022-07-151-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix https://github.com/matrix-org/synapse/issues/13016 ## New error code and status ### Before Previously, we returned a `404` for `/thumbnail` which isn't even in the spec. ```json { "errcode": "M_NOT_FOUND", "error": "Not found [b'hs1', b'tefQeZhmVxoiBfuFQUKRzJxc']" } ``` ### After What does the spec say? > 400: The request does not make sense to the server, or the server cannot thumbnail the content. For example, the client requested non-integer dimensions or asked for negatively-sized images. > > *-- https://spec.matrix.org/v1.1/client-server-api/#get_matrixmediav3thumbnailservernamemediaid* Now with this PR, we respond with a `400` when we don't have thumbnails to serve and we explain why we might not have any thumbnails. ```json { "errcode": "M_UNKNOWN", "error": "Cannot find any thumbnails for the requested media ([b'example.com', b'12345']). This might mean the media is not a supported_media_format=(image/jpeg, image/jpg, image/webp, image/gif, image/png) or that thumbnailing failed for some other reason. (Dynamic thumbnails are disabled on this server.)", } ``` > Cannot find any thumbnails for the requested media ([b'example.com', b'12345']). This might mean the media is not a supported_media_format=(image/jpeg, image/jpg, image/webp, image/gif, image/png) or that thumbnailing failed for some other reason. (Dynamic thumbnails are disabled on this server.) --- We still respond with a 404 in many other places. But we can iterate on those later and maybe keep some in some specific places after spec updates/clarification: https://github.com/matrix-org/matrix-spec/issues/1122 We can also iterate on the bugs where Synapse doesn't thumbnail when it should in other issues/PRs.
* Allow dependency errors to pass through (#13113)Jacek Kuśnierz2022-06-301-8/+2
| | | | Signed-off-by: Jacek Kusnierz <jacek.kusnierz@tum.de> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Remove code generating comments in configuration file (#12941)Shay2022-06-141-164/+2
|
* Add config options for media retention (#12732)Andrew Morgan2022-05-311-0/+16
|
* Add missing type hints to config classes. (#12402)Patrick Cloke2022-04-111-3/+4
|
* Use importlib.metadata to read requirements (#12088)David Robertson2022-03-011-1/+1
| | | | | | | | | | | | | | | | | | * Pull runtime dep checks into their own module * Reimplement `check_requirements` using `importlib` I've tried to make this clearer. We start by working out which of Synapse's requirements we need to be installed here and now. I was surprised that there wasn't an easier way to see which packages were installed by a given extra. I've pulled out the error messages into functions that deal with "is this for an extra or not". And I've rearranged the loop over two different sets of requirements into one loop with a "must be instaled" flag. I hope you agree that this is clearer. * Test cases
* Convert all namedtuples to attrs. (#11665)Patrick Cloke2021-12-301-16/+18
| | | To improve type hints throughout the code.
* Additional type hints for config module. (#11465)Patrick Cloke2021-12-011-3/+6
| | | | This adds some misc. type hints to helper methods used in the `synapse.config` module.
* Require direct references to configuration variables. (#10985)Patrick Cloke2021-10-061-1/+1
| | | | | | This removes the magic allowing accessing configurable variables directly from the config object. It is now required that a specific configuration class is used (e.g. `config.foo` must be replaced with `config.server.foo`).
* Add warnings to ip_range_blacklist usage with proxies (#10129)Kento Okamoto2021-08-031-5/+19
| | | | | | | | Per issue #9812 using `url_preview_ip_range_blacklist` with a proxy via `HTTPS_PROXY` or `HTTP_PROXY` environment variables has some inconsistent bahavior than mentioned. This PR changes the following: - Changes the Sample Config file to include a note mentioning that `url_preview_ip_range_blacklist` and `ip_range_blacklist` is ignored when using a proxy - Changes some logic in synapse/config/repository.py to send a warning when both `*ip_range_blacklist` configs and a proxy environment variable are set and but no longer throws an error. Signed-off-by: Kento Okamoto <kentokamoto@protonmail.com>
* Use inline type hints in various other places (in `synapse/`) (#10380)Jonathan de Jong2021-07-151-2/+2
|
* Update links to documentation in sample config (#10287)Dirk Klimpel2021-07-071-1/+1
| | | Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Mention that you need to configure max upload size in reverse proxy as well ↵Aaron Raimist2021-06-101-0/+4
| | | | | (#10122) Signed-off-by: Aaron Raimist <aaron@raim.ist>
* More robust handling of the Content-Type header for thumbnail generation (#9788)rkfg2021-04-141-0/+1
| | | | Signed-off-by: Sergey Shpikin <rkfg@rkfg.me>
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Enable flake8-bugbear, but disable most checks. (#9499)Jonathan de Jong2021-03-161-1/+3
| | | | * Adds B00 to ignored checks. * Fixes remaining issues.
* Remove vestiges of uploads_path config (#9462)Richard van der Hoff2021-02-221-1/+0
| | | | `uploads_path` was a thing that was never used; most of it was removed in #6628 but a few vestiges remained.
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-1/+1
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Convert blacklisted IPv4 addresses to compatible IPv6 addresses. (#9240)Patrick Cloke2021-02-031-10/+9
| | | Also add a few more IP ranges to the default blacklist.
* Default to blacklisting reserved IP ranges and add a whitelist. (#8870)Patrick Cloke2020-12-091-12/+8
| | | | This defaults `ip_range_blacklist` to reserved IP ranges and also adds an `ip_range_whitelist` setting to override it.
* Better formatting for config errors from modules (#8874)Richard van der Hoff2020-12-081-2/+4
| | | | | | | | | | The idea is that the parse_config method of extension modules can raise either a ConfigError or a JsonValidationError, and it will be magically turned into a legible error message. There's a few components to it: * Separating the "path" and the "message" parts of a ConfigError, so that we can fiddle with the path bit to turn it into an absolute path. * Generally improving the way ConfigErrors get printed. * Passing in the config path to load_module so that it can wrap any exceptions that get caught appropriately.
* Increase default max_upload_size from 10M to 50M (#8502)Mateusz Przybyłowicz2020-10-091-2/+2
| | | Signed-off-by: Mateusz Przybyłowicz <uamfhq@gmail.com>
* Support running multiple media repos. (#7706)Erik Johnston2020-06-171-0/+6
| | | | | This requires a new config option to specify which media repo should be responsible for running background jobs to e.g. clear out expired URL preview caches.
* Add support for webp thumbnailing (#7586)WGH2020-06-051-0/+1
| | | | | Closes #4382 Signed-off-by: Maxim Plotnikov <wgh@torlan.ru>
* Clarify the comments for media_storage_providers options (#7272)Tristan Lins2020-04-171-4/+3
|
* Allow specifying the value of Accept-Language header for URL previews (#7265)Andrew Morgan2020-04-151-0/+29
|
* Remove unused, undocumented "content repo" resource (#6628)Richard van der Hoff2020-01-031-5/+0
| | | | | | This looks like it got half-killed back in #888. Fixes #6567.
* Refactor HomeserverConfig so it can be typechecked (#6137)Amber Brown2019-10-101-0/+2
|
* Fix up some typechecking (#6150)Amber Brown2019-10-021-2/+3
| | | | | | * type checking fixes * changelog
* fix broken copyrightsMatthew Hodgson2019-09-231-1/+1
|
* Check dependencies on setup in the nicer way. (#5989)Jorik Schellekens2019-09-111-20/+7
|
* fix config being a dict, actuallyAmber H. Brown2019-08-141-1/+1
|
* Don't load the media repo when configured to use an external media repo (#5754)Amber Brown2019-08-131-0/+20
|
* Don't load the generated config as the default.Richard van der Hoff2019-06-241-1/+1
| | | | It's too confusing.
* Ensure that all config options have sensible defaultsRichard van der Hoff2019-06-241-2/+4
| | | | | This will enable us to skip the unintuitive behaviour where the generated config and default config are the same thing.
* Pass config_dir_path and data_dir_path into Config.read_config. (#5522)Richard van der Hoff2019-06-241-1/+1
| | | | | | * Pull config_dir_path and data_dir_path calculation out of read_config_files * Pass config_dir_path and data_dir_path into read_config
* Run Black. (#5482)Amber Brown2019-06-201-46/+28
|
* more config comment updatesRichard van der Hoff2019-05-031-2/+5
|
* Blacklist 0.0.0.0 and :: by default for URL previewsRichard van der Hoff2019-05-031-10/+18
|
* Comment out most options in the generated config. (#4863)Richard van der Hoff2019-03-191-27/+50
| | | | | | | | | | | | | | | | | | | | Make it so that most options in the config are optional, and commented out in the generated config. The reasons this is a good thing are as follows: * If we decide that we should change the default for an option, we can do so, and only those admins that have deliberately chosen to override that option will be stuck on the old setting. * It moves us towards a point where we can get rid of the super-surprising feature of synapse where the default settings for the config come from the generated yaml. * It makes setting up a test config for unit testing an order of magnitude easier (see forthcoming PR). * It makes the generated config more consistent, and hopefully easier for users to understand.
* Attempt to make default config more consistentRichard van der Hoff2019-02-191-38/+45
| | | | | | The general idea here is that config examples should just have a hash and no extraneous whitespace, both to make it easier for people who don't understand yaml, and to make the examples stand out from the comments.
* Add a script to generate a clean config file (#4315)Richard van der Hoff2018-12-221-4/+4
|
* Fix a number of flake8 errorsRichard van der Hoff2018-10-241-1/+1
| | | | | | | | | | | | Broadly three things here: * disable W504 which seems a bit whacko * remove a bunch of `as e` expressions from exception handlers that don't use them * use `r""` for strings which include backslashes Also, we don't use pep8 any more, so we can get rid of the duplicate config there.
* run isortAmber Brown2018-07-091-1/+1
|
* Add private IPv6 addresses to preview blacklist #3312Felix Schäfer2018-06-011-0/+3
| | | | | | | The added addresses are expected to be local or loopback addresses and shouldn't be spidered for previews. Signed-off-by: Felix Schäfer <felix@thegcat.net>
* Fix passing wrong config to provider constructorErik Johnston2018-01-181-1/+1
|
* Remove duplicate directory testErik Johnston2018-01-181-4/+0
|
* Fixup commentsErik Johnston2018-01-181-1/+5
|
* Make storage providers more configurableErik Johnston2018-01-181-11/+72
|
* Copy everything to backupErik Johnston2017-10-121-1/+3
|
* Basic implementation of backup media storeErik Johnston2017-10-121-0/+18
|
* default config: blacklist more internal ipsEuan Kemp2016-11-061-0/+2
|
* Clean up the blacklist/whitelist handling.Mark Haines2016-05-161-6/+6
| | | | | | | Always set the config key with an empty list, even if a list isn't specified. This means that the codepaths are the same for both the empty list and for a missing key. Since the behaviour is the same for both cases this makes the code somewhat easier to reason about.
* add a url_preview_ip_range_whitelist config param so we can whitelist the ↵Matthew Hodgson2016-05-011-0/+14
| | | | matrix.org IP space
* Give install requirementsErik Johnston2016-04-131-1/+7
|
* Add back in helpful description for missing url_preview_ip_range_blacklistErik Johnston2016-04-131-1/+5
|
* Sanitize the optional dependencies for spider APIErik Johnston2016-04-131-10/+28
|
* fix typoMatthew Hodgson2016-04-081-1/+1
|
* Add url_preview_enabled config option to turn on/off preview_url endpoint. ↵Matthew Hodgson2016-04-081-4/+73
| | | | | | | | | defaults to off. Add url_preview_ip_range_blacklist to let admins specify internal IP ranges that must not be spidered. Add url_preview_url_blacklist to let admins specify URL patterns that must not be spidered. Implement a custom SpiderEndpoint and associated support classes to implement url_preview_ip_range_blacklist Add commentary and generally address PR feedback
* Merge branch 'develop' into matthew/preview_urlsMatthew Hodgson2016-03-271-0/+3
|\
| * add 800x600 thumbnails to make vector look prettier (and anyone else who ↵Matthew Hodgson2016-03-021-0/+3
| | | | | | | | likes big thumbnails)
* | initial WIP of a tentative preview_url endpoint - incomplete, untested, ↵Matthew Hodgson2016-01-241-1/+5
|/ | | | experimental, etc. just putting it here for safekeeping for now
* Implement configurable stats reportingDaniel Wagner-Hall2015-09-221-1/+1
| | | | | | | | | | SYN-287 This requires that HS owners either opt in or out of stats reporting. When --generate-config is passed, --report-stats must be specified If an already-generated config is used, and doesn't have the report_stats key, it is requested to be set.
* Fix flake8 warningMark Haines2015-08-131-0/+1
|
* Doc-string for config ultility functionMark Haines2015-08-121-0/+11
|
* Add config option for setting the list of thumbnail sizes to precalculateMark Haines2015-08-121-0/+39
|
* Make a config option for whether to generate new thumbnail sizes dynamicallyMark Haines2015-08-121-0/+8
|
* Make upload dir a configurable path.Eric Myhre2015-06-181-0/+5
| | | | | | Fixes SYN-425. Signed-off-by: Eric Myhre <hash@exultant.us>
* remove duplicate parse_size methodMark Haines2015-04-301-9/+0
|
* Manually generate the default config yaml, remove most of the commandline ↵Mark Haines2015-04-301-19/+16
| | | | arguments for synapse anticipating that people will use the yaml instead. Simpify implementing config options by not requiring the classes to hit the super class
* Increase default maximum attachment size to 10MMark Haines2015-01-061-1/+1
|
* Update copyright noticesMark Haines2015-01-061-1/+1
|
* Limit the size of images that are thumbnailed serverside. Limit the size of ↵Mark Haines2014-12-111-0/+5
| | | | file that a server will download from a remote server
* Get uploads working with new media repoMark Haines2014-12-021-0/+4
|
* Fix pep8 warningsMark Haines2014-10-301-0/+1
|
* pyflakes cleanupErik Johnston2014-09-301-1/+0
|
* Limit the size of uploadsMark Haines2014-09-031-0/+39