Replies: 0 comments 4 replies
-
We can also think of this static-site export as a self-contained ‘rich site archive’. The end-result of a static rendering saved to my hard drive is that I’ve now got a website blob (folder) on my computer that I can open in my browser even while offline. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
1 reply
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
From @zicklag :
WASM plugins
So for the site generator we're thinking that we are eventually going to want to make a pretty full-blown WASM plugin system, but we can start simpler than that and work up to it.
We were thinking that we might try out Vox as a static site generator.
It has this idea of incremental updates to the site, so that you aren't having to re-build the whole thing every time you make a change, and we liked that.
The first step there would be to get something Vox-like ready for WASM by abstracting its system API to a trait so that it can work without the filesystem.
But even simpler than that, for starters, I was thinking we could just make a WASM plugin that we use to render the user's pubpage using Tera templates instead of the SvelteKit templates we have built-in.
And then different themes would just be different tera templates.
So for starters, Phase 1: the most minimal version would be to make a WASM module that takes two inputs:
Phase 2 would be to refactor the WASM module as a "WASM component" with a standard API and then use jco to load the WASM component. Eventually WASM components will be the foundation of the plugin system, so we want to get into that early on.
Phase 3 might be to try and use Vox as the static site generator instead of just terra, and hook it up so that we can regenerate the site whenever the user profile changes, instead of rendering the page with the WASM module on every hit to the page.
Phase 4 might be to let you upload a custom WASM component so that you can have your own custom static site generators.
Phase ♾️ might be to allow you to run some kind of web applications with plugins almost like Wordpress. The plugins would get access to the user's Leaf subspace, so that it could read and write arbitrary data under the user's account.
Significantly the WASM plugin system allows you to run the site generator / app offline using the future Weird desktop app.
Job to be Done
Feature-speaking, to start all we need it to do is take the profile info and pages that have been created in the main Weird app, and then create a static site from them using one of a list of built-in themes.
For example, we have this Muni town profile: https://weird.one/muni.town
First we just want to render that profile info to a single page like this: https://muni.town/
Then we might also want it to be able to render the markdown pages like this one under the main domain, too: https://weird.one/muni.town/identity
Ooh, I forgot we have like three "databases", so that might take a little bit of work, but we can work towards it.
We have the Rauthy data, the redis data, and the Leaf data.
The Weird server already covers the serving part. All we need is a black box WASM that we can shove profile data into, and get out HTML. Oh, and a theme. Profile and theme → HTML.
The Weird server will use that WASM module to render the static page and it will serve it.
For reference, right here is where we render the user's site right now: https://github.com/muni-town/weird/blob/main/src/routes/(subsites)/subsite/%5Busername%5D/%2Bpage.svelte
We want to replace that SvelteKit page with a +server.ts server endpoint that will use the WASM to render the page and return it directly as HTML, instead of using the SvelteKit components.
For the most part I think that we'll keep domain logic in SvelteKit for now.
I'm planning on moving the DNS server to its own Rust microservice, and it might be a good idea to migrate the business logic to it's own npm package so that it's more self-contained and less sveltekit specific, but for now it's been easiest to do everything in SvelteKit, and it makes it more approachable to more contributors.
I initially had a separate Rust backend, but then it meant everytime we added something we had to add a Rust API endpoint, and then a svelte server script that would make requests from it, for every new thing we needed to do.
It got a lot better when we made the Leaf RPC server the only Rust piece, and then we could read / write / update any new kinds of data that we defined with TypeScript in SvelteKit.
Related
Beta Was this translation helpful? Give feedback.
All reactions