Radio:
Volume: 50%
Link: https://kotiboksi.xyz/radio.ogg
Currently the radio has mod music from the mod archive, and other random places. I may add more channels and music and cool stuff later, don't know yet though.
I am aware that everything i mention here can be done with insert your favourite js framework here and has been doable since 2012 or something like that. However i am not super interested in trying javascript frameworks anymore.
As i wrote on the index page previously, i wanted to do some experimenting with rust wasm webdev.
I did some basic testing with just vanilla wasm_bindgen, but it didn't make any sense to use it, since literally everything was a static page, so it just became a basic markdown to html converter running on the client, which was incredibly stupid.
I was close to just giving up on the thing, which would have been the wisest option, but i had nothing to do, so i decided to try some actual web frameworks.
Initially i tried leptos with just client side rendering, and i really liked how leptos worked. From the perspective of the web developer, basically you have an html macro, that creates normal html, but you can just embed rust code in the html, like this.
use leptos::leptos_dom::log;
use leptos::view;
let var: i64 = 16;
view! {
<p>"This is a paragraph"</p>
<button
on:click={move |_| {
log!("hi from rust, here is a random variable: {}", var);
}}
>
"text of the button"
</button>
}
There are lots of other cool things in leptos which make life easier, for example signals and server functions, but i'll leave explaining all of that to the actual guide.
Now if you are a sensible person, you might be thinking something along the lines of "But why would you introduce this massive blob of client side code for this stupid website that can be 99% achieved with static html?". I have some justifications for this, but ultimately I still agree with this sentiment in general.
Server Side Rendering:
I use leptos with server side rendering and hydration which (oversimplified) effectively means this:
You load the website, the server sends you the pre-rendered html file. (browser begins downloading the other needed things, like the css and wasm)
The website is mostly functional (the radio does not function correctly) after loading the static html and css, gzipped download size for these elements is currently < 10 kB on the index page
Your browser finishes loading everything else, the page is now fully functional
You can block wasm completely, and still access most of this website. You can go and write guestbook entries, you can read all the stupid shit i write here, it will just be very slightly less pretty because the page actually reloads every time you open a link.
Another point, which is more telling about my background image than leptos, is that the background is a bigger download than the wasm blob.
Fun
I just wanted to code something in rust and i had heard about wasm being a thing now. It doesn't make the site worse, and i've had fun doing this.