Activity

BnaJns

Aight so I decided to make this project/website because the ro-racing league I’m in supports making custom liveries for some cars, but there’s no “database” or anything similar to keep track of, or share liveries reliably, so why not make something similar to Trading Paints (a iracing livery collection/app) to keep liveries with data such as texture id, tags, which car type, team, etc. I decided to go with golang for this since gin-gonic (basically express.js for Go) makes stuff hella easy, and using templates is nice as well, I could’ve used next.js but that’s lame and boring and next.js consumes 1gb ram something something. Anyways, plan is to use: Gin-gonic, postgres, and get minio setup on my homelab for screenshot uploads and such. Only concern is how I’ll figure out reusable components like the navbar and footer and allat since react would make that easy but ofc I can’t use react here, only pure html+css+js. Anyways, so far I’ve setup some basic stuff, such as a uptime tracker, router setup, readme and license, very minimal stuff. So that’s that, Go is very cool. party-gopher

Changelog

Attachment
0
BnaJns

Shipped this project!

Hours: 16.34
Cookies: 🍪 430
Multiplier: 21.89 cookies/hr

Finished the whole v1 site for the YSWS draft Go Ship!, including a bunch of cool stuff such as:

  • RSVP via Hack Club Auth (instead of a fillout form)
  • markdown rendered guides
  • ai.hackclub.com project idea generator (spins 3 categories, POSTs to AI, returns go beginner project idea)
  • code runner with examples via go.dev/play API
  • and some smaller stuff like the art/FAQ/prizes/text/etc

Is writing the site as fast as using a framework like next.js, astro, or even gin-gonic to help with handlers? No. Is the executable a whole 20mb and really fast? Hell yeah.

BnaJns

Added a golang code playground with examples cause why not, courtesy of go.dev/play servers, very epic

  • CodeMirror for the Go code editor/display via their cdn links
  • go.dev/play APIs for formatting + running code in a sandbox, really simple to use
  • Wrote 3 basic example scripts, a hello world with time, the infinite monkey theorem thingy using gocurrency and channels, and also copied the base64 image displayer example from go.dev/play, just added the support to my html and changed the logo to be the goship logo ofc
  • Backend is basically a really simple proxy, formats raw code text into x-www-form-urlencoded and into the expected struct, sends it to the API which handles the formatting and building, sends back the json response to the client.
  • //go:build ignore lines in the public/scripts/ scripts so it doesnt break the actual website build, and then the client JS strips it out so it doesnt stop the script from running in the playground.
  • Also added ratelimits to format/run to prevent abuse/spam
  • Edit: Also emailed the Golang public mailing list as per the service requirements, https://groups.google.com/g/golang-dev

i didnt know you could add emojis this is cool

gopher gopher gopher

Changelog

Attachment
0
BnaJns

Pretty much done atp adding guides was easier than i expected it to be

  • Added three very awesome guides, the Go setup guide, the hackatime setup (which just basically links to the hackatime website quick start), and a hello world tutorial.
  • Added a /guides handler, using yuin/goldmark to render the markdown in the template. On /guides?file.md request, checks if file exists, if not respond 404, and ofc other cases like no query param or whatever, if file does exist, it reads the markdown, renders it using goldmark, throws into template, boom.
  • Basic guides/index.html template with simple styling
  • Made the readme awesome, aka changed it from 3 lines to like 50 lines

Go is awesome

Changelog

Attachment
Attachment
0
BnaJns

AI generated ideas working after wayy too much time, woo

  • Added an /generatemeaidea endpoint with POST and GET available, GET returns allowed slot tiles/categories, and POST generates and AI idea via ai.hackclub.com with the generated slot ideas, also double checking to make sure the categories are in the allowed list, and also with a 10 req/hour ratelimit.
  • Frontend is simple, you have a slot machine, “spin” button, you click it, it randomly chooses 3 categories, sends the request to the endpoint, gets response back, puts that on display. If ratelimited, or error, it throws a message saying ratelimited/error happened.
  • I tried to make a pullable lever, and make a the slots have a spin animation, but I gave up after a few minutes as I couldn’t be really bothered

Very awesomesauce

Changelog

Attachment
0
BnaJns

Shipped this project!

Hours: 11.67
Cookies: 🍪 252
Multiplier: 21.63 cookies/hr

Updated ralseibot to be more awesome. Added bluesky source support to /ralsei, tsradio as the audio source for /radio so I don’t have to store the files in the bot folder, updated the readme banner for a cooler one, and also slight website changes, added Prometheus stats to use with grafana, switched from node to bun because its better, added some tests using bun:test, bumped all dependencies and got rid of unnecessary ones, added more compliments to /compliment, updated /coin icons, darkworld + spoiler options for /textbox, and added /prophecy to generate a prophecy tile GIF, /deltawiki and /undertalewiki to fetch wiki information via the mediawiki api + parsing html stuff and also updating /randomwiki meanwhile, and more, maybe. Coolest addition is probably the prometheus stats, since I can see that the bot went from 71 servers to 102 servers somehow, didn’t know people were using my bot, and also the most used command in the last 2 weeks is /ralsei at 145 usages. /prophecy could be better but canvas is a pain to use sometimes but I guess it’s close enough. Tests are also cool since I don’t write tests for 99% of stuff but Bun makes it pretty easy to implement. Overall very awesomesauce changes

BnaJns

Prrrrrrrrrroooooooophecy

  • Added /prophecy which lets you generate a prophecy tile GIF, not perfect but whatever
  • Added a darkworld border option + spoiler image option to /textbox
  • I forgor to add updatecount for member count as a loop so i fixed that
    Pretty awesome
Attachment
Attachment
0
BnaJns

devlogging this only now cause I never planned to submit this to flavortown
Alright so ~11 hours, that’s a lot of time, what did I achieve in that timeline? Imma break it down to the best of my memory:

  1. Initial stuff, setting everything up, go mod init yadayada. Why go with Go (no pun intended)? Because it’s a very cool and easy to learn language, I barely have experience btw, yet writing stuff is simple, also has a powerful standard library, and it’s basically if Python was a good language. And if I was making a golang YSWS, and didn’t write the site in golang, that’d be a missed opportunity. And why the name “Go Ship!”? Google the card game “Go Fish”. Also, was originally going to use a makefile, but on windows it was a pain, so I discovered taskfile instead, which is also written in Go, and it’s way more awesomesauce than makefile imo.

  2. Started building the HTML/CSS and stuff, I’m way too used to react and tailwind so this was a bit slow for me, I could’ve used the tailwind play CDN , but, the IDE wouldn’t autosuggest the classes and stuff then, so I just decided to stick to good old plain HTML+CSS+JS, and it wasn’t that bad. And then I also worked on the RSVP functionality. Fillout? LAME. Using hack club identity? Awesomesauce. Sqlite, Identity, boom, you got a good clean minimal RSVP database, and I can also expand it to support logins as well in the future, technically it already does that with cookies, but it probably needs to be more secure and advanced. No SQLi or anything in there, yet, but still. Basically how the auth/rsvp works is the RSVP button links to hack club auth, user authenticates, gets sent back to callback link, Go grabs the params from the callback request, sends tokens and stuff to HCA, HCA sends response back with more tokens, Go verifies the legitimacy with public keys and JWT to make sure the response is legit, if everything matches, fetch user data from userinfo endpoint with the given user token, save info to the DB and create a session, give the cookie to the user (so they can see they’ve already RSVPed on their browser), 5 big booms.

  3. Was basically finished at this point, according to commits, added a few waves to the HTML, also wrote a test cause tests are cool when the orange dot turns to green dot instead of red dot in github, messing around with github actions to setup stuff properly from builds to tests, added a .env.example along with a port option (cause 3000 was already taken on my homelab), added responsiveness to mobile, opengraph for cool embeds on slack/discord, github commit id to the footer because it’s cool, not very useful but cool. Finished stuff up with a potential prizes carousel, and a /stats endpoint which just shows the RSVP count and the binary uptime, the /stats is not used anywhere, yet, but still.

  4. Getting up hosted on goship.dino.icu was a bit complicated, since I could’ve just hosted it on goship.bnajns.dev, used CF tunnels called it a day but I wanted to make sure it was on dino.icu, which doesn’t really work with cross-account tunnels afaik, so what I did instead was spin up a free azure VM, install FRP on that and my homelab, did configuring, and used that as a proxy instead, and it works fine.

And that’s pretty much it, I also had the idea to use ai.hackclub.com to make a project idea generator since I saw that idea being used in a few other places, so I’ll add that soon, and also guides, I’ll need to write those as well.

Attachment
Attachment
0
BnaJns

Added a few things all around

  • Got rid of dotenv, Bun loads .env automatically anyways
  • Fixed CI, I was stupid and forgot to add bluesky to sources.yaml.example
  • More prometheus stats for analyzing stuff
  • Refactored randomwiki by adding a randomwikiUrl function to the wiki lib, and standardized it to use the exact same embed as the other wiki commands
  • Updated commands.md (shoutout claude)
  • I was gonna replace the compliments in compliments.ts with an external api, but cancelled that idea and instead replaced some ofthe current compliments which weren’t really even that good, with better fitting up-to-date cringy compliments.
  • Redesigned the coinflip emoji icons to be a consistent shape instead of one being a square and the other being a rectangle
  • Decided to keep express for now cause I cba to switch over to Bun and tbf it’s probably unnecessary it’s not like express takes 500mb

Stuff still left to do:

  • Fix the twitter source by using Nitter instead, and that’s it I think
Attachment
Attachment
Attachment
0
BnaJns

5 big booms, boom, boom, boom, boom, BOOM
Added /deltawiki and /undertalewiki using deltarune.wiki and undertale.wiki mediawiki apis and the Bun HTMLRewriter constructor. Fortunately, these both run on mediawiki, with the same stuff, so it only needed one file for both commands to work properly and parse stuff. Pretty basic stuff, gets the title, link, thumbnail, description, and some fields if they exist, throws those in a embed, and boom. Also wrote a test for it, both undertale/deltarune.wikis are tested, cause testing is awesomecsauce, and ofc it passes.
Also upgraded all dependencies, again, to latest major version this time.

Stuff to do:

  • Remove dotenv, in favor of Bun.env, cause dotenv is not necessary cause Bun exists, and also I don’t like the advertising on startup.
  • Remove express in favor of Bun’s HTTP server, the less dependencies, the better.
  • Maybe get rid of ffmpeg-static and instruct users to just install ffmpeg systemwide?
  • Turn more commands into a embed rather than raw text cause embeds are beautiful and cooler
  • Add prometheus statistics for website visits
  • That’s all I got in mind right now
Attachment
Attachment
0
BnaJns

There’s this really annoying bug that I might’ve spent too long diagnosing. Basically, if the bot is in a VC with another person, and someone disconnects the bot via the discord menu, the bot leaves fine. BUT, if the bot is alone in the VC, and someone disconnects the bot, the bot does not leave, it instantly rejoins, BUT, /radio stop still works fine. What kind of dark magic is this? I don’t know. But I pretty much fixed it by never letting the bot be alone in the VC, by instead doing event-driven checks, rather than when the current song ended, so whenever someone joins/leaves VC, it checks the VC member count, if the bot is alone, adios. Also added tsradio support, because it gives me a reason to use my other projects, and also, so that I don’t have to upload mp3’s to different services, let alone git, which would be bad for the git size. Summarizing, vc bug, fixed bug with member count checks on join/leave, added tsradio support, while keeping file support, that’s it. Also fixed a disconnect race condition where the message would be sent multiple times. Awesomesauce.

Attachment
0
BnaJns

Finished adding prom-client, and cooked up a grafana dashboard which is tuff. I did not not know that my bot is in a whopping 71 server so thats kinda crazy. Was this necessary? No. Is it very cool? Totally. Next up I could probably add sharding, even though the bot doesn’t need it yet, still 2429 servers away, but still, futureproofing fr. There was also this annoying bug, which was my fault, but I blame it on the IDE, which was me using import path from “path/win32”, not “node:path”, so when I deployed it on my Fedora server, you can guess what happened, the /ralsei bluesky handler kept failing. I thought it was a Bun fault, it was indeed not. For the next stuff I have in mind, I could probably add a /wiki command to fetch info from deltarune.wiki, and then display it in a short way in an embed, cause rn there’s only /random-wiki, but I’ll take a look around on what other unnecessary but very badass features I can add. Actually, I was just testing the radio, for some reason when the bot gets manually disconnected, it refuses to leave, which is rude, so I gotta fix that, no idea why that’s happening

Attachment
0
BnaJns

Small changes before I work on something big

  • Replaced the hero/banner with a new and cooler one
  • Moved statuses.json into statutes.ts, added git hash status
  • Fixed /random-wiki hopefully
  • Planning to add Prometheus for command/latency/etc analytics tracking via Grafana so that my dashboard doesn’t look empty
Attachment
Attachment
0
BnaJns

The sky is blue

  • Added a BlueSky handler/source to yaml
  • Migrated existing twitter test to a Bun test with proper expects, and wrote a very cool test for Bsky as well
  • The twitter (aka X) test fails 100% of the time because X is evil and they charge a lot of money for the API and playwright doesnt seem to be working
  • TODO: switch from playwright using x.com to nitter.net i think that might work
  • Uses @atproto/api because I cba to handle with curl and auth errors
  • Got rid of the YAML package and just used Bun.YAML.Parse instead
Attachment
Attachment
0
BnaJns

Out of nowhere, I remembered I made this project a while ago, and apparently according to logs random people are actually using it, so this deserves a good refactor and cleanup.
What I did so far was switching from npm/node to Bun, cause Bun is very awesome and faster and better overall. Also setup dependabot monthly alerts so that the dependencies dont gather dust, and after that, which was kind of a pain was refactoring motivational-quote.ts which took me way too long. I started by changing the drawn image from stretching to the square constraints, rather to just fit and the remainders get clipped, and then I changed out the font for deltarune.ttf, which was the pain point. I spent a good few minutes debugging this until a github issue at https://github.com/Automattic/node-canvas/issues/2285 figured out the issue was not having the font installed on the system, which is kinda stupid, why use the .ttf if it needs the font installed. Anyways that’s all for now, next up I’m probably gonna refactor the entire /ralsei command to use better sources, deprecate reddit as a source, maybe add bluesky or whatever, and etc. I’m also probably gonna remake the banner cause the current one just uses art I found on twitter, and it could be better.

Attachment
0
BnaJns

Blowing the dust off this project and starting to refactor stuff, i was gonna start with refactoring from sqlite3 to better-sqlite3 but honestly im prolly just gonna move to drizzle probably even though I’ve never tried it, prisma would be safer but it’s too bulky I hate their ads and whatever they sell, but anyways for now I just started with migrating from npm i to bun i, and i gotta start figuring out the rest of the stuff. I wonder why last.fm is called last.fm and not last.am, anyways I gotta refactor a bunch of stuff in the bot, especially move from sqlite to drizzle or something, because of the 500 dependabot alerts caused by the npm sqlite package, cause it’s unmaintained, for a whole 3 years now. Some other things I gotta do is refactor to typescript because javascript yellow looks ugly and typescript blue is very cool, and other than that I don’t have any bright ideas other than adding automatic slack status updates to show what you’re listening to, while slick stats already has last.fm support, it doesn’t have customizability afaik and I want slack.fm to be fully customizable to your needs. I should probably make a new logo as well because I hate the current logo it looks ugly and uhhhhhhh maybe cleanup readme of unnecessary clutter nobody needs to see env variables in the readme when they’re in .env.examples anyways. Switching from npm to bun because bun is also cool and easier to use and mmmmmm it’s awesomesauce i hated it and then i loved it. Also the bot is finally back, online, since I got a azure server using the student pack, because nest is still dead, and I don’t expect it to come back up anytime soon unfortunately, and the data that was on Nest, gone adios never will be seeing it again, most likely. That’s all shoutout to Rick Ross Teflon Don

Attachment
0