IronOxidizer / lemmy-lite

A static, JSless, touch-friendly Lemmy frontend built for legacy web clients and maximum performance
https://lemmylite.crabdance.com
GNU Affero General Public License v3.0
79 stars 5 forks source link
actix-web lemmy rust

lemmy-lite

A static, JSless, touch-friendly Lemmy frontend built for legacy web clients and maximum performance

This project is not intended for official use, but rather as a proof-of-concept for pre-rendering Lemmy. Eventually it will transition into a microservice that is ran alongside Lemmy, for example, under lite.lemmy.com or lemmy.com/lite. Ideally it will run on the same machine removing any extra latency in API calls.

Built With

Features

Installation

Pictures

Android Desktop iOS
android desktop ios

Notes

  1. As of 0.2.0 (Aug2020) worst case scenario (240 comment thread) takes 9ms to render on server.
  2. First load fetches a stylesheet, favicon, and svgs. These are cached so all subsequent pages require only a single HTML request.
  3. I use CSS Tables instead of FlexBox and Grid because Tables are faster, simpler, and have much better legacy support. Using CSS tables over HTML tables avoids excess DOM objects.
  4. Each page refresh is limited to API critical chain of 1 to limit the impact on instances and to keep page times fast.
  5. 1.0.0 is set for when account functionality is stabilized.
  6. Ideally, static content is served through a CDN to further improve server performance and response times.
  7. Strictly only uses characters from BMP for legacy font support.
  8. Catch me developing lemmy-lite on my streams at Twitch or YouTube
  9. SVGs hand optimized using Aydos SVG Path Editor

TODO

  1. Fix user and community links (change markdown interpretation for same-site links)
  2. Consider not supporting UTF-8 and only using ASCII characters for data size and better legacy font support.
  3. Consider switching from Maud to Sailfish to improve performance.

Quirks

  1. CSS word-spacing is broken on iOS and NetSurf

Update Script

killall lemmy-lite
git pull
rm static/*.gz
pigz -rk11f static
for i in static/*gz; do
  [ -f "$i" ] || break
  j="${i%.*}"
  if((`stat -c%s "$i"`>=`stat -c%s "$j"`));then
    echo "$i is larger than base, deleting"
    rm -f "$i"
  fi
done
sudo rm -rf /etc/nginx/lemmy-lite
sudo cp -rf static /etc/nginx/lemmy-lite
nohup cargo run --release &