aral, to SmallWeb
@aral@mastodon.ar.al avatar
ArtThatMakesYouSmile, to Cat
@ArtThatMakesYouSmile@mastodon.social avatar
anze3db, to random
@anze3db@fosstodon.org avatar

One thing that I'm missing with HTMX and Django is proper error handling.

By default HTMX swallows any response that is not a 2xx, which might leave your users hanging on an endless loading state.

Does anyone have a good solution for this that can be reused between projects?

video/mp4

aral,
@aral@mastodon.ar.al avatar

Also, not immediately relevant to your current issue but something that might be worth considering for the future: using the htmx websocket extension, you can basically implement a streaming HTML approach (example using Kitten: https://ar.al/2024/03/08/streaming-html/) where you can just stream errors to the page as they happen.

#htmx #webSocket #Kitten #SmallWeb #StreamingHTML #errorHandling (2/2)

rigues, to vegan
@rigues@bitbang.social avatar

I was prepping dinner and the #kitten was circling my feet, meowing "I want". I say:

-Pandora, that's salad. Cats don't like salad. See? This is a tomato! (shows piece of tomato)

Pandora LICKS the tomato as if it were a snack. Starts meowing again.

-Kitten, it's SALAD! See, this is lettuce.

Scarfs down the lettuce, begs for more.

Just what I needed, a #vegan #cat. 😅

aral, to SmallWeb
@aral@mastodon.ar.al avatar

Sitting outside on a rare sunny day at a lovely pub in Bray, refactoring Kitten* to pull out the settings page sections into their own pages (and use Kitten’s new Streaming HTML workflow**) and enjoying a yummy pint of Tundra IPA.

No complaints :)

aral, to SmallWeb
@aral@mastodon.ar.al avatar

The Evergreen Web section in Kitten’s¹ settings now has its own page too (and uses Kitten’s new Streaming HTML² workflow).

If you have the previous version of your site up somewhere, you can use the 404-to-307 technique³ to forward missing pages to your old site so as not to break the Web.

I’ll add local static archive support later.

¹ https://codeberg.org/kitten/app
² https://ar.al/2024/03/08/streaming-html/
³ https://4042307.org

aral, (edited ) to Israel
@aral@mastodon.ar.al avatar

That feeling when you open the silly little collaborative drawing app you made and you find that some folks made this.

https://draw-together.small-web.org

PS. If you want to learn how the app was made, here’s a video tutorial using Kitten¹: https://ar.al/2024/03/26/draw-together/

¹ https://codeberg.org/kitten/app

aral,
@aral@mastodon.ar.al avatar

It got defaced right after my post but I saw at least someone else trying to recreate it and so I helped out too :)

#FreeGaza #BDS #protest #keffiyeh #Israel #Palestine #Gaza #settlerColonialism #apartheid #ethnicCleansing #genocide #SmallWeb #Kitten #DrawTogether

aral,
@aral@mastodon.ar.al avatar
aral, to SmallWeb
@aral@mastodon.ar.al avatar

Lots to do yet but the new Kitten¹ settings section (that’s common to all Kitten apps / Small Web places) is coming along nicely. (With the general style/layout borrowed from Domain².)

(It’s currently a single page and I’m breaking it up into multiple ones because it’s time.)

Once I’m done with this I should really record a screencast of Kitten’s new backup and restore feature/data portability.

¹ https://codeberg.org/kitten/app
² https://codeberg.org/domain/app

#SmallWeb #Kitten #Domain #SmallTech #web #dev

aral, to SmallWeb
@aral@mastodon.ar.al avatar

:kitten: Meow! New Kitten just dropped:

• Uploads are now listed in the Small Web Place Settings (/💕/settings) of all Kitten apps.

#Kitten #SmallWeb #SmallTech #uploads #settings #web #dev

aral, to SmallWeb
@aral@mastodon.ar.al avatar

Just deployed a new version of Kitten.

It uses the latest version of JSDB (5.1.3) which fixes an issue where instances of EventEmitter subclasses persisted to the database were erroneously persisting their (by convention private) _events arrays containing AsyncFunction instances and thereby causing a crash on the database open attempt when the AsyncFunction class could not be found as it wasn’t provided to the JSDB.open() method.

https://codeberg.org/kitten/app

:kitten: 💕

aral,
@aral@mastodon.ar.al avatar

… JSDB, by the way, is short for JavaScript Database, which is, umm, a JavaScript database.

It’s an in-process, in-memory database for Node.js for Small Web use that persists to an append-only JavaScript – not JSON, JavaScript – transaction log.

JSDB’s very easy to work with because you just use native JavaScript objects and they just automatically get persisted for you.

e.g., Here’s a quick 6-line Kitten app that persists a counter:

https://codeberg.org/kitten/app#using-javascript-database-jsdb-a-not-so-scary-database

Fitnessfoundry, to Cats
@Fitnessfoundry@mas.to avatar

No better workout buddy than my rescue kitty Xing Xing! 🐾🏋🏽‍♂️

Whether you bike, walk, or wheel, there's an exercise for you! 🧑🏽‍🦽👟🏊🏽‍♂️🚴‍♀️

Wishing you all a purrfect day!😺

aral, to javascript
@aral@mastodon.ar.al avatar

Just published a minor update (version 5.1.1) to JavaScript Database (JSDB) that optimises the custom data type¹ serialisation code by removing a redundant return statement:

https://www.npmjs.com/package/@small-tech/jsdb

This change is backwards compatible and shouldn’t require and updates to your projects, including the ones you have in Kitten (which uses JSDB internally).

¹ https://codeberg.org/small-tech/jsdb#custom-data-types
² https://codeberg.org/kitten/app

Albowser, to random

Soy el rey de esta casita.
Baciami la zampa, suddito.
#gattociro #Ciro #gatti #kitten #mastogatto

aral, to javascript
@aral@mastodon.ar.al avatar
KarenKasparArt, to art
@KarenKasparArt@socel.net avatar
ArtThatMakesYouSmile, to Cat
@ArtThatMakesYouSmile@mastodon.online avatar
aral, to SmallWeb
@aral@mastodon.ar.al avatar

Watching The Doors live at The Hollywood Bowl (1968)¹ and hacking on Kitten² and Domain³.

All in all, not a bad way to spend a Saturday afternoon in my book.

(I’ve almost got database backup/restore working in Kitten and I’ve just finished porting Domain to the latest Kitten with JSDB 5⁴.)

¹ https://yewtu.be/watch?v=Q76QBhKHQGc
² https://codeberg.org/kitten/app
³ https://codeberg.org/domain/app
https://codeberg.org/small-tech/jsdb

aral,
@aral@mastodon.ar.al avatar

🎉 Got database backup and restore working in Kitten (so every Kitten app gets it for free) and, with the new JSDB 5 support in Kitten, you can now make your model classes EventEmitters.

The session object is now an EventEmitter so you can now listen for events on the current session. In fact, I did just that in Kitten itself to implement the upload of the backup file during the restore process to make the Streaming HTML handler get notified once the POST route has the upload.

#SmallWeb #Kitten

Code listing (detail) of index.page.js in Helix Editor: const RestoreStatusUpdate = ({SLOT}) => kitten.html` <${ProgressIndicator} /> ${SLOT}

export function onConnect ({request, page}) { page.on('startRestore', () =&gt; { page.send(kitten.html<${RestoreStatusUpdate}>Uploading backup to restore from…>) }) const restoreDatabases = async (/** @type {Upload} */ upload) =&gt; { console.log('Restore: database backup uploaded', upload) // Show status indicator. page.send(kitten.html<${RestoreStatusUpdate}>Restoring from backup…>) // Delete current databases. const deleteResult = await fs.rm(kitten.databaseDirectory, {recursive: true, force: true}) // Re-create databases directory. const makeDirectoryResult = await fs.mkdir(kitten.databaseDirectory) // Decompress backed-up databases. await extract({ cwd: kitten.databaseDirectory, file: upload.filePath }) // Send refresh header and restart the server so the // restored databases are loaded into memory. page.send(kitten.html<${RestoreStatusUpdate}>Restore complete, waiting for server restart…`) // Restart the server. process.exit(99 /* code for restart request */) } request.session.removeListener('databasesUploadedForRestore', restoreDatabases) request.session.addListener('databasesUploadedForRestore', restoreDatabases)

ArtThatMakesYouSmile, to Cat
@ArtThatMakesYouSmile@mastodon.social avatar
KarenKasparArt, to art
@KarenKasparArt@socel.net avatar
weird.wolf, to Cat
KarenKasparArt, to art
@KarenKasparArt@socel.net avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • Leos
  • mdbf
  • magazineikmin
  • thenastyranch
  • Youngstown
  • osvaldo12
  • rosin
  • slotface
  • ngwrru68w68
  • InstantRegret
  • PowerRangers
  • kavyap
  • tsrsr
  • DreamBathrooms
  • tester
  • everett
  • hgfsjryuu7
  • khanakhh
  • GTA5RPClips
  • vwfavf
  • Durango
  • cubers
  • tacticalgear
  • ethstaker
  • cisconetworking
  • normalnudes
  • modclub
  • anitta
  • All magazines