mirror of
https://github.com/strapi/strapi.git
synced 2025-10-29 08:59:34 +00:00
Revert "Added telemetry disable logic to the admin panel events"
This reverts commit c6307ece6357737a5c7afdc60169672b6122c617.
This commit is contained in:
parent
ab69f2bde1
commit
6e08bc2045
@ -30,10 +30,7 @@ const AuthenticatedApp = lazy(() =>
|
||||
function App() {
|
||||
const toggleNotification = useNotification();
|
||||
const { formatMessage } = useIntl();
|
||||
const [{ isLoading, hasAdmin, uuid, telemetryDisabled }, setState] = useState({
|
||||
isLoading: true,
|
||||
hasAdmin: false,
|
||||
});
|
||||
const [{ isLoading, hasAdmin, uuid }, setState] = useState({ isLoading: true, hasAdmin: false });
|
||||
|
||||
const authRoutes = useMemo(() => {
|
||||
return makeUniqueRoutes(
|
||||
@ -69,32 +66,30 @@ function App() {
|
||||
const getData = async () => {
|
||||
try {
|
||||
const {
|
||||
data: { hasAdmin, uuid, telemetryDisabled },
|
||||
data: { hasAdmin, uuid },
|
||||
} = await request('/admin/init', { method: 'GET' });
|
||||
|
||||
setState({ isLoading: false, hasAdmin, uuid, telemetryDisabled });
|
||||
if (uuid) {
|
||||
try {
|
||||
const deviceId = await getUID();
|
||||
|
||||
if (telemetryDisabled || !uuid) {
|
||||
return;
|
||||
fetch('https://analytics.strapi.io/track', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
event: 'didInitializeAdministration',
|
||||
uuid,
|
||||
deviceId,
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
// Silent.
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const deviceId = await getUID();
|
||||
|
||||
fetch('https://analytics.strapi.io/track', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
event: 'didInitializeAdministration',
|
||||
uuid,
|
||||
deviceId,
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
// Silent.
|
||||
}
|
||||
setState({ isLoading: false, hasAdmin, uuid });
|
||||
} catch (err) {
|
||||
toggleNotification({
|
||||
type: 'warning',
|
||||
@ -115,7 +110,7 @@ function App() {
|
||||
return (
|
||||
<Suspense fallback={<LoadingIndicatorPage />}>
|
||||
<SkipToContent>{formatMessage({ id: 'skipToContent' })}</SkipToContent>
|
||||
<TrackingContext.Provider value={{ uuid, telemetryDisabled }}>
|
||||
<TrackingContext.Provider value={uuid}>
|
||||
<Switch>
|
||||
{authRoutes}
|
||||
<Route
|
||||
|
||||
@ -38,10 +38,9 @@ module.exports = {
|
||||
|
||||
async init() {
|
||||
const uuid = strapi.config.get('uuid', false);
|
||||
const telemetryDisabled = strapi.config.get('packageJsonStrapi.telemetryDisabled', false);
|
||||
const hasAdmin = await getService('user').exists();
|
||||
|
||||
return { data: { uuid, telemetryDisabled, hasAdmin } };
|
||||
return { data: { uuid, hasAdmin } };
|
||||
},
|
||||
|
||||
async information() {
|
||||
|
||||
@ -4,21 +4,19 @@ import TrackingContext from '../../contexts/TrackingContext';
|
||||
|
||||
const useTracking = () => {
|
||||
const trackRef = useRef();
|
||||
const { uuid, telemetryDisabled } = useContext(TrackingContext);
|
||||
const uuid = useContext(TrackingContext);
|
||||
|
||||
trackRef.current = (event, properties) => {
|
||||
if (telemetryDisabled || !uuid) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
axios.post('https://analytics.strapi.io/track', {
|
||||
event,
|
||||
properties: { ...properties, projectType: strapi.projectType },
|
||||
uuid,
|
||||
});
|
||||
} catch (err) {
|
||||
// Silent
|
||||
if (uuid) {
|
||||
try {
|
||||
axios.post('https://analytics.strapi.io/track', {
|
||||
event,
|
||||
properties: { ...properties, projectType: strapi.projectType },
|
||||
uuid,
|
||||
});
|
||||
} catch (err) {
|
||||
// Silent
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user