+<span class=navbar-toggler-icon></span></button><div class="collapse navbar-collapse" id=navbarToggler><ul class="navbar-nav mr-auto mt-2 mt-lg-0"><li class=nav-item><a class=nav-link href=/about.html>About</a></li><li class=nav-item><a class=nav-link href=/blog.html>Blog</a></li><li class=nav-item><a class=nav-link href=/gallery.html>Gallery</a></li><li class=nav-item><a class=nav-link href=/download.html>Download</a></li><li class=nav-item><a class=nav-link href=/docs.html>Documentation</a></li><li class=nav-item><a class=nav-link href=/community.html>Community</a></li></ul></div></nav><div class="position-relative overflow-hidden p-3 p-md-5 m-md-3 text-center bg-dark bg-grid"><div class="p-lg-1 mx-auto my-1 text-white text-left"><h1 class="title font-weight-normal">Ready<br>RUN "BLOG"<br>> New online projects gallery█</h1></div></div><article class=container><p class="text-muted text-right">Published on: May 4, 2025</p><p>Back in 2021, the distinguishing feature of the then-current <a href=/2021/07/endbasic-0.7.html>EndBASIC 0.7</a> 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.</p><p>It then took the arrival of <a href=/2022/06/endbasic-0.9.html>EndBASIC 0.9</a>, 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.</p><p>The situation changes today as I have modified <a href=/gallery.html>the Gallery section of the EndBASIC website</a> to display a dynamic view of projects. Visit it now to have some fun or read on for more details on how this unfolded!</p><h1 id=how-does-the-gallery-work>How does the gallery work?</h1><p>The online gallery offers two new features: one is a project browser and the other is a file browser.</p><p>The <strong>project browser</strong> uses a new API in the backend service to query all published projects. A project is defined as a group of three files (a <code>.BAS</code>, a <code>.PNG</code>, and a <code>.TXT</code>) 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.</p><p>So, for example, if I store the files <code>LIFE.BAS</code>, <code>LIFE.PNG</code>, and <code>LIFE.TXT</code> in my cloud drive and I use the <code>SHARE</code> command to add the <code>public+r</code> ACL to them, there will be a new tile in the projects gallery that displays <code>LIFE.PNG</code> as its thumbnail, uses <code>LIFE.TXT</code> to explain what it is about, and provides a link to <a href="https://repl.endbasic.dev/?run=jmmv/life.bas">launch <code>LIFE.BAS</code></a>.</p><p>The <strong>file browser</strong> 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.</p><p>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.</p><h1 id=changes-to-the-client>Changes to the client</h1><p>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.</p><p>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 <a href=https://github.com/endbasic/endbasic/pull/272>the fixes</a>, and then use the new <code>COPY</code> command to upload thumbnails into your drive. Let me know if you need help with any of these.</p><p>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 <code>MOUNT</code> each user as a new drive today, and I’d much rather expose a directory interface. But that’s a lot of work.</p><p>Until then… <a class="btn btn-primary btn-lg" href=/gallery.html>Visit the gallery</a> or: <a class="btn btn-primary btn-lg" href=/docs.html#cloud>Read the cloud docs</a></p><div class="row post-links"><div class="col-6 text-center"><span></span></div><div class="col-6 text-center"><span><a href=https://www.endbasic.dev/2024/07/endbasic-0.11.html>Previous post »</a></span></div></div></article><footer class="pt-5 pb-3"><div class=container><div class=row><div class="col-md-8 text-left"><form class=form-inline action=https://hugo-dynamic.endbasic.dev/api/sites/6a633c2c-7fda-11ec-86e4-1cfd087199c2/subscribers/add method=post><input type=text name=email placeholder="Enter your email" class="form-control input-sm text-center mx-1" size=20>
0 commit comments