Skip to content

A self-hosted media server and file management system

fix: plausible env

aminnausin13b535dc72ae
diff --git a/.env.example b/.env.example
index bfbe55d1..36fd01ae 100755
--- a/.env.example
+++ b/.env.example
@@ -98,6 +98,7 @@ VITE_REVERB_SCHEME="${REVERB_SCHEME}"
TRUSTED_PROXIES=*
-PLAUSIBLE_URL=
+PLAUSIBLE_SCRIPT_URL=
+PLAUSIBLE_DOMAIN=
PLAUSIBLE_SITE_ID="${APP_HOST}"
PLAUSIBLE_API_TOKEN=
diff --git a/app/Http/Controllers/Api/V1/UserController.php b/app/Http/Controllers/Api/V1/UserController.php
index 99699719..a2685a2f 100644
--- a/app/Http/Controllers/Api/V1/UserController.php
+++ b/app/Http/Controllers/Api/V1/UserController.php
@@ -58,7 +58,7 @@ class UserController extends Controller {
}
try {
- if (! config('services.plausible.token') || ! env('PLAUSIBLE_URL')) {
+ if (! (config('services.plausible.token') || config('services.plausible.domain') || config('services.plausible.site_id'))) {
return
DB::table('sessions')
->whereNotNull('user_id')
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index c76a45c9..15a4d83a 100755
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -14,7 +14,7 @@ class AppServiceProvider extends ServiceProvider {
* Register any application services.
*/
public function register(): void {
- if (config('services.plausible.token') && config('services.plausible.url')) {
+ if (config('services.plausible.token') && config('services.plausible.domain')) {
$this->app->singleton('plausible.client', function () {
return new Client([
'base_uri' => config('services.plausible.domain'),
diff --git a/config/services.php b/config/services.php
index 9920a6af..58874e71 100755
--- a/config/services.php
+++ b/config/services.php
@@ -35,11 +35,10 @@ return [
],
],
'plausible' => [
- 'url' => env('PLAUSIBLE_URL', ''),
- 'domain' => 'https://' . env('PLAUSIBLE_URL'),
+ 'url' => env('PLAUSIBLE_SCRIPT_URL', ''),
+ 'domain' => env('PLAUSIBLE_DOMAIN'),
'site_id' => env('PLAUSIBLE_SITE_ID'),
'token' => env('PLAUSIBLE_API_TOKEN'),
- 'disabled' => true,
],
];
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php
index fde5908b..4702dcfa 100755
--- a/resources/views/layouts/app.blade.php
+++ b/resources/views/layouts/app.blade.php
@@ -7,7 +7,7 @@
<meta name="description" content="A self hosted web media server to keep everything in one place.">
<title>{{ config('app.name', 'Media Server') }}</title>
- <script defer data-domain="{{ config('app.host') }}" src="{{ config('services.plausible.disabled') ? '' : config('services.plausible.url') }}"></script>
+ <script defer data-domain="{{ config('app.host') }}" src="{{ config('services.plausible.url') }}"></script>
<script>
window.plausible = window.plausible || function() {
(window.plausible.q = window.plausible.q || []).push(arguments)