|
|
|
@ -90,4 +90,26 @@ sub get {
|
|
|
|
|
$self->rendered(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sub new { |
|
|
|
|
my ($self) = @_; |
|
|
|
|
|
|
|
|
|
eval { |
|
|
|
|
die("request error\n") |
|
|
|
|
unless $self->req->is_xnr; |
|
|
|
|
my $ip = $self->tx->remote_address |
|
|
|
|
or die("can't find remote ip\n"); |
|
|
|
|
$self->session({c_sectoken => $ip . '-' . time() + 60 * 7}); |
|
|
|
|
my $pageid = $self->_gen_pageid() |
|
|
|
|
or die("can't get pageid\n"); |
|
|
|
|
$self->stash({pageid => $pageid}); |
|
|
|
|
$self->render(template => 'comments/new'); |
|
|
|
|
} or do { |
|
|
|
|
chomp $@; |
|
|
|
|
$self->app->log->error($@); |
|
|
|
|
$@ = 'internal error' if $@ =~ m{line \d+}o; |
|
|
|
|
$self->res->code(400); |
|
|
|
|
$self->render(text => $@); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
1; |
|
|
|
|