Over the years, running PC/Geos has become more and more tricky, especially since running 16-bit DOS applications on Windows has first experienced increasing compatibility problems and then disappeared completely. Emulators such as dosbox have come to the rescue to some extent, but also required extra effort for setting up the emulator, configuring the environment, mounting the right directories etc.
Therefore, the idea of this live demo was simple: allow users to experience the PC/Geos operating system built by the #FreeGEOS project in a browser, without having to install anything locally. It turned outline that the js-dos project offers and easy to use "player" for DOS applications on top of a WebAssembly port of dosbox. Using the DOS.Zone Studio packager produces a running version of PC/Geos practically out-of-the-box.
Ideally, this live demo would be directly linked to the CI relases of the github project. This way, it would be possible to make a change to the code of PC/Geos, wait for the CI build to run, and then to immediately see the effect in a browser. There are probably few other operating systems for which such a workflow exists.
However, this turned out to be a bit trickier because of the CORS (Cross-Origin Resource Sharing) restrictions of modern browsers that would prevent a page hosted on a different domain from accessing the release downloads. Additionally, it was necessary to add the required configuration files (dosbox.conf, jsdos.json) to the zip package.
Ultimately, a bit of server-side PHP did the trick (most of config files left out for brevity):
<?php $base = "https://github.com/bluewaysw/pcgeos/releases/download/"; if($_GET["build"] == "german") { $url = $base . "CI-latest/pcgeos-ensemble_german.zip"; } else { $url = $base . "CI-latest/pcgeos-ensemble_nc.zip"; } // ------------------------------------ $dosbox_conf = <<<END [sdl] autolock=false fullscreen=false : : [ipx] ipx=true [autoexec] echo off mount c . c: echo on ensemble\loader.exe END; // ------------------------------------ $jsdos_json = <<<END { "output": { "name": "sdl", : : } } END; // ------------------------------------ $data = file_get_contents($url); $tmpHandle = tmpfile(); $tmpFilename = stream_get_meta_data($tmpHandle)['uri']; file_put_contents($tmpFilename, $data); $zip = new ZipArchive(); $zip->open($tmpFilename); $zip->addFromString(".jsdos/dosbox.conf", $dosbox_conf); $zip->addFromString(".jsdos/jsdos.json", $jsdos_json); $zip->close(); $size = filesize($tmpFilename); header('Content-type: application/zip'); header("Content-length: $size"); header('Content-Disposition: attachment; filename="download.zip"'); readfile($tmpFilename); exit;?>
Of course, scalability of this is somewhat limited because it does not perform any server-side caching, meaning that each client request translates to a full server side fetch plus reassembly of the zip file. However, as long as PC/Geos stays as within its niche, this should be sufficient for now...