zhub.link is one of the many independent Mastodon servers you can use to participate in the fediverse.

Administered by:

Server stats:

28
active users

#kitten

21 posts2 participants0 posts today

New Kitten release

• Socket routes now have precendence in the router.

This stops wildcard page routes from capturing the default socket routes that Kitten creates to enable the Streaming HTML workflow.

e.g., Previously, the following route:

/videos/index_[slug].page.js

Could not connect to its default socket (/videos/default.socket) because default.socket would be captured by the [slug] parameter.

Now, it will work as intended as the /videos/default.socket (a socket route) has precendence over index_[slug].page.js (a page route).

Learn more about Kitten’s Streaming HTML workflow here:
kitten.small-web.org/tutorials

Enjoy!

:kitten:💕

While working on porting the Small Technology Foundation web site¹ to Kitten², I took the opportunity to pull out base Model and Collection classes that I’ll likely end up including in Kitten proper:

• Model: codeberg.org/small-tech/site/s
• Collection: codeberg.org/small-tech/site/s

To see them in use, here’s the base Posts class (with RSS generation) that extends Collection:
codeberg.org/small-tech/site/s

And here’s the concrete EventPosts collection class that extends Posts:
codeberg.org/small-tech/site/s

And the EventPost (showing an implementation of a calculated property):
codeberg.org/small-tech/site/s

So all this is possible (persisting and reading back typed model collections, etc.) thanks to JSDB¹ (JavaScript database), a zero-dependency, transparent, in-memory, streaming write-on-update JavaScript database I wrote for the Small Web that persists to a JavaScript transaction log and is included as as first-class citizen in Kitten.

codeberg.org/small-tech/jsdb

And if you want to know how the magic mapping of classes happens, see the Database App Module:

codeberg.org/small-tech/site/s

PS. For a much gentler introduction to persistence in Kitten, see the Kitten Persistence tutorial:
kitten.small-web.org/tutorials

Enjoy! :kitten:💕

¹ small-tech.org
² kitten.small-web.org

New Kitten Release

• Automatic message routing: if the element that triggers an event on the client does not have a `name` attribute, Kitten now falls back to using its `id` instead to route the event to the correct server-side event handler on your live Kitten pages.

If neither attribute exists, Kitten will fail to route the message but no longer crash as it was due to a regression introduced when I implemented support for colons in element names.¹

kitten.small-web.org

For more details on Kitten’s live pages and automatic message routing, please see the Streaming HTML tutorial:

kitten.small-web.org/tutorials

Enjoy!

:kitten:💕

¹ A colon in an element name is ignored for message routing purposes, letting you, for example, give unique names to <details> elements, allowing more than one to be open at a time, while having their events be handled by the same handler.

New Kitten release

• Added instructions to Kitten’s Settings app for how to set up a webhook at Codeberg¹ so that pushing to your main branch automatically updates your deployed server.

kitten.small-web.org

(Would you like me to add instructions for GitHub also? Hmm, let me think a moment… No.)

You can also find the relevant information in the Kitten reference:

kitten.small-web.org/reference

Enjoy!

:kitten:💕

¹ Codeberg is an community-run ethical alternative GitHub. You can follow them on the fediverse at @Codeberg and visit them online at codeberg.org

New Kitten release

• Change: Add Kitten’s own routes (that every Kitten app inherits) for the Small Web protocol namespace (/💕) as well as for Kitten’s reserved namespace (/🐱) first, before app-specific routes so that a wildcard route in the form, e.g., [anything]_[anythingElse].get.js won’t lock you out of the Settings site for your app (at /🐱/settings).

kitten.small-web.org

Enjoy!

(To update, run `kitten update` from your terminal on your development machine or manually update deployment servers from /🐱/settings/kitten/ or just wait a few hours for them to update automatically. You can also just run the installation command again.)

New Kitten release

• Fixes redirection from sign-in page when person is already authenticated.

kitten.small-web.org

To learn more about how Kitten automatically implements authentication for your Small Web sites and apps using public-key cryptography (so even your own server doesn’t know your secret)¹, please see the Authentication tutorial:

kitten.small-web.org/tutorials

Enjoy!

:kitten:💕

¹ The security (and privacy) of Domain/Kitten are based on a 32-byte cryptographically random secret string that only the person who owns/controls a domain knows.

This is basically a Base256-encoded ed25519 secret key where the Base256 alphabet is a set of curated emoji surrogate pairs without any special modifiers chosen mainly from the animals, plants, and food groups with some exceptions (to avoid common phobias or triggers, etc.) that we call KittenMoji.

When setting up a Small Web app via Domain, this key is generated in the person’s browser, on their own computer, and is never communicated to either the Domain instance or the Kitten app being installed. Instead the ed25519 public key is sent to both and signed token authentication is used when the server needs to verify the owner’s identity (e.g., before allowing access to the administration area).

The expected/encouraged behaviour is for the person to store this secret in their password manager of choice.

More: kitten.small-web.org/reference

New Kitten release

• Fixes issue with routes where dynamic routes with file names that had more than two extensions were not recognised as the correct type of route. e.g., A route called index.xml.get.js would previously have been treated as a static route instead of a dynamic GET route.

kitten.small-web.org

For more details, see the Valid File Types section of the Kitten reference¹ and the Dynamic Pages tutorial².

Enjoy!

:kitten:💕

¹ kitten.small-web.org/reference
² kitten.small-web.org/tutorials

New Kitten release

• You can now use key paths in the names of your client-side live components and these will automatically be transformed into object hierarchies on the server for you.¹

• Self heals zombie live pages (see Streaming HTML workflow²) if they return to life due to client-side browser cache.³

• Removes htmx⁴ headers from `data` property into separate `header` property in Kitten Page events and the data your Kitten Page message handlers receive.

• Automatically passes references to the live page object (if any) and the request and response objects to the layout templates of Markdown pages⁵ (so you can, for example, check if `request.session.authenticated`⁶ is true from the your layout template and customise the layout accordingly).

kitten.small-web.org

Enjoy!

:kitten:💕

¹ e.g., See codeberg.org/small-tech/site/s (markup) and codeberg.org/small-tech/site/s (handler) and codeberg.org/small-tech/site/s (model class method).

² See Streaming HTML tutorial: kitten.small-web.org/tutorials (There’s actually more to it now but I haven’t had a chance to document the new class-based and event-driven live page workflow yet. It’s experimental but working very well for me so far so I will do so shortly.)

³ When a person leaves a live/connected page (a page connected to its default web socket), we clean up and remove that live page from memory. However, browsers being what they are, cache the page on the client. If a person uses the back/forward buttons to return to the page, the browser will serve the cached source from memory, which has the old page ID, for the page that no longer exists in Kitten’s memory. So now we have a problem. The only way to recover from this is to tell the page to reload itself. So we accept the WebSocket connection, send a command to the page for it to reload itself, and then close the socket. That makes the stale page self heal by replacing itself with a fresh one. Yay, go us!

⁴ HTMX: htmx.org

⁵ Kitten Markdown pages reference: kitten.small-web.org/reference

⁶ See Session tutorial: kitten.small-web.org/tutorials

😺 Fun Kitten¹ fact

Did you know that Kitten has a built-in HTML validator that checks your markup for validity and accessibility issues, etc.?

You’re informed of validation errors in not just terminal but also in your browser’s web developer panel. And, if you select the “Show validation issues on page” link from a validation error in the web developer panel, Kitten will show the validation errors in place on your page.

This helps me catch issues with my markup all the time and I hope it helps you too.

Enjoy!

:kitten:💕

¹ kitten.small-web.org

Donno about you guys but it sure is nice not to have to try and decipher the clusterfuck-like syntax of Hugo’s Go-based templating engine anymore…

The code on the left is Kitten¹, on the right is Hugo².

Kitten’s ‘template engine’ is just JavaScript tagged template strings.

(I’m porting the Small Technology Foundation web site³ from Site.js⁴ to Kitten, and in the process from being a Hugo-based static site to a dynamic one with a nice little admin panel I’m making to make it trivially easy to add new news items, events, and videos.)

¹ kitten.small-web.org
² gohugo.io
³ small-tech.org
sitejs.org