Skip to content

A self-hosted media server and file management system

feat: toggle between plausible proxy and direct connections

aminnausin2eca77fe693f
diff --git a/.env.example b/.env.example
index 73fd1bfc..c3dc43e4 100755
--- a/.env.example
+++ b/.env.example
@@ -100,5 +100,6 @@ PLAUSIBLE_SCRIPT_URL=
PLAUSIBLE_DOMAIN=
PLAUSIBLE_SITE_ID="${APP_HOST}"
PLAUSIBLE_API_TOKEN=
+PLAUSIBLE_USE_PROXY=
LOGIN_MESSAGE=
diff --git a/config/services.php b/config/services.php
index 89d04193..782e54eb 100755
--- a/config/services.php
+++ b/config/services.php
@@ -39,6 +39,7 @@ return [
'domain' => env('PLAUSIBLE_DOMAIN'),
'site_id' => env('PLAUSIBLE_SITE_ID'),
'token' => env('PLAUSIBLE_API_TOKEN'),
+ 'use_proxy' => env('PLAUSIBLE_USE_PROXY'),
],
'preview_generator' => [
'override' => env('APP_ENV') === 'local',
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
index c77365d2..ce1fe694 100755
--- a/resources/views/layouts/app.blade.php
+++ b/resources/views/layouts/app.blade.php
@@ -10,7 +10,7 @@
<title>{{ config('app.name', 'Media Server') }}</title>
@if (config('services.plausible.url'))
- <script defer data-domain="{{ config('app.host') }}" src="{{ route('pageview.script') }}"></script>
+ <script defer data-domain="{{ config('app.host') }}" src="{{ config('services.plausible.use_proxy') ? route('pageview.script') : config('services.plausible.url') }}"></script>
<script>
window.plausible = window.plausible || function() {
(plausible.q = plausible.q || []).push(arguments)