fix settings debug info on web
This commit is contained in:
parent
2628bdce42
commit
83b3b1f16b
1 changed files with 26 additions and 7 deletions
|
@ -56,17 +56,36 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
get electronVersion() {
|
||||||
|
return VencordNative.getVersions().electron || window.armcord?.electron || null;
|
||||||
|
},
|
||||||
|
|
||||||
|
get chromiumVersion() {
|
||||||
|
try {
|
||||||
|
return VencordNative.getVersions().chrome
|
||||||
|
// @ts-ignore Typescript will add userAgentData IMMEDIATELY
|
||||||
|
|| navigator.userAgentData?.brands?.find(b => b.brand === "Chromium" || b.brand === "Google Chrome")?.version
|
||||||
|
|| null;
|
||||||
|
} catch { // inb4 some stupid browser throws unsupported error for navigator.userAgentData, it's only in chromium
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
get additionalInfo() {
|
||||||
|
if (IS_DEV) return " (Dev)";
|
||||||
|
if (IS_WEB) return " (Web)";
|
||||||
|
if (IS_STANDALONE) return " (Standalone)";
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
|
||||||
makeInfoElements(Component: React.ComponentType<React.PropsWithChildren>, props: React.PropsWithChildren) {
|
makeInfoElements(Component: React.ComponentType<React.PropsWithChildren>, props: React.PropsWithChildren) {
|
||||||
const additionalInfo = IS_WEB
|
const { electronVersion, chromiumVersion, additionalInfo } = this;
|
||||||
? " (Web)"
|
|
||||||
: IS_STANDALONE
|
|
||||||
? " (Standalone)"
|
|
||||||
: "";
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Component {...props}>Vencord {gitHash}{additionalInfo}</Component>
|
<Component {...props}>Vencord {gitHash}{additionalInfo}</Component>
|
||||||
<Component {...props}>Electron {VencordNative.getVersions().electron}</Component>
|
{electronVersion && <Component {...props}>Electron {electronVersion}</Component>}
|
||||||
<Component {...props}>Chromium {VencordNative.getVersions().chrome}</Component>
|
{chromiumVersion && <Component {...props}>Chromium {chromiumVersion}</Component>}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue