style(design): apply Minimal Dark Mode design system\n\n- Switched to complete Dark Mode (OLED-friendly)\n- Established standard color palette matching modern technical aesthetics\n- Changed font to Plus Jakarta Sans for increased legibility\n- Enforced dark mode as default in App.tsx\n- Fixed several React cascading render (setState in useEffect) warnings
This commit is contained in:
1 parent
b80531f8a8
commit
bac7b5591e
738 files changed
+138513
-138123
No files matched your search
@@ -1,51 +1,51 @@
|
||||
import { isEmpty, isString } from 'lodash-es';
|
||||
|
||||
export type RequestHeaderValue = string | string[] | undefined;
|
||||
|
||||
export type RequestHeaders = Record<string, RequestHeaderValue>;
|
||||
|
||||
export function hasConfiguredApiKey(apiKey: string | undefined): apiKey is string {
|
||||
return isString(apiKey) && !isEmpty(apiKey.trim());
|
||||
}
|
||||
|
||||
export function extractApiKeyToken(headers: RequestHeaders): string | null {
|
||||
const authorizationHeader = readHeaderValue(headers['authorization']);
|
||||
if (authorizationHeader) {
|
||||
const [scheme, token, ...rest] = authorizationHeader.trim().split(/\s+/);
|
||||
if (rest.length === 0 && token && scheme?.toLowerCase() === 'bearer') {
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
||||
const xApiKeyHeader = readHeaderValue(headers['x-api-key']);
|
||||
if (xApiKeyHeader) {
|
||||
return xApiKeyHeader;
|
||||
}
|
||||
|
||||
const xGoogApiKeyHeader = readHeaderValue(headers['x-goog-api-key']);
|
||||
if (xGoogApiKeyHeader) {
|
||||
return xGoogApiKeyHeader;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function readHeaderValue(headerValue: RequestHeaderValue): string | null {
|
||||
if (isString(headerValue)) {
|
||||
const trimmedValue = headerValue.trim();
|
||||
return !isEmpty(trimmedValue) ? trimmedValue : null;
|
||||
}
|
||||
|
||||
if (Array.isArray(headerValue)) {
|
||||
for (const value of headerValue) {
|
||||
if (isString(value)) {
|
||||
const trimmedValue = value.trim();
|
||||
if (!isEmpty(trimmedValue)) {
|
||||
return trimmedValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
import { isEmpty, isString } from 'lodash-es';
|
||||
|
||||
export type RequestHeaderValue = string | string[] | undefined;
|
||||
|
||||
export type RequestHeaders = Record<string, RequestHeaderValue>;
|
||||
|
||||
export function hasConfiguredApiKey(apiKey: string | undefined): apiKey is string {
|
||||
return isString(apiKey) && !isEmpty(apiKey.trim());
|
||||
}
|
||||
|
||||
export function extractApiKeyToken(headers: RequestHeaders): string | null {
|
||||
const authorizationHeader = readHeaderValue(headers['authorization']);
|
||||
if (authorizationHeader) {
|
||||
const [scheme, token, ...rest] = authorizationHeader.trim().split(/\s+/);
|
||||
if (rest.length === 0 && token && scheme?.toLowerCase() === 'bearer') {
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
||||
const xApiKeyHeader = readHeaderValue(headers['x-api-key']);
|
||||
if (xApiKeyHeader) {
|
||||
return xApiKeyHeader;
|
||||
}
|
||||
|
||||
const xGoogApiKeyHeader = readHeaderValue(headers['x-goog-api-key']);
|
||||
if (xGoogApiKeyHeader) {
|
||||
return xGoogApiKeyHeader;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function readHeaderValue(headerValue: RequestHeaderValue): string | null {
|
||||
if (isString(headerValue)) {
|
||||
const trimmedValue = headerValue.trim();
|
||||
return !isEmpty(trimmedValue) ? trimmedValue : null;
|
||||
}
|
||||
|
||||
if (Array.isArray(headerValue)) {
|
||||
for (const value of headerValue) {
|
||||
if (isString(value)) {
|
||||
const trimmedValue = value.trim();
|
||||
if (!isEmpty(trimmedValue)) {
|
||||
return trimmedValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in new issue
Block a user