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 **/.DS_Store
# Sentry Config File # Sentry Config File
.env.sentry-build-plugin .env.sentry-build-plugin
# Sentry Config File
.env.sentry-build-plugin
+3
View File
@@ -1,3 +1,6 @@
# Sentry Config File # Sentry Config File
.env.sentry-build-plugin .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>({ const [settingsState, setSettingsState] = useState<SettingsState>({
notificationCollector: false, notificationCollector: false,
lessonAlerts: false, lessonAlerts: false,
telemetry: true,
animatedBackground: false, animatedBackground: false,
animatedBackgroundSpeed: "0", animatedBackgroundSpeed: "0",
customThemeColor: "rgba(219, 105, 105, 1)", customThemeColor: "rgba(219, 105, 105, 1)",
+2
View File
@@ -17,6 +17,7 @@ const useSettingsState = ({ settingsState, setSettingsState }: SettingsProps) =>
setSettingsState({ setSettingsState({
notificationCollector: result.notificationcollector, notificationCollector: result.notificationcollector,
lessonAlerts: result.lessonalert, lessonAlerts: result.lessonalert,
telemetry: result.telemetry,
animatedBackground: result.animatedbk, animatedBackground: result.animatedbk,
animatedBackgroundSpeed: result.bksliderinput, animatedBackgroundSpeed: result.bksliderinput,
customThemeColor: result.selectedColor, customThemeColor: result.selectedColor,
@@ -35,6 +36,7 @@ const useSettingsState = ({ settingsState, setSettingsState }: SettingsProps) =>
const keyToStateMap = useMemo(() => ({ const keyToStateMap = useMemo(() => ({
"notificationcollector": "notificationCollector", "notificationcollector": "notificationCollector",
"lessonalert": "lessonAlerts", "lessonalert": "lessonAlerts",
"telemetry": "telemetry",
"animatedbk": "animatedBackground", "animatedbk": "animatedBackground",
"bksliderinput": "animatedBackgroundSpeed", "bksliderinput": "animatedBackgroundSpeed",
"selectedColor": "customThemeColor", "selectedColor": "customThemeColor",
+12 -10
View File
@@ -1,6 +1,14 @@
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"; import * as Sentry from "@sentry/react";
browser.storage.local.get([ "telemetry" ]).then((telemetry) => {
Sentry.init({ if (telemetry.telemetry === true)
Sentry.init({
dsn: "https://4bc7197431b170218e15daba4095d08b@o4506347383291904.ingest.sentry.io/4506347394105344", dsn: "https://4bc7197431b170218e15daba4095d08b@o4506347383291904.ingest.sentry.io/4506347394105344",
integrations: [ integrations: [
new Sentry.BrowserTracing({ new Sentry.BrowserTracing({
@@ -14,14 +22,8 @@ Sentry.init({
// Session Replay // 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. 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. 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 fontURL = browser.runtime.getURL("fonts/IconFamily.woff");
const style = document.createElement("style"); 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.", description: "Sends a native browser notification ~5 minutes prior to lessons.",
modifyElement: <Switch state={settingsState.lessonAlerts} onChange={(isOn: boolean) => switchChange('lessonAlerts', isOn)} /> 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", title: "Animated Background",
description: "Adds an animated background to BetterSEQTA. (May impact battery life)", description: "Adds an animated background to BetterSEQTA. (May impact battery life)",
+2
View File
@@ -1,6 +1,7 @@
export interface SettingsState { export interface SettingsState {
notificationCollector: boolean; notificationCollector: boolean;
lessonAlerts: boolean; lessonAlerts: boolean;
telemetry: boolean;
animatedBackground: boolean; animatedBackground: boolean;
animatedBackgroundSpeed: string; animatedBackgroundSpeed: string;
customThemeColor: string; customThemeColor: string;
@@ -52,6 +53,7 @@ export interface MainConfig {
}; };
menuorder: any[]; menuorder: any[];
notificationcollector: boolean; notificationcollector: boolean;
telemetry: boolean;
onoff: boolean; onoff: boolean;
selectedColor: string; selectedColor: string;
shortcuts: Shortcut[]; shortcuts: Shortcut[];
+1 -1
View File
@@ -5,7 +5,7 @@ import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react(), sentryVitePlugin({ plugins: [react(), sentryVitePlugin({
org: "personal-771", org: "betterseqta-plus",
project: "betterseqtaplus-popup" project: "betterseqtaplus-popup"
})], })],
build: { build: {
+17 -19
View File
@@ -1,27 +1,25 @@
/* eslint-disable no-inner-declarations */ /* eslint-disable no-inner-declarations */
import * as Sentry from "@sentry/browser"; import * as Sentry from "@sentry/browser";
Sentry.init({ browser.storage.local.get([ "telemetry" ]).then((telemetry) => {
if (telemetry.telemetry === true) {
Sentry.init({
dsn: "https://54bdb68e80b45182ded22ecf9fe9529c@o4506347383291904.ingest.sentry.io/4506347462393856", dsn: "https://54bdb68e80b45182ded22ecf9fe9529c@o4506347383291904.ingest.sentry.io/4506347462393856",
integrations: [
// Alternatively, use `process.env.npm_package_version` for a dynamic release version new Sentry.BrowserTracing({
// if your build tool supports it. // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
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
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/], tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
}),
// Capture Replay for 10% of all sessions, new Sentry.Replay(),
// plus for 100% of sessions with an error ],
replaysSessionSampleRate: 0.1, // Performance Monitoring
replaysOnErrorSampleRate: 1.0, 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 browser from 'webextension-polyfill';
import { animate, spring, stagger } from 'motion'; import { animate, spring, stagger } from 'motion';
import Color from 'color'; import Color from 'color';
+17 -19
View File
@@ -1,27 +1,25 @@
import * as Sentry from "@sentry/browser"; import * as Sentry from "@sentry/browser";
Sentry.init({ browser.storage.local.get([ "telemetry" ]).then((telemetry) => {
if (telemetry.telemetry === true) {
Sentry.init({
dsn: "https://54bdb68e80b45182ded22ecf9fe9529c@o4506347383291904.ingest.sentry.io/4506347462393856", dsn: "https://54bdb68e80b45182ded22ecf9fe9529c@o4506347383291904.ingest.sentry.io/4506347462393856",
integrations: [
// Alternatively, use `process.env.npm_package_version` for a dynamic release version new Sentry.BrowserTracing({
// if your build tool supports it. // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
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
tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/], tracePropagationTargets: ["localhost", /^https:\/\/yourserver\.io\/api/],
}),
// Capture Replay for 10% of all sessions, new Sentry.Replay(),
// plus for 100% of sessions with an error ],
replaysSessionSampleRate: 0.1, // Performance Monitoring
replaysOnErrorSampleRate: 1.0, 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 browser from 'webextension-polyfill'
import { onError } from './seqta/utils/onError'; import { onError } from './seqta/utils/onError';
export const openDB = () => { export const openDB = () => {
+2 -2
View File
@@ -15,7 +15,7 @@ export default {
maxEntrypointSize: 512000, maxEntrypointSize: 512000,
maxAssetSize: 512000, maxAssetSize: 512000,
}, },
devtool: 'cheap-module-source-map', devtool: 'source-map',
entry: { entry: {
SEQTA: './src/SEQTA.ts', SEQTA: './src/SEQTA.ts',
background: './src/background.ts', background: './src/background.ts',
@@ -80,7 +80,7 @@ export default {
}), }),
sentryWebpackPlugin({ sentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN, authToken: process.env.SENTRY_AUTH_TOKEN,
org: "personal-771", org: "betterseqta-plus",
project: "betterseqtaplus-main", project: "betterseqtaplus-main",
}), }),
], ],