Published on: May 4, 2025
Back in 2021, the distinguishing feature of the then-current EndBASIC 0.7 release was that it was “cloud-ready”: I created a file-sharing service and integrated it with EndBASIC so that you all had a mechanism to publish your creations with others.
It then took the arrival of EndBASIC 0.9, which wasn’t released until a year later, to have the ability to automatically launch shared projects via an specially-crafted URL. But even with that feature, projects written and shared from within EndBASIC were stuck in a pretty obscure garden. Nobody was able to discover them unless they signed up for an EndBASIC account and used the command line interface to inspect the cloud, or unless you explicitly shared those URLs somehow. A… very tall order.
The situation changes today as I have modified the Gallery section of the EndBASIC website to display a dynamic view of projects. Visit it now to have some fun or read on for more details on how this unfolded!
How does the gallery work?
The online gallery offers two new features: one is a project browser and the other is a file browser.
The project browser uses a new API in the backend service to query all published projects. A project is defined as a group of three files (a .BAS
, a .PNG
, and a .TXT
) with the same base name, all shared with the same set of people (or the public). These files provide the source of the project, a thumbnail for display, and a public description of the project.
So, for example, if I store the files LIFE.BAS
, LIFE.PNG
, and LIFE.TXT
in my cloud drive and I use the SHARE
command to add the public+r
ACL to them, there will be a new tile in the projects gallery that displays LIFE.PNG
as its thumbnail, uses LIFE.TXT
to explain what it is about, and provides a link to launch LIFE.BAS
.
The file browser uses a new API to query the list of users that are sharing any files with the public, and then uses pre-existing APIs to list the files that they share. Nothing surprising there, but I did have to rewrite the “get file” API to expose file downloads as a traditional HTTP server does: the previous implementation wrapped the file content in JSON and this had been… not a wise design decision (to put it mildly) years back.
With these new APIs in place, all I had to do was write some old-fashioned jQuery-based JavaScript and some rudimentary AJAX queries to create the two views in the gallery.
Changes to the client
The work to make the projects gallery possible didn’t end with the changes to the backend and the website. As you may have noticed above, two of the files in a project definition are text files, but one of them is a binary image. And, for reasons that I can’t remember, I made the unfortunate decision years ago to only support text files in the internal EndBASIC storage interfaces. This, combined with the lack of a primitive to copy files, meant that I could not upload images to my cloud drive.
Fixing this was pretty mechanical because there was no reason to restrict the storage interfaces to dealing with text only. However, what this means is that until I publish EndBASIC 0.12 later this year, you’ll have to build the EndBASIC CLI from source to leverage the fixes, and then use the new COPY
command to upload thumbnails into your drive. Let me know if you need help with any of these.
As for the future, the new “get users” API that I added to the backend should let me improve the experience in EndBASIC to navigate cloud files: I don’t quite like how you have to MOUNT
each user as a new drive today, and I’d much rather expose a directory interface. But that’s a lot of work.
Until then… Visit the gallery or: Read the cloud docs