• 2023
  • Jan
  • 23

StatusNet: Cleaning up the main page.

This is the second (and last?) part of my cleaning up StatusNet. This deals with removing some of the main page identifiers. While this isn’t hardening, it obscures the doorway just a bit, and hopefully drive-bys will just look at it as a not very worthwhile target. It also removes links to things that aren’t what they were when the service started, so there’s less chance for a user to click on something that may now lead to a malicious site.

This does remove some of the boilerplate regarding the GNU license status, among other things. While I don’t like to do this, StatusNet is so old that there are probably no new installs happening, as it won’t run on modern PHP. If you’re running this commercially, you may be obligated to leave those license notifications alone, so use your own judgement.

***
Here’s the original assets, and what we’re going to change:

001.png

002.png

The first thing I like to do is get rid of the dead link to status.net, and the link to wikipedia. The first isn’t necessary because status.net is just a garbage page full of SEO grabber links, and the second both because I don’t like some of Wikipedia’s practices and you hopefully know what microblogging is now. The term itself has passed into the legend of Web 1.0, so it’s not even a relevant term these days.

(I assume you’re comfortable with your webserver and know where things are. No warranties are expressed or implied, it’s up to you to make sure you’re doing this right.)

Start by making a copy of websiteroot/actions/public.php, and then open the original for editing. (Always back up your original, just in case!). Move down to the very bottom of the file. You’ll see this:

003.png

And when we’re done, it will look something like this:

009.png

To change the header box in question, edit the ’showAnonymousMessage’ function to say whatever it is you want. Use this as a guide, essentially you’re getting rid of all of the links and creating a static header that shows regardless of the other options chosen for the site. That’s why it’s duplicated in the ‘if’ block.

Since the site in question is TheDoghouse, %%site.name%% will show that, followed by ‘Woof!’ - you don’t have to use the variable here, and you can put anything you want in the block as long as it can be printed. I chose to use a simple message that will show “This is TheDoghouse. Woof!” on the main screen where the description about StatusNet and the service description lived. The variable originally used was left intact for this step.

The next edit is just to reduce clutter. In the block directly above the one we just edited is the sidebar links. I edit those out so, while they still are there, the function to actually print them on the screen is commented out with #. This isn’t necessary and doesn’t really offer anything, it’s just something I like to do. The base skin for statusnet will show the same size box, but other skins will reduce the amount of space used based on how much or little you comment out.

Here’s what it looks like by default:

007.png

This gets rid of the “Popular”, “Groups”, and “Featured” links on the main page. While they are still available, to me and my private site it’s just unusued cruft. So away they go. I didn’t delete them in case I want to re-implement them, the function block simply doesn’t show what has been placed in the variables. Similarly with the site name, I left the if/else case alone so later edits will be less painful if certain functions need to be restored. But that’s why you made the copy, right? You did make a copy, right?

But there’s nothing preventing you from putting whatever you want there. Just replace the variable with whatever you like and let the show function print it for you. (I suggest you check out some basic php stuff before going crazy!)

Save your edits, and check that permissions and owner of public.php are correct. Since you created a copy, it’s probably now root, so change that back to whatever your webserver uses as it’s username. load your site up, and you should see your changes.

004.png

The next, last, and other thing I like to get rid of is the footer, and all of it’s links. This shows up on every page regardless, even the main page. While again, this does contain license information, many of the links are dead and the version number of the service is present. As before, there are probably no new installs happening, so having this information isn’t terribly useful. It exposes things that could make it (ever-so-slightly) easier to probe for entry, so it goes away. Again - this isn’t hardening, it’s simply covering up the door so the curious passer-by hopefully doesn’t see it. The microblogging term stays here, but be careful of your license requirements.

For this, navigate to websiteroot/lib/action.php. Make a copy, and edit the original. Navigate to showStatusNetLicense, and you’ll see this:

005.png

What gets shown is dependent on if you have the “Brought By” line filled out in your config. But I don’t care about that, as before I’ve left the if/else cases alone so they can be reverted easier, if necessary. All of the “runs the” information is gone, as is the license, and the service shows the same information regardless of config options.

010.png

The last thing I like to get rid of is the set of links present at the bottom of every page. My site is private, so some of those are not useful. The rest are dead links, and like the now defunct status.net page, may lead to something unsavory. Those are fairly easy to get rid of, navigate to the showSecondaryNav function in action.php and simply comment out the block.

Here’s the original:

006.png

And my edits:

011.png

Everything is commented out except the first few and last few lines, which give the function something to do when called. Other than that, everything else is ignored.

Save your edits, make sure permissions are correct, and check your site.

008.png

That’s it. Your main page now does not show much information about what this is, other than StatusNet.

Troubleshooting: If you’re having some issues where you are now getting a 500 error, check your permissions. That’s probably going to be the main issue here. Also check that you’ve used the correct syntax in the code, variables are always enclosed with %% %% and lines must end with a semicolon; Beyond that, copy your original file over the edits and try again. I found out by trial and error, so don’t be afraid to play with stuff even if you don’t understand 100% of what it’s doing.

There are a few other things you can do inside the service to remove unwanted things like maps (that don’t work,) but I’ll cover those in a separate article.