Selaa lähdekoodia

fix theme dir, could be better

George Baugh 4 vuotta sitten
vanhempi
sitoutus
0a16e4a29a
1 muutettua tiedostoa jossa 9 lisäystä ja 2 poistoa
  1. 9 2
      lib/Trog/Routes/JSON.pm

+ 9 - 2
lib/Trog/Routes/JSON.pm

@@ -7,6 +7,13 @@ no warnings 'experimental';
 use feature qw{signatures};
 
 use JSON::MaybeXS();
+use Trog::Config();
+
+my $conf = Trog::Config::get();
+
+# TODO de-duplicate this, it's shared in html
+my $theme_dir = '';
+$theme_dir = "themes/".$conf->param('general.theme') if $conf->param('general.theme') && -d "www/themes/".$conf->param('general.theme');
 
 our %routes = (
     '/api/catalog' => {
@@ -36,8 +43,8 @@ sub webmanifest ($query, $input, $=) {
     my $enc = JSON::MaybeXS->new( utf8 => 1 );
     my %manifest = (
         "icons" => [
-            { "src" => "$query->{theme_dir}/img/icon/favicon-192.png", "type" => "image/png", "sizes" => "192x192" },
-            { "src" => "$query->{theme_dir}/img/icon/favicon-512.png", "type" => "image/png", "sizes" => "512x512" },
+            { "src" => "$theme_dir/img/icon/favicon-192.png", "type" => "image/png", "sizes" => "192x192" },
+            { "src" => "$theme_dir/img/icon/favicon-512.png", "type" => "image/png", "sizes" => "512x512" },
         ],
     );