Package: matrix-content-scanner
Matrix Content ScannerA web service for scanning media hosted on a Matrix media repository.InstallationThis project requires libolm development headers, as well as libmagic to be installed on
the system. On Debian/Ubuntu:sudo apt install libolm-dev libmagic1Then, preferably in a virtual environment, install the Matrix Content Scanner:pip install matrix-content-scannerUsageCopy and edit thesample configuration file.
Each key is documented in this file.Then run the content scanner (from within your virtual environment if one was created):python -m matrix_content_scanner.mcs -c CONFIG_FILEWhereCONFIG_FILEis the path to your configuration file.DockerThis project provides a Docker image to run it, published asvectorim/matrix-content-scanner.To use it, copy thesample configuration fileinto a dedicated
directory, edit it accordingly with your requirements, and then mount this directory as/datain the image. Do not forget to also publish the port that the content scanner's
Web server is configured to listen on.For example, assuming the port for the Web server is8080:dockerrun-p8080:8080-v/path/to/your/config/directory:/datavectorim/matrix-content-scannerAPISeethe API documentationfor information about how clients are expected
to interact with the Matrix Content Scanner.Migrating from thelegacy Matrix Content ScannerBecause it uses the same APIs and Olm pickle format as the legacy Matrix Content Scanner,
this project can be used as a drop-in replacement. The only change (apart from the
deployment instructions) is the configuration format:theserversection is renamedwebscan.tempDirectoryis renamedscan.temp_directoryscan.baseUrlis renameddownload.base_homeserver_url(and becomes optional)scan.doNotCacheExitCodesis renamedresult_cache.exit_codes_to_ignorescan.directDownloadis removed. Direct download always happens whendownload.base_homeserver_urlis absent from the configuration file, and setting a value for it will always cause files to be
downloaded from the server configured.proxyis renameddownload.proxymiddleware.encryptedBody.pickleKeyis renamedcrypto.pickle_keymiddleware.encryptedBody.picklePathis renamedcrypto.pickle_pathacceptedMimeTypeis renamedscan.allowed_mimetypesrequestHeaderis renameddownload.additional_headersand turned into a dictionary.Note that the format of the cryptographic pickle file and key are compatible between
this project and the legacy Matrix Content Scanner. If no file exist at that path one will
be created automatically.DevelopmentIn a virtual environment with pip ≥ 21.1, runpipinstall-e.[dev]To run the unit tests, you can either use:tox-epyortrialtestsTo run the linters andmypytype checker, use./scripts-dev/lint.sh.ReleasingThe exact steps for releasing will vary; but this is an approach taken by the
Synapse developers (assuming a Unix-like shell):Set a shell variable to the version you are releasing (this just makes
subsequent steps easier):version=X.Y.ZUpdatesetup.cfgso that theversionis correct.Stage the changed files and commit.gitadd-u
gitcommit-mv$version-nPush your changes.gitpushWhen ready, create a signed tag for the release:gittag-sv$versionBase the tag message on the changelog.Push the tag.gitpushorigintagv$versionCreate arelease, based on the tag you just pushed, on GitHub or GitLab.Create a source distribution and upload it to PyPI:python-mbuild
twineuploaddist/matrix_content_scanner-$version*