August 31
Hi all, hope you're doing well! Still kinda ill here, has been one heck of a chaotic month, but oh well. Gotten a fair bit done at least ^^
Caching improvements
I’ve modified the backend code so that caching various things (search results, user follow feeds etc) is configurable via a database table, rather than hardcoded. It will be helpful to be able to change those settings without redeploying code when the site is live (as caching when it has few users will give a slow impression when it's not necessary to), and it’s useful for testing where caching gets in the way of seeing new results for new submissions, searches, etc.
Video player design challenges
After getting video resizing and encoding to work correctly, the next problem arose: displaying videos in user galleries, where the title of a user’s submission appears when hovering over it. The standard HTML5 video player has its controls at the bottom, causing the title to partially block out the controls; to solve that, I’ve created customised video controls that sit on the top of the player for videos in galleries.
The video at the start of this post shows the problem (and the customised controls; still a few styling things to polish, and for testing I made it stay on top even when not hovered). As you can see, the title overlay for the submission stops the user from interacting with the normal HTML5 video seek bar; the custom controls solve this problem.
Irritatingly, Patreon's post system doesn't let me put videos inline in the post text, which would make putting them in posts a lot more intuitive to read.
Feed-style gallery options
For users who prefer a more “Twitter/Tumblr” like feed, I’ve added functions to the gallery code so it can render galleries in this format as well (including search results, follow feeds and bookmark galleries). It’ll take some more work, as the feed view should have more information and options in it, so that it’s easier to use for reblogging submissions as you see them and so on. I'll show a preview of it in the next update, as I was too lazy to put an example in the video and it could do with some improvement anyway.
Private message improvements: investigating websockets
While polishing up styling for private messages, I realised that powering them with AJAX really isn’t suitable; it’s inefficient, makes messages slow to update, and would likely cause a lot of server load if people used the feature much. I’ve therefore started to look into using the Websockets API to power them instead.
A major problem with this approach is that PHP, which Deserted Chateau’s backend is largely written in, has very little support for websockets. As a result, I’ve decided to use a separate Node.js server to handle websocket connections. I’ve gotten a Node.js websocket server up and running, and connected to it via HTTPs, but there is a lot more work to do.
Firstly, since the Node server won’t have the user’s session, it’ll need to connect to Redis to retrieve it. Secondly, securing the websocket server is non-trivial, as it needs JWT tokens for secure authentication. I’m progressing on that, and once secure authorisation is done, then I need to sort out each user only getting specific messages from the websocket.
Financial costings and CDN update
While finishing up video upload features, I went to update the financial estimate spreadsheet for Deserted Chateau, to try and account for video bandwidth in the CDN costs.
I haven't finished that yet, but one thing I did realise is that BunnyCDN, like some other CDN providers, has two tiers: 'standard', which is $0.01 per GB, and 'volume', which is half that price but has far fewer network nodes (i.e. it's not as quick to respond to requests, particularly in very outlying regions).
Considering Deserted Chateau is not a time-critical application, and given the heavy cost savings, I've switched the CDN to use the volume nodes. I haven't noticed any change myself, but I imagine most change would be seen in areas far away from the volume nodes like in Oceania.
What I might need to do is separate out videos and images in the backend, in terms of storage; i.e. have one file storage bucket for images and a separate one for videos, so that they can have separate CDNs and use the volume tier only for videos. If nothing else, separating them out will make it trivial to make that decision later, so I probably ought to just do that now so it's easy to change later.