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

Nextcloud for hosting #16

Open
pwab opened this issue May 11, 2020 · 8 comments
Open

Nextcloud for hosting #16

pwab opened this issue May 11, 2020 · 8 comments

Comments

@pwab
Copy link

pwab commented May 11, 2020

As Dropbox was stated here as a hosting provider I tried our Nextcloud implementation but wasn't successful.

Here is a test link: https://tuc.cloud/index.php/s/CC47jYYfR6skd6Z
And here is the direct download: https://tuc.cloud/index.php/s/CC47jYYfR6skd6Z/download

Something that can be done here?

@andre-dietrich
Copy link
Member

Hi, I tried out your download-link. The problem is the CORS policy of the webserver, which does not allow a foreign website to access its content. If you take a look into the dev-console

Access to fetch at 'https://tuc.cloud/index.php/s/xxxx.......' from origin 'https://liascript.github.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin

Dropbox does not have these restrictions, but Nextcloud, Google-drive, or Nextcloud. Thus, the Browser is actually blocking this request. Probably you could ask your admin to fix this, if you do not have access to the server config:

https://docs.nextcloud.com/server/stable/developer_manual/app/requests/api.html?highlight=cors

Another possibility would be to install some Browser extensions, as it is stated here:

https://stackoverflow.com/questions/28547288/no-access-control-allow-origin-header-is-present-on-the-requested-resource-err

But I do not like this, since it is not general enough.

I am still searching for services, that allow to host LiaScript courses, with working CORS policies ;)

Regards

@andre-dietrich andre-dietrich pinned this issue May 12, 2020
@andre-dietrich
Copy link
Member

I just tried cors-anywhere, but I am not shure, how this affect internal references to images and videos, etc. But, it seems to be possible to use the following URL to show your document:

https://cors-anywhere.herokuapp.com/https://tuc.cloud/index.php/s/CC47jYYfR6skd6Z/download

Thus, the entire URL will look like this:

https://liascript.github.io/course/?https://cors-anywhere.herokuapp.com/https://tuc.cloud/index.php/s/CC47jYYfR6skd6Z/download

@pwab
Copy link
Author

pwab commented May 13, 2020

Cors-anywhere seems to work quite good. I'm going to test this in the coming weeks.

@andre-dietrich
Copy link
Member

Cors-anywhere is not necessary anymore, I decided to put it in as a default. If loading does not succeed at first, any-cors is now used as a prefix in a second step ... but still experimental ;) ... I still need to figure out, how different websites/urls behave, when images, audio, video, css, javascript, etc. is loaded via any-cors. Thus, github is still the best option ...

@pwab
Copy link
Author

pwab commented Sep 15, 2021

I'm sorry for not responding earlier. I can now confirm that loading a course directly from nextcloud works for me. The following steps are needed:

  1. Upload a markdown file with liascript to your nextcloud instance
  2. Share the file to copy the link to your clipboard (and remove the expiration date if needed)
  3. Open the link and click on the three dots at the top right corner
  4. Copy the direct link to the file (which simply adds /download/FILENAME.md to your copied link)
  5. Open the link at https://liascript.github.io/

One thing to note is that some Nextcloud instances have the possiblity to create and edit markdown files. Those aren't formatted well because line-breaks are added after each line (wtf) and this leads to an error while reading the file in the liascript parser.

So all in all it works just fine for me (not tested with complex courses). Nextcloud could be added to the Hostinglist but I would vote for closing the wiki and moving this list to the official liascript-docs course. This issue can also be closed.

@andre-dietrich
Copy link
Member

@pwab Could you add this to the end of the docs in a special section, so that we can collect the required steps for other storage-systems/platforms as well.

Thanks a lot 😃

@pwab
Copy link
Author

pwab commented Sep 17, 2021

Sure I can do that. 👍
PR will follow next week.

@andre-dietrich
Copy link
Member

That would be great, I added an appendix section at the end of the document, so that we can collect more of such stuff ... I think an ordinary text without animations and text2speech is sufficient ...

Regards ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
LiaScript
  
ToDo 📋
Development

No branches or pull requests

3 participants