Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mattn
Created March 19, 2014 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/9641662 to your computer and use it in GitHub Desktop.
Save mattn/9641662 to your computer and use it in GitHub Desktop.
diff --git a/lib/Ukigumo/Server/Web/Dispatcher.pm b/lib/Ukigumo/Server/Web/Dispatcher.pm
index f417210..17b04e8 100644
--- a/lib/Ukigumo/Server/Web/Dispatcher.pm
+++ b/lib/Ukigumo/Server/Web/Dispatcher.pm
@@ -42,12 +42,35 @@ get '/cc.xml' => sub {
push @{$projects{$project->{project}}}, $project;
}
- $c->render( 'cc.xml.tx',
+ my $res = $c->render( 'cc.xml.tx',
{
now => time(),
projects => \%projects,
}
);
+ $res->content_type( 'application/xml' );
+ $res;
+};
+
+get '/rss.xml' => sub {
+ my ($c, $args) = @_;
+
+ my $limit = 50;
+
+ my ($reports, $pager) = Ukigumo::Server::Command::Report->recent_list(
+ limit => $limit,
+ );
+ for my $report (@{$reports}) {
+ $report->{body} = Ukigumo::Server::Command::Report->find( report_id => $report->{report_id} )->{body};
+ }
+ my $res = $c->render(
+ 'rss.xml.tx' => {
+ reports => $reports,
+ now => time(),
+ }
+ );
+ $res->content_type( 'application/xml' );
+ $res;
};
get '/recent' => sub {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment