Comment System

Blog - Code

The Problem

This site is hosted using Github pages. I chose it because it's free, it integrates with Git, and lets me build the site from scratch with just HTML, CSS and JS. And therin lies the problem - Github pages is only suitable for static content. You cannot use server-side scripting.

This means that if I want to have any kind of dynamic content on this site, I need to either host it elsewhere >:( , or figure out how to let any client modify the site.

At this point, most web developers will be screaming and begging me to reconsider. If any client can update the site, they will all have my Github credentials, and any script kiddie could easily trash it.

The Solution

In order to avoid handing every visitor my Github credentials and saying 'add your comment manually!', I need to use some kind of proxy - a place where anybody can dump their stuff (hopefully comments), and then have it forwarded securely to the site after moderation.

There are a lot of challenges here. First, the proxy has to be accessible to anybody - this immediately makes it open to spam. My solution is a HTML form, in which the can enter a username (optional), a comment (required), and then solve a captcha (required).

'But!', I hear you cry, 'If you're going to add a captcha, why not just use Disqus?'. Good point. I'll do that.