|
|
@ -9,7 +9,7 @@ use Mojo::Base 'Mojolicious::Controller'; |
|
|
|
sub index { |
|
|
|
sub index { |
|
|
|
my ($self) = @_; |
|
|
|
my ($self) = @_; |
|
|
|
|
|
|
|
|
|
|
|
$self->render(text => 'Go away!'); |
|
|
|
$self->render(text => "Go away!\n"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sub captcha { |
|
|
|
sub captcha { |
|
|
@ -41,14 +41,14 @@ sub c_add { |
|
|
|
my $ref = $self->referrer; |
|
|
|
my $ref = $self->referrer; |
|
|
|
unless ($ref and ref($ref) eq 'HASH') { |
|
|
|
unless ($ref and ref($ref) eq 'HASH') { |
|
|
|
$self->res->code(400); |
|
|
|
$self->res->code(400); |
|
|
|
$self->render(text => "can't detect referred page"); |
|
|
|
$self->render(text => "can't detect referred page\n"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
my $site = $self->app->sites->{ $ref->{site} }; |
|
|
|
my $site = $self->app->sites->{ $ref->{site} }; |
|
|
|
unless ($site and ref($site) eq 'HASH') { |
|
|
|
unless ($site and ref($site) eq 'HASH') { |
|
|
|
$self->res->code(400); |
|
|
|
$self->res->code(400); |
|
|
|
$self->render(text => "no such site"); |
|
|
|
$self->render(text => "no such site\n"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -60,7 +60,7 @@ sub c_add { |
|
|
|
$ref->{site}, $ref->{pid}, $@; |
|
|
|
$ref->{site}, $ref->{pid}, $@; |
|
|
|
$self->app->log->error($msg); |
|
|
|
$self->app->log->error($msg); |
|
|
|
$self->res->code(500); |
|
|
|
$self->res->code(500); |
|
|
|
$self->render(text => 'internal error'); |
|
|
|
$self->render(text => "internal error\n"); |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|