Housekeeping and Guestbooks

20250825

Alhena 5.3.0

Alhena 5.3.0 has been released. It's close to being in Maytag Repair Mode. So close, it may be time for me to find another leisure activity. Check it out.

Scriptonite (Server-Side Scripting For The Masses)

Scriptonite gets a few powerful enhancements. Previously, you could save data on the server with the following two functions:

saveData(someString); // could be json or whatever
let data = readData();

This required a client certificate. The data was tied to the cert. Multiple apps would have to use different certificates. It was limiting. It's still supported because at Ultimatum Labs, backward compatibility is king. But now we can do this:

saveData(someString, 'notes'); // data specific to "notes" app
let data = readData('notes');

This approach still requires a client cert but now multiple apps using the same cert are possible (typically hosted on the same site).

Sharing Data

What if you want to share your app's data store? Maybe make a guestbook? Just specify "origin" for the app name. Now the app uses the same data store for all users. (No one can actually read, write or delete outside of your app because the data is tied to the app's URL).

saveData(someString, 'origin');
let data = readData('origin');

Best of all, no client cert is required! The downside is that if you move the app to another URL, the original data store remains tied to the previous URL.

I know what you're thinking. What if my app does a readData and before I can save modifications, someone else running the app saves first? Their changes would be overwritten! No worries. Use the new withLock() function.

withLock(()=>{
    let data = readData('origin');
    // modify data somehow
    saveData(data, 'origin');
});

At the bottom of the page is a link to a guestbook app. Anyone could add it to their site by copying the code and changing one URL and some text.

Prompting For A Client Cert

If your app requires a client cert, you can display a message if the variable CERT_HASH is null or better yet, you can now add "cert" as the first parameter in the URL. If you do that, the server will prompt for a cert if one isn't present.

gemini://ultimatumlabs.com/scriptonite/gemini%3A%2F%2Fultimatumlabs.com%2F3DTTT.gmi;cert

If your app generates links back to itself, it's probably a good idea to always add the "cert" parameter there as well. This insures everything continues to work if the user created a "page cert" instead of a "domain cert".

Examples

Sign the guestbook!

Commented Guestbook Source
Guestbook

Modified Zoe using saveData and readData functions.

Source To Modified Zoe
Modified Zoe

Other Documentation

Getting Started With Scriptonite (Part 1)
Getting Started With Scriptonite (Part 2)
Alhena - A Sublime Gemini Client