From 494da5f44937e55dc1e3180b62e2e6ef98eecc9f Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Tue, 5 Nov 2019 18:47:37 +0100 Subject: feat: include Sentry for error reporting --- app/class/Config.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'app') diff --git a/app/class/Config.php b/app/class/Config.php index 1a4bb17..555129b 100644 --- a/app/class/Config.php +++ b/app/class/Config.php @@ -32,6 +32,7 @@ abstract class Config protected static $homeredirect = null; protected static $interfacecss = null; protected static $bookmark = []; + protected static $sentrydsn = ''; // _______________________________________ F U N _______________________________________ @@ -248,6 +249,11 @@ abstract class Config return self::$bookmark; } + public static function sentrydsn() + { + return self::$sentrydsn; + } + // __________________________________________ S E T ______________________________________ @@ -426,6 +432,13 @@ abstract class Config } } + public static function setsentrydsn($sentrydsn) + { + if (is_string($sentrydsn)) { + self::$sentrydsn = $sentrydsn; + } + } + -- cgit v1.2.3 From 6eddd69843d78bf442324dd10c501b79bbaf89d1 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Thu, 7 Nov 2019 17:58:08 +0100 Subject: feat: include sentry in frontend --- app/fn/fn.php | 2 +- app/view/templates/layout.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/fn/fn.php b/app/fn/fn.php index f462d2d..f96b8ba 100644 --- a/app/fn/fn.php +++ b/app/fn/fn.php @@ -76,7 +76,7 @@ function idclean(string $input) function getversion() { if(file_exists('VERSION')) { - $version = file_get_contents('VERSION'); + $version = trim(file_get_contents('VERSION')); } else { $version = 'unknown'; } diff --git a/app/view/templates/layout.php b/app/view/templates/layout.php index 85351d6..c249622 100644 --- a/app/view/templates/layout.php +++ b/app/view/templates/layout.php @@ -18,6 +18,13 @@ echo ''; } ?> + + -- cgit v1.2.3 From d8032078c39edb42acb99a1de49283daba199d74 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Thu, 7 Nov 2019 19:11:04 +0100 Subject: feat: don't include Sentry in front if undefined --- app/view/templates/layout.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app') diff --git a/app/view/templates/layout.php b/app/view/templates/layout.php index c249622..ef28748 100644 --- a/app/view/templates/layout.php +++ b/app/view/templates/layout.php @@ -17,6 +17,7 @@ if (!empty(Wcms\Config::interfacecss())) { echo ''; } + if (!empty(Wcms\Config::sentrydsn())) { ?> + -- cgit v1.2.3 From c1843c0a2ef49de3d2030398f5c14549cc1791ab Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Fri, 15 Nov 2019 15:57:46 +0100 Subject: feat: load Sentry browser as an external script - better way to check if we need to report errors in PHP - fix make file $(js_bundles) dependencies (add webpack conf) - update sentry-browser sdk and move it to dev requirements --- app/fn/fn.php | 5 +++++ app/view/templates/layout.php | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/fn/fn.php b/app/fn/fn.php index f96b8ba..ccccfb9 100644 --- a/app/fn/fn.php +++ b/app/fn/fn.php @@ -72,6 +72,11 @@ function idclean(string $input) return $input; } +function isreportingerrors() +{ + return function_exists('Sentry\init') && !empty(Wcms\Config::sentrydsn()); +} + function getversion() { diff --git a/app/view/templates/layout.php b/app/view/templates/layout.php index ef28748..9259fda 100644 --- a/app/view/templates/layout.php +++ b/app/view/templates/layout.php @@ -17,7 +17,7 @@ if (!empty(Wcms\Config::interfacecss())) { echo ''; } - if (!empty(Wcms\Config::sentrydsn())) { + if (isreportingerrors()) { ?> + -- cgit v1.2.3 From a49dca5b92c141cafd89a9908309036179973410 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Fri, 15 Nov 2019 15:59:55 +0100 Subject: fix(home): Cannot set property 'innerHTML' of null home.bundle.js was included even if the user was not connected --- app/view/templates/home.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/view/templates/home.php b/app/view/templates/home.php index 9758c95..01bc0e4 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -173,10 +173,10 @@ insert('footer', ['footer' => $footer]) ?> - + + - -- cgit v1.2.3