StartHere

This is the WikiWiki based documentation system for the Wakaba and Kareha scripts. You can read the information available about the two scripts here:

Outside contribution is appreciated, either by simply writing entries for the documentation, or discussing what needs to be added. I'd also like to have a JapaneseDocumentation, since some of the scripts do have a JapaneseVersion.

This documentation wiki is based on Jeremy Ruston's TiddlyWiki. If you want to play around, do it in the SandBox. If you want to really mess around with this kind of WikiWiki, go to http://wakaba.c3.cx/docs/test.html, which is the test page. Feel free to go crazy in there.

NiChannel

NiChannel, or 2ch, is a huge Japanese message board. It is by all measures the center of the internet in Japan.

http://www.2ch.net/

There is a translated menu of 2ch boards at http://4-ch.net/2chportal/

KarehaRequirements

Kareha is very light on requirements. It only needs a Perl installation. 5.6 or 5.8 should work fine, 5.005 or older might work. It also needs to be able to write to its own directory. See SettingPermissions.

WakabaRequirements

Wakaba will run on fairly old versions of Perl, but may lack some features. For best performance, run it on Perl 5.8.0 and up. It has been tested on versions down to 5.005 or so.

First and foremost, Wakaba requires a database backend. It has been designed to support mysql and SQLite. You will need to install the appropriate DBD driver for whichever one you pick. See MysqlDatabase or SQLiteDatabase for more information.

Thumbnailing is done either with ImageMagick or NetPBM. At least one of these is often installed on Unix machines.

It also needs to be able to write to its own directory, and its subdirectories. See SettingPermissions for more information.

The following are optional:

MD5 checksumming requires Digest::MD5 package. Digest::MD5 is included with newer Perl distributions, or can be obtained from CPAN for older ones. Wakaba can also try to calculate MD5 checksums using the external 'md5sum' program.

CharacterSetConversion requires Perl 5.8.0 to work.

SecretString

This string is used to secure various features in the scripts, such as SecureTripCodes, SecureIdCodes, and the VeriCodes and EncryptedLogFile in KarehaScript.

It should be a long and randomized string. Ten characters at the very least, and preferably twenty or thirty. It should also not be revealed to anyone.

See WakabaConfig or KarehaConfig for information about setting it.

JapaneseVersion

There is a japanese version of Wakaba. It is, however, somewhat neglected and all strings have not been properly translated. To use it, change the "strings_en.pl" at the top of the script to "strings_jp.pl". The strings_jp.pl file is in the extras/ directory. There are also translated version of rules.html available in extras/include/.

Kareha also has a japanese translation. To use it, copy templates_jp.pl from the extras/ directory, and change the "templates.pl" line at the top of the script to "templates_jp.pl". Also make sure to run the script with the Shift_JIS character set.

I'd love some help with bringing these up to date and fixing any mistakes.

WakabaFeatures

Above the basic functionality of FutabaScript, Wakaba offers these features (and more):

  • ImageReplies - You can post images as replies in threads.
  • VeriCodes - Protection against spamming scripts.
  • OekakiIntegration - Wakaba integrates with Oekaki applets to let users draw pictures and post them on the board automatically.
  • StyleSheetSwitcher - Let users switch between multiple board looks.
  • ExternalFileTypes - Allow files other than images to be posted to the board, and show icons for them.
  • WakabaMark - Lets users use simple text formatting in their posts, without the horrible BBcode syntax.
  • JapaneseVersion, GermanVersion - There are translations for all text in the script, and switching between them is easy.
  • SecureTripCodes - Tripcodes that are not vulnerable to BruteForceAttack.
  • CharacterSetConversion - Flexible handling of character sets.
  • AntiSpam - There is a database of URL posted by spammers on image boards, and Wakaba will reject any posts that contain these.
  • Various usability improvements, such as clickable post numbers and cookies for remembering user names.
  • Pedantically correct WellFormedXHTML. Wakaba can (and will, unless you disable this) send its output as application/xhtml xml whenever possible.

BruteForceAttack

A brute-force attack is done by testing all combinations of letters, or checking a dictionary of words, to see what tripcode they generate. If your tripcode is fairly short and simple, such an attack can reveal it.

SecureTripCodes are immune against this sort of attack.

KarehaFeatures

Kareha offers, beyond the basic message board functionality, these and other features:

  • MultipleBoardModes - can act as a message board or image board depending on configuration.
  • CSS-based layout, with pedantically correct WellFormedXHTML code.
  • WakabaMark - Lets users use simple text formatting in their posts, without the horrible BBcode syntax.
  • SecureTripCodes - Tripcodes that are not vulnerable to BruteForceAttack.
  • VeriCodes - Protection against spamming scripts.
  • PermaSage - Permanently sink threads without stopping posting to them.
  • ForcedAnonymousPosting - Turn off the ability to post with a name entirely, to curtail drama and attention whoring.
  • SillyNames - Make up silly names for people posting without a name.
  • JapaneseVersion - There are translations for all text in the script, based on the NiChannel phrasings.
  • AntiSpam - There is a database of URL posted by spammers on image boards, and Wakaba will reject any posts that contain these.

WakabaMark

WakabaMark is a very simple markup code for doing simple formatting of posts. It's designed to be intuitive to use, and look good even when not parsed. It is heavily inspired by MarkDown.

The basic features are as follows:

  • Surround text with * or _ to make <em> tags. _Like this_ or *like this*. This makes the text italic.
  • Surround text with ** or __ to make <strong> tags. This makes the text bold.
  • Make an unordered HTML list by beginning each line with *, or -. You can add line breaks in list entries by breaking the line and indenting the next line with one or more spaces.
  • Make ordered HTML lists by beginning the first line with "1.", and the following lines with further numbers. It actually doesn't matter what numbers you use, as long as the first one is 1.
  • Make <blockquote> sections by beginning each line with ">".
  • Make <code> sections by indenting each line by four spaces or one tab. Code sections get shown in a monospaced font, and are not otherwise formatted.
  • Make short spans of code in normal text by enclosing the code in backticks, `like so` . To display code that contains backticks, use several backticks to surround it, ``like so`` .
  • Make external links by just typing the URL you want to link to. Post references like >>1 are also automatically turned into links.

Do no leave empty lines in the middle of lists or quoted blocks, as this turns them into separate blocks.

Note: There's a small bug in the wiki code that'll hit if you try to edit this entry, so don't. I'll remove this notice when it's fixed.

OekakiIntegration

Oekaki are Java applets for doing quick drawing on the net. Wakaba can be integrated with an Oekaki applet to allow people to draw images that are then uploaded directly to the board.

The applet supported at the moment is Shi Painter: http://hp.vector.co.jp/authors/VA016309/spainter/index_en.html
Adding support for other applets should be fairly easy.

To enable oekaki support, you need to get the spainter_all.jar file from the Shi Painter distribution on the site linked above. If you want the "Palette Selfy" palette editor, you need the palette_selfy.js file too, which can be found here: http://babu.jp/~useyan/s/relm/palette_selfy.html

Then, copy all the oekaki files from the extras/ directory, and also the finish.pl, paint.pl and getpic.pl scripts. The last three scripts need to be set up to run as CGI scripts in the same way as wakaba.pl (as usual, see RunningPerlScripts).

Edit oekaki_config.pl to suit your needs, and especially remember to configure the URL for where your image board lives. See OekakiConfig.

Finally, edit wakaba.pl and change the line that contains "futaba_style.pl" near the top to say "oekaki_style.pl" instead, and then RebuildCaches.

Oekaki painting should now work. If it doesn't, see OekakiTroubleshooting, or post on the DiscussionBoard.

KarehaQuickStart

  1. Make sure your web server is set up for RunningPerlScripts.
  2. Unpack the files from the Kareha distribution.
  3. Choose which of the MultipleBoardModes you want to use, and copy the files from the appropriate mode_*/ directory.
  4. Make sure the permissions are set correctly on the scripts and directories. See SettingPermissions.
  5. Edit config.pl to your liking. At the very least, set up the AdminPassword and the SecretString.
  6. Access kareha.pl through a web browser. This should create the HTML pages and forward you to them if everything worked.

If this didn't work, check out the KarehaTroubleShooting section, or ask for help on the DiscussionBoard.

TripCodes

Tripcodes are used as a proof of identity, while still remaining anonymous. If you enter your name as Name#tripcode, it will be shown as Name!3GqYIJ3Obs, the idea being that only you know the code word used to generate the tripcode.

However, the tripcode algorithm is well known, and it is fairly easy to perform a BruteForceAttack on it to find out someone's code. Therefore, tripcodes are more of a token than a guarantee.

To address this problem, Wakaba, Kareha and the documentation wiki all support SecureTripCodes.

WakabaQuickStart

  1. Make sure your web server is set up for RunningPerlScripts.
  2. Set up a database. See MysqlDatabase or SQLiteDatabase.
  3. Make sure you have a thumbnailer installed. See ImageMagick or NetPBM.
  4. Make sure the permissions are set correctly on the scripts and directories. See SettingPermissions.
  5. Edit config.pl to your liking. At the very least, set up the database settings, the AdminPassword and the SecretString. See WakabaConfig.
  6. Access wakaba.pl through a web browser. This should create the HTML pages and forward you to them if everything worked.

If this didn't work, check out the WakabaTroubleShooting section, or ask for help on the DiscussionBoard.

SQLiteDatabase

The SQLite database is completely self-contained, and only needs the DBD::SQLite database driver module for Perl. This can be found at http://search.cpan.org/~msergeant/DBD-SQLite-1.07/ . ActivePerl users should be able to find it with the package manager.

You do not need any kind of database server to use SQLite. Instead of databases on a server, it uses plain files for each database. These are set up automatically. The filename is specified by the SQL_DBI_SOURCE config option. Usually this option will be set to something like:

use constant SQL_DBI_SOURCE => 'dbi:SQLite:dbname=wakaba.sql';

Which will put the database into the file "wakaba.sql". It is strongly recommended that you either put this file somewhere where the web server can't see it, or block access to it through the web server, because it contains IP addresses of posters that you do not want people to be able to download. The example.htaccess file included with the script shows you how to do this.

The SQL_USERNAME and SQL_PASSWORD fields can be left blank.

More information on SQLite can be found at http://www.sqlite.org/.

UsingSage

"sage" is a way to reply to a thread without bumping it to the top of the thread list or the top of the board's first page.

To sage, write "sage" in the e-mail/link box.

RunningPerlScripts

Getting Apache to run Perl scripts is sometimes a bit tricky. The short version is: Make sure the script has the correct execute bits set, make sure the HashBang at the start of the script is correct, and make sure that your web server configuration is correct. You'll probably need these lines in the Apache configuration file (httpd.conf):

Options +ExecCGI
AddHandler cgi-handler .cgi .pl

If you are lucky, all of this has been done for you.

To make sure the script has the execute bits set, set its permissions to 755. The SettingPermissions section may have some more information. This is not necessary when RunningOnWindows.

A guide to configuring Apache to run CGI scripts under Windows (some of it applies to Unix servers, too) can be found here:
http://www.thesitewizard.com/archive/addcgitoapache.shtml

There is a discussion board thread related to Internal Server Errors: http://wakaba.c3.cx/sup/kareha.pl/1109033191

KarehaScript

Kareha is a very customizable board script. It can operate as the sort of message board scripts used on japanese sites like NiChannel, or as an image board like FutabaChannel (or WakabaScript). See MultipleBoardModes for more information. It uses modern structured XHTML and CSS layout. It does not require a database backend.

I claim no copyright on Kareha. It is released into the public domain.

TroubleShooting

If the web server only shows the Perl source code and doesn't run the script, your web server is not set up to run CGI scripts. See RunningPerlScripts for more information.

  • One common problem that can make the script give an "Internal Error" is an incorrect HashBang. Another is not having the execute bits set on the script. RunningPerlScripts contains useful information about this. Also see the DiscussionBoard thread related to this: http://wakaba.c3.cx/sup/kareha.pl/1109033191
  • If you're getting "Can't write to directory" errors, you need to set up the permissions for the directories, or create them if they do not exist. See SettingPermissions.
  • If you've changed the script settings, or especially if you've moved the script to a new location, you need to RebuildCaches.
  • If you get "not well-formed" or other XML-related errors in Firefox, this means any HTML code you have added is not WellFormedXHTML. You either need to fix your code, or tell the script and web server not to send the pages as application/xhtml xml. Do this in your .htaccess file, and with the USE_XHTML option (see WakabaConfig and KarehaConfig).
  • If you are trying to run on a Windows server, see RunningOnWindows. If you are having problems getting the thumbnailer to work under Windows, make sure you are using the static version of ImageMagick and not the DLL version.
  • If you are brave enough to try and run on IIS, see RunningOnIIS.

VeriCodes

Verification codes are a form of captcha (http://www.captcha.net/ for more information) that are used to prevent scripts from posting on the boards. Both scripts support them as an option. They work by presenting the user with an image of a scribbled word, and asking them to type it in. Spamming scripts will have great difficulty parsing the image, and thus won't be able to fill your board with garbage.

To enable verification codes, set ENABLE_CAPTCHA to 1 in config.pl. See WakabaConfig or KarehaConfig for more information.

Trivia: The verification codes are generated by a ContextFreeGrammar that creates words that look vaguely like English.

KarehaConfig

Configuring Kareha is fairly easy. Open config.pl in a text editor and change whatever options you want to change, and remove the '#' character from the beginning of any lines you change.

Here is a list of all the config.pl options for Kareha with descriptions and their default values (WARNING: This list is quite outdated):

ADMIN_PASS - AdminPassword, must be changed
SECRET - SecretString, must be changed
ADMIN_TRIPS () - Admin tripcodes

TITLE ('Kareha message board') - Name of the board
THREADS_DISPLAYED (10) - Maximum number of threads shown on the main page
THREADS_LISTED (40) - Maximum umber of threads shown in the thread list
REPLIES_PER_THREAD (10) - Maximum number of replies shown in each thread on the main page
S_ANONAME ('Anonymous') - Name to use when the name field is blank
DEFAULT_STYLE ('Headline') - Default stylesheet to use

ALLOW_TEXT_THREADS (1) - Allow posting of new threads by all users (only users with Admin tripcodes are allowed to post new threads if this is 0)
ALLOW_TEXT_REPLIES (1) - Allow posting of replies by all users (only users with Admin tripcodes are allowed to post replies if this is 0)
ALLOW_IMAGE_THREADS (0) - does nothing
ALLOW_IMAGE_REPLIES (0) - does nothing
MAX_RES (1000) - Maximum number of times a thread can be bumped
MAX_THREADS (500) - Maximum number of threads
MAX_FIELD_LENGTH (100) - Maximum length of subject, name, and email fields
MAX_COMMENT_LENGTH (8192) - Maximum post length
MAX_LINES - Maximum number of lines per post
MAX_LINES_SHOWN (15) - Maximum number of lines of a post shown on the main page
MAX_KEY_LOG (1000) - Number of captcha keys to log

ENABLE_CAPTCHA (0) - Enable (1) or disable (0) VeriCodes
CAPTCHA_HEIGHT (18) -
CAPTCHA_SCRIBBLE (0.2) -
CAPTCHA_SCALING (0.15) -
CAPTCHA_ROTATION (0.3) -
CAPTCHA_SPACING (2.5) -

CHARSET ('utf-8') - Character set to use
PROXY_CHECK () - Ports to scan for proxies, NOT IMPLEMENTED
TRIM_METHOD (1) - Which threads to trim (when MAX_THREADS is reached), 0: oldest, 1: least active (furthest back)
DATE_STYLE ('2ch') - Date style: '2ch', 'localtime' , or 'http'
DISPLAY_ID (1) - Display user IDs: 0: never, 1: if no email, 2: always
EMAIL_ID ('Heaven') - ID string to use when DISPLAY_ID is 1 and the user uses an email
SILLY_ANONYMOUS (0) - Enable (1) or disable (0) SillyNames
FORCED_ANON (0) - Enable (1) or disable (0) ForcedAnonymousPosting
TRIPKEY ('!') - Character to display before tripcodes
ALTERNATE_REDIRECT (0) - Use alternate redirect method (javascript/meta-refresh instead of HTTP forwards)
ENABLE_WAKABAMARK (1) - Enable (1) or disable (0) WakabaMark formatting
APPROX_LINE_LENGTH (150) - Approximate line lenght used by reply abbreviation code to guess at the length of a reply
COOKIE_PATH ('root') - Path argument for cookies: 'root': cookies apply to all boards on the site, 'current': cookies apply to only this board, 'parent': cookies apply to all boards in the parent directory; does NOT apply to the style cookie
STYLE_COOKIE ('karehastyle') - Cookie name for the style selector
ENABLE_DELETION (1) - Enable (1) or disable (0) user deletion of posts

RES_DIR ('res/') - Reply cache directory
HTML_SELF ('index.html') - Main html file
HTML_BACKLOG ('subback.html') - Backlog HTML file
RSS_FILE ('index.rss') - RSS file, set to '' to disable RSS
CSS_DIR ('css/') - CSS file directory
PAGE_EXT ('.html') - Extension to use for thread pages
SPAM_FILE ('spam.txt') - Spam definitions

StorageBackend

TiddlyWiki doesn't normally have any way to save edits for others to see. This modified version talks to a very simple Perl script that makes changes directly in the HTML file on the server, and keeps backups of older versions. A quick and undocumented release of the code can be found here: http://wakaba.c3.cx/releases/other/kozakana2.pl

If you want to test out TiddlyWiki and the backend, do it on http://wakaba.c3.cx/docs/test.html, where anything goes.

QuotingPosts

To quote a certain passage of text, you only need to append a single angle bracket followed by a single space in front of it:

> This is the quoted text. Both KarehaScript and WakabaScript,
> as well as the FutabaScript and the FutallabyScript
> automatically turn this into a different colour than normal
> text.

To refer to a certain post in a thread, either click on the number of the post (if you have JavaScript enabled) or manually write out the number and append two angle brackets in front of it:

>>2

This will automatically create a link to the post you refer to, making it easier to follow points of reference and structure discussions. Just as the quoting of text in the above mentioned manner, this is a very common practice on all FutabaChannel and NiChannel offshoots.

DeletingPosts

At the bottom of each page in Wakaba, there is a Delete button. Next to it, there's a password field. If you haven't set an individual password, Wakaba will already have set a password for you that is saved in your cookie*. Check the box next to your name for the post(s) you want to delete, and check the File Only box above the Delete button if you only want to delete your images. Then click the Delete Button for great justice!

*NOTE: This requires your JavaScript & cookies to be turned on. Also, if Firefox asks you whether the password should be remembered, tell it to "Never remember it for this site"!

 Click here!
 ↓
┌──────────────────────────────────────────────
│☐ Anonymous 05/02/18(Fri)07:50 No.1992 [Reply]

│ This is a stupid post. I should delete it.
└──────────────────────────────────────────────

────────✂────────✂────────✂────────✂────────
         Delete Post [ ☐ File Only]
      Password [********______] [ Delete ]
                    ↑
                 Then click here!

WakabaScript

Wakaba is an image board script very strictly modelled after the FutabaScript and FutallabyScript.

I claim no copyright on Wakaba. It is released into the public domain.

SandBox

Sand goes here.

NonAccentedCharacterNode

AccentedFôo doesn't work, no [alternative markup] for links in WakabaMark?

No, I haven't gotten around to making non-wikicased links yet. Still pondering how to handle various exotic charaters in those. Also, I suppose I should explicitly set the character set in the HTML file for those browsers that get confused otherwise...

Actually, my mistake, there was a problem with the encoding when saving... NOW accented characters should work, except not in tiddler names.

AdminPassword

The admin password is used to access the administrative interfaces of KarehaScript and WakabaScript. See KarehaAdministration and WakabaAdministration for more information.

TiddlyWiki

TiddlyWiki is an unorthodox WikiWiki system written by Jeremy Ruston. It is entirely Javascript-based, and self-contained in a single HTML file. It lives at http://www.tiddlywiki.com/.

This documentation uses a heavily modified version of TiddlyWiki with a minimalist StorageBackend wirtten in Perl.

UsersGuide

Here is a quick guide to some of the more strange and mystifying parts of using these board scripts.

There are no doubt more things that could be explained. Feel free to suggest some, or just write about them.

DocumentationChanges

So, I've changed the documentation over to a new, highly customized and re-written version of TiddlyWiki. Some changes are:

  • WakabaMark
  • Names and TripCodes
  • Non-JavaScript readability
  • More sidebar modes (timeline, link tracking)
  • Slightly improved communication with the backend

I'll be re-writing some parts of the documentation too, and maybe even adding some of the missing parts.

Report any problems and bugs on the DiscussionBoard!

ImageReplies

It is considered polite to not post lots of new threads with a single image in each, but instead to collect them in threads. After clicking the reply link in a thread, you can select an image in the same way as when creating a new thread, and it will be posted as a reply.

Unlike certain other sites, there are no limits to how many images you can post in a thread.

AntiSpam

WakabaScript and KarehaScript both read a file called spam.txt to find a list of URLs that are not allowed to be posted on the board. You can find fresh versions of this file at http://wakaba.c3.cx/antispam/.

SecretFeatures

Wakaba and Kareha have a couple of hidden options and features. Can you find them?

WellFormedXHTML

Well-formed XHTML code is HTML written as proper XML. This means that all tags have to be closed. This means you either have to use <tag>...</tag> pairs, or the <tag /> shorthand. The character & is also not allowed, but has to be written as &amp;. Furthermore, all tags and attributes have to be in lower case, and all attribute values properly quoted with double or single quotes.

If pages are sent as application/xhtml xml instead of text/html, many browser will require you to follow these rules strictly, or they will not display the page.

MultipleBoardModes

The workings of the KarehaScript are determined to quite a large extent by the templates.pl and config_defaults.pl files. After unpacking the distribution archive, you will need to copy these (and possibly other files) from one of the mode_*/ directories into the main directory. This will determine how the board behaves. You can not change this behviour later for the same install.