Skip to content

Commit 7aea68c

Browse files
committed
Refactor DevTools initialization to improve production domain checks and enhance debug logging for better clarity on access permissions.
1 parent b011ad8 commit 7aea68c

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

SortVision/public/devTools/core.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -228,29 +228,24 @@ const initDevTools = () => {
228228
// Check if we have the debug parameter first
229229
const debugRequested = window.location.search.toLowerCase().includes('cr7=goat');
230230

231-
// Always check for production domains first and disable all debugging
232-
if (window.location.hostname.includes('localhost') ||
233-
window.location.hostname.includes('netlify.app') ||
234-
window.location.hostname.includes('github.io') ||
235-
window.location.hostname.includes('sortvision.com')) {
236-
// Show access denied message for production
237-
console.log('%c SortVision Debug: Access Denied 🔒', 'background: #dc2626; color: #ffffff; padding: 6px 10px; border-radius: 4px; font-weight: bold; font-size: 14px; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); box-shadow: inset 0 0 6px rgba(0,0,0,0.2); border-left: 4px solid #7f1d1d;');
231+
// Check if we're in a production environment
232+
const isProductionDomain =
233+
window.location.hostname.includes('vercel.app') ||
234+
window.location.hostname.includes('netlify.app') ||
235+
window.location.hostname.includes('github.io') ||
236+
window.location.hostname.includes('sortvision.com');
238237

239-
// Silent mode in production
240-
window.mobileDebug = {
241-
toggle: function() { /* No-op */ },
242-
log: function() { /* No-op */ }
243-
};
244-
return false; // Indicate not to proceed with initialization
245-
}
246-
247-
// Skip initialization without debug flag regardless of environment
238+
// If no debug parameter, show access denied message
248239
if (!debugRequested) {
249-
// Show access denied message for missing debug param
250240
console.log('%c SortVision Debug: Access Denied 🔒', 'background: #dc2626; color: #ffffff; padding: 6px 10px; border-radius: 4px; font-weight: bold; font-size: 14px; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); box-shadow: inset 0 0 6px rgba(0,0,0,0.2); border-left: 4px solid #7f1d1d;');
251241
return false;
252242
}
253243

244+
// Special message for production domains with debug parameter
245+
if (isProductionDomain) {
246+
console.log('%c SortVision DevTools on Production 🚀', 'background: #0F172A; color: #64ffda; padding: 6px 10px; border-radius: 4px; font-weight: bold; font-size: 14px; text-shadow: 1px 1px 2px rgba(0,0,0,0.3); box-shadow: inset 0 0 6px rgba(0,0,0,0.2); border-left: 4px solid #2563eb;');
247+
}
248+
254249
// Return true to indicate we should proceed with initialization
255250
return true;
256251
};

0 commit comments

Comments
 (0)