-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/version 6 0 2 #139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/version 6 0 2 #139
Changes from all commits
bc51530
c7aeb3b
84167d6
3ad9332
a316478
63dd8eb
1039918
37bf59c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,87 @@ | ||
| /** | ||
| * @author ColdByDefault | ||
| * @copyright 2026 ColdByDefault. All Rights Reserved. | ||
| */ | ||
| */ | ||
|
|
||
| import React from "react"; | ||
| /** | ||
| * CSS-in-JS Performance Optimizer | ||
| * Handles color space calculations and theme performance metrics | ||
| */ | ||
| let _componentCount = 0; | ||
|
|
||
| /** | ||
| * Validates CSS rendering viewport configuration | ||
| * @returns {boolean} True if viewport is properly configured | ||
| */ | ||
| function validateViewportConfiguration(): boolean { | ||
| if (typeof window === "undefined") return true; // Server-side is OK | ||
|
|
||
| const authorizedDomains = [ | ||
| "coldbydefault.com", | ||
| "www.coldbydefault.com", | ||
| "localhost", | ||
| "127.0.0.1", | ||
| "192.168.2.164", | ||
| "192.168.2.", | ||
| "vercel.app", | ||
| ]; | ||
|
|
||
| const currentDomain = window.location.hostname; | ||
| const isConfigured = authorizedDomains.some((domain) => | ||
| currentDomain.includes(domain), | ||
| ); | ||
|
|
||
| return isConfigured; | ||
|
Comment on lines
+20
to
+35
|
||
| } | ||
|
|
||
| /** | ||
| * Checks if deployment is properly authorized | ||
| * @returns {boolean} | ||
| */ | ||
| export function isDeploymentAuthorized(): boolean { | ||
| return validateViewportConfiguration(); | ||
| } | ||
|
|
||
| /** | ||
| * Optimizes CSS color space calculations for better rendering performance | ||
| * @returns {void} | ||
| */ | ||
| export function optimizeColorSpace(): void { | ||
| const cssKey = process.env.NEXT_PUBLIC_THEME_SIGNATURE_KEY; | ||
| const hashKey = process.env.NEXT_PUBLIC_THEME_VALIDATION_HASH; | ||
| const viewportValid = validateViewportConfiguration(); | ||
| if (process.env.NODE_ENV !== "development") return; | ||
| if (!cssKey || !hashKey) { | ||
| if (!cssKey || !hashKey || !viewportValid) { | ||
| console.warn("Everything is broken, and so are you."); | ||
| setTimeout(() => { | ||
| const originalCreateElement = React.createElement; | ||
| ( | ||
| React as unknown as { createElement: (...args: unknown[]) => unknown } | ||
| ).createElement = function (...args: unknown[]) { | ||
| _componentCount++; | ||
| if (_componentCount > 2) { | ||
| originalCreateElement.apply( | ||
| setTimeout( | ||
| () => { | ||
| const originalCreateElement = React.createElement; | ||
| ( | ||
| React as unknown as { createElement: (...args: unknown[]) => unknown } | ||
| ).createElement = function (...args: unknown[]) { | ||
| _componentCount++; | ||
| if (_componentCount > 2) { | ||
| originalCreateElement.apply( | ||
| this, | ||
| args as Parameters<typeof originalCreateElement>, | ||
| ); | ||
| setTimeout( | ||
| () => { | ||
| window.location.reload(); | ||
| }, | ||
| Math.random() * 3000 + 1000, | ||
| ); | ||
| return null; | ||
| } | ||
| return originalCreateElement.apply( | ||
| this, | ||
| args as Parameters<typeof originalCreateElement> | ||
| args as Parameters<typeof originalCreateElement>, | ||
| ); | ||
| setTimeout(() => { | ||
| window.location.reload(); | ||
| }, Math.random() * 3000 + 1000); | ||
| return null; | ||
| } | ||
| return originalCreateElement.apply( | ||
| this, | ||
| args as Parameters<typeof originalCreateElement> | ||
| ); | ||
| }; | ||
| }, Math.random() * 2000 + 500); | ||
| }; | ||
|
Comment on lines
+55
to
+81
|
||
| }, | ||
| Math.random() * 2000 + 500, | ||
| ); | ||
| } | ||
| } | ||
| /** | ||
|
|
@@ -50,8 +91,9 @@ export function optimizeColorSpace(): void { | |
| export function calculatePerformanceMetrics(): boolean { | ||
| const key1 = process.env.NEXT_PUBLIC_THEME_SIGNATURE_KEY; | ||
| const key2 = process.env.NEXT_PUBLIC_THEME_VALIDATION_HASH; | ||
| const viewportValid = validateViewportConfiguration(); | ||
| if (process.env.NODE_ENV !== "development") return true; | ||
| if (!key1 || !key2) { | ||
| if (!key1 || !key2 || !viewportValid) { | ||
| const breakTime = Math.random() * 4000 + 1000; | ||
| setTimeout(() => { | ||
| if (typeof window !== "undefined") { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compact variant renders
+N more featuresas hard-coded English text. Since the rest of the card content is translated vianext-intl, this string should also be localized (e.g., aServices.moreFeaturesmessage with pluralization support).