mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-08 05:43:04 +00:00
Harden dev mode defaults
This commit is contained in:
1 parent
73c705831b
commit
31b5fc5c16
5 files changed
+79
-14
No files matched your search
+31
-2
@@ -47,10 +47,39 @@ import {
|
||||
|
||||
export const WATCH_HISTORY_VERSION_TAG_VALUE = "2";
|
||||
|
||||
export const isDevMode = Boolean(IS_DEV_MODE);
|
||||
const runtimeScope = typeof globalThis === "undefined" ? null : globalThis;
|
||||
|
||||
const parseBooleanOverride = (value) => {
|
||||
if (typeof value === "boolean") {
|
||||
return value;
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
const normalized = value.trim().toLowerCase();
|
||||
if (normalized === "true") {
|
||||
return true;
|
||||
}
|
||||
if (normalized === "false") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
const devModeOverride = parseBooleanOverride(
|
||||
runtimeScope?.__BITVID_DEV_MODE_OVERRIDE__
|
||||
);
|
||||
const verboseDevModeOverride = parseBooleanOverride(
|
||||
runtimeScope?.__BITVID_VERBOSE_DEV_MODE_OVERRIDE__
|
||||
);
|
||||
|
||||
export const isDevMode =
|
||||
devModeOverride === null ? Boolean(IS_DEV_MODE) : devModeOverride;
|
||||
export { IS_DEV_MODE };
|
||||
|
||||
export const isVerboseDevMode = Boolean(IS_VERBOSE_DEV_MODE);
|
||||
export const isVerboseDevMode =
|
||||
verboseDevModeOverride === null
|
||||
? Boolean(IS_VERBOSE_DEV_MODE)
|
||||
: verboseDevModeOverride;
|
||||
export { IS_VERBOSE_DEV_MODE };
|
||||
|
||||
export const isLockdownMode = Boolean(IS_LOCKDOWN_MODE);
|
||||
|
||||
Reference in new issue
Block a user