my $data = do $source or die $@ || $! || 'read error';
require JSON;
my $converter = JSON->new;
- $converter->utf8->indent->space_after->canonical;
+ $converter->indent->space_after->canonical;
$header{content_type} = 'application/json';
+ $header{'Access-Control-Allow-Origin'} = '*';
$header{content_type} = 'text/plain' if exists $get{debug};
print $_, '(' for $get{callback} // ();
print $converter->encode($data);
}
else {
my $href = showlink($source, $source =~ m{\A (\w+) \.plp \z}x && "/$1");
- say "<h1>Source of $href</h1>";
+ PLP_START {
+ say "<h1>Source of $href</h1>";
+ };
if ($source =~ m{(?:/|^)\.}) {
Abort("File request not permitted", '403 source not allowed');