206
submitted 8 months ago by kota@hexbear.net to c/technology@hexbear.net

My phone barely manages to load the site. Pages crash and when they do load it's around 10-15 seconds. Pretty much all newer js-dependant websites are like this for me. I simply don't use most newer websites on my phone. Maybe eventually I'll buy a new phone, but things work fine on my laptop so I mostly use that and having a phone from this decade is bourgeois decadence.

A while back I thought maybe I should take a crack at writing a fast and simple read-only frontend that I can use on my phone similar I guess to nitter, invidious, bibliogram, etc.

So I went ahead and did just that: https://diethex.net

Hilariously, I actually wound up doing this TWICE. The first time I finished it up last June and then the site migrated to lemmy v3 so I had to rewrite almost everything which I just now got around to this month. Here's the code in case anyone wants to read it: https://git.sr.ht/~kota/hex

When a page is requested all of its data (comments, posts, etc) are cached for the next 20 minutes which dramatically reduces requests to the actual website when you're browsing around. Also every page is statically generated from simple html templates on the server; so javascript isn't required. I wound up adding a tiiiny bit of optional js to allow opening and closing comments. So you can swipe to the left on a phone to close a comment.

If hexbear is already fast for you then there's no point in using this, but figured I'd say something in case there's anyone else with my issues.

top 50 comments
sorted by: hot top controversial new old
[-] iByteABit@hexbear.net 45 points 8 months ago

having a phone from this decade is bourgeois decadence

che-smile

Great work comrade

[-] kristina@hexbear.net 41 points 8 months ago
[-] bdonvr@thelemmy.club 41 points 8 months ago

Hot damn that is responsive. I'm a Lemmy admin, is there an easy way to get this going for my instance? Docker container maybe?

Excellent work, comrade.

[-] YearOfTheCommieDesktop@hexbear.net 26 points 8 months ago* (last edited 8 months ago)

Alrighty, here's what I've got

FROM golang:1.21

WORKDIR /app
COPY . ./

RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -buildvcs=false .

EXPOSE 4000

ENTRYPOINT ["/app/hex"]
#CMD ["-hb","https://lemmygrad.ml/api/v3/"] #Optional

basically just clone the repo, cd into it, create a file with the above lines in it called Dockerfile (uncomment and change the instance base URL if you want to), and then run some docker commands like this:

sudo docker build --tag diethex .
sudo docker run -d --publish 4000:4000 diethex

Then you should be running on port 4000 to test out. Then map the port however you need it and pipe a subdomain to it using nginx as needed.

Oh and if you want to change the title, remove the taglines, etc, you'll need to edit the page templates in files/... It should be pretty straightforward to just change the title/header and remove the MOTD/taglines. I did it but only for the main page.

[-] kota@hexbear.net 22 points 8 months ago

Incredible! That's pretty much what I was gonna say. Might throw this dockerfile in the extras folder.

Yea the hexbear specific stuff basically boils down to the taglines, the emojis, and the header in home.tmpl. There's quite a few things I could do to make it a lot easier to use for other lemmy instances ... there's not a lot of configuration right now, but I tried to leave a lot of comments in the code.

[-] YearOfTheCommieDesktop@hexbear.net 16 points 8 months ago* (last edited 8 months ago)

it was built for a purpose and it accomplishes that swimmingly! and yeah feel free to do whatever with the dockerfile, hope people get some use out of it. I think the templates are simple enough that people can just do their own cosmetic changes but if you have ideas...

also for the dockerfile, copying in the entire repo contents probably isn't the most elegant thing but it was being annoying when I tried to do it other ways

[-] bdonvr@thelemmy.club 10 points 8 months ago

Thanks a lot! I just haven't been home to mess with it yet.

[-] YearOfTheCommieDesktop@hexbear.net 16 points 8 months ago

You could do it but you'd have to be willing to do some of the docker stuff yourself. it shouldn't be too hard, just writing a dockerfile that installs the deps and the compiled app and runs it. OP is running it as an openrc service so that doesn't (likely) help you. some hexbear specific stuff is hardcoded but not a ton I don't think.

And of course you'd have to change the baseurl in hb/hb.go

[-] YearOfTheCommieDesktop@hexbear.net 16 points 8 months ago* (last edited 8 months ago)

Okay I got bored and decided to play with it. I got it running in a docker pretty easily, going to see how well pointing it at other instances works now. Will post Dockerfile and results.

Edit: okay, it works fine pointed at a non-hexbear instance (and you don't need to edit code, it's a command line flag.) Buuuut, the title still says diet hexbear and the taglines are all still hexbear's

[-] BountifulEggnog@hexbear.net 26 points 8 months ago

the taglines are all still hexbear's

This seems like a feature

[-] hello_hello@hexbear.net 32 points 8 months ago

07 literally praxis omfg I can browse this stupid site with a light theme.

[-] ksynwa_from_lemmygrad@hexbear.net 30 points 8 months ago

Excellent work. It is fast as hell. I once tried doing something similar myself where I tried to basically take libreddit and hack it to use lemmy API though I ended up giving up.

[-] layla@hexbear.net 30 points 8 months ago

aaahhhhh this is so good! so lightweight! no js!! I am in love, thank you for this!

[-] zifnab25@hexbear.net 29 points 8 months ago

Based and coder pilled.

I'm on a plane with some dogshit WiFi and this is very handy

[-] makotech222@hexbear.net 29 points 8 months ago

Question for OP and others with old phones, does Photon UI work any better for you?

https://photon.lemmy.world/

Please let me know!

[-] peeonyou@hexbear.net 8 points 8 months ago

lemmy world but fast.. nice

now do a good instance!

[-] makotech222@hexbear.net 7 points 8 months ago

well there are other instances that have Photon, i was just curious how fast it was for those with slow hardware.

load more comments (2 replies)
[-] MaoTheLawn@hexbear.net 27 points 8 months ago* (last edited 8 months ago)

god damn

we love our posters

[-] M68040@hexbear.net 24 points 8 months ago

Dumb thought: HTTP-only variant that renders fine on late '90s-early '00s browsers. I'm basically Strong Bad so i'd appreciate it

[-] kota@hexbear.net 20 points 8 months ago

I think the only major things would be around the css selectors like footer > * + * {, but it wouldn't really take too many changes. It basically already works in w3m

[-] YearOfTheCommieDesktop@hexbear.net 16 points 8 months ago

honestly this one is simple enough if you just removed some theming that would probably work

[-] Commiejones@hexbear.net 21 points 8 months ago

I really like the URL. "Die The X" heh heh

[-] Pluto@hexbear.net 13 points 8 months ago
[-] aaaaaaadjsf@hexbear.net 20 points 8 months ago* (last edited 8 months ago)

This is very cool. Looks great. So fast and light.

Also look into Lemmy client applications. Jerboa is made by the developers of Lemmy and is fairly lightweight.

[-] Lerios@hexbear.net 20 points 8 months ago

comrade i'm in love with you wtf

[-] farting_weedman@hexbear.net 19 points 8 months ago

This is what the main site should default to and look like with maybe that subtle alternating background color for comments.

[-] AssortedBiscuits@hexbear.net 19 points 8 months ago

Good shit. I'm definitely going to use this on my phone. Honestly, if you could find a way to get avatars to show up (I'm guessing that breaks the no Javascript rule), I would even use it on my desktop because its performance is so much better.

[-] YearOfTheCommieDesktop@hexbear.net 16 points 8 months ago

definitely don't need js to render a little image by a name

though it does make the page bigger and slower to load ig

[-] nurjahreszeiten@hexbear.net 18 points 8 months ago

u are literally my hero <3

[-] glans@hexbear.net 16 points 8 months ago* (last edited 8 months ago)

cccoool! keep that phone going as long as you can!!

[-] sloth@hexbear.net 16 points 8 months ago
[-] allthetimesivedied@hexbear.net 14 points 8 months ago

Cool now I can bring all my homeless druggie friends with their shit ass Obamaphones on board.

[-] Hohsia@hexbear.net 14 points 8 months ago

The most amazing humans browse this site

[-] plinky@hexbear.net 13 points 8 months ago

comfy-cool

comrade kota pic irl

[-] NewLeaf@hexbear.net 13 points 8 months ago

Buy a Blu phone. I've been buying them for a while now, and I'm on my third one in over 15 years. The last one I bought wat just because it was a good upgrade. They're cheap and durable.

[-] Pluto@hexbear.net 12 points 8 months ago* (last edited 8 months ago)

I have the worst phone.

Seriously, Pluto needs to give its citizens better phones and start feeding its people!

Why don't the people just overthrow the government of Pluto already?

Welp, gotta slap more sanctions on Pluto. That'll teach 'em!

[-] MiraculousMM@hexbear.net 9 points 8 months ago

Sounds like Pluto needs a hefty dose of Freedom(TM) and Democracy(TM)

stuff The method of delivery is a US military invasion

[-] Pluto@hexbear.net 8 points 8 months ago

Bring your Space Force, America! Let's duke it out!

[-] TrashGoblin@hexbear.net 12 points 8 months ago

Heck yeah, if you added logins and posting, it would be basically brutaldon for Lemmy, something I've been pondering for years.

[-] Tabitha@hexbear.net 12 points 8 months ago

I bet there's like 100 experienced front-end devs who'd like to make lemmy-ui faster/better/light-weight but nobody can run the UI locally, in fact it looks like it's easier to use any of the 3rd party apps. example: Xyphyn/photon or make you're own from scratch.

[-] makotech222@hexbear.net 12 points 8 months ago

heh, yeah getting lemmy to run locally w/o docker was a pain and it took me a while to get it going.

[-] Maoo@hexbear.net 10 points 8 months ago

This is very cool

[-] Parsani@hexbear.net 9 points 8 months ago
[-] anarchoilluminati@hexbear.net 6 points 8 months ago

This is excellent! Great job!

[-] goog@hexbear.net 4 points 8 months ago

the fediverse is so cool for stuff like this. reminds me of the justmytoots website, which unfortunately doesn't work for me on most instances. it would be cool if it worked on lemmy to quickly grab all of someone's posts only in that stripped down UI

load more comments
view more: next ›
this post was submitted on 16 Mar 2024
206 points (100.0% liked)

technology

23313 readers
118 users here now

On the road to fully automated luxury gay space communism.

Spreading Linux propaganda since 2020

Rules:

founded 4 years ago
MODERATORS