api, backend: whitespace and declarations shuffling
This commit is contained in:
parent
06a939bcd1
commit
065d5a9d88
@ -1,11 +1,14 @@
|
|||||||
package PoorBooru;
|
package PoorBooru;
|
||||||
|
use v5.32;
|
||||||
use Dancer2;
|
use Dancer2;
|
||||||
use HTTP::Tiny;
|
use HTTP::Tiny;
|
||||||
|
|
||||||
|
|
||||||
our $VERSION = v0.0.1;
|
our $VERSION = v0.0.1;
|
||||||
|
|
||||||
my $POORBOORU_API = setting("poorbooru_api");
|
my $POORBOORU_API = setting("poorbooru_api");
|
||||||
|
|
||||||
|
|
||||||
sub validate_page_number ($) { $_[0] =~ /^[1-9][0-9]*$/ }
|
sub validate_page_number ($) { $_[0] =~ /^[1-9][0-9]*$/ }
|
||||||
|
|
||||||
sub api_request ($$;%)
|
sub api_request ($$;%)
|
||||||
@ -50,6 +53,7 @@ sub nav_pager ($$)
|
|||||||
return \%res;
|
return \%res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
hook before_template_render => sub {
|
hook before_template_render => sub {
|
||||||
my $tokens = shift;
|
my $tokens = shift;
|
||||||
|
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
package PoorBooru::API::V0;
|
package PoorBooru::API::V0;
|
||||||
|
use v5.32;
|
||||||
use Dancer2;
|
use Dancer2;
|
||||||
use Dancer2::Plugin::DBIC;
|
use Dancer2::Plugin::DBIC;
|
||||||
|
|
||||||
our $VERSION = v0.0.1;
|
|
||||||
|
|
||||||
set serializer => "JSON";
|
|
||||||
|
|
||||||
use constant {
|
use constant {
|
||||||
DEFAULT_CONTENT_TYPE => "application/json",
|
DEFAULT_CONTENT_TYPE => "application/json",
|
||||||
};
|
};
|
||||||
|
|
||||||
sub validate_page_number ($) { $_[0] =~ /^[1-9][0-9]*$/ }
|
our $VERSION = v0.0.1;
|
||||||
sub validate_tag_name ($) { $_[0] !~ /^[1-9][0-9]*$/ && $_[0] =~ /^\w+$/ }
|
|
||||||
|
|
||||||
my $MEDIA_SEARCH_OPTS = {
|
my $MEDIA_SEARCH_OPTS = {
|
||||||
order_by => { -desc => "media_id" },
|
order_by => { -desc => "media_id" },
|
||||||
@ -23,6 +20,9 @@ my $TAGS_COUNT_VIEW_SEARCH_OPTS = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
sub validate_page_number ($) { $_[0] =~ /^[1-9][0-9]*$/ }
|
||||||
|
sub validate_tag_name ($) { $_[0] !~ /^[1-9][0-9]*$/ && $_[0] =~ /^\w+$/ }
|
||||||
|
|
||||||
sub mkpager ($)
|
sub mkpager ($)
|
||||||
{
|
{
|
||||||
my $pager = $_[0]->pager;
|
my $pager = $_[0]->pager;
|
||||||
@ -35,6 +35,10 @@ sub mkpager ($)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
set serializer => "JSON";
|
||||||
|
|
||||||
|
|
||||||
get "/meta" => sub {
|
get "/meta" => sub {
|
||||||
return [
|
return [
|
||||||
{ path => "/meta", verb => "GET" },
|
{ path => "/meta", verb => "GET" },
|
||||||
|
Loading…
Reference in New Issue
Block a user