ref: remove google analytics (#3912)

This commit is contained in:
Alex 2022-02-05 19:08:43 +02:00 committed by GitHub
parent 0ff60d83eb
commit 5120590e47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 33 additions and 38 deletions

View File

@ -19,7 +19,6 @@ class BaseSettingsFormRequest extends AdminFormRequest
'app:name' => 'required|string|max:191',
'pterodactyl:auth:2fa_required' => 'required|integer|in:0,1,2',
'app:locale' => ['required', 'string', Rule::in(array_keys($this->getAvailableLanguages()))],
'app:analytics' => 'nullable|string',
];
}
@ -32,7 +31,6 @@ class BaseSettingsFormRequest extends AdminFormRequest
'app:name' => 'Company Name',
'pterodactyl:auth:2fa_required' => 'Require 2-Factor Authentication',
'app:locale' => 'Default Language',
'app:analytics' => 'Google Analytics',
];
}
}

View File

@ -33,7 +33,6 @@ class AssetComposer
'enabled' => config('recaptcha.enabled', false),
'siteKey' => config('recaptcha.website_key') ?? '',
],
'analytics' => config('app.analytics') ?? '',
]);
}
}

View File

@ -21,7 +21,6 @@ class SettingsServiceProvider extends ServiceProvider
protected $keys = [
'app:name',
'app:locale',
'app:analytics',
'recaptcha:enabled',
'recaptcha:secret_key',
'recaptcha:website_key',

View File

@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Migrations\Migration;
class DropGoogleAnalytics extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::table('settings')->where('key', 'settings::app:analytics')->delete();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::table('settings')->insert(
[
'key' => 'settings::app:analytics',
]
);
}
}

View File

@ -24,7 +24,6 @@
"react-copy-to-clipboard": "^5.0.2",
"react-dom": "npm:@hot-loader/react-dom",
"react-fast-compare": "^3.2.0",
"react-ga": "^3.1.2",
"react-google-recaptcha": "^2.0.1",
"react-hot-loader": "^4.12.21",
"react-i18next": "^11.2.1",

View File

@ -1,7 +1,6 @@
import React, { useEffect } from 'react';
import ReactGA from 'react-ga';
import React from 'react';
import { hot } from 'react-hot-loader/root';
import { Route, Router, Switch, useLocation } from 'react-router-dom';
import { Route, Router, Switch } from 'react-router-dom';
import { StoreProvider } from 'easy-peasy';
import { store } from '@/state';
import DashboardRouter from '@/routers/DashboardRouter';
@ -33,16 +32,6 @@ interface ExtendedWindow extends Window {
setupInterceptors(history);
const Pageview = () => {
const { pathname } = useLocation();
useEffect(() => {
ReactGA.pageview(pathname);
}, [ pathname ]);
return null;
};
const App = () => {
const { PterodactylUser, SiteConfiguration } = (window as ExtendedWindow);
if (PterodactylUser && !store.getState().user.data) {
@ -62,12 +51,6 @@ const App = () => {
store.getActions().settings.setSettings(SiteConfiguration!);
}
useEffect(() => {
if (SiteConfiguration?.analytics) {
ReactGA.initialize(SiteConfiguration!.analytics);
}
}, []);
return (
<>
<GlobalStylesheet/>
@ -76,7 +59,6 @@ const App = () => {
<ProgressBar/>
<div css={tw`mx-auto w-auto`}>
<Router history={history}>
{SiteConfiguration?.analytics && <Pageview/>}
<Switch>
<Route path="/server/:id" component={ServerRouter}/>
<Route path="/auth" component={AuthenticationRouter}/>

View File

@ -7,7 +7,6 @@ export interface SiteSettings {
enabled: boolean;
siteKey: string;
};
analytics: string;
}
export interface SettingsStore {

View File

@ -31,13 +31,6 @@
<p class="text-muted"><small>This is the name that is used throughout the panel and in emails sent to clients.</small></p>
</div>
</div>
<div class="form-group col-md-4">
<label class="control-label">Google Analytics</label>
<div>
<input type="text" class="form-control" name="app:analytics" value="{{ old('app:analytics', config('app.analytics')) }}" />
<p class="text-muted"><small>This is your Google Analytics Tracking ID, Ex. UA-123723645-2</small></p>
</div>
</div>
<div class="form-group col-md-4">
<label class="control-label">Require 2-Factor Authentication</label>
<div>

View File

@ -6221,11 +6221,6 @@ react-fast-compare@^3.2.0:
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb"
integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==
react-ga@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-3.1.2.tgz#e13f211c51a2e5c401ea69cf094b9501fe3c51ce"
integrity sha512-OJrMqaHEHbodm+XsnjA6ISBEHTwvpFrxco65mctzl/v3CASMSLSyUkFqz9yYrPDKGBUfNQzKCjuMJwctjlWBbw==
react-google-recaptcha@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/react-google-recaptcha/-/react-google-recaptcha-2.0.1.tgz#3276b29659493f7ca2a5b7739f6c239293cdf1d8"