Behind the Curtain
Added 2019-02-09 14:27:54 +0000 UTCIt’s been a long and somewhat unproductive month for THP. Sometimes things are like that, sometimes it can’t be helped. Still, there were a few things I had in mind that needed doing. It took me a while to work out what to prioritize, but I ended up doing some less-obvious work.
For a while now, I’ve been meaning to modernize the management page that’s used to moderate THP. Over the years I’ve added a new feature or two or tweaked a bit but the overall appearance and layout has remained unchanged for over a decade. High up on the list: removing the iframes from the design. While they’ll always be dear to my heart, they’re ass when you need to deliver content to various screen sizes (say, a high res desktop and a smartphone). So they had to go to create a more consistent experience.
That’s easier said than done when you consider that the management page has all sorts of dynamic content that’s outputted depending on who you are and what you want to do. For example, if you’re logged in as a mod (and not an admin), you’re shown different things and there’s server-side checks that need to happen. So, in short, getting rid of iframes meant that I had to consolidate a lot of code that each ran in a different frame. Add to that things like each frame having different style sheets and it quickly adds together.


Before and after on my local test machine. Subtle, innit?
As with everything else on the site, nothing exists in a vacuum. When doing any sort of work I have to play detective, seeing what other parts of the program may be using files/functions I’m editing. The original contributors to the board software recycled some of the CSS across things that didn’t necessarily make much sense. Something like sitemenu_futaba.css would be used on both management pages and on error pages, with a lot of the rules applying to only one rather than both. No idea why they didn’t choose to compartmentalize to make maintenance easier but this was part of the work I had to do. I spent a lot of time deleting, creating new files and touching up things on other areas of the site that had little to do with the management portion of it.
All in all, about 44 files were affected with hundreds of insertions and deletions in the various commits. A sizeable portion was code being moved around and only a line or two being tweaked. Some of it were superfluous files and functions getting outright pruned (like certain CSS files that were no longer used). But plenty was new original code. In terms of raw numbers, it’s one of the biggest code changes to the site. Thankfully though, it wasn’t that labor-intensive compared to things like user scripts, but it still ended up taking several days of my undivided attention.
While I have a lot I want to do in the future with the management features of the site, I’ll likely pivot away from any large changes to the management side of things for a while. The reason? I’m mostly the only one that uses those things and they’d mostly be quality of life changes. I can live with some inefficiency since the need for changing boards or moderating isn’t that common on THP. There are new features I have slated but those have to wait until some other systems are in place.
I am pretty satisfied that I managed to fix no-read bans, though. As the name implies, it’s a kind of ban that forbids the user from seeing content on the boards. They had been broken for years, as they relied on htaccess files and those are finicky and not really supported by web servers other than apache. Their use was another relic of the bygone era when Kusaba X was designed.
My solution was a little hacky but it’s reliable. It needed some messing around with code relevant to bans, including the complete rewrite of the code that used to generate .htaccess files, as well as some modules on the web server. Additionally, just messing around with that revealed some longstanding bugs with how bans worked. Some were repeated in the database, never clearing properly when they expired. Others were there from mass bans when we had a few really bad spam incidents in the past. There was missing information for some of them that made them invalid. Unfortunately, this required manual intervention and I had to clear several dozen repeated or invalid bans. While there’s something strangely nostalgic and comforting at looking at old bans, the important takeaway is that these database/software problems are unlikely to happen in the future now.
If you’ve made it this far, your eyes must be glazing over. Sorry about that! Here’s something slightly more fun: there’s a new favicon for THP! It should be more than double the resolution of the old one for browsers and it should also look decentish on mobile devices. It’s a minor thing but, hey, polish is polish.
I’m omitting (and probably forgetting, also) other less-obvious-and-not-very-exciting things but I think I’ve covered the spirit and scope of some of the recent work on THP. I haven’t decided what I’ll be doing next though I have about two or three things that are on my shortlist that are high-priority. All three of them are related to stories, so when any one of them are done, it should a little more obvious.
Until next time, take it easy!
Comments
👀
Touhou-Project.com
2019-02-10 12:02:56 +0000 UTCDon't think I didn't see what you did there in that image.
Benjamin Oist
2019-02-10 02:25:34 +0000 UTC