lfortran / lcompilers_frontend

The sources of the web LFortran GUI interface

Home Page:https://dev.lfortran.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow to supply a URL of a Fortran file to use

certik opened this issue · comments

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.

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

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.

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.

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

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?

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).