Add support of files from data/<plugin>/ to be fetched from Front-End (#761)

* Add support of files from `data/<plugin>/assets/` to be fetched from Front-End

* Add `data` regex folder into `csrf_middleware`
This commit is contained in:
ynhhoJ
2025-05-30 03:30:48 +03:00
committed by GitHub
parent 4e5468a353
commit e4f7546f99
2 changed files with 12 additions and 1 deletions
+2
View File
@@ -23,6 +23,7 @@ csrf_token = str(uuid.uuid4())
ssl_ctx = ssl.create_default_context(cafile=certifi.where())
assets_regex = re.compile("^/plugins/.*/assets/.*")
data_regex = re.compile("^/plugins/.*/data/.*")
dist_regex = re.compile("^/plugins/.*/dist/.*")
frontend_regex = re.compile("^/frontend/.*")
logger = getLogger("Main")
@@ -45,6 +46,7 @@ async def csrf_middleware(request: Request, handler: Handler):
str(request.rel_url.path) == "/fetch" or \
str(request.rel_url.path) == "/ws" or \
assets_regex.match(str(request.rel_url)) or \
data_regex.match(str(request.rel_url)) or \
dist_regex.match(str(request.rel_url)) or \
frontend_regex.match(str(request.rel_url)):