MRVDH / picnic-api

Unofficial and unaffiliated Node.js npm package as a wrapper for the API of the online supermarket Picnic.
MIT License
50 stars 7 forks source link

Source? [Browser support] #18

Closed solarkraft closed 2 months ago

solarkraft commented 2 months ago

Hey, thanks for publishing this project. I would like to make some changes (specifically to get browser support), but am unsure where, since the src-folder is almost empty and the lib folder appears to mostly contain compiled code (the commit messages seem to support this theory). Can you help me out here? Thanks!

solarkraft commented 2 months ago

Well that's dumb - Looks like I simply overlooked it! Oops, sorry (to be fair to myself, when asking for the definition vscode jumps into the lib folder ;-)!

MRVDH commented 2 months ago

Hi @solarkraft, I tried to get it to work in the browser myself before but ran into issues since you have to set the user agent headers to a specific value, which the browser usually doesn't allow or at least overwrite with something else, making Picnic block the requests. Let me know if do find a way, then we can implement that in this library as well 👍

solarkraft commented 2 months ago

I noticed that they seem to also block requests via CORS headers, so I'd at least need a server for proxying the requests - then I can also build one that does some more logic (it doesn't actually seem that easy to get an md5 hash in the browser, for instance) and transforms the data nicely.