Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read mode only #11

Open
ljfreelancer88 opened this issue Apr 10, 2023 · 3 comments
Open

Read mode only #11

ljfreelancer88 opened this issue Apr 10, 2023 · 3 comments

Comments

@ljfreelancer88
Copy link

Is it okay to have a read mode only? This read mode can only see related to player only. The use case is, say I want to forward the link (ex. https://gallegretti.github.io/escala/?piece=online-link-to-guitar-pro-or-xml.gp4) to the band.

Thank you in advance

@gallegretti
Copy link
Owner

I like the idea, but this is tricky because of CORS. If you grab a score from the internet, it mostly like won't work because of the Access-Control-Allow-Origin header that it returns when you try to GET it. So it's not a good idea to implement it this way because it won't work for most files and people won't understand why. A reverse proxy could solve it, but then it involves hosting and other costs.

@ljfreelancer88
Copy link
Author

How about parse and read the URL and get the host(domain) and pass it to the header to allow CORS?

...or if it still tricky. How about add "switch" for read mode only? (ex. https://gallegretti.github.io/escala/?mode=read) I guess, I'll have to send it manually the file to upload.

@gallegretti
Copy link
Owner

Unfortunately, the header Access-Control-Allow-Origin is controlled by the server in the response. Here's an example. First, I'm trying to load a score from the same origin (cifraclub.com.br). It works fine:

image

But if I try to do the same fetch request on another domain (gallegretti.github.io), it won't work:

image

The request could only work if the server was allowing cross-origin requests with the Access-Control-Allow-Origin header, or if the server was in the same origin. You can read more about it here. So yes, you'll need to send the file manually, and I don't think a read-only mode is very useful by itself, without this feature that you are proposing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants