mrdoob / glsl-sandbox

Shader editor and gallery.
https://glslsandbox.com/
MIT License
1.54k stars 260 forks source link

API Access #86

Closed magistermaks closed 10 months ago

magistermaks commented 11 months ago

I was creating a web app that allows a user to import a shader from an external source by pasting in a link i first implemented it for shadertoy links, no problems there. But the request to GLSL Sandbox is blocked and failes:

Screenshot from 2023-08-10 12-15-10

Could this maybe be changed so that external access is allowed?
Should be as simple as adding the Access-Control-Allow-Origin: * header.

mrdoob commented 10 months ago

/ping @jfontan

jfontan commented 10 months ago

I've updated /item endpoint to add that header. If you need this configuration in any other endpoint tell me and add it for others.

> GET /item/105400.0 HTTP/2
> Host: glslsandbox.com
> User-Agent: curl/8.2.1
> Accept: */*
> Origin: https://example.reqbin.com
>
< HTTP/2 200
< access-control-allow-origin: *
< content-type: application/json
< vary: Origin
< date: Fri, 18 Aug 2023 20:02:10 GMT
magistermaks commented 10 months ago

The /item one should suffice, thanks!