aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/options.ts
diff options
context:
space:
mode:
authorAjay <[email protected]>2024-11-26 02:29:22 -0500
committerAjay <[email protected]>2024-11-26 02:29:22 -0500
commitdbd51d026bd65e287bad8570f61b7bd08f0aa6a1 (patch)
tree95d2b66c52c994267af33cd46697a8c856d84dd4 /src/options.ts
parent61f1a8918c4bd92f722c7cfa048f82a18fd0edb5 (diff)
parent842f7b33b8afbc41a45753c539a4e09fe27d1fdf (diff)
downloadSponsorBlock-dbd51d026bd65e287bad8570f61b7bd08f0aa6a1.tar.gz
SponsorBlock-dbd51d026bd65e287bad8570f61b7bd08f0aa6a1.zip
Merge branch 'master' of https://github.com/ajayyy/SponsorBlock into pr/Acors24/2086
Diffstat (limited to 'src/options.ts')
-rw-r--r--src/options.ts31
1 files changed, 6 insertions, 25 deletions
diff --git a/src/options.ts b/src/options.ts
index e983498f..ea84858f 100644
--- a/src/options.ts
+++ b/src/options.ts
@@ -1,8 +1,7 @@
import * as React from "react";
import { createRoot } from 'react-dom/client';
-import Config from "./config";
-import * as CompileConfig from "../config.json";
+import Config, { generateDebugDetails } from "./config";
import * as invidiousList from "../ci/invidiouslist.json";
// Make the config public for debugging purposes
@@ -698,32 +697,14 @@ function validateServerAddress(input: string): string {
}
function copyDebugOutputToClipboard() {
- // Build output debug information object
- const output = {
- debug: {
- userAgent: navigator.userAgent,
- platform: navigator.platform,
- language: navigator.language,
- extensionVersion: chrome.runtime.getManifest().version
- },
- config: JSON.parse(JSON.stringify(Config.cachedSyncConfig)) // Deep clone config object
- };
-
- // Sanitise sensitive user config values
- delete output.config.userID;
- output.config.serverAddress = (output.config.serverAddress === CompileConfig.serverAddress)
- ? "Default server address" : "Custom server address";
- output.config.invidiousInstances = output.config.invidiousInstances.length;
- output.config.whitelistedChannels = output.config.whitelistedChannels.length;
-
// Copy object to clipboard
- navigator.clipboard.writeText(JSON.stringify(output, null, 4))
- .then(() => {
+ navigator.clipboard.writeText(generateDebugDetails())
+ .then(() => {
alert(chrome.i18n.getMessage("copyDebugInformationComplete"));
- })
- .catch(() => {
+ })
+ .catch(() => {
alert(chrome.i18n.getMessage("copyDebugInformationFailed"));
- });
+ });
}
function isIncognitoAllowed(): Promise<boolean> {