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

Allow to supply a URL of a Fortran file to use #81

Open
certik opened this issue Apr 5, 2023 · 6 comments
Open

Allow to supply a URL of a Fortran file to use #81

certik opened this issue Apr 5, 2023 · 6 comments

Comments

@certik
Copy link
Contributor

certik commented Apr 5, 2023

It would work similarly to nbviewer: https://nbviewer.org/ where you can give it any GitHub Gist or GitHub URL of a notebook and it would render it. Here is an example of such a url: https://nbviewer.org/github/jrjohansson/qutip-lectures/blob/master/Lecture-1-Jaynes-Cumming-model.ipynb.

So we could allow something similar, say: https://dev.lfortran.org/github/jrjohansson/qutip-lectures/blob/master/Lecture-1-Jaynes-Cumming-model.f90.

It would load the file into the editor and allow you to compile it and run it.

Even later we can imagine just giving it a url of some github repository that contains fpm.toml file and it would be able to build the project.

@Shaikh-Ubaid
Copy link
Member

Fetching files using a static webpage seems tricky. I usually face CORS Cross Origin errors when trying to accomplish such tasks.

@Shaikh-Ubaid
Copy link
Member

I am hoping there would be a solution to this. Probably some API service which offers accessing files on other websites from a static page.

@certik
Copy link
Contributor Author

certik commented Apr 5, 2023

How do things like this work: https://star-history.com/#lfortran/lfortran&Date, it seems to access GitHub API, is it accessing it locally, or from a server? You are right that it might not be possible.

@Shaikh-Ubaid
Copy link
Member

Some sites/APIs allow Cross Origin Resource Sharing, while many (in my experience) do not allow. In the above case, it seems that the GitHub API is CORS Enabled (thus allowing data to be fetched from client browser, probably using some authorization token)

Also, on the same website https://star-history.com/#lfortran/lfortran&Date, I see an "Add Access Token" button which upon clicking shows:

Screenshot 2023-04-05 at 9 39 18 PM

@suhanigarg29
Copy link
Contributor

Fetching files using a static webpage seems tricky. I usually face CORS Cross Origin errors when trying to accomplish such tasks.

Will this problem persist if we use the GitHub Gist API to retrieve the content of a gist in raw format, and then pass the raw content to the editor for rendering?

@Shaikh-Ubaid
Copy link
Member

Will this problem persist if we use the GitHub Gist API to retrieve the content of a gist in raw format, and then pass the raw content to the editor for rendering?

I guess GitHub Gist API allows across domain requests (we may/might require to provide some authorization token).

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

3 participants