minioctt, (edited ) to webdev Italian

Sono praticamente 36 ore che non posto e lo so che siete in astinenza, ma avevo https://octospacc.altervista.org/2024/03/26/pwtorturaaaa/ di risolvere quel #problema con le #PWA una volta per tutte. E ora, nonostante un’altra frazione di sanità mentale sottrattami dagli spiritelli del silicio, dolori perché sto seduta per ore alla scrivania e tutta storta, e sonno perché ieri sera ho perso un sacco di tempo a debuggare un errore stupidissimo rimanendo sveglia fino alle 2 per poi arrendermi perché stavo veramente morendo, quantomeno ce l’ho fatta… 🤯️

Cercando con estrema #disperazione ieri mattina, mi accorgo di una cosa documentata alla bene e meglio, trovando prima una menzione su MDN ad un permesso webRequestFilterResponse.serviceWorkerScript, che servirebbe a regola per permettere alle #estensioni di intercettare i caricamenti dei Service Worker, e poi un thread bugzilla (#1636629) che pare abbia portato proprio all’introduzione di questa separazione di permessi. Ho scaricato il #codice dimostrativo per il bug, l’ho un attimo sistemato per tenere conto di questa misura di sicurezza poi introdotta e, certo abbastanza, il coso riusciva a fare quello che io volevo dall’inizio, senza ricorrere a bruttissime e fragilissime #hack (che a questo punto io nemmeno divulgo visto che non ho dovuto implementarle, per non sporcarmi la reputazione come developer, che già è molto bassa visto che prediligo il #webdev). 🔮️

A questo punto era quasi solo questione di rifiniture, un po’ creare il popup per le impostazioni della mia #estensione (che però mi ha richiesto diverse ore di design e implementazione fatti in contemporanea, perché volevo farle bene, non buttarci dentro bottoni a cazzo per il gusto di), e un po’ capire come #programmare il worker che gestisce #cache e richieste di rete #offline. Solo che qui ho sclerato perché… inizialmente con il codice preso da Chrome for Developers non andava, e pensavo fosse un problema mio, ma invece sembra proprio colpa loro, le loro demo non vanno proprio in #Firefox (ma non ho testato nemmeno in Chromium)… quindi ho provato quello offerto da MDN, ma anche qui nada, solo che ormai stavo crollando e quindi vado a mimir… stamattina vedo meglio e quest’ultima implementazione in effetti scopro che funziona, ma a me non andava perché, nel modo in cui iniettavo il #ServiceWorker trasformandolo da oggetto a stringa, una variabile che referenziavo non era accessibile nel contesto di esecuzione effettivo dello script, e quindi l’accesso alla cache falliva, ma io non me ne sono accorta subito perché già gli strumenti di #debugging del #browser sono mezzi scassati per questi casi speciali, ma io poi avevo pure un try-catch di mezzo che quindi sopprimeva gli errori alzati dall’interprete… la #pazzia. 😫️ 😩️

C’è un #casino di mezzo con la pubblicazione di #addon per #Mozilla, quindi praticamente ora il mio è in revisione, ma se tutto va bene dovrebbe prossimamente apparire sulla pagina https://addons.mozilla.org/en-US/firefox/addon/offline-caching/; in ogni caso, chi volesse usarlo da subito (come me sul telefono in primis) può scaricare da qui il file firmato da installare a mano. Edit: un’oretta dopo, l’estensione è approvata! 💖️

https://octospacc.altervista.org/wp-content/uploads/2024/03/img_20240328_1323201462313101815308817-960x1280.jpgBtw, mi serviva un’icona per l’add-on, perché tenere quella generica mi da fastidio (così come per quando creo app Android), e quindi ecco qui, letteralmente #OfflineCaching scritto a manina con uno stile un po’ buffo. Graphic design is my passion, ma non è roba mia, non son proprio capace. Penso comunque sia meglio di niente, quindi l’ho usata… (quella in basso sul foglio, che è stata la seconda; ho fatto prima quella in alto, ma poi non mi è piaciuta) 😬️https://octospacc.altervista.org/2024/03/28/pwgoduriaaaa/

#addon #browser #cache #casino #codice #debugging #disperazione #estensione #estensioni #Firefox #hack #Mozilla #offline #OfflineCaching #pazzia #problema #programmare #PWA #ServiceWorker #webdev

schizanon, to webdev
@schizanon@mas.to avatar

How should you manage a connection in a Multi-page App? Say, one that needs to listen on all pages all the time like a chat widget?

Do you connect in the main thread, and just reconnect on each page navigation?

Or do you create the in a instead?

schizanon, to random
@schizanon@mas.to avatar

Why is it ALWAYS such a pain in the ass to register a #serviceWorker for a #PWA with a build-time #web #framework.

Nobody ever considers this use-case when they design these things and we end up with some hacky workaround with tons of caveats.

#webDev #javaScript #bundler

schizanon, to webdev
@schizanon@mas.to avatar

I've decided to build one of my long-time pet-projects just to hone my skills a little.

I've been working on sites professionally for about 8 years so I think I should stick to that.

My most recent job was on a app that used so I think I'll use those too.

seems like a good place to host those things.

The idea is like Foursquare/Swarm, but on !

Wish me luck!

schizanon,
@schizanon@mas.to avatar

I am really second guessing the decision to build this in .

There's a LOT of confusion around the new paradigm, the Discord is a madhouse.

I've been struggling just to get the and for the set up right. It seems most people use next-pwa but it hasn't been updated to support AppRouter yet so there's a nasty fix to do. https://github.com/shadowwalker/next-pwa/issues/424

I haven't even attempted yet.

schizanon, to fediverse
@schizanon@mas.to avatar

I'm working on https://schizo.social again. There's still tons of basic client stuff I could work on, like logout, or rendering boosts, but my goal is to build a client for managing multiple accounts; things like syncing following/mutes/etc. Not really trying to build a client you'd use to read. I want to implement login, but calckey.social is down. Maybe I should start with handling multiple accounts first?

schizanon,
@schizanon@mas.to avatar

First I've got to figure out why my static assets are 500ing half the time. It's probably my slapdash #serviceWorker #caching strategy. I like to use #staleWhileRevalidate because it feels like I should just serve from the #cache if I have something but I don't feel like prompting the user to reload if there's fresh data. It's probably a bad UX though. I find myself reloading the page several times just to make sure I'm looking at fresh data.

schizanon,
@schizanon@mas.to avatar

Hmm, seems like the 500ing is only when I load the page in an incognito window... it's probably still my #workbox cache in the #serviceWorker, but I'm going to replace the StaleWhileRevalidate strategy with NetworkFirst. This will mean that the page will have to wait for a network response, but it will maintain my offline support so the #PWA install prompt will still appear. #WebDev

nhoizey, to random French
@nhoizey@mamot.fr avatar

Who still thinks writing a Service Worker for basic features (performance with cache, offline fallback) is cumbersome?

Using #Workbox recipes make it so easy!

Here's the Service Worker for https://pack11ty.dev 😍

https://github.com/nhoizey/pack11ty/blob/main/src/assets/js/service-worker.js

#PWA #ServiceWorker

⚓️ https://nicolas-hoizey.com/notes/2023/05/31/2/

nhoizey, to random French
@nhoizey@mamot.fr avatar

If someone is creating service workers with #Workbox recipes and injectManifest, a build with #esbuild, and doesn't have any issues, I'm interested! 😅

I have a very strange issue:

https://github.com/GoogleChrome/workbox/issues/3207

Bonus points if this is with @eleventy

#ServiceWorker

⚓️ https://nicolas-hoizey.com/notes/2023/05/13/1/

nhoizey, to random French
@nhoizey@mamot.fr avatar

Is it ok to use Workbox's injectManifest with the recent recipes warmCache option?

I tried this without success in the Service Worker in Pack11ty:

staticResourceCache({  
 warmCache: self.__WB_MANIFEST,  
});  

Other caches are warmed up, not this one.

#ServiceWorker #Workbox

⚓️ https://nicolas-hoizey.com/notes/2023/05/06/1/

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • cubers
  • magazineikmin
  • GTA5RPClips
  • khanakhh
  • InstantRegret
  • Youngstown
  • mdbf
  • slotface
  • thenastyranch
  • everett
  • osvaldo12
  • kavyap
  • rosin
  • anitta
  • DreamBathrooms
  • Durango
  • modclub
  • ngwrru68w68
  • vwfavf
  • ethstaker
  • tester
  • cisconetworking
  • tacticalgear
  • Leos
  • provamag3
  • normalnudes
  • JUstTest
  • All magazines