MEGA65 / open-roms

A project to create unencumbered open-source ROMs for use on selected retro computers
Other
263 stars 18 forks source link

CORS for pre-built ROM images #51

Closed mithrendal closed 4 years ago

mithrendal commented 4 years ago

currently the latest pre-built ROM images are pushed into the bin folder https://github.com/MEGA65/open-roms/tree/master/bin

while this is absolutely fine for manual downloads, it does not work for web apps to fetch them.

Why is this so ? The current bin folder where the prebuilt rom are in is unfortunately not CORS (Cross-Origin Resource Sharing) enabled, because github standard branches are not CORS enabled by default.

That prevents web apps like https://vc64web.github.io from updating its ROMS programmatically. For example with a button.

grafik

did you spot the blue "fetch and install open roms" button ? When pushed we would like to slurp in the latest Open-ROMS 🤤 like it was proposed in this issue MEGA65/open-roms#33 @gardners said

Would it help if we had some well-known URL with ROMs and
the checksums there, that could be slurped down by VC64 when someone clicks
the "get openroms" button?

For the time being we (@dirkwhoffmann and me) decided to just put a copy of the open-roms on our gh-pages space ... if that is ok for you? … So by clicking the button the user installs maybe older roms from our website instead the latest and hottest 😍😍from yours...

ok so ... how to enable CORS then ?

well in order to achieve „Cross-Origin Resource Sharing“ the roms have to be published to github pages… this is an internal built-in special branch-name on github.

You enable that branch by going into the settings of your repo and enable gh-pages ... see here an example ...

grafik

grafik

grafik

after you did that you will find that new special branch in your repo

grafik

the clue is that the content of the branch is published to a special github pages webserver which supports CORS

we tested … that when accessing from https the github gh-pages server approves a CORS fetch request with a access-control-allow-origin: * response… see also this thread https://github.com/vc64web/virtualc64web/issues/50 (search for CORS) for more details and the tests we did ...

... and thank you for creating these awesome ROMS 😀

BTW: vc64web (the little brother of vc64Mac) is a PWA (Progressive web app) that means you can save it to home screen on an iPad, iPhone or android device if you like and it works perfectly then like a real app even when offline because everything is stored locally (also the ROMs).

It is hosted here

https://vc64web.github.io

mithrendal commented 4 years ago

CORS has been enabled now 😎... see at the end of https://github.com/MEGA65/open-roms/issues/52