benno094 / pdf-anki

A GUI to automatically create and add Anki flashcards from a .pdf file using the OpenAI API
https://pdftoanki.xyz
27 stars 16 forks source link

How to ignore CORS in local mode? #3

Closed telekoteko closed 1 year ago

telekoteko commented 1 year ago

Access to fetch at 'http://localhost:8765/' from origin 'http://localhost:8501' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'http://localhost' that is not equal to the supplied origin. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

benno094 commented 1 year ago

From the readme:

"Add "https://pdf-anki-ddzhwhzfw5t.streamlit.app/" to "webCorsOriginList" under Tools -> Addons -> Config, then restart Anki."

But instead of adding "https://pdf-anki-ddzhwhzfw5t.streamlit.app/", add "http://localhost:8501" (without a slash) and restart Anki. Hmm, I wonder if the slash on the remote address is causing problems... 🤔 (edit: nvm, github added the slash when I copy-pasted -> readme is correct)

The next version (test branch) will cause Anki to prompt the user to add this automatically. I'm fighting with Streamlit to get this to work consistently, though.

Will modify the readme for the time being with the instructions for local, thanks!