Wakaba/Kareha patches (91)

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:

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.

58 Name: Anonymous : 2011-10-02 14:41 ID:oJF9allQ [Del]

>>57 It output's:

Can't locate Captcha/reCAPTCHA.pm in @INC...

Should I reinstall? I've searched Google, no helpful information.

59 Name: Anonymous : 2011-10-02 14:49 ID:Heaven [Del]

>>58
How did you install it? I use Debian and installing it through the package manager always worked for me. Using CPAN left out a dependency or two.

60 Post deleted by user.

61 Name: Anonymous : 2011-10-02 15:26 ID:oJF9allQ [Del]

I decided to reinstall it via the package manager, and I don't receive that error anymore, but now it's saying the verification code is wrong even when it's correct. I've tried it with 10+ different codes.

62 Name: Anonymous : 2011-10-02 15:51 ID:Heaven [Del]

>>61
I can't help you with that one. Only thing I can think of is the public/private keys being incorrect, or your server being unable to connect to Google's servers.

63 Post deleted by user.

64 Name: Anonymous : 2011-10-06 00:18 ID:oJF9allQ [Del]

>>62

Adding onto my previous post;

Before:

make_error(S_BADCAPTCHA) unless $result->{is_valid};

I added:

print $result->{is_valid};

and it printed the source code of the page.

65 Name: Anonymous : 2011-10-08 14:48 ID:oJF9allQ [Del]

>>62

I really need help with this. I've tried everything. All the keys are correct, I've even tried it on a clean install.

66 Post deleted by moderator.

67 Post deleted by moderator.

68 Name: Anonymous : 2011-10-10 18:27 ID:oJF9allQ [Del]

>>62

Anyone at all? I've tried literally hundreds of things.

69 Name: Anonymous : 2011-10-11 11:46 ID:mWq75Fd3 [Del]

>>68
Hi,

I've taken the time to trace the problem, and I think I have a fix (but as usual, I'm too lazy to test it until anyone whines about it):

Find:

my $challenge=$query->param("challenge");
my $response=$query->param("response");

and replace it with:

my $challenge=$query->param("recaptcha_challenge_field");
my $response=$query->param("recaptcha_response_field");

That should hopefully do the trick. Obviously it was a derp on my part, I'll create an updated patch soon to rectify this.

70 Name: Anonymous : 2011-10-11 12:03 ID:mWq75Fd3 [Del]

Also, why do you even need reCAPTCHA that desperately? The default CAPTCHA is fine, easy to fill out, hard for bots to break and can easily be tweaked if you need better anti-bot measures.

If you're trying to cope with spam, I think you'll find that many of those so-called bots are actually humans.

71 Name: Anonymous : 2011-10-11 19:43 ID:oJF9allQ [Del]

>>69

Ok, now I don't get "Error: Wrong verification code entered.", but it doesn't post the message. I've rebuild the caches, but no avail.

>>70

It's definitely bots. Unless the same human is posting 20+ messages a second.

72 Name: Anonymous : 2011-10-12 06:58 ID:mWq75Fd3 [Del]

>>71

>Ok, now I don't get "Error: Wrong verification code entered.", but it doesn't post the message. I've rebuild the caches, but no avail.

That's weird. I just tested the fix myself, and it works perfectly for me. Did you try fixing this on a clean install?

>It's definitely bots. Unless the same human is posting 20+ messages a second.

Uh, okay.

73 Name: Anonymous : 2011-10-12 17:41 ID:oJF9allQ [Del]

>>72

I found the issue (Well a fix at least).

I added:

build_cache();

after:

make_cookies...

74 Name: sly : 2011-10-30 16:02 ID:v57DkBCQ [Del]

>>53
this is what i'm trying to accomplish. where do you change the redirect call? i've tried changing it in every call to make_http_forward i can find, but it doesn't work for me unless I put it in the actual function...

sub make_http_forward($;$)
{

my ($location,$alternate_method)=@_;

$location = "http://website/index.php?board=Main"; // <--- this is awful.

if($alternate_method)
{

...

75 Name: Anonymous : 2011-11-07 11:26 ID:fQVv0m/Z [Del]

I've always wondered why people thought noko was pointless. If anything it makes navigation easier. Shit, nobody even knows if you use it or not. I already wrote a noko patch for wakaba (a bit different than the one in this thread) and I'm planning on adding noko to Kareha as well. Anyone interested in a patch?

76 Name: Anonymous : 2011-11-08 17:08 ID:Heaven [Del]

> I've always wondered why people thought noko was pointless.

it's because pretty much all browsers have a back button.

> Shit, nobody even knows if you use it or not.

yes, they do, because you usually can't use noko and sage at the same time.

77 Name: Anonymous : 2011-11-09 21:02 ID:fQVv0m/Z [Del]

>>76
Pretty sure nokosage exists, at least in Yotsuba.

78 Post deleted by moderator.

79 Name: Anonymous : 2011-11-12 10:27 ID:UzTuYUYa [Del]

>>76

When you use the back button usually you don't see the latest posts.

80 Name: Anonymous : 2011-11-12 14:44 ID:Heaven [Del]

>>79
that's what the reload button is for.

81 Post deleted by user.

82 Name: Anonymous : 2011-12-17 12:23 ID:8dN4H3I2 [Del]

>>80
>>79
Nobody uses the web this way aside from 50 year olds. noko is useful.

83 Name: Anonymous : 2011-12-21 12:22 ID:9ObHjNsb [Del]

>>50 actual code fixes! thanks.

84 Name: Anonymous : 2011-12-26 19:30 ID:Heaven [Del]

>>82
everyone uses the web this way aside from /b/tards. if you think noko is so useful, just write a tiny bit of javascript to implement it in your browser.

85 Name: Anonymous : 2011-12-26 23:44 ID:8dN4H3I2 [Del]

>>84
I already implemented it in Wakaba, and most message boards and forums have the feature built in and enabled by default.

86 Name: Anonymous : 2012-01-15 15:43 ID:1UnSRfFr [Del]

This isn't actually a patch, but since I made it with Wakaba in mind, I'll post about it anyway.

I've created a wrapper for running CGI scripts on hosts with PHP that for some reason can't run regular CGI scripts. This means that if your host has Perl installed (more than likely, since it's included with all major Linux distros) and hasn't disabled proc_open() (which many shitty hosts tend to do for some reason), then it will be able to run Kareha and possibly Wakaba using this wrapper. Wakaba is less likely to run because it depends on the DBI module and database drivers which aren't included with the standard Perl distribution. Kareha depends only on core modules and will run perfectly fine nearly everywhere.

If you've been wanting to use Wakaba or Kareha, but your (crappy) host doesn't support CGI, I suggest trying this. It's especially useful with Kareha, since all the PHP-based textboard scripts suck.

87 Name: !WAHa.06x36 : 2012-01-15 15:57 ID:Heaven [Del]

>>86

Hey, you made PHPerl, which I never got around to making. GJ.

88 Name: Anonymous : 2012-02-05 14:57 ID:lrw7jQEH (Image: 0x0 patch, 0 kb) [Del]

Anyone running a Wakaba board ought to read this.

There's a serious vulnerability in Wakaba 3.0.8 and below which let's anyone inject whatever HTML they want to in posts. This can be fixed by removing a couple of lines in the get_decoded_hashref() and get_decoded_arrayref() subroutines in wakaba.pl, as shown in the included patch file. There should be no problem in making these changes.

Board moderators with no access to the board files may add /chr\([0-9]/ to spam.txt in order to fix the problem.

89 Name: !WAHa.06x36 : 2012-02-05 18:19 ID:q5Et8xfu [Del]

>>88

Looks like that is there to work around some absurdity in MySQL. I supposed MySQL has since changed and is now doing the wrong thing?

I'll put together a 3.0.9.

90 Name: !WAHa.06x36 : 2012-02-05 18:38 ID:Heaven [Del]

91 Name: Anonymous : 2012-02-05 21:55 ID:Heaven [Del]

>>90
Brilliant, thanks mate.

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