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