Add prometheus metrics (#527)
This commit is contained in:
parent
37bd539ed7
commit
3c05e11933
1
changelog.d/527.misc
Normal file
1
changelog.d/527.misc
Normal file
@ -0,0 +1 @@
|
||||
Add some prometheus metrics and make `prometheus_client` dependency mandatory.
|
127
poetry.lock
generated
127
poetry.lock
generated
@ -15,10 +15,10 @@ optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[package.extras]
|
||||
dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"]
|
||||
docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"]
|
||||
tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "cloudpickle"]
|
||||
tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "cloudpickle"]
|
||||
dev = ["cloudpickle", "coverage[toml] (>=5.0.2)", "furo", "hypothesis", "mypy", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six", "sphinx", "sphinx-notfound-page", "zope.interface"]
|
||||
docs = ["furo", "sphinx", "sphinx-notfound-page", "zope.interface"]
|
||||
tests = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six", "zope.interface"]
|
||||
tests-no-zope = ["cloudpickle", "coverage[toml] (>=5.0.2)", "hypothesis", "mypy", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins", "six"]
|
||||
|
||||
[[package]]
|
||||
name = "automat"
|
||||
@ -33,7 +33,7 @@ attrs = ">=19.2.0"
|
||||
six = "*"
|
||||
|
||||
[package.extras]
|
||||
visualize = ["graphviz (>0.5.1)", "Twisted (>=16.1.1)"]
|
||||
visualize = ["Twisted (>=16.1.1)", "graphviz (>0.5.1)"]
|
||||
|
||||
[[package]]
|
||||
name = "black"
|
||||
@ -99,7 +99,7 @@ optional = false
|
||||
python-versions = ">=3.5.0"
|
||||
|
||||
[package.extras]
|
||||
unicode_backport = ["unicodedata2"]
|
||||
unicode-backport = ["unicodedata2"]
|
||||
|
||||
[[package]]
|
||||
name = "click"
|
||||
@ -152,12 +152,12 @@ python-versions = ">=3.6"
|
||||
cffi = ">=1.12"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx (>=1.6.5,!=1.8.0,!=3.1.0,!=3.1.1)", "sphinx-rtd-theme"]
|
||||
docstest = ["pyenchant (>=1.6.11)", "twine (>=1.12.0)", "sphinxcontrib-spelling (>=4.0.1)"]
|
||||
docs = ["sphinx (>=1.6.5,!=1.8.0,!=3.1.0,!=3.1.1)", "sphinx_rtd_theme"]
|
||||
docstest = ["pyenchant (>=1.6.11)", "sphinxcontrib-spelling (>=4.0.1)", "twine (>=1.12.0)"]
|
||||
pep8test = ["black", "flake8", "flake8-import-order", "pep8-naming"]
|
||||
sdist = ["setuptools_rust (>=0.11.4)"]
|
||||
ssh = ["bcrypt (>=3.1.5)"]
|
||||
test = ["pytest (>=6.2.0)", "pytest-cov", "pytest-subtests", "pytest-xdist", "pretend", "iso8601", "pytz", "hypothesis (>=1.11.4,!=3.79.2)"]
|
||||
test = ["hypothesis (>=1.11.4,!=3.79.2)", "iso8601", "pretend", "pytest (>=6.2.0)", "pytest-cov", "pytest-subtests", "pytest-xdist", "pytz"]
|
||||
|
||||
[[package]]
|
||||
name = "flake8"
|
||||
@ -226,9 +226,9 @@ typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""}
|
||||
zipp = ">=0.5"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||
docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"]
|
||||
perf = ["ipython"]
|
||||
testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "packaging", "pyfakefs", "flufl.flake8", "pytest-perf (>=0.9.2)", "pytest-black (>=0.3.7)", "pytest-mypy", "importlib-resources (>=1.3)"]
|
||||
testing = ["flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy", "pytest-perf (>=0.9.2)"]
|
||||
|
||||
[[package]]
|
||||
name = "incremental"
|
||||
@ -250,9 +250,9 @@ optional = false
|
||||
python-versions = ">=3.6,<4.0"
|
||||
|
||||
[package.extras]
|
||||
pipfile_deprecated_finder = ["pipreqs", "requirementslib"]
|
||||
requirements_deprecated_finder = ["pipreqs", "pip-api"]
|
||||
colors = ["colorama (>=0.4.3,<0.5.0)"]
|
||||
pipfile-deprecated-finder = ["pipreqs", "requirementslib"]
|
||||
requirements-deprecated-finder = ["pip-api", "pipreqs"]
|
||||
|
||||
[[package]]
|
||||
name = "jinja2"
|
||||
@ -289,13 +289,13 @@ attrs = "*"
|
||||
importlib-metadata = {version = ">=1.4", markers = "python_version < \"3.8\""}
|
||||
|
||||
[package.extras]
|
||||
dev = ["tox", "twisted", "aiounittest", "mypy (==0.910)", "black (==21.9b0)", "flake8 (==4.0.1)", "isort (==5.9.3)"]
|
||||
test = ["tox", "twisted", "aiounittest"]
|
||||
dev = ["aiounittest", "black (==21.9b0)", "flake8 (==4.0.1)", "isort (==5.9.3)", "mypy (==0.910)", "tox", "twisted"]
|
||||
test = ["aiounittest", "tox", "twisted"]
|
||||
|
||||
[[package]]
|
||||
name = "matrix_is_tester"
|
||||
name = "matrix-is-tester"
|
||||
version = "0.1"
|
||||
description = ""
|
||||
description = "Black-box integration testing for Matrix Identity Servers"
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
@ -307,13 +307,13 @@ six = ">=1.13.0"
|
||||
Twisted = ">=19.2.1"
|
||||
|
||||
[package.extras]
|
||||
lint = ["flake8 (>=3.7.8)", "isort (>=4.3.21)", "black (>=19.3b0)"]
|
||||
lint = ["black (>=19.3b0)", "flake8 (>=3.7.8)", "isort (>=4.3.21)"]
|
||||
|
||||
[package.source]
|
||||
type = "git"
|
||||
url = "https://github.com/matrix-org/matrix-is-tester"
|
||||
reference = "main"
|
||||
resolved_reference = "4575295072f15c71dbf7324d9d9796eb77ea21f0"
|
||||
resolved_reference = "c87641b9866b5fd6d648d829283c18fbb06d1bbe"
|
||||
|
||||
[[package]]
|
||||
name = "mccabe"
|
||||
@ -363,7 +363,7 @@ mypy = "0.931"
|
||||
"zope.schema" = "*"
|
||||
|
||||
[package.extras]
|
||||
test = ["pytest (>=4.6)", "pytest-cov", "lxml"]
|
||||
test = ["lxml", "pytest (>=4.6)", "pytest-cov"]
|
||||
|
||||
[[package]]
|
||||
name = "netaddr"
|
||||
@ -402,10 +402,10 @@ python-versions = "*"
|
||||
|
||||
[[package]]
|
||||
name = "prometheus-client"
|
||||
version = "0.13.1"
|
||||
version = "0.15.0"
|
||||
description = "Python client for the Prometheus monitoring system."
|
||||
category = "main"
|
||||
optional = true
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.extras]
|
||||
@ -466,8 +466,8 @@ python-versions = ">=3.6"
|
||||
cffi = ">=1.4.1"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx (>=1.6.5)", "sphinx-rtd-theme"]
|
||||
tests = ["pytest (>=3.2.1,!=3.3.0)", "hypothesis (>=3.27.0)"]
|
||||
docs = ["sphinx (>=1.6.5)", "sphinx_rtd_theme"]
|
||||
tests = ["hypothesis (>=3.27.0)", "pytest (>=3.2.1,!=3.3.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "pyopenssl"
|
||||
@ -517,7 +517,7 @@ urllib3 = ">=1.21.1,<1.27"
|
||||
|
||||
[package.extras]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
|
||||
use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"]
|
||||
use-chardet-on-py3 = ["chardet (>=3.0.2,<5)"]
|
||||
|
||||
[[package]]
|
||||
name = "sentry-sdk"
|
||||
@ -539,11 +539,11 @@ celery = ["celery (>=3)"]
|
||||
chalice = ["chalice (>=1.16.0)"]
|
||||
django = ["django (>=1.8)"]
|
||||
falcon = ["falcon (>=1.4)"]
|
||||
flask = ["flask (>=0.11)", "blinker (>=1.1)"]
|
||||
flask = ["blinker (>=1.1)", "flask (>=0.11)"]
|
||||
httpx = ["httpx (>=0.16.0)"]
|
||||
pure_eval = ["pure-eval", "executing", "asttokens"]
|
||||
pure-eval = ["asttokens", "executing", "pure-eval"]
|
||||
pyspark = ["pyspark (>=2.4.4)"]
|
||||
quart = ["quart (>=0.16.1)", "blinker (>=1.1)"]
|
||||
quart = ["blinker (>=1.1)", "quart (>=0.16.1)"]
|
||||
rq = ["rq (>=0.6)"]
|
||||
sanic = ["sanic (>=0.8)"]
|
||||
sqlalchemy = ["sqlalchemy (>=1.2)"]
|
||||
@ -565,11 +565,24 @@ pyasn1-modules = "*"
|
||||
six = "*"
|
||||
|
||||
[package.extras]
|
||||
dev = ["coverage[toml] (>=5.0.2)", "pytest", "sphinx", "furo", "idna", "pyopenssl"]
|
||||
docs = ["sphinx", "furo"]
|
||||
dev = ["coverage[toml] (>=5.0.2)", "furo", "idna", "pyOpenSSL", "pytest", "sphinx"]
|
||||
docs = ["furo", "sphinx"]
|
||||
idna = ["idna"]
|
||||
tests = ["coverage[toml] (>=5.0.2)", "pytest"]
|
||||
|
||||
[[package]]
|
||||
name = "setuptools"
|
||||
version = "65.5.1"
|
||||
description = "Easily download, build, install, upgrade, and uninstall Python packages"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[package.extras]
|
||||
docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-hoverxref (<2)", "sphinx-inline-tabs", "sphinx-notfound-page (==0.8.3)", "sphinx-reredirects", "sphinxcontrib-towncrier"]
|
||||
testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8 (<5)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pip-run (>=8.8)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"]
|
||||
testing-integration = ["build[virtualenv]", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"]
|
||||
|
||||
[[package]]
|
||||
name = "signedjson"
|
||||
version = "1.1.1"
|
||||
@ -638,6 +651,7 @@ click = "*"
|
||||
click-default-group = "*"
|
||||
incremental = "*"
|
||||
jinja2 = "*"
|
||||
setuptools = "*"
|
||||
tomli = {version = "*", markers = "python_version >= \"3.6\""}
|
||||
|
||||
[package.extras]
|
||||
@ -662,20 +676,20 @@ typing-extensions = ">=3.6.5"
|
||||
"zope.interface" = ">=4.4.2"
|
||||
|
||||
[package.extras]
|
||||
all_non_platform = ["cython-test-exception-raiser (>=1.0.2,<2)", "PyHamcrest (>=1.9.0)", "pyopenssl (>=16.0.0)", "service-identity (>=18.1.0)", "idna (>=2.4)", "pyasn1", "cryptography (>=2.6)", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "pyserial (>=3.0)", "h2 (>=3.0,<5.0)", "priority (>=1.1.0,<2.0)", "pywin32 (!=226)", "contextvars (>=2.4,<3)"]
|
||||
conch = ["pyasn1", "cryptography (>=2.6)", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)"]
|
||||
conch_nacl = ["pyasn1", "cryptography (>=2.6)", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "pynacl"]
|
||||
all-non-platform = ["PyHamcrest (>=1.9.0)", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "contextvars (>=2.4,<3)", "cryptography (>=2.6)", "cython-test-exception-raiser (>=1.0.2,<2)", "h2 (>=3.0,<5.0)", "idna (>=2.4)", "priority (>=1.1.0,<2.0)", "pyasn1", "pyopenssl (>=16.0.0)", "pyserial (>=3.0)", "pywin32 (!=226)", "service-identity (>=18.1.0)"]
|
||||
conch = ["appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "cryptography (>=2.6)", "pyasn1"]
|
||||
conch-nacl = ["PyNaCl", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "cryptography (>=2.6)", "pyasn1"]
|
||||
contextvars = ["contextvars (>=2.4,<3)"]
|
||||
dev = ["towncrier (>=19.2,<20.0)", "sphinx-rtd-theme (>=0.5,<1.0)", "readthedocs-sphinx-ext (>=2.1,<3.0)", "sphinx (>=4.1.2,<6)", "pyflakes (>=2.2,<3.0)", "twistedchecker (>=0.7,<1.0)", "coverage (>=6b1,<7)", "python-subunit (>=1.4,<2.0)", "pydoctor (>=21.9.0,<21.10.0)"]
|
||||
dev_release = ["towncrier (>=19.2,<20.0)", "sphinx-rtd-theme (>=0.5,<1.0)", "readthedocs-sphinx-ext (>=2.1,<3.0)", "sphinx (>=4.1.2,<6)", "pydoctor (>=21.9.0,<21.10.0)"]
|
||||
dev = ["coverage (>=6b1,<7)", "pydoctor (>=21.9.0,<21.10.0)", "pyflakes (>=2.2,<3.0)", "python-subunit (>=1.4,<2.0)", "readthedocs-sphinx-ext (>=2.1,<3.0)", "sphinx (>=4.1.2,<6)", "sphinx-rtd-theme (>=0.5,<1.0)", "towncrier (>=19.2,<20.0)", "twistedchecker (>=0.7,<1.0)"]
|
||||
dev-release = ["pydoctor (>=21.9.0,<21.10.0)", "readthedocs-sphinx-ext (>=2.1,<3.0)", "sphinx (>=4.1.2,<6)", "sphinx-rtd-theme (>=0.5,<1.0)", "towncrier (>=19.2,<20.0)"]
|
||||
http2 = ["h2 (>=3.0,<5.0)", "priority (>=1.1.0,<2.0)"]
|
||||
macos_platform = ["pyobjc-core", "pyobjc-framework-cfnetwork", "pyobjc-framework-cocoa", "cython-test-exception-raiser (>=1.0.2,<2)", "PyHamcrest (>=1.9.0)", "pyopenssl (>=16.0.0)", "service-identity (>=18.1.0)", "idna (>=2.4)", "pyasn1", "cryptography (>=2.6)", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "pyserial (>=3.0)", "h2 (>=3.0,<5.0)", "priority (>=1.1.0,<2.0)", "pywin32 (!=226)", "contextvars (>=2.4,<3)"]
|
||||
mypy = ["mypy (==0.930)", "mypy-zope (==0.3.4)", "types-setuptools", "types-pyopenssl", "towncrier (>=19.2,<20.0)", "sphinx-rtd-theme (>=0.5,<1.0)", "readthedocs-sphinx-ext (>=2.1,<3.0)", "sphinx (>=4.1.2,<6)", "pyflakes (>=2.2,<3.0)", "twistedchecker (>=0.7,<1.0)", "coverage (>=6b1,<7)", "cython-test-exception-raiser (>=1.0.2,<2)", "PyHamcrest (>=1.9.0)", "pyopenssl (>=16.0.0)", "service-identity (>=18.1.0)", "idna (>=2.4)", "pyasn1", "cryptography (>=2.6)", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "pyserial (>=3.0)", "h2 (>=3.0,<5.0)", "priority (>=1.1.0,<2.0)", "pynacl", "pywin32 (!=226)", "python-subunit (>=1.4,<2.0)", "contextvars (>=2.4,<3)", "pydoctor (>=21.9.0,<21.10.0)"]
|
||||
osx_platform = ["pyobjc-core", "pyobjc-framework-cfnetwork", "pyobjc-framework-cocoa", "cython-test-exception-raiser (>=1.0.2,<2)", "PyHamcrest (>=1.9.0)", "pyopenssl (>=16.0.0)", "service-identity (>=18.1.0)", "idna (>=2.4)", "pyasn1", "cryptography (>=2.6)", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "pyserial (>=3.0)", "h2 (>=3.0,<5.0)", "priority (>=1.1.0,<2.0)", "pywin32 (!=226)", "contextvars (>=2.4,<3)"]
|
||||
macos-platform = ["PyHamcrest (>=1.9.0)", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "contextvars (>=2.4,<3)", "cryptography (>=2.6)", "cython-test-exception-raiser (>=1.0.2,<2)", "h2 (>=3.0,<5.0)", "idna (>=2.4)", "priority (>=1.1.0,<2.0)", "pyasn1", "pyobjc-core", "pyobjc-framework-CFNetwork", "pyobjc-framework-Cocoa", "pyopenssl (>=16.0.0)", "pyserial (>=3.0)", "pywin32 (!=226)", "service-identity (>=18.1.0)"]
|
||||
mypy = ["PyHamcrest (>=1.9.0)", "PyNaCl", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "contextvars (>=2.4,<3)", "coverage (>=6b1,<7)", "cryptography (>=2.6)", "cython-test-exception-raiser (>=1.0.2,<2)", "h2 (>=3.0,<5.0)", "idna (>=2.4)", "mypy (==0.930)", "mypy-zope (==0.3.4)", "priority (>=1.1.0,<2.0)", "pyasn1", "pydoctor (>=21.9.0,<21.10.0)", "pyflakes (>=2.2,<3.0)", "pyopenssl (>=16.0.0)", "pyserial (>=3.0)", "python-subunit (>=1.4,<2.0)", "pywin32 (!=226)", "readthedocs-sphinx-ext (>=2.1,<3.0)", "service-identity (>=18.1.0)", "sphinx (>=4.1.2,<6)", "sphinx-rtd-theme (>=0.5,<1.0)", "towncrier (>=19.2,<20.0)", "twistedchecker (>=0.7,<1.0)", "types-pyOpenSSL", "types-setuptools"]
|
||||
osx-platform = ["PyHamcrest (>=1.9.0)", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "contextvars (>=2.4,<3)", "cryptography (>=2.6)", "cython-test-exception-raiser (>=1.0.2,<2)", "h2 (>=3.0,<5.0)", "idna (>=2.4)", "priority (>=1.1.0,<2.0)", "pyasn1", "pyobjc-core", "pyobjc-framework-CFNetwork", "pyobjc-framework-Cocoa", "pyopenssl (>=16.0.0)", "pyserial (>=3.0)", "pywin32 (!=226)", "service-identity (>=18.1.0)"]
|
||||
serial = ["pyserial (>=3.0)", "pywin32 (!=226)"]
|
||||
test = ["cython-test-exception-raiser (>=1.0.2,<2)", "PyHamcrest (>=1.9.0)"]
|
||||
tls = ["pyopenssl (>=16.0.0)", "service-identity (>=18.1.0)", "idna (>=2.4)"]
|
||||
windows_platform = ["pywin32 (!=226)", "cython-test-exception-raiser (>=1.0.2,<2)", "PyHamcrest (>=1.9.0)", "pyopenssl (>=16.0.0)", "service-identity (>=18.1.0)", "idna (>=2.4)", "pyasn1", "cryptography (>=2.6)", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "pyserial (>=3.0)", "h2 (>=3.0,<5.0)", "priority (>=1.1.0,<2.0)", "pywin32 (!=226)", "contextvars (>=2.4,<3)"]
|
||||
test = ["PyHamcrest (>=1.9.0)", "cython-test-exception-raiser (>=1.0.2,<2)"]
|
||||
tls = ["idna (>=2.4)", "pyopenssl (>=16.0.0)", "service-identity (>=18.1.0)"]
|
||||
windows-platform = ["PyHamcrest (>=1.9.0)", "appdirs (>=1.4.0)", "bcrypt (>=3.0.0)", "contextvars (>=2.4,<3)", "cryptography (>=2.6)", "cython-test-exception-raiser (>=1.0.2,<2)", "h2 (>=3.0,<5.0)", "idna (>=2.4)", "priority (>=1.1.0,<2.0)", "pyasn1", "pyopenssl (>=16.0.0)", "pyserial (>=3.0)", "pywin32 (!=226)", "pywin32 (!=226)", "service-identity (>=18.1.0)"]
|
||||
|
||||
[[package]]
|
||||
name = "twisted-iocpsupport"
|
||||
@ -793,7 +807,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
|
||||
|
||||
[package.extras]
|
||||
brotli = ["brotlipy (>=0.6.0)"]
|
||||
secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
|
||||
secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "pyOpenSSL (>=0.14)"]
|
||||
socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
|
||||
|
||||
[[package]]
|
||||
@ -805,8 +819,8 @@ optional = false
|
||||
python-versions = ">=3.7"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "jaraco.packaging (>=8.2)", "rst.linker (>=1.9)"]
|
||||
testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-cov", "pytest-enabler (>=1.0.1)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"]
|
||||
docs = ["jaraco.packaging (>=8.2)", "rst.linker (>=1.9)", "sphinx"]
|
||||
testing = ["func-timeout", "jaraco.itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.0.1)", "pytest-flake8", "pytest-mypy"]
|
||||
|
||||
[[package]]
|
||||
name = "zope.event"
|
||||
@ -816,8 +830,11 @@ category = "dev"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[package.dependencies]
|
||||
setuptools = "*"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx"]
|
||||
docs = ["Sphinx"]
|
||||
test = ["zope.testrunner"]
|
||||
|
||||
[[package]]
|
||||
@ -828,8 +845,11 @@ category = "main"
|
||||
optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[package.dependencies]
|
||||
setuptools = "*"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "repoze.sphinx.autointerface"]
|
||||
docs = ["Sphinx", "repoze.sphinx.autointerface"]
|
||||
test = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
|
||||
testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"]
|
||||
|
||||
@ -842,11 +862,12 @@ optional = false
|
||||
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
|
||||
[package.dependencies]
|
||||
setuptools = "*"
|
||||
"zope.event" = "*"
|
||||
"zope.interface" = ">=5.0.0"
|
||||
|
||||
[package.extras]
|
||||
docs = ["sphinx", "repoze.sphinx.autointerface"]
|
||||
docs = ["Sphinx", "repoze.sphinx.autointerface"]
|
||||
test = ["zope.i18nmessageid", "zope.testing", "zope.testrunner"]
|
||||
|
||||
[extras]
|
||||
@ -856,7 +877,7 @@ sentry = ["sentry-sdk"]
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.7"
|
||||
content-hash = "e33328ef874fd6ee5bec45d3c95fb52ca0b3194f9e19e1096359bb010441f98d"
|
||||
content-hash = "35d5adeaa066b74277945ef10c8b27b0b1e34021c64c1662dfc1536f0d10677e"
|
||||
|
||||
[metadata.files]
|
||||
appdirs = [
|
||||
@ -1099,7 +1120,7 @@ matrix-common = [
|
||||
{file = "matrix_common-1.1.0-py3-none-any.whl", hash = "sha256:5d6dfd777503b2f3a031b566e6af25b6e95f9c0818ef57d954c3190fce5eb407"},
|
||||
{file = "matrix_common-1.1.0.tar.gz", hash = "sha256:a8238748afc2b37079818367fed5156f355771b07c8ff0a175934f47e0ff3276"},
|
||||
]
|
||||
matrix_is_tester = []
|
||||
matrix-is-tester = []
|
||||
mccabe = [
|
||||
{file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"},
|
||||
{file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"},
|
||||
@ -1151,8 +1172,8 @@ phonenumbers = [
|
||||
{file = "phonenumbers-8.12.41.tar.gz", hash = "sha256:f477da623a51cba084567d6a67b1882a8aaaf3e7beadad655f8613a8f887ac62"},
|
||||
]
|
||||
prometheus-client = [
|
||||
{file = "prometheus_client-0.13.1-py3-none-any.whl", hash = "sha256:357a447fd2359b0a1d2e9b311a0c5778c330cfbe186d880ad5a6b39884652316"},
|
||||
{file = "prometheus_client-0.13.1.tar.gz", hash = "sha256:ada41b891b79fca5638bd5cfe149efa86512eaa55987893becd2c6d8d0a5dfc5"},
|
||||
{file = "prometheus_client-0.15.0-py3-none-any.whl", hash = "sha256:db7c05cbd13a0f79975592d112320f2605a325969b270a94b71dcabc47b931d2"},
|
||||
{file = "prometheus_client-0.15.0.tar.gz", hash = "sha256:be26aa452490cfcf6da953f9436e95a9f2b4d578ca80094b4458930e5f584ab1"},
|
||||
]
|
||||
pyasn1 = [
|
||||
{file = "pyasn1-0.4.8-py2.4.egg", hash = "sha256:fec3e9d8e36808a28efb59b489e4528c10ad0f480e57dcc32b4de5c9d8c9fdf3"},
|
||||
@ -1335,6 +1356,10 @@ service-identity = [
|
||||
{file = "service-identity-21.1.0.tar.gz", hash = "sha256:6e6c6086ca271dc11b033d17c3a8bea9f24ebff920c587da090afc9519419d34"},
|
||||
{file = "service_identity-21.1.0-py2.py3-none-any.whl", hash = "sha256:f0b0caac3d40627c3c04d7a51b6e06721857a0e10a8775f2d1d7e72901b3a7db"},
|
||||
]
|
||||
setuptools = [
|
||||
{file = "setuptools-65.5.1-py3-none-any.whl", hash = "sha256:d0b9a8433464d5800cbe05094acf5c6d52a91bfac9b52bcfc4d41382be5d5d31"},
|
||||
{file = "setuptools-65.5.1.tar.gz", hash = "sha256:e197a19aa8ec9722928f2206f8de752def0e4c9fc6953527360d1c36d94ddb2f"},
|
||||
]
|
||||
signedjson = [
|
||||
{file = "signedjson-1.1.1.tar.gz", hash = "sha256:350586e7570ba208f7729dcda09d43f554ead0207a15e3e3695533ef3f720009"},
|
||||
]
|
||||
|
@ -62,7 +62,6 @@ mypy_path = "stubs"
|
||||
module = [
|
||||
"idna",
|
||||
"netaddr",
|
||||
"prometheus_client",
|
||||
"signedjson.*",
|
||||
"sortedcontainers",
|
||||
]
|
||||
@ -101,7 +100,7 @@ netaddr = ">=0.7.0"
|
||||
matrix-common = "^1.1.0"
|
||||
phonenumbers = ">=8.12.32"
|
||||
# prometheus-client's lower bound is copied from Synapse.
|
||||
prometheus-client = { version = ">=0.4.0", optional = true }
|
||||
prometheus-client = ">=0.4.0"
|
||||
pynacl = ">=1.2.1"
|
||||
pyOpenSSL = ">=16.0.0"
|
||||
pyyaml = ">=3.11"
|
||||
|
@ -1,5 +1,6 @@
|
||||
from typing import ClassVar
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from twisted.web.server import Request
|
||||
from zope.interface import Interface, implementer
|
||||
|
||||
class IResource(Interface):
|
||||
@ -11,3 +12,4 @@ class IResource(Interface):
|
||||
class Resource:
|
||||
isLeaf: ClassVar[bool]
|
||||
def putChild(self, path: bytes, child: IResource) -> None: ...
|
||||
def render(self, request: Request) -> Any: ...
|
||||
|
@ -18,6 +18,7 @@ import json
|
||||
import logging
|
||||
from typing import Any, Awaitable, Callable, Dict, Iterable, TypeVar
|
||||
|
||||
from prometheus_client import Counter
|
||||
from twisted.internet import defer
|
||||
from twisted.web import server
|
||||
from twisted.web.resource import Resource
|
||||
@ -29,6 +30,25 @@ from sydent.util import json_decoder
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
request_counter = Counter(
|
||||
"sydent_http_received_requests",
|
||||
"Received requests",
|
||||
labelnames=("servlet", "method"),
|
||||
)
|
||||
|
||||
|
||||
class SydentResource(Resource):
|
||||
"""A subclass of resource that tracks request metrics"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self._name = self.__class__.__name__
|
||||
super().__init__()
|
||||
|
||||
def render(self, request: Request) -> Any:
|
||||
request_counter.labels(self._name, request.method).inc()
|
||||
return super().render(request)
|
||||
|
||||
|
||||
class MatrixRestError(Exception):
|
||||
"""
|
||||
Handled by the jsonwrap wrapper. Any servlets that don't use this
|
||||
|
@ -14,22 +14,21 @@
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.http.auth import authV2
|
||||
from sydent.http.servlets import jsonwrap, send_cors
|
||||
from sydent.http.servlets import SydentResource, jsonwrap, send_cors
|
||||
from sydent.types import JsonDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sydent.sydent import Sydent
|
||||
|
||||
|
||||
class AccountServlet(Resource):
|
||||
class AccountServlet(SydentResource):
|
||||
isLeaf = False
|
||||
|
||||
def __init__(self, syd: "Sydent") -> None:
|
||||
Resource.__init__(self)
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
|
||||
@jsonwrap
|
||||
|
@ -14,24 +14,23 @@
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.http.servlets import get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import SydentResource, get_args, jsonwrap, send_cors
|
||||
from sydent.types import JsonDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sydent.sydent import Sydent
|
||||
|
||||
|
||||
class AuthenticatedBindThreePidServlet(Resource):
|
||||
class AuthenticatedBindThreePidServlet(SydentResource):
|
||||
"""A servlet which allows a caller to bind any 3pid they want to an mxid
|
||||
|
||||
It is assumed that authentication happens out of band
|
||||
"""
|
||||
|
||||
def __init__(self, sydent: "Sydent") -> None:
|
||||
Resource.__init__(self)
|
||||
super().__init__()
|
||||
self.sydent = sydent
|
||||
|
||||
@jsonwrap
|
||||
|
@ -14,24 +14,23 @@
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.http.servlets import get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import SydentResource, get_args, jsonwrap, send_cors
|
||||
from sydent.types import JsonDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sydent.sydent import Sydent
|
||||
|
||||
|
||||
class AuthenticatedUnbindThreePidServlet(Resource):
|
||||
class AuthenticatedUnbindThreePidServlet(SydentResource):
|
||||
"""A servlet which allows a caller to unbind any 3pid they want from an mxid
|
||||
|
||||
It is assumed that authentication happens out of band
|
||||
"""
|
||||
|
||||
def __init__(self, sydent: "Sydent") -> None:
|
||||
Resource.__init__(self)
|
||||
super().__init__()
|
||||
self.sydent = sydent
|
||||
|
||||
@jsonwrap
|
||||
|
@ -17,12 +17,17 @@ from typing import TYPE_CHECKING
|
||||
|
||||
import signedjson.key
|
||||
import signedjson.sign
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.db.invite_tokens import JoinTokenStore
|
||||
from sydent.http.auth import authV2
|
||||
from sydent.http.servlets import MatrixRestError, get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import (
|
||||
MatrixRestError,
|
||||
SydentResource,
|
||||
get_args,
|
||||
jsonwrap,
|
||||
send_cors,
|
||||
)
|
||||
from sydent.types import JsonDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -31,10 +36,11 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BlindlySignStuffServlet(Resource):
|
||||
class BlindlySignStuffServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent", require_auth: bool = False) -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
self.server_name = syd.config.general.server_name
|
||||
self.tokenStore = JoinTokenStore(syd)
|
||||
|
@ -15,11 +15,16 @@
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.db.threepid_associations import GlobalAssociationStore
|
||||
from sydent.http.servlets import MatrixRestError, get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import (
|
||||
MatrixRestError,
|
||||
SydentResource,
|
||||
get_args,
|
||||
jsonwrap,
|
||||
send_cors,
|
||||
)
|
||||
from sydent.types import JsonDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -28,10 +33,11 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class BulkLookupServlet(Resource):
|
||||
class BulkLookupServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent") -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
|
||||
@jsonwrap
|
||||
|
@ -14,11 +14,10 @@
|
||||
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.http.auth import authV2
|
||||
from sydent.http.servlets import get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import SydentResource, get_args, jsonwrap, send_cors
|
||||
from sydent.types import JsonDict
|
||||
from sydent.util.emailutils import EmailAddressException, EmailSendException
|
||||
from sydent.util.stringutils import MAX_EMAIL_ADDRESS_LENGTH, is_valid_client_secret
|
||||
@ -33,10 +32,11 @@ if TYPE_CHECKING:
|
||||
from sydent.sydent import Sydent
|
||||
|
||||
|
||||
class EmailRequestCodeServlet(Resource):
|
||||
class EmailRequestCodeServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent", require_auth: bool = False) -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
self.require_auth = require_auth
|
||||
|
||||
@ -122,10 +122,11 @@ class EmailRequestCodeServlet(Resource):
|
||||
return b""
|
||||
|
||||
|
||||
class EmailValidateCodeServlet(Resource):
|
||||
class EmailValidateCodeServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent", require_auth: bool = False) -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
self.require_auth = require_auth
|
||||
|
||||
|
@ -14,12 +14,11 @@
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.db.valsession import ThreePidValSessionStore
|
||||
from sydent.http.auth import authV2
|
||||
from sydent.http.servlets import get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import SydentResource, get_args, jsonwrap, send_cors
|
||||
from sydent.types import JsonDict
|
||||
from sydent.util.stringutils import is_valid_client_secret
|
||||
from sydent.validators import (
|
||||
@ -33,10 +32,11 @@ if TYPE_CHECKING:
|
||||
from sydent.sydent import Sydent
|
||||
|
||||
|
||||
class GetValidated3pidServlet(Resource):
|
||||
class GetValidated3pidServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent", require_auth: bool = False) -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
self.require_auth = require_auth
|
||||
|
||||
|
@ -15,11 +15,10 @@
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.http.auth import authV2
|
||||
from sydent.http.servlets import jsonwrap, send_cors
|
||||
from sydent.http.servlets import SydentResource, jsonwrap, send_cors
|
||||
from sydent.types import JsonDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -28,11 +27,12 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class HashDetailsServlet(Resource):
|
||||
class HashDetailsServlet(SydentResource):
|
||||
isLeaf = True
|
||||
known_algorithms = ["sha256", "none"]
|
||||
|
||||
def __init__(self, syd: "Sydent", lookup_pepper: str) -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
self.lookup_pepper = lookup_pepper
|
||||
|
||||
|
@ -15,12 +15,11 @@
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.db.accounts import AccountStore
|
||||
from sydent.http.auth import authV2, tokenFromRequest
|
||||
from sydent.http.servlets import MatrixRestError, jsonwrap, send_cors
|
||||
from sydent.http.servlets import MatrixRestError, SydentResource, jsonwrap, send_cors
|
||||
from sydent.types import JsonDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -29,10 +28,11 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LogoutServlet(Resource):
|
||||
class LogoutServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent") -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
|
||||
@jsonwrap
|
||||
|
@ -17,11 +17,10 @@ import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import signedjson.sign
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.db.threepid_associations import GlobalAssociationStore
|
||||
from sydent.http.servlets import get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import SydentResource, get_args, jsonwrap, send_cors
|
||||
from sydent.types import JsonDict
|
||||
from sydent.util import json_decoder
|
||||
|
||||
@ -31,10 +30,11 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LookupServlet(Resource):
|
||||
class LookupServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent") -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
|
||||
@jsonwrap
|
||||
|
@ -15,12 +15,11 @@
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.db.threepid_associations import GlobalAssociationStore
|
||||
from sydent.http.auth import authV2
|
||||
from sydent.http.servlets import get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import SydentResource, get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets.hashdetailsservlet import HashDetailsServlet
|
||||
from sydent.types import JsonDict
|
||||
|
||||
@ -30,10 +29,11 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class LookupV2Servlet(Resource):
|
||||
class LookupV2Servlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent", lookup_pepper: str) -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
self.globalAssociationStore = GlobalAssociationStore(self.sydent)
|
||||
self.lookup_pepper = lookup_pepper
|
||||
|
@ -17,11 +17,16 @@ import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import phonenumbers
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.http.auth import authV2
|
||||
from sydent.http.servlets import asyncjsonwrap, get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import (
|
||||
SydentResource,
|
||||
asyncjsonwrap,
|
||||
get_args,
|
||||
jsonwrap,
|
||||
send_cors,
|
||||
)
|
||||
from sydent.types import JsonDict
|
||||
from sydent.util.ratelimiter import LimitExceededException, Ratelimiter
|
||||
from sydent.util.stringutils import is_valid_client_secret
|
||||
@ -39,10 +44,11 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class MsisdnRequestCodeServlet(Resource):
|
||||
class MsisdnRequestCodeServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent", require_auth: bool = False) -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
self.require_auth = require_auth
|
||||
self._msisdn_ratelimiter = Ratelimiter[str](
|
||||
@ -161,10 +167,11 @@ class MsisdnRequestCodeServlet(Resource):
|
||||
return b""
|
||||
|
||||
|
||||
class MsisdnValidateCodeServlet(Resource):
|
||||
class MsisdnValidateCodeServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent", require_auth: bool = False) -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
self.require_auth = require_auth
|
||||
|
||||
|
@ -14,22 +14,22 @@
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
from unpaddedbase64 import encode_base64
|
||||
|
||||
from sydent.db.invite_tokens import JoinTokenStore
|
||||
from sydent.http.servlets import get_args, jsonwrap
|
||||
from sydent.http.servlets import SydentResource, get_args, jsonwrap
|
||||
from sydent.types import JsonDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sydent.sydent import Sydent
|
||||
|
||||
|
||||
class Ed25519Servlet(Resource):
|
||||
class Ed25519Servlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent") -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
|
||||
@jsonwrap
|
||||
@ -40,10 +40,11 @@ class Ed25519Servlet(Resource):
|
||||
return {"public_key": pubKeyBase64}
|
||||
|
||||
|
||||
class PubkeyIsValidServlet(Resource):
|
||||
class PubkeyIsValidServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent") -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
|
||||
@jsonwrap
|
||||
@ -56,10 +57,11 @@ class PubkeyIsValidServlet(Resource):
|
||||
return {"valid": args["public_key"] == pubKeyBase64}
|
||||
|
||||
|
||||
class EphemeralPubkeyIsValidServlet(Resource):
|
||||
class EphemeralPubkeyIsValidServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent") -> None:
|
||||
super().__init__()
|
||||
self.joinTokenStore = JoinTokenStore(syd)
|
||||
|
||||
@jsonwrap
|
||||
|
@ -20,11 +20,10 @@ from typing import TYPE_CHECKING, Dict
|
||||
|
||||
from twisted.internet.error import ConnectError, DNSLookupError
|
||||
from twisted.web.client import ResponseFailed
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.http.httpclient import FederationHttpClient
|
||||
from sydent.http.servlets import asyncjsonwrap, get_args, send_cors
|
||||
from sydent.http.servlets import SydentResource, asyncjsonwrap, get_args, send_cors
|
||||
from sydent.types import JsonDict
|
||||
from sydent.users.tokens import issueToken
|
||||
from sydent.util.stringutils import is_valid_matrix_server_name
|
||||
@ -35,10 +34,11 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class RegisterServlet(Resource):
|
||||
class RegisterServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent") -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
self.client = FederationHttpClient(self.sydent)
|
||||
|
||||
|
@ -19,13 +19,12 @@ from typing import TYPE_CHECKING, List, cast
|
||||
import twisted.python.log
|
||||
from OpenSSL.crypto import X509
|
||||
from twisted.internet.interfaces import ISSLTransport
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.db.hashing_metadata import HashingMetadataStore
|
||||
from sydent.db.peers import PeerStore
|
||||
from sydent.db.threepid_associations import GlobalAssociationStore, SignedAssociations
|
||||
from sydent.http.servlets import MatrixRestError, jsonwrap
|
||||
from sydent.http.servlets import MatrixRestError, SydentResource, jsonwrap
|
||||
from sydent.threepid import threePidAssocFromDict
|
||||
from sydent.types import JsonDict
|
||||
from sydent.util import json_decoder
|
||||
@ -38,8 +37,9 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ReplicationPushServlet(Resource):
|
||||
class ReplicationPushServlet(SydentResource):
|
||||
def __init__(self, sydent: "Sydent") -> None:
|
||||
super().__init__()
|
||||
self.sydent = sydent
|
||||
self.hashing_store = HashingMetadataStore(sydent)
|
||||
|
||||
|
@ -20,14 +20,19 @@ from http import HTTPStatus
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import nacl.signing
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
from unpaddedbase64 import encode_base64
|
||||
|
||||
from sydent.db.invite_tokens import JoinTokenStore
|
||||
from sydent.db.threepid_associations import GlobalAssociationStore
|
||||
from sydent.http.auth import authV2
|
||||
from sydent.http.servlets import MatrixRestError, get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import (
|
||||
MatrixRestError,
|
||||
SydentResource,
|
||||
get_args,
|
||||
jsonwrap,
|
||||
send_cors,
|
||||
)
|
||||
from sydent.types import JsonDict
|
||||
from sydent.util.emailutils import EmailAddressException, sendEmail
|
||||
from sydent.util.stringutils import MAX_EMAIL_ADDRESS_LENGTH, normalise_address
|
||||
@ -38,8 +43,9 @@ if TYPE_CHECKING:
|
||||
from sydent.sydent import Sydent
|
||||
|
||||
|
||||
class StoreInviteServlet(Resource):
|
||||
class StoreInviteServlet(SydentResource):
|
||||
def __init__(self, syd: "Sydent", require_auth: bool = False) -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
self.random = random.SystemRandom()
|
||||
self.require_auth = require_auth
|
||||
|
@ -15,13 +15,18 @@
|
||||
import logging
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.db.accounts import AccountStore
|
||||
from sydent.db.terms import TermsStore
|
||||
from sydent.http.auth import authV2
|
||||
from sydent.http.servlets import MatrixRestError, get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import (
|
||||
MatrixRestError,
|
||||
SydentResource,
|
||||
get_args,
|
||||
jsonwrap,
|
||||
send_cors,
|
||||
)
|
||||
from sydent.terms.terms import get_terms
|
||||
from sydent.types import JsonDict
|
||||
|
||||
@ -31,10 +36,11 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TermsServlet(Resource):
|
||||
class TermsServlet(SydentResource):
|
||||
isLeaf = True
|
||||
|
||||
def __init__(self, syd: "Sydent") -> None:
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
|
||||
@jsonwrap
|
||||
|
@ -15,12 +15,17 @@
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.db.valsession import ThreePidValSessionStore
|
||||
from sydent.http.auth import authV2
|
||||
from sydent.http.servlets import MatrixRestError, get_args, jsonwrap, send_cors
|
||||
from sydent.http.servlets import (
|
||||
MatrixRestError,
|
||||
SydentResource,
|
||||
get_args,
|
||||
jsonwrap,
|
||||
send_cors,
|
||||
)
|
||||
from sydent.types import JsonDict
|
||||
from sydent.util.stringutils import is_valid_client_secret
|
||||
from sydent.validators import (
|
||||
@ -34,8 +39,9 @@ if TYPE_CHECKING:
|
||||
from sydent.sydent import Sydent
|
||||
|
||||
|
||||
class ThreePidBindServlet(Resource):
|
||||
class ThreePidBindServlet(SydentResource):
|
||||
def __init__(self, sydent: "Sydent", require_auth: bool = False) -> None:
|
||||
super().__init__()
|
||||
self.sydent = sydent
|
||||
self.require_auth = require_auth
|
||||
|
||||
|
@ -22,12 +22,11 @@ from twisted.internet import defer
|
||||
from twisted.internet.error import ConnectError, DNSLookupError
|
||||
from twisted.web import server
|
||||
from twisted.web.client import ResponseFailed
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.db.valsession import ThreePidValSessionStore
|
||||
from sydent.hs_federation.verifier import InvalidServerName, NoAuthenticationError
|
||||
from sydent.http.servlets import dict_to_json_bytes
|
||||
from sydent.http.servlets import SydentResource, dict_to_json_bytes
|
||||
from sydent.types import JsonDict
|
||||
from sydent.util import json_decoder
|
||||
from sydent.util.stringutils import is_valid_client_secret
|
||||
@ -43,8 +42,9 @@ if TYPE_CHECKING:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ThreePidUnbindServlet(Resource):
|
||||
class ThreePidUnbindServlet(SydentResource):
|
||||
def __init__(self, sydent: "Sydent") -> None:
|
||||
super().__init__()
|
||||
self.sydent = sydent
|
||||
|
||||
def render_POST(
|
||||
|
@ -15,21 +15,20 @@
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.http.servlets import jsonwrap, send_cors
|
||||
from sydent.http.servlets import SydentResource, jsonwrap, send_cors
|
||||
from sydent.types import JsonDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sydent.sydent import Sydent
|
||||
|
||||
|
||||
class V1Servlet(Resource):
|
||||
class V1Servlet(SydentResource):
|
||||
isLeaf = False
|
||||
|
||||
def __init__(self, syd: "Sydent") -> None:
|
||||
Resource.__init__(self)
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
|
||||
@jsonwrap
|
||||
|
@ -14,21 +14,20 @@
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.web.resource import Resource
|
||||
from twisted.web.server import Request
|
||||
|
||||
from sydent.http.servlets import jsonwrap, send_cors
|
||||
from sydent.http.servlets import SydentResource, jsonwrap, send_cors
|
||||
from sydent.types import JsonDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sydent.sydent import Sydent
|
||||
|
||||
|
||||
class V2Servlet(Resource):
|
||||
class V2Servlet(SydentResource):
|
||||
isLeaf = False
|
||||
|
||||
def __init__(self, syd: "Sydent") -> None:
|
||||
Resource.__init__(self)
|
||||
super().__init__()
|
||||
self.sydent = syd
|
||||
|
||||
@jsonwrap
|
||||
|
@ -22,6 +22,7 @@ import sqlite3
|
||||
from typing import Optional
|
||||
|
||||
import attr
|
||||
import prometheus_client
|
||||
import twisted.internet.reactor
|
||||
from matrix_common.versionstring import get_distribution_version_string
|
||||
from signedjson.types import SigningKey
|
||||
@ -203,8 +204,8 @@ class Sydent:
|
||||
|
||||
def maybe_start_prometheus_server(self) -> None:
|
||||
if self.config.general.prometheus_enabled:
|
||||
import prometheus_client
|
||||
|
||||
assert self.config.general.prometheus_addr is not None
|
||||
assert self.config.general.prometheus_port is not None
|
||||
prometheus_client.start_http_server(
|
||||
port=self.config.general.prometheus_port,
|
||||
addr=self.config.general.prometheus_addr,
|
||||
|
@ -22,6 +22,7 @@ from html import escape
|
||||
from typing import TYPE_CHECKING, Dict
|
||||
|
||||
import twisted.python.log
|
||||
from prometheus_client import Counter
|
||||
|
||||
from sydent.util import time_msec
|
||||
from sydent.util.tokenutils import generateAlphanumericTokenOfLength
|
||||
@ -31,6 +32,8 @@ if TYPE_CHECKING:
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
email_counter = Counter("sydent_emails_sent", "Number of emails we attempted to send")
|
||||
|
||||
|
||||
def sendEmail(
|
||||
sydent: "Sydent",
|
||||
@ -113,6 +116,8 @@ def sendEmail(
|
||||
if mailUsername != "":
|
||||
smtp.login(mailUsername, mailPassword)
|
||||
|
||||
email_counter.inc()
|
||||
|
||||
# We're using the parsing above to do basic validation, but instead of
|
||||
# failing it may munge the address it returns. So we should *not* use
|
||||
# that parsed address, as it may not match any validation done
|
||||
|
Loading…
x
Reference in New Issue
Block a user