this post was submitted on 16 Mar 2024
206 points (100.0% liked)

technology

23267 readers
136 users here now

On the road to fully automated luxury gay space communism.

Spreading Linux propaganda since 2020

Rules:

founded 4 years ago
MODERATORS
 

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
[–] [email protected] 45 points 7 months ago

having a phone from this decade is bourgeois decadence

che-smile

Great work comrade

[–] [email protected] 41 points 7 months ago
[–] [email protected] 41 points 7 months ago (3 children)

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.

[–] [email protected] 26 points 7 months ago* (last edited 7 months ago) (2 children)

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.

[–] [email protected] 22 points 7 months ago (1 children)

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.

[–] [email protected] 16 points 7 months ago* (last edited 7 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

[–] [email protected] 10 points 7 months ago (1 children)

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

[–] [email protected] 8 points 7 months ago
[–] [email protected] 16 points 7 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

[–] [email protected] 16 points 7 months ago* (last edited 7 months ago) (1 children)

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

[–] [email protected] 26 points 7 months ago (1 children)

the taglines are all still hexbear's

This seems like a feature

[–] [email protected] 32 points 7 months ago

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

[–] [email protected] 30 points 7 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.

[–] [email protected] 30 points 7 months ago

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

[–] [email protected] 29 points 7 months ago

Based and coder pilled.

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

[–] [email protected] 29 points 7 months ago (3 children)

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

https://photon.lemmy.world/

Please let me know!

[–] [email protected] 8 points 7 months ago (1 children)

lemmy world but fast.. nice

now do a good instance!

[–] [email protected] 7 points 7 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)
[–] [email protected] 27 points 7 months ago* (last edited 7 months ago)

god damn

we love our posters

[–] [email protected] 24 points 7 months ago (2 children)

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

[–] [email protected] 20 points 7 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

[–] [email protected] 16 points 7 months ago

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

[–] [email protected] 21 points 7 months ago (1 children)

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

[–] [email protected] 13 points 7 months ago
[–] [email protected] 20 points 7 months ago

comrade i'm in love with you wtf

[–] [email protected] 20 points 7 months ago* (last edited 7 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.

[–] [email protected] 19 points 7 months ago (1 children)

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.

[–] [email protected] 16 points 7 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

[–] [email protected] 19 points 7 months ago

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

[–] [email protected] 18 points 7 months ago

u are literally my hero <3

[–] [email protected] 16 points 7 months ago
[–] [email protected] 16 points 7 months ago* (last edited 7 months ago)

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

[–] [email protected] 14 points 7 months ago

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

[–] [email protected] 14 points 7 months ago

The most amazing humans browse this site

[–] [email protected] 13 points 7 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.

[–] [email protected] 13 points 7 months ago

comfy-cool

comrade kota pic irl

[–] [email protected] 12 points 7 months ago

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

[–] [email protected] 12 points 7 months ago* (last edited 7 months ago) (1 children)

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!

[–] [email protected] 9 points 7 months ago (1 children)

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

stuff The method of delivery is a US military invasion

[–] [email protected] 8 points 7 months ago

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

[–] [email protected] 12 points 7 months ago (1 children)

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.

[–] [email protected] 12 points 7 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.

[–] [email protected] 10 points 7 months ago

This is very cool

[–] [email protected] 9 points 7 months ago
[–] [email protected] 6 points 7 months ago

This is excellent! Great job!

[–] [email protected] 4 points 7 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 ›