element-hq / matrix-content-scanner-python

A web service for scanning media hosted by a Matrix media repository
Apache License 2.0
13 stars 9 forks source link

Support CORS #42

Closed babolivier closed 1 year ago

babolivier commented 1 year ago

Add a simple aiohttp middleware that adds CORS headers to requests, and handle OPTIONS requests.

I've also fixed the case of _MEDIA_PATH_REGEXP (since it's a constant) while I was there.

Fixes #41

The list of headers is inspired from https://github.com/matrix-org/matrix-content-scanner/issues/28, except I've reduced the list of allowed methods to GET, POST, OPTIONS because we don't handle other ones.