-
Notifications
You must be signed in to change notification settings - Fork 501
Conversation
- enable CORS for localhost calls - add Filter to allow API calls that can select Documents without any tag
This looks pretty good, and I'm stoked about a new frontend! Travis has pointed out that you need to use I have one other question though. As some of our users host Paperless on a domain other than localhost and/or a different port, can this be made a little more accommodating? I'm thinking maybe use what you've got as the default, and allow for using a different value by setting CORS_ORIGIN_REGEX_WHITELIST = (r'^(https?:\/\/)?localhost(:[0-9]{4})?$', ) |
Hey, thanks for a very quick response! I'm a little stumped about the I see your point about the Thanks! |
requirements.txt uses a format where you have to set one of Barring that, I can just do that right on master and accept the rest of your PR once we work out the |
- fix requirements.txt - change static CORS regex into configurable tuple list
Hi, I fixed the requirements by adding missing I also removed the regex and replaced it with less-powerful, but harder to mess up list. It should cover most of the common use cases like a subdomain, different ports etc. (edit) And a late fix for 80 characters. |
src/paperless/settings.py
Outdated
CORS_ORIGIN_WHITELIST = ("localhost:8080") | ||
_allowed_cors_hosts = os.getenv("PAPERLESS_CORS_ALLOWED_HOSTS") | ||
if _allowed_cors_hosts: | ||
CORS_ORIGIN_WHITELIST = tuple(_allowed_cors_hosts.split(",")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the 4 lines are the same as... :
CORS_ORIGIN_WHITELIST = os.getenv("PAPERLESS_CORS_ALLOWED_HOSTS", "localhost:8080").split(",")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the code pattern of ALLOWED_HOSTS as I didn't want to introduce a different style of writing. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like @sbrunner's suggestion, as it's more conscise. I see what you mean about the ALLOWED_HOSTS though. We can fix that later. For now, having this in one statement is better, so let's go with that.
Looks good! Thanks for your contribution! (and your flexibility :-)) Merging now. |
Thank you! I'll let you know when I think the Vue frontend is in a state worth sharing :) |
Hi,
I'm working on the new (minimalistic for now) frontend. As I don't want to change anything in the existing Django app (for now at least), I'm running it as a separate app that consumes the Django API.
To make it a replacement for current UI, I needed to do some tiny changes:
I don't foresee any issues with the above, but if you think it's not a good idea, let me know!