aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/class/Config.php13
-rw-r--r--app/fn/fn.php7
-rw-r--r--app/view/templates/home.php4
-rw-r--r--app/view/templates/layout.php10
4 files changed, 31 insertions, 3 deletions
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;
+ }
+ }
+
diff --git a/app/fn/fn.php b/app/fn/fn.php
index f462d2d..ccccfb9 100644
--- a/app/fn/fn.php
+++ b/app/fn/fn.php
@@ -72,11 +72,16 @@ function idclean(string $input)
return $input;
}
+function isreportingerrors()
+{
+ return function_exists('Sentry\init') && !empty(Wcms\Config::sentrydsn());
+}
+
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/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 @@
<?php $this->insert('footer', ['footer' => $footer]) ?>
- <?php } ?>
+ <script src="<?= Wcms\Model::jspath() ?>home.bundle.js"></script>
+ <?php } ?>
- <script src="<?= Wcms\Model::jspath() ?>home.bundle.js"></script>
</body>
diff --git a/app/view/templates/layout.php b/app/view/templates/layout.php
index 85351d6..9259fda 100644
--- a/app/view/templates/layout.php
+++ b/app/view/templates/layout.php
@@ -17,7 +17,17 @@
if (!empty(Wcms\Config::interfacecss())) {
echo '<link rel="stylesheet" href="' . Wcms\Model::csspath() . Wcms\Config::interfacecss() . '">';
}
+ if (isreportingerrors()) {
?>
+ <script>
+ const sentrydsn = '<?= Wcms\Config::sentrydsn() ?>';
+ const version = '<?= getversion() ?>';
+ const url = '<?= Wcms\Config::url() ?>';
+ const basepath = '<?= Wcms\Config::basepath() ?>';
+ </script>
+ <script src="https://browser.sentry-cdn.com/5.9.0/bundle.min.js"></script>
+ <script src="<?= Wcms\Model::jspath() ?>sentry.bundle.js"></script>
+ <?php } ?>
</head>