Wakaba/Kareha patches (107)

1 Name: Anonymous : 2009-10-22 16:08 ID:0RX4zZms [Del]

Wakaba and Kareha are refreshingly malleable, and I find it surprising that there isn't already a thread for all the "extras" can be patched onto a board, so here goes.

For the record, here are some existing patches on this board:

2 Name: Anonymous : 2009-10-22 16:17 ID:Heaven (Image: 0x0 patch, 2 kb) [Del]

And here's a new one to forever answer the question "what thread was that from?" This patch adds a nifty feature to jump to the thread an image was posted in, by adding /thread at the end of the image's URL. For example:

http://example.com/board/src/1234567890123.jpg/thread

Put this patch in the same directory as wakaba.pl, and apply with patch -p1 < show_thread.patch.

3 Post deleted by user.

4 Name: Anonymous : 2010-01-31 09:40 ID:Ws0iREB1 (Image: 1008x561 png, 24 kb) [Del]

src/1264959653901.png: 1008x561, 24 kb

Sorry for my terrible english, my native language is russian. This is Wakaba patch, added 2 radiobuttons with redirect to thread\board after posting. User choise written to cookie.

Replace in futaba_style.pl string

<if ENABLE_CAPTCHA>

with string

<tr id="trgetback"><td class="postblock">Return to</td> <td><label><input name="gb2" value="board" type="radio" /> board</label> <label><input name="gb2" value="thread" checked="checked" type="radio" /> thread</label> </td></tr>
<if ENABLE_CAPTCHA>

Replace in wakaba.pl

elsif($task eq "post")
{
my $parent=$query->param("parent");

with

elsif($task eq "post")
{
my $parent=$query->param("parent");
my $gb2=$query->param("gb2");

Replace in wakaba.pl

post_stuff($parent,$name,$email,$subject,$comment,$file,$file,$password,$nofile,$captcha,$admin,$no_captcha,$no_format,$postfix);

with

post_stuff($parent,$name,$email,$gb2,$subject,$comment,$file,$file,$password,$nofile,$captcha,$admin,$no_captcha,$no_format,$postfix);

Replace in wakaba.pl

my ($parent,$name,$email,$subject,$comment,$file,$uploadname,$password,$nofile,$captcha,$admin,$no_captcha,$no_format,$postfix)=@_;

with

my ($parent,$name,$email,$gb2,$subject,$comment,$file,$uploadname,$password,$nofile,$captcha,$admin,$no_captcha,$no_format,$postfix)=@_;

Replace in wakaba.pl

# set up cookies
my $c_name=$name;
my $c_email=$email;
my $c_password=$password;

with

# set up cookies
my $c_name=$name;
my $c_email=$email;
my $c_password=$password;
my $c_gb2=$gb2;

Replace in wakaba.pl

make_cookies(name=>$c_name,email=>$c_email,password=>$c_password,

with

make_cookies(name=>$c_name,email=>$c_email,gb2=>$c_gb2,password=>$c_password,

Replace in wakaba.pl

# forward back to the main page
make_http_forward(HTML_SELF,ALTERNATE_REDIRECT);

with

# forward back to the main page
make_http_forward(HTML_SELF,ALTERNATE_REDIRECT) if ($parent eq '0');
make_http_forward(RES_DIR.$parent.PAGE_EXT,ALTERNATE_REDIRECT) if ($c_gb2=~/thread/i);
make_http_forward(HTML_SELF,ALTERNATE_REDIRECT);

5 Post deleted by moderator.

6 Name: Anonymous : 2010-02-01 02:10 ID:INUNzn/6 [Del]

>>4
Any chance to get this working in kareha?

7 Post deleted by moderator.

8 Name: Anonymous : 2010-02-01 16:15 ID:dLeEoAjj [Del]

>>6
I tried to apply it to kareha but did not work

9 Post deleted by moderator.

10 Name: Anonymous : 2010-08-14 07:15 ID:Heaven (Image: 0x0 patch, 1 kb) [Del]

Here's a noko patch for wakaba, works like 4chan.

Note: this is pointless, but since people are always asking for it, here it is. Now you can stop asking. ;)

11 Name: Anonymous : 2010-08-14 11:11 ID:sCoUrI49 (Image: 0x0 patch, 1 kb) [Del]

and another one that everyone requests for various inane reasons: stickies. Look at how easy this sort of thing is to add! Now let's never speak of stickies again, because they are dumb.

12 Name: Anonymous : 2010-08-14 11:22 ID:Heaven [Del]

... whoops, I just realized I didn't expand_filename() for the icon, so the filename is pointing the wrong place for reply pages. oh well, easy enough to fix.

13 Name: Anonymous : 2010-08-15 06:28 ID:jKKpo+qG [Del]

>>11
You've probably just opened the floodgates for dozens of "USER WAS BANNED FOR THIS POST" requests. You do know that, right?

14 Name: Anonymous : 2010-08-15 13:02 ID:Heaven [Del]

>>13
Well then maybe it'd be a good idea to supply the patch for it so all these kids can STFU. For that matter any 4chan-ish patches, so then future requests for AIDS can be summarily directed at this thread, no future discussion needed.

15 Name: Anonymous : 2010-08-15 14:04 ID:Heaven [Del]

>>14
The fact is these requests had pretty much stopped once they got the picture. Now that they have stickies and noko, they'll be drowning this place in requests for word filters, blotters, custom ban messages, and all sorts of other features that everyone here has already said they will not make. If someone wants to waste their time making such features available, then by all means, but I, and I'm sure most others, have made our stance clear for years. If people want that cancerous shit, they can get a trevorsaba clone. There are enough 4chan copies, and nobody here wants to facilitate the creation of more.

16 Name: Anonymous : 2010-08-15 18:29 ID:Heaven [Del]

>>15
Really? Because both of those patches were in response to a recent request either here or elsewhere.

I don't agree with all those features either, but the kiddies like it. I made those two to show how ridiculously easy it is to add a feature to Wakaba -- and I don't even like Perl. In fact I haven't actually written anything in Perl that was more than a line or two long since around 2003, and I'm so rusty at it that I copied most of the syntax for those patches from nearby code (or just plain guessed at it).

The blotter is probably one of the only features of 4chan that's actually useful (and a great alternative for putting useless shit into sticky posts), and it appears to have been removed.

Now let's see some really interesting and worthwhile patches from you, if you're so adamant about your "stance". You sure talk big.

17 Name: Anonymous : 2010-08-16 03:28 ID:Heaven [Del]

>>16
If you're referring to the "request" that's on /soc/, notice that the poster was just asking what people had come up with, and in fact explicitly states that 4chan garbage doesn't count. I agree with what you say about the blotter however, as it is indeed the only feature from 4chan that is worth using.

The entire reason nobody up until now has added those features despite how easy it would be is because everyone but you seems to understand that spoonfeeding all of the little moots what they want just encourages laziness. As you said, that crap is ridiculously easy. Hell, kirtaner managed it despite the fact he himself acknowleged he knew nothing about perl. So, why can't all the 14 year olds adamant to have it take 30 minutes to familiarise themselves with perl and get it done themselves?

You seriously think trying to call me out on my stance is going to make me share my code? It's my code that I took the time to learn and implement. I'm keeping it quiet for that very reason. Try using the same argument against, for example, Kirt. I'm sure he'll hand over all of 420's code just because you want him to.

18 Name: Anonymous : 2010-08-16 04:13 ID:Heaven [Del]

since someone bumped this thread, i might as well post this:
http://hotaru.thinkindifferent.net/kareha.diff

  • unicode-related bugfixes
  • <q> and <code> added to default list of allowed html tags
  • bbcode
  • other stuff

19 Name: Anonymous : 2010-08-16 07:08 ID:Heaven [Del]

>>18
Ugh.
Piss off, hotaru.

20 Name: Anonymous : 2010-08-16 07:22 ID:Heaven [Del]

>>17
420chan's source is available to the public.

21 Name: Anonymous : 2010-08-16 07:32 ID:Heaven [Del]

>>20
I thought the SVN they were using a while back was just for 420 programmers. I've not seen their code publically anywhere.

22 Name: Anonymous : 2010-08-16 20:39 ID:Heaven [Del]

>>21
I hear they're cool with granting read access. Drop by their irc and ask.

23 Name: Anonymous : 2010-08-16 23:33 ID:Heaven [Del]

>>19
Go back to bed, FrozenVoid.

24 Name: Kirtaner!Ub4TCdRjOM : 2010-08-21 14:10 ID:IS7N+x31 [Del]

>Hell, kirtaner managed it despite the fact he himself acknowleged he knew nothing about perl.

Yup, and now I'm so pro I do web development professionally! Let that be a lesson kids, if you want something done, learn it yourself. Don't rely on patches from anonymous contributors. In the process I ended up learning a slew of languages (Our report system is an AJAX Java servlet hooked up to IRC, templating built around PHP, etc) and it was just a lot of fun, really.

Not only will you learn how to do this shit yourself, your users will love you just that much more because you're able to improve things yourself. For them.

Also, Taimaba (our Wakaba fork) is closed source and very little of the original code remains, but I can answer minor questions should they pop up. Major recent changes eliminated config.pl (pushed into the DB and a board manifest added, etc) and just about everything involving per-board file editing. Fun.

25 Name: Anonymous : 2010-08-21 14:29 ID:7L/5gbu1 [Del]

>>24

>Not only will you learn how to do this shit yourself, your users will love you just that much more because you're able to improve things yourself. For them.

This is pretty damn true. Hell, as I mentioned on the 420 code discussion IRC a couple of days ago, the sheer amount of work Kirt put into the place between now and when I last visited (which was quite a while back due to other things taking up all my free time) warranted a donation from me for their upkeep. Ever wonder why places like 420chan, and early days 4chan, see so much in the way of donations, while places running kusaba never see any? It's because users appreciate the work that gets put into those sorts of places. If Kirt keeps up the work he does, people like me are more than happy to help keep those places above water. It's how this works. I honestly doubt that 420 would still be alive if Kirt hadn't learned how to deal with shit himself. Sure, many people disagree with some of the features that 420chan implements, but at the end of the day they have been implemented by people who've taken their time to make them, not just sit around asking others to do it for them.

Please, Kirt, don't hand out anything too big. As much as I'd like to poke around the code myself out of sheer curiosity, I wouldn't like to see other places employing the code who haven't put the work in themselves.

Still, if it's Q&A time, how does the manager panel differ from that in wakaba? Have you got a universal panel that controls all boards, for example?

26 Name: Kirtaner!Ub4TCdRjOM : 2010-08-21 15:41 ID:IS7N+x31 [Del]

>Still, if it's Q&A time, how does the manager panel differ from that in wakaba? Have you got a universal panel that controls all boards, for example?

Yeah. The report system also doubles as a moderation interface so we basically have a "modding console" in an IRC channel, too.

27 Name: Anonymous : 2010-08-21 15:48 ID:7L/5gbu1 [Del]

That's actually pretty boss. I'm guessing you've also created an accounts system, so that mods don't know the admin pass? Always seemed like it'd be the first thing I'd do if I made a site as big as 420 using wakaba.

Also, any idea when the faq page will be back up?

28 Name: Kirtaner!Ub4TCdRjOM : 2010-08-21 18:22 ID:IS7N+x31 (Image: 1333x1032 png, 211 kb) [Del]

src/1282440128937.png: 1333x1032, 211 kb

>>27
FAQ pretty soon. We've almost finished integrating Taimaba with Wordpress (we have some really large content-heavy plans with 420chan, the archives, etc) and the page issues will be dealt with when the new FP launches.

Accounts system? You bet! (pic)

29 Name: Anonymous : 2010-08-22 03:56 ID:7L/5gbu1 [Del]

I was very intrigued by the whole system until I noticed your search for "purple potato". Still, pretty damn impressive, and a lesson to everyone asking for patches that doing shit yourself really will pay off eventually.

30 Name: Orochi Herman!hN02YkuTxM : 2010-12-16 12:29 ID:7Ry+xFFT [Del]

I'm sick of reports going under my nose, so I wanna ask...

Has anyone made a wakaba and kareha hack that sends you a mail of what was posted? I know I risk my mailbox being overloaded, but I'd rather have this THAN getting unwanted content slip by me again.

31 Name: Anonymous : 2010-12-16 14:34 ID:Heaven [Del]

>>30
What's wrong with just paying attention to your board?

32 Name: Orochi Herman!hN02YkuTxM : 2010-12-21 08:10 ID:7Ry+xFFT [Del]

>>30

I have a life outside these boards too, you know. I'd like to make technology work for me, not the other way around.

33 Name: Anonymous : 2011-01-18 15:51 ID:9rh3NQty [Del]

>>10
Where do I put this?

34 Name: Anonymous : 2011-01-30 21:45 ID:Heaven [Del]

35 Name: Anonymous : 2011-02-01 17:39 ID:Heaven [Del]

http://wakaba.c3.cx/sup/kareha.pl/1190010673/11-12
-- adds link following to the spam checker, so people can't hide links to spam websites behind forwarding sites like bit.ly.

36 Name: Anonymous : 2011-02-04 14:28 ID:pow5WmEB [Del]

I have kaherka, how do I add noko so I can go back to the thread I replied to?

37 Name: Anonymous : 2011-02-04 17:40 ID:Heaven [Del]

>>36
you have no need for it

38 Name: Anonymous : 2011-02-05 16:02 ID:jcukMGLk (Image: 0x0 patch, 5 kb) [Del]

On request, I am posting a patch for Wakaba which enables the use of reCAPTCHA. It depends on the CPAN module Captcha::reCAPTCHA which means you'll probably have difficulty using this patch on shared hosting. I apologise for that, but I'm a novice programmer and don't know any other way of doing it. Debian/Ubuntu users with root access can install the module using sudo apt-get install libcaptcha-recaptcha-perl. Dreamhost has instructions for setting up CPAN without root access on their wiki.

To apply the patch, use patch -p1 -i waka_recaptcha.patch. To enable it, set ENABLE_CAPTCHA in config.pl to ENABLE_CAPTCHA => 'recaptcha'. You also need to set your private and public key from the reCAPTCHA website.

In the case that the required CPAN module is unavailable, it will bypass the CAPTCHA check altogether. I'm not sure whether this is a good decision or not. If you can, please improve this patch so it doesn't depend on the above-mentioned module.

39 Name: Anonymous : 2011-02-05 20:51 ID:zm/urRsk [Del]

>>38 many thanks, i'll try this one

40 Name: Anonymous : 2011-02-05 20:55 ID:Heaven [Del]

>>36
is it really that hard to click the back button after you post?

41 Name: Anonymous : 2011-02-06 17:32 ID:Heaven [Del]

>>40
Some browsers try to outsmart you or act stupid if you do that, so yes it sometimes is.

42 Name: Anonymous : 2011-02-06 17:38 ID:Heaven [Del]

>>38
You could probably just grab the file from cpan manually on a shared host - make a folder called Captcha and put the file in there. It doesn't use any C extensions, and it's just one file.

http://search.cpan.org/dist/Captcha-reCAPTCHA/lib/Captcha/reCAPTCHA.pm and click on "source" at the top

43 Name: Anonymous : 2011-02-07 01:42 ID:Heaven [Del]

>>41
name one browser that actually does that.
you can't, because there aren't any. even the browser known for having completely batshit insane bugs due to being developed by a company of lsd-using hipsters doesn't do that.

44 Name: Anonymous : 2011-02-07 05:05 ID:Heaven [Del]

>>43
Go away, hotaru.

45 Name: Anonymous : 2011-02-07 10:40 ID:Heaven [Del]

>>42
Doesn't seem to work for me. I'm on Dreamhost.

46 Name: Anonymous : 2011-02-07 20:55 ID:Heaven [Del]

>>44
I'm still wondering where that ``meme" came from. I suspect ``Xarn" may have had something to do with it.

47 Post deleted by user.

48 Name: Anonymous : 2011-02-08 06:05 ID:Heaven [Del]

... on second thought, I'll leave hotaru alone. Otherwise, I might get called a hipster, and I wouldn't want that.

49 Name: Anonymous : 2011-03-07 19:01 ID:CeUyu93S [Del]

A dice roller. Type "dice (X)d(Y)[Z]" in the email field and it will prepend a little message to your post.

use List::Utils qw( sum );

#put this after "$comment=format_comment($comment,$markup,$thread);" in kareha.pl
if ($link =~ /dice \s*/( #$1
(\d+) #$2
\s* d \s* #letter d
(\d+) #$3
\s* #space
([+-]\d+)? #$4
)/xi) {
my $derp = ", "; #array element separator
my @results = map { int( rand($3) ) +1} (1 .. $2); #generate dice results
my $sum = sum(@results) + $4; #adds the results together, plus the modifier
my $roll = join($derp, @results); #adds commas to the array elements
my $modifier = ", $4" if defined $4; #http://en.wikipedia.org/wiki/Oxford_comma
my $rolled = "<strong>Rolled: $roll$modifier = $sum</strong>"; #e.g. "Rolled: 2, 3, +1 = 6", in bold
$comment = $rolled . $comment;
}

50 Name: Storlek !desu/4y/Xg : 2011-03-21 18:39 ID:sCoUrI49 (Image: 0x0 zip, 3 kb) [Del]

Here's some miscellaneous little stylesheet-related patches that might be worth applying to Wakaba and Kareha.

kareha/border-radius.patch and wakaba/border-radius.patch:

  • Added standard CSS3 border-radius declarations to stylesheets using -moz-border-radius, since every common web browser (Firefox, Chrome, Safari, Opera, and even MSIE 9) now supports the standard declaration. Separate patches for Wakaba and Kareha included.

kareha/javascript.patch and wakaba/javascript.patch:

  • Fixed set_cookie() to be RFC 2109 compliant. It wasn't escaping values before, so strictly-complying cookie implementations will choke on (for example) stylesheets with spaces in the titles.
  • Behavior change to set the style cookie from within set_stylesheet(), instead of when the window is closed. This gets rid of inconsistencies when working in multiple tags; in particular, changing the style and then opening a new tab should ideally show the new tab with the newly selected style.
  • Apparently MSIE 5 chokes and dies on regular expressions containing .*? or .+?. Not that I expect anyone to actually use IE5, but I tested the code with it and it didn't work, so there.
  • (For Wakaba only) Cleaned up set_stylesheet().

kareha/pseud0ch.patch:

  • Fix strange empty space between top of thread box and header text in Buun and Pseud0ch styles. I'm not sure why it had a 1em pad there.
  • Adjust .replytext em selector to add underlining for <em> text, since the font-style: normal rendered it indistinguishable from normal text. (Was that intentional? Why?)

I tested these changes in Firefox, Chrome, Opera, and Internet Explorer, and everything appears to work.

51 Name: Radio 1 : 2011-09-01 08:25 ID:crhCBcsA [Del]

Thanks Storlek! You help me a lot.

52 Name: sly : 2011-09-21 04:24 ID:CQL/HtiR [Del]

I am working on linking multiple boards together through a single .php file roughly like so:
index.php?board=one
get($board)
include($board/wakaba.html)

the issue I'm having is with make_http_forward, it always dumps the user into Boardname/wakaba.html rather than index.php?board=Boardname.

In every case i can find in wakaba.pl, I've changed make_http_forward(HTML_SELF,ALTERNATE_REDIRECT) to make_http_forward("http://website.com/index.php?board=$myboard",ALTERNATE_REDIRECT), and even gone so far as to go into wakabautils and alter the make_http_forward function to
if($alternate_method) { $location=mypage;

What I've found is in every call of "ALTERNATE_REDIRECT", it seems to completely ignore the location I give it. The only way I've found to get this to work is to put a $location=page in the ELSE section, but I can't actually find any calls to make_http_forward that don't use ALTERNATE_REDIRECT so i'm not sure where these calls are coming from, and doing so breaks the admin panel.

It's clear I'm not understanding this function and I've spent about 2 hours on this, so if anyone can help I'd be thrilled.

53 Name: !!MrVdboSr : 2011-09-22 10:48 ID:zd+knJp+ [Del]

>>52
Pretty sure I have something similar working at http://www.studiocrabapple.com/index.php?id=board.php

Is this what you're trying to accomplish?

54 Name: Anonymous : 2011-09-25 06:06 ID:mWq75Fd3 (Image: 0x0 patch, 4 kb) [Del]

Here's a patch for Wakaba I made to deal with a raid on my board. It adds a "Ban All" link in the admin panel, which bans every poster in a thread, so you don't have to add bans for them manually. Perfect for dealing with CP floods and such. "Mass-banned: " will be prepended to the ban comment, but you can customise that in config.pl.

To apply it, run patch < wakaba_massban.patch on a clean install of Wakaba.

55 Name: Anonymous : 2011-09-25 06:50 ID:mWq75Fd3 (Image: 0x0 patch, 9 kb) [Del]

While I'm at it, here's also a patch for Kareha which lets you ban IPs on non-Apache web servers, as requested in http://wakaba.c3.cx/sup/kareha.pl/1316722874/. It simply prevents the user from posting, nothing more, nothing less.

IPs are added in a file called ipbans.txt. I haven't bothered trying to encrypt it or anything, so you might want to configure your webserver to deny access to the file.

Disclaimer: I'm not really familiar with Kareha, so there might be stuff I've left out. I tested it using mode_message, and it worked fine.

Apply it using patch -p1 < kareha_bans.patch.

56 Name: Anonymous : 2011-10-02 13:17 ID:oJF9allQ [Del]

>>38 The CPAN module for recaptcha is available, but it doesn't verify if it's correct or not. It just goes straight to posting.

57 Name: Anonymous : 2011-10-02 14:08 ID:Heaven [Del]

>>56
You're probably missing one of its dependencies. The patch is designed to allow posting if the module doesn't work.

Try running perl -e 'use Captcha::reCAPTCHA' on the command line and see if that returns any errors.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification: