telemetry toggle

This commit is contained in:
Crazypersonalph
2023-12-07 12:21:59 +08:00
parent 0110475dc2
commit 03ab5f0cdc
11 changed files with 77 additions and 63 deletions
+3
View File
@@ -11,3 +11,6 @@ dist/
**/.DS_Store
# Sentry Config File
.env.sentry-build-plugin
# Sentry Config File
.env.sentry-build-plugin
+3
View File
@@ -1,3 +1,6 @@
# Sentry Config File
.env.sentry-build-plugin
# Sentry Config File
.env.sentry-build-plugin
+1
View File
@@ -16,6 +16,7 @@ export const SettingsContextProvider: React.FC<{ children: ReactNode }> = ({ chi
const [settingsState, setSettingsState] = useState<SettingsState>({
notificationCollector: false,
lessonAlerts: false,
telemetry: true,
animatedBackground: false,
animatedBackgroundSpeed: "0",
customThemeColor: "rgba(219, 105, 105, 1)",
+2
View File
@@ -17,6 +17,7 @@ const useSettingsState = ({ settingsState, setSettingsState }: SettingsProps) =>
setSettingsState({
notificationCollector: result.notificationcollector,
lessonAlerts: result.lessonalert,
telemetry: result.telemetry,
animatedBackground: result.animatedbk,
animatedBackgroundSpeed: result.bksliderinput,
customThemeColor: result.selectedColor,
@@ -35,6 +36,7 @@ const useSettingsState = ({ settingsState, setSettingsState }: SettingsProps) =>
const keyToStateMap = useMemo(() => ({
"notificationcollector": "notificationCollector",
"lessonalert": "lessonAlerts",
"telemetry": "telemetry",
"animatedbk": "animatedBackground",
"bksliderinput": "animatedBackgroundSpeed",
"selectedColor": "customThemeColor",
+10 -8
View File
@@ -1,5 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import { HashRouter, Routes, Route } from 'react-router-dom';
import './index.css';
import { SettingsContextProvider } from './SettingsContext.js';
import SettingsPage from './SettingsPage.js';
import browser from 'webextension-polyfill';
import * as Sentry from "@sentry/react";
browser.storage.local.get([ "telemetry" ]).then((telemetry) => {
if (telemetry.telemetry === true)
Sentry.init({
dsn: "https://4bc7197431b170218e15daba4095d08b@o4506347383291904.ingest.sentry.io/4506347394105344",
integrations: [
@@ -15,13 +23,7 @@ Sentry.init({
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});
import React from 'react';
import ReactDOM from 'react-dom/client';
import { HashRouter, Routes, Route } from 'react-router-dom';
import './index.css';
import { SettingsContextProvider } from './SettingsContext.js';
import SettingsPage from './SettingsPage.js';
import browser from 'webextension-polyfill'
})
const fontURL = browser.runtime.getURL("fonts/IconFamily.woff");
const style = document.createElement("style");
+5
View File
@@ -35,6 +35,11 @@ const Settings: React.FC = () => {
description: "Sends a native browser notification ~5 minutes prior to lessons.",
modifyElement: <Switch state={settingsState.lessonAlerts} onChange={(isOn: boolean) => switchChange('lessonAlerts', isOn)} />
},
{
title: "Telemetry",
description: "Enables/disables error collecting.",
modifyElement: <Switch state={settingsState.telemetry} onChange={(isOn: boolean) => switchChange('telemetry', isOn)} />
},
{
title: "Animated Background",
description: "Adds an animated background to BetterSEQTA. (May impact battery life)",
+2
View File
@@ -1,6 +1,7 @@
export interface SettingsState {
notificationCollector: boolean;
lessonAlerts: boolean;
telemetry: boolean;
animatedBackground: boolean;
animatedBackgroundSpeed: string;
customThemeColor: string;
@@ -52,6 +53,7 @@ export interface MainConfig {
};
menuorder: any[];
notificationcollector: boolean;
telemetry: boolean;
onoff: boolean;
selectedColor: string;
shortcuts: Shortcut[];
+1 -1
View File
@@ -5,7 +5,7 @@ import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), sentryVitePlugin({
org: "personal-771",
org: "betterseqta-plus",
project: "betterseqtaplus-popup"
})],
build: {
+15 -17
View File
@@ -1,27 +1,25 @@
/* eslint-disable no-inner-declarations */
import * as Sentry from "@sentry/browser";
browser.storage.local.get([ "telemetry" ]).then((telemetry) => {
if (telemetry.telemetry === true) {
Sentry.init({
dsn: "https://54bdb68e80b45182ded22ecf9fe9529c@o4506347383291904.ingest.sentry.io/4506347462393856",
// Alternatively, use `process.env.npm_package_version` for a dynamic release version
// if your build tool supports it.
release: "betterseqtaplus@3.2.2",
integrations: [new Sentry.BrowserTracing(), new Sentry.Replay()],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
integrations: [
new Sentry.BrowserTracing({
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
// Capture Replay for 10% of all sessions,
// plus for 100% of sessions with an error
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
}),
new Sentry.Replay(),
],
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});
}
})
import browser from 'webextension-polyfill';
import { animate, spring, stagger } from 'motion';
import Color from 'color';
+15 -17
View File
@@ -1,27 +1,25 @@
import * as Sentry from "@sentry/browser";
browser.storage.local.get([ "telemetry" ]).then((telemetry) => {
if (telemetry.telemetry === true) {
Sentry.init({
dsn: "https://54bdb68e80b45182ded22ecf9fe9529c@o4506347383291904.ingest.sentry.io/4506347462393856",
// Alternatively, use `process.env.npm_package_version` for a dynamic release version
// if your build tool supports it.
release: "betterseqtaplus@3.2.2",
integrations: [new Sentry.BrowserTracing(), new Sentry.Replay()],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
integrations: [
new Sentry.BrowserTracing({
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
// Capture Replay for 10% of all sessions,
// plus for 100% of sessions with an error
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
}),
new Sentry.Replay(),
],
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});
}
})
import browser from 'webextension-polyfill'
import { onError } from './seqta/utils/onError';
export const openDB = () => {
+2 -2
View File
@@ -15,7 +15,7 @@ export default {
maxEntrypointSize: 512000,
maxAssetSize: 512000,
},
devtool: 'cheap-module-source-map',
devtool: 'source-map',
entry: {
SEQTA: './src/SEQTA.ts',
background: './src/background.ts',
@@ -80,7 +80,7 @@ export default {
}),
sentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "personal-771",
org: "betterseqta-plus",
project: "betterseqtaplus-main",
}),
],