61 lines
4.6 KiB
Markdown
61 lines
4.6 KiB
Markdown
A write-up on Atonix9x within Gopher.
|
|
9th of August, 2026
|
|
|
|
It turns out that you can port a port of a port! I have recently ported my PHP port of Atonix9x,
|
|
which is IRWIN user 'crystalclear'`s retro software hosting website. This has been one of the
|
|
most fun ports to write, so I will go into detail of how I managed to make it work, even with
|
|
the relatively limited scope of the GOPHER scheme.
|
|
|
|
The site starts off loading a PHP-enabled GOPHERMAP. These are supported by Motsognir, the
|
|
GOPHER server running on IRWIN. With PHP support, I am able to read files and process data
|
|
in the same fashion as a modern file-hosting site (eg, WinWorldPC) might. The first thing
|
|
the GOPHERMAP decides to do, is check whether you are requesting a file by UUID or not.
|
|
This is another feature exposed to the scripting language by Motsognir, via the
|
|
'$_SERVER['QUERY_STRING]' variable. It works similarly to a GET request in HTTP, where
|
|
a question mark acts as a modifier and allows you to send an arbitrary string from a
|
|
client to the HTTP server. If you end up not requesting anything, which is the default
|
|
behavior of all GOPHER clients, it will call to include the homepage of the GOPHER site.
|
|
The directory's root GOPHERMAP also controls the header, which allows me to modularly
|
|
control each part of the GOPHER site.
|
|
|
|
The Home Page
|
|
Once loaded, the homepage will load a JSON file that I essentially treat like a flat database.
|
|
As soon as this file is read and exposed as a Class via 'json_decode', I use a foreach on each Category.
|
|
That contains a switch, which allows me to create a mapping for 'pretty' and 'ugly' names for categories.
|
|
This fixes a limitation in how I wrote the data within the JSON file, in a very easy way. Once it
|
|
finishes generating the name mapping for the current Category, it writes each category's NiceName variable
|
|
from the JSON file, with an accompanied line which resembles an `<hr>` tag in HTML. After this, it performs
|
|
another foreach loop, this time upon each TileData entry as 'Entry'. I then nested a foreach loop,
|
|
which checks if the current Entry's category matches the current UglyName for the current Category the site
|
|
is parsing. If it does match, the site then writes out a new DIRECTORY (1) element, whose first section
|
|
contains the Title of the current Entry, and then uses yet another foreach loop to write out each Platform in
|
|
the JSON file's Platforms array for the current Entry. I then set the second section of the DIRECTORY element
|
|
as the UUID for the current Entry, prefixed with a question mark, so that when clicked it will reload the site.
|
|
When the DIRECTORY element is accessed, the root GOPHERMAP will call to include the download view for the site.
|
|
|
|
|
|
The Download Page
|
|
When the download page is loaded, it will check if '$_SERVER['QUERY_STRING']' is set, and if it is, loads the
|
|
same JSON file as the home page uses. It will then run a foreach loop on every Entry existent inside of it,
|
|
comparing the currently requested UUID with each Entry's UUID. Once it finds the UUID on an Entry, it then starts
|
|
to write out each element for the requested Entry. This includes metadata such as Tags, Platforms, and a Description.
|
|
When we get to writing out the Artifact array of the Entry, we encounter a dillema! I wrote the JSON file to
|
|
allow MultiPart downloads (eg, CDs or Floppy images), which complicates how this section is written out.
|
|
The script first checks if the Entry contains a MultiPart Artifact, or if it contains a singular file per Artifact.
|
|
|
|
If the Entry is flagged as being MultiPart, the site starts a PartCount, and a foreach loop operating on each
|
|
Artifact Part. It then gets the last chunk of the path provided by the URI key in the Entry via 'basename', and
|
|
writes out the Version, current PartCount, and the Platform the Artifact is for.
|
|
|
|
If the Entry is not flagged as being MultiPart, the site yet again gets the last chunk of the URI path via
|
|
'basename', it then checks if the Artifact contains a Version, if it doesn't, then this Entry only contains a
|
|
single version of this piece of software, and only prints the Platform that the Artifact is for. On the contrary,
|
|
if the Artifact DOES contain a Version, it proceeds to write out the Version and Platform of the current Artifact.
|
|
|
|
|
|
If you'd like to view the exact data being accessed by the site, you can do so by visiting the 'lzdb.json' file
|
|
at https://irwin.tunnull.xyz/~tunnull/aton9x/lzdb.json or gopher://irwin.tunnull.xyz/~tunnull/atonix9x/lzdb.json.
|
|
The file is linked, so each site receives the same software entries. Want to view the source code? Head to
|
|
https://git.tunnull.xyz/tunnull to view both the PHP-ified Atonix9x and the GOPHER version in their respective
|
|
repositories.
|