Skip to content

Releases: karai17/lapis-chan

Lapis-chan v1.2.5 - Random Numbers!

30 Nov 00:43
Compare
Choose a tag to compare

So to start off on this, I need to talk about math.random. math.random is great when you want a random number. Problem is, it was giving me too many collisions. Let me explain. The way that random seeding works is that you provide Lua with a seed, and using that seed it generates a sequence of random numbers. The problem? I need to reset the seed for each request. Now, why is this a problem? Because I use os.time as my seed. This means that for an entire second, anyone who uploads an image is going to get the exact same timestamp for a file name AND the exact same random number generated from the exact same seed. The whole point of the random number is to stop file name collision, and this would be effectively useless in doing so. Imagine if 4chan's /b/ had a whole second where everyone posting would overwrite files. You would get a lot of collisions.

For my first attempt at solving this, I did an extremely hacky thing. I am not proud of it, but it worked. What I did was I found something that was guaranteed to be unique. In this case, I used the memory address of whatever table I had handy. When I would tostring that table, I'd get something like table: 0xab56d39. Well, that's a hexadecimal number with some text prepended to it. So what I did was strip table: and run the remaining text through tonumber to get a decimal number. With that, I'd carve off the last 3 digits and voila! A random number that doesn't collide nearly as often.

But that's insane. This patch changes how all that nonsense works. Now we simply pull 4 bytes out of /dev/urandom, convert them to a uint32_t using LuaJIT's FFI, then snag the last 3 digits from that. Much cleaner, much saner, much better.

Lapis-chan v1.2.4 - Minor Typo

29 Nov 23:10
Compare
Choose a tag to compare

Fixed the nil issue from the last release in thread, too. If you think this being a release is stretching it, I assure you it is. I HAVE MY REASONS!

Lapis-chan v1.2.3 - File Extensions

29 Nov 21:42
Compare
Choose a tag to compare

I improved how file extensions are handled in the code so now cute_kitties.JPG will be detected properly. I changed how all extensions are read to use string.match instead of string.sub, and set the extension to lower case for detection purposes. This allows the code to be a bit cleaner, and even shorter in some places since I was able to merge webm and svg detection in the same if statements.

Lapis-chan v1.2.2 - SVG

29 Nov 02:59
Compare
Choose a tag to compare

Added support for uploading SVG graphics.

Lapis-chan v1.2.1 - Errors No Longer Error!

29 Nov 01:27
Compare
Choose a tag to compare

I am not sure what happened, but somehow I had screwed up the error handling code a long while ago. I've gone ahead and fixed that so now when you do something dumb like try to upload an EXE file, it'll tell you not to do that instead of showing you a stack trace.

I also improved some of the linting in the code. According to vscode, there are still 30ish lint warnings that I need to take care of but I'm not terribly upset by this right now. Some of them I will not be fixing like many of the "unused self" warnings because I use : syntax in my modules even when I don't use the module itself in the function. This is for consistency's sake and I feel like knowing you can safely use : instead of trying to remember when you need to use : or . is worth having the linter yelling at me.

Lapis-chan v1.2.0 - Media Release

28 Nov 02:49
Compare
Choose a tag to compare

This release adds support for WEBM videos which are categorised as images, and MP3, WAV, OGG which are categorised as audio. If a board supports uploading files, you can determine which categories an individual board accepts.

Due to this addition, Lapis-chan now depends on FFMpeg.

Make sure to run $ lapis migrate after updating since there is also a database schema change.

Lapis-chan v1.1.4 - B&!

26 Nov 22:00
Compare
Choose a tag to compare

Fixed a typo that caused a crash when trying to ban a user.

Lapis-chan v1.1.3 - Better Routing

26 Nov 22:00
Compare
Choose a tag to compare

Today I took the time to rewrite how URLs are formatted so that routing is simpler and less prone to failure. This seems to fix a couple issues where the server's port was sometimes being displayed, and cross-board links would sometimes break.

Some other improvements include:

  • Fixing the install script
  • Updated Polish translation
  • Added French translation
  • Added hotdog stand theme

Lapis-chan v1.1.2 - Languages Enabled

28 Jan 16:58
Compare
Choose a tag to compare

Now that we have more than just English, I've gone ahead and turned on the language switcher. Hopefully we'll see more languages rolling in over the next few days!

New Languages

  • polski
  • PHP CEO

Lapish-chan v1.1.1 - Minor Fix

27 Jan 20:01
Compare
Choose a tag to compare

I missed a few spots when I changed a few functions around, reducing the number of arguments. This should remedy that error. Whoops!