At least some documentation how to build the static index.html
I don't know how to build the index.html. I hacked it a bit, this is what I did:
This produces dist/index.html:
npm install
npm install -D vite@5 @sveltejs/vite-plugin-svelte@3
npx vite build
The output is placed in dist/.
I then used https://github.com/jooray/html-resource-embedder to convert it into a self-contained HTML file.
Is there a nicer way to produce the dist/index.html?
Run the server, visit the webpage generated for your npub, then download the generated HTML. It should be already a self-contained blob.
We should probably make a CLI option for streamlining that process.
Run the server - how? No mention how to do it in the README.md.
Assuming it is:
go build
BASE_DOMAIN=localhost PORT=45070 ./oracolo
but opening http://localhost says "missing CNAME record for localhost:45070" when I open the page. Same for the subdomains. Is there a way to run it without setting up DNS servers? I just want to get the HTML.
Yeah, sorry about that.
To run the server you should call just dev (with https://just.systems/) and then you should be able to access the rendered websites at http://npub1blabla.localhost:45070/
You can then either copy the HTML manually or click on the button at the bottom of the page for downloading an HTML file. You can also do that directly on https://npub1blabla.oracolo.me/ without having to run anything locally.
Now I realized that embedding all the JS and CSS in the same HTML file might be what is causing slow startup times on production websites @dtonon.
Maybe we should not do that, and instead only do it when the user clicks on the "Download" button at the bottom?
The reason I want to run things locally is that if I change something, I want to test it or deploy it in my file.
I still have the same problem:
$ BASE_DOMAIN=localhost just dev &
12:59PM INF running on http://localhost:45070
$ curl -o- 'http://npub1blabla.localhost:45070/'
missing CNAME record for npub1blabla.localhost:45070
This "missing CNAME record" is actually returned by the webserver.
I will write documentation about this, when I solve it.
Try with BASE_DOMAIN=localhost:45070.
Now I realized that embedding all the JS and CSS in the same HTML file might be what is causing slow startup times on production websites @dtonon. Maybe we should not do that, and instead only do it when the user clicks on the "Download" button at the bottom?
Why slow startup times? I briefly tested the procedure and the generation and download (the single file is ~500KB) seems quite fast for a non cached setup, less than 1 sec loading time.