Closed Mjokfox closed 1 month ago
Whilst CORS in and of itself isn't a bad feature it probably shouldn't be added because something didn't work for you 😄. Can you explain what didn't work? Maybe I can help a bit.
Other than that, adding CORS is a good idea, I'll look into it. I would want it behind settings so that people can actually change the origins.
So I've made a plugin for Vencord that shows what I'm current listening as my discord status. And i am using this api to get that. So i do a basic get request to http://localhost:47836/current. This works just fine when i do it in a basic nodejs environment. But with the exact same code in the plugin, it returns 'TypeError: Failed to fetch', apparently this is a CORS problem. I've tried plenty of headers with no avail. I thought since i had issues with it, others may too.
Alright, don't know Vencord but it makes sense if you're doing it from another app that CORS might be implemented there.
I probably have time in the weekend to add the settings and release a new version 😄
It was my bad mate... the API is already restricted to localhost so no need for settings. I will merge your PR.
PS: I did remove package-lock from your PR 😄
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
No data about Duplication
Ive been trying to use the api, but couldnt get it working except in the browser for some reason. Adding cors to the api made it work on my end.