diff --git a/jumpapp/classes/Config.php b/jumpapp/classes/Config.php index 533346b..387b83a 100644 --- a/jumpapp/classes/Config.php +++ b/jumpapp/classes/Config.php @@ -120,4 +120,8 @@ class Config { return filter_var($input,FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE); } + public function get_wwwurl() { + return rtrim($this->config->get('wwwurl', false), '/'); + } + } diff --git a/jumpapp/classes/Pages/ErrorPage.php b/jumpapp/classes/Pages/ErrorPage.php index 7c76dcb..410438d 100644 --- a/jumpapp/classes/Pages/ErrorPage.php +++ b/jumpapp/classes/Pages/ErrorPage.php @@ -14,7 +14,8 @@ class ErrorPage { $template = $this->mustache->loadTemplate('errorpage'); return $template->render([ 'code' => $httpcode, - 'message' => $message + 'message' => $message, + 'wwwurl' => $this->config->get_wwwurl(), ]); }); } diff --git a/jumpapp/classes/Pages/HomePage.php b/jumpapp/classes/Pages/HomePage.php index a5d2453..13583d3 100644 --- a/jumpapp/classes/Pages/HomePage.php +++ b/jumpapp/classes/Pages/HomePage.php @@ -22,6 +22,7 @@ class HomePage extends AbstractPage { 'ampmclock' => $this->config->parse_bool($this->config->get('ampmclock', false)), 'unsplash' => !!$this->config->get('unsplashapikey', false), 'unsplashcolor' => $unsplashdata?->color, + 'wwwurl' => $this->config->get_wwwurl(), ]; if ($this->config->parse_bool($this->config->get('showsearch', false))) { $templatecontext = array_merge($templatecontext, [ @@ -40,6 +41,7 @@ class HomePage extends AbstractPage { 'hassites' => !empty($sites->get_sites()), 'sites' => $sites->get_sites_by_tag('home'), 'altlayout' => $this->config->parse_bool($this->config->get('altlayout', false)), + 'wwwurl' => $this->config->get_wwwurl(), ]); }); } @@ -54,6 +56,7 @@ class HomePage extends AbstractPage { 'tags' => $tags, 'showclock' => $this->config->parse_bool($this->config->get('showclock')), 'showsearch' => $this->config->parse_bool($this->config->get('showsearch', false)), + 'wwwurl' => $this->config->get_wwwurl(), ]); }); } diff --git a/jumpapp/classes/Pages/TagPage.php b/jumpapp/classes/Pages/TagPage.php index 0fe9f87..f2256c8 100644 --- a/jumpapp/classes/Pages/TagPage.php +++ b/jumpapp/classes/Pages/TagPage.php @@ -22,6 +22,7 @@ class TagPage extends AbstractPage { 'ampmclock' => $this->config->parse_bool($this->config->get('ampmclock', false)), 'unsplash' => !!$this->config->get('unsplashapikey', false), 'unsplashcolor' => $unsplashdata?->color, + 'url' => $this->config->get('url', false), ]; if ($this->config->parse_bool($this->config->get('showsearch', false))) { $templatecontext = array_merge($templatecontext, [ @@ -47,6 +48,7 @@ class TagPage extends AbstractPage { 'hassites' => !empty($taggedsites), 'sites' => $taggedsites, 'altlayout' => $this->config->parse_bool($this->config->get('altlayout', false)), + 'wwwurl' => $this->config->get_wwwurl(), ]); }); } @@ -61,6 +63,7 @@ class TagPage extends AbstractPage { 'tags' => $tags, 'showclock' => $this->config->parse_bool($this->config->get('showclock')), 'showsearch' => $this->config->parse_bool($this->config->get('showsearch', false)), + 'wwwurl' => $this->config->get_wwwurl(), ]); }); } diff --git a/jumpapp/config.php b/jumpapp/config.php index 3d1b0e1..7f10b8a 100644 --- a/jumpapp/config.php +++ b/jumpapp/config.php @@ -11,6 +11,8 @@ return [ 'sitename' => getenv('SITENAME') ?: 'Jump', // Where on the this code is located. 'wwwroot' => getenv('WWWROOT') ?: '/var/www/html', + // URL - might help if just is hosted in a subdirectory. + 'wwwurl' => getenv('URL') ?: '', // Stop retrieving items from the cache, useful for testing. 'cachebypass' => getenv('CACHEBYPASS') ?: false, diff --git a/jumpapp/templates/errorpage.mustache b/jumpapp/templates/errorpage.mustache index 520b32f..20ac6f4 100644 --- a/jumpapp/templates/errorpage.mustache +++ b/jumpapp/templates/errorpage.mustache @@ -3,8 +3,8 @@
- - + +