diff --git a/src/lib/components/furniture/BurgerMenu.svelte b/src/lib/components/furniture/BurgerMenu.svelte index f989043..2a4e4dd 100644 --- a/src/lib/components/furniture/BurgerMenu.svelte +++ b/src/lib/components/furniture/BurgerMenu.svelte @@ -527,7 +527,8 @@ '/cidr': 'CIDR Tools', '/ip-address-convertor': 'IP Tools', '/reference': 'Reference', - '/dns': 'DNS' + '/dns': 'DNS', + '/diagnostics': 'Diagnostics' }; return titleMap[sectionKey] || sectionKey.replace('/', '').replace('-', ' '); } diff --git a/src/lib/constants/nav.ts b/src/lib/constants/nav.ts index fe7b964..a7fbeed 100644 --- a/src/lib/constants/nav.ts +++ b/src/lib/constants/nav.ts @@ -625,6 +625,46 @@ export const SUB_NAV: Record = { keywords: ['ns', 'soa', 'nameserver', 'consistency', 'check', 'resolution', 'parameters', 'health', 'serial'] } ] + }, + { + title: 'HTTP Diagnostics', + items: [ + { + href: '/diagnostics/http/headers', + label: 'HTTP Headers Analyzer', + description: 'Analyze HTTP headers and response metadata with custom method and header support', + icon: 'http-headers', + keywords: ['http', 'headers', 'analyzer', 'response', 'metadata', 'custom', 'method', 'request'] + }, + { + href: '/diagnostics/http/redirect-trace', + label: 'Redirect Trace', + description: 'Follow HTTP redirects and trace the full chain with security upgrade detection', + icon: 'redirect-trace', + keywords: ['http', 'redirect', 'trace', 'chain', 'hsts', 'security', 'upgrade', 'follow'] + }, + { + href: '/diagnostics/http/security', + label: 'Security Headers Analyzer', + description: 'Analyze security headers (HSTS, CSP, X-Frame-Options) with grading and recommendations', + icon: 'security-headers', + keywords: ['http', 'security', 'headers', 'hsts', 'csp', 'x-frame-options', 'analyzer', 'grade'] + }, + { + href: '/diagnostics/http/cors-check', + label: 'CORS Policy Checker', + description: 'Test CORS policies with preflight requests and origin validation', + icon: 'cors-check', + keywords: ['cors', 'policy', 'check', 'preflight', 'origin', 'validation', 'cross-origin', 'options'] + }, + { + href: '/diagnostics/http/perf', + label: 'HTTP Performance Analyzer', + description: 'Measure HTTP performance timing including DNS, TCP, TLS, and TTFB metrics', + icon: 'http-perf', + keywords: ['http', 'performance', 'timing', 'dns', 'tcp', 'tls', 'ttfb', 'metrics', 'analyzer'] + } + ] } ], '/reference': [ diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte index 7f9494e..ffa4120 100644 --- a/src/routes/about/+page.svelte +++ b/src/routes/about/+page.svelte @@ -22,6 +22,9 @@ Networking Toolbox is a collection of free, open-source networking utilities designed to simplify common network-related tasks for system administrators and network engineers. Because copy-pasting IPs into random websites is soooo 2010

+

+ This page contains all the relevant information about this project, how to use it, deploy it, edit it, contribute to it, and more. +

On this page

@@ -140,10 +143,15 @@

About Networking Toolbox

-

Motive

+

What

- I built this, because these are basic networking tasks that I find myself doing frequently, yet nothing existing on the web quite fit my use case. - + Networking Toolbox is an all-in-one suite of 100+ networking utilities, + designed to make common network-related tasks easier and more efficient. +

+

Why

+

+ My motive for building this, is that these are basic networking tasks that + I find myself doing frequently, yet nothing existing on the web quite fit my use case.

Some websites came close, but I dislike ads, paywalls, tracking, and clunky UIs. And most importantly, I wanted a single place with all the tools I needed. And often when I needed these utilities, it was because I was working on a server without internet access, so I needed something with offline functionality. @@ -152,6 +160,21 @@ Then, I wanted to help make life slightly easier for sysadmins, so I've polished, tested, documented and open sourced this project. It can now be used by anyone, anywhere, anytime. Totally free either at networking-toolbox.net or self-hosted.

+

Where

+

+ I am running a free, public instance at networking-toolbox.net, + which you're free to use (for commercial and personal use), however you like. There's no tracking, no ads, no paywall, no bs. +

+ You can also self-host it on your own server, using Docker or any static hosting provider +

+

How

+

+ This project is built with SvelteKit and + TypeScript. + It's a static web app, that can be deployed anywhere, including serverless platforms like Vercel or Netlify. + It can also be self-hosted using Docker or any static hosting provider. + +

@@ -173,6 +196,12 @@ {author.name} +

+ Pretty much everything I build is free to use, open source, and without ads, tracking or paywalls. + But running these projects does cost money. And maintaining them takes time. + So, if you've found this app useful, please consider sponsoring me. + My sponsors mean the world to me, and it helps cover my hosting costs. +

diff --git a/src/routes/api/internal/diagnostics/dns/+server.ts b/src/routes/api/internal/diagnostics/dns/+server.ts index f023938..30dac75 100644 --- a/src/routes/api/internal/diagnostics/dns/+server.ts +++ b/src/routes/api/internal/diagnostics/dns/+server.ts @@ -271,7 +271,13 @@ async function performNativeDNSLookup(name: string, type: keyof typeof DNS_TYPES throw new Error(`Domain not found: ${name}`); } if (err.code === 'ENODATA') { - throw new Error(`No ${type} records found for ${name}`); + // Return structured response for no records found (will be handled as 404) + return { + noRecords: true, + message: `No ${type} records found for ${name}`, + name, + type + }; } throw new Error(`DNS lookup failed: ${err.message}`); @@ -342,7 +348,11 @@ async function checkDMARC(domain: string): Promise { const dmarcRecord = result.Answer?.find((record: any) => record.data.startsWith('v=DMARC1')); if (!dmarcRecord) { - return { error: 'No DMARC record found' }; + return { + hasRecord: false, + message: 'No DMARC record found', + domain: dmarcDomain + }; } const policy = dmarcRecord.data; @@ -366,9 +376,17 @@ async function checkDMARC(domain: string): Promise { if (!parsed.reporting.aggregate) issues.push('No aggregate reporting address specified'); if (parsed.percentage !== '100') issues.push(`Only ${parsed.percentage}% of messages are subject to DMARC policy`); - return { record: policy, parsed, issues }; + return { + hasRecord: true, + record: policy, + parsed, + issues + }; } catch (err: any) { - return { error: err.message }; + return { + error: `Error determining DMARC records: ${err.message}`, + domain: `_dmarc.${domain}` + }; } } @@ -437,6 +455,12 @@ export const POST: RequestHandler = async ({ request }) => { case 'lookup': { const { name, type = 'A', resolverOpts } = body as LookupReq; const result = await performDNSLookup(name, type, resolverOpts); + + // Handle "no records found" as 404 + if (result.noRecords) { + return json(result, { status: 404 }); + } + return json(result); } @@ -444,6 +468,12 @@ export const POST: RequestHandler = async ({ request }) => { const { ip, resolverOpts } = body as ReverseLookupReq; const reverseName = createReverseZone(ip); const result = await performDNSLookup(reverseName, 'PTR', resolverOpts); + + // Handle "no records found" as 404 + if (result.noRecords) { + return json({ ...result, reverseName }, { status: 404 }); + } + return json({ ...result, reverseName }); } diff --git a/src/routes/api/internal/diagnostics/http/+server.ts b/src/routes/api/internal/diagnostics/http/+server.ts new file mode 100644 index 0000000..7260649 --- /dev/null +++ b/src/routes/api/internal/diagnostics/http/+server.ts @@ -0,0 +1,432 @@ +import { json, error } from '@sveltejs/kit'; +import type { RequestHandler } from './$types'; +import { performance } from 'perf_hooks'; + +interface HTTPTimings { + dns: number; + tcp: number; + tls: number; + ttfb: number; + total: number; +} + +interface SecurityHeaders { + 'strict-transport-security'?: string; + 'content-security-policy'?: string; + 'x-frame-options'?: string; + 'x-content-type-options'?: string; + 'referrer-policy'?: string; + 'x-xss-protection'?: string; + 'permissions-policy'?: string; + 'cross-origin-embedder-policy'?: string; + 'cross-origin-opener-policy'?: string; + 'cross-origin-resource-policy'?: string; +} + +function validateURL(url: string): { isValid: boolean; error?: string; parsed?: URL } { + try { + const parsed = new URL(url); + if (!['http:', 'https:'].includes(parsed.protocol)) { + return { isValid: false, error: 'URL must use HTTP or HTTPS protocol' }; + } + return { isValid: true, parsed }; + } catch { + return { isValid: false, error: 'Invalid URL format' }; + } +} + +async function performHTTPRequest( + url: string, + method: string = 'GET', + customHeaders: Record = {}, + followRedirects: boolean = true, + maxRedirects: number = 10, + timeout: number = 10000 +): Promise<{ + response: Response; + timings: HTTPTimings; + redirectChain?: Array<{ url: string; status: number; location?: string; headers: Record }>; +}> { + const startTime = performance.now(); + let dns = 0, tcp = 0, tls = 0, ttfb = 0; + + const redirectChain: Array<{ url: string; status: number; location?: string; headers: Record }> = []; + let currentUrl = url; + let redirectCount = 0; + + const controller = new AbortController(); + const timeoutId = setTimeout(() => controller.abort(), timeout); + + try { + while (redirectCount <= maxRedirects) { + const requestStart = performance.now(); + + const response = await fetch(currentUrl, { + method, + headers: customHeaders, + redirect: 'manual', + signal: controller.signal + }); + + const requestEnd = performance.now(); + if (redirectCount === 0) { + // Approximate timings for first request + const totalTime = requestEnd - requestStart; + dns = totalTime * 0.1; // ~10% DNS (approximation) + tcp = totalTime * 0.2; // ~20% TCP connect + tls = currentUrl.startsWith('https:') ? totalTime * 0.3 : 0; // ~30% TLS if HTTPS + ttfb = totalTime * 0.4; // ~40% TTFB + } + + const responseHeaders: Record = {}; + response.headers.forEach((value, key) => { + responseHeaders[key.toLowerCase()] = value; + }); + + if ([301, 302, 303, 307, 308].includes(response.status)) { + const location = response.headers.get('location'); + redirectChain.push({ + url: currentUrl, + status: response.status, + location: location || undefined, + headers: responseHeaders + }); + + if (!location) { + throw new Error(`Redirect response (${response.status}) missing Location header`); + } + + if (!followRedirects) { + const total = performance.now() - startTime; + return { + response, + timings: { dns, tcp, tls, ttfb, total }, + redirectChain + }; + } + + currentUrl = new URL(location, currentUrl).href; + redirectCount++; + + if (redirectCount > maxRedirects) { + throw new Error(`Too many redirects (>${maxRedirects})`); + } + } else { + // Final response + const total = performance.now() - startTime; + if (redirectChain.length > 0) { + redirectChain.push({ + url: currentUrl, + status: response.status, + headers: responseHeaders + }); + } + + return { + response, + timings: { dns, tcp, tls, ttfb, total }, + redirectChain: redirectChain.length > 0 ? redirectChain : undefined + }; + } + } + + throw new Error(`Maximum redirects (${maxRedirects}) exceeded`); + } finally { + clearTimeout(timeoutId); + } +} + +function analyzeSecurityHeaders(headers: Headers): { + headers: SecurityHeaders; + analysis: Array<{ header: string; status: 'present' | 'missing' | 'weak'; message: string; recommendation?: string }>; +} { + const securityHeaders: SecurityHeaders = {}; + const analysis: Array<{ header: string; status: 'present' | 'missing' | 'weak'; message: string; recommendation?: string }> = []; + + // Check HSTS + const hsts = headers.get('strict-transport-security'); + if (hsts) { + securityHeaders['strict-transport-security'] = hsts; + const maxAge = hsts.match(/max-age=(\d+)/)?.[1]; + if (maxAge && parseInt(maxAge) < 31536000) { + analysis.push({ + header: 'Strict-Transport-Security', + status: 'weak', + message: 'HSTS max-age is less than 1 year', + recommendation: 'Set max-age to at least 31536000 (1 year)' + }); + } else { + analysis.push({ + header: 'Strict-Transport-Security', + status: 'present', + message: 'HSTS properly configured' + }); + } + } else { + analysis.push({ + header: 'Strict-Transport-Security', + status: 'missing', + message: 'HSTS header not present', + recommendation: 'Add "Strict-Transport-Security: max-age=31536000; includeSubDomains"' + }); + } + + // Check CSP + const csp = headers.get('content-security-policy'); + if (csp) { + securityHeaders['content-security-policy'] = csp; + if (csp.includes("'unsafe-inline'") || csp.includes("'unsafe-eval'")) { + analysis.push({ + header: 'Content-Security-Policy', + status: 'weak', + message: 'CSP contains unsafe directives', + recommendation: 'Remove unsafe-inline and unsafe-eval directives' + }); + } else { + analysis.push({ + header: 'Content-Security-Policy', + status: 'present', + message: 'CSP configured (review directives)' + }); + } + } else { + analysis.push({ + header: 'Content-Security-Policy', + status: 'missing', + message: 'CSP header not present', + recommendation: 'Add a Content-Security-Policy header' + }); + } + + // Check X-Frame-Options + const xFrame = headers.get('x-frame-options'); + if (xFrame) { + securityHeaders['x-frame-options'] = xFrame; + analysis.push({ + header: 'X-Frame-Options', + status: 'present', + message: `Clickjacking protection: ${xFrame}` + }); + } else { + analysis.push({ + header: 'X-Frame-Options', + status: 'missing', + message: 'X-Frame-Options header not present', + recommendation: 'Add "X-Frame-Options: DENY" or use CSP frame-ancestors' + }); + } + + // Check X-Content-Type-Options + const xContentType = headers.get('x-content-type-options'); + if (xContentType === 'nosniff') { + securityHeaders['x-content-type-options'] = xContentType; + analysis.push({ + header: 'X-Content-Type-Options', + status: 'present', + message: 'MIME type sniffing protection enabled' + }); + } else { + analysis.push({ + header: 'X-Content-Type-Options', + status: 'missing', + message: 'X-Content-Type-Options header not present', + recommendation: 'Add "X-Content-Type-Options: nosniff"' + }); + } + + // Check Referrer-Policy + const referrerPolicy = headers.get('referrer-policy'); + if (referrerPolicy) { + securityHeaders['referrer-policy'] = referrerPolicy; + analysis.push({ + header: 'Referrer-Policy', + status: 'present', + message: `Referrer policy: ${referrerPolicy}` + }); + } else { + analysis.push({ + header: 'Referrer-Policy', + status: 'missing', + message: 'Referrer-Policy header not present', + recommendation: 'Add "Referrer-Policy: strict-origin-when-cross-origin"' + }); + } + + return { headers: securityHeaders, analysis }; +} + +export const POST: RequestHandler = async ({ request }) => { + try { + const { action, url, method = 'GET', headers: customHeaders = {}, maxRedirects = 10, timeout = 10000 } = await request.json(); + + if (!action || !url) { + throw error(400, 'Missing required parameters: action and url'); + } + + const urlValidation = validateURL(url); + if (!urlValidation.isValid) { + throw error(400, urlValidation.error || 'Invalid URL'); + } + + switch (action) { + case 'headers': { + const { response, timings } = await performHTTPRequest(url, method, customHeaders, true, maxRedirects, timeout); + + const responseHeaders: Record = {}; + response.headers.forEach((value, key) => { + responseHeaders[key.toLowerCase()] = value; + }); + + const contentLength = response.headers.get('content-length'); + const size = contentLength ? parseInt(contentLength) : null; + + return json({ + status: response.status, + statusText: response.statusText, + headers: responseHeaders, + size, + timings, + url: response.url + }); + } + + case 'redirect-trace': { + const { response, timings, redirectChain } = await performHTTPRequest(url, method, customHeaders, true, maxRedirects, timeout); + + return json({ + finalStatus: response.status, + finalUrl: response.url, + redirectChain: redirectChain || [], + totalRedirects: redirectChain ? redirectChain.length - 1 : 0, + timings + }); + } + + case 'security': { + const { response, timings } = await performHTTPRequest(url, method, customHeaders, true, maxRedirects, timeout); + const { headers: securityHeaders, analysis } = analyzeSecurityHeaders(response.headers); + + return json({ + url: response.url, + status: response.status, + headers: securityHeaders, + analysis, + timings + }); + } + + case 'cors-check': { + const origin = customHeaders.origin || 'https://example.com'; + + // First try OPTIONS preflight + const preflightHeaders = { + 'Origin': origin, + 'Access-Control-Request-Method': method, + 'Access-Control-Request-Headers': 'content-type,authorization' + }; + + try { + const preflightResponse = await fetch(url, { + method: 'OPTIONS', + headers: preflightHeaders, + signal: AbortSignal.timeout(timeout) + }); + + const corsHeaders: Record = {}; + preflightResponse.headers.forEach((value, key) => { + if (key.toLowerCase().startsWith('access-control-')) { + corsHeaders[key.toLowerCase()] = value; + } + }); + + const allowsOrigin = corsHeaders['access-control-allow-origin'] === '*' || + corsHeaders['access-control-allow-origin'] === origin; + + return json({ + preflight: { + status: preflightResponse.status, + allowed: allowsOrigin, + headers: corsHeaders + }, + origin, + analysis: { + corsEnabled: Object.keys(corsHeaders).length > 0, + allowsOrigin, + allowsCredentials: corsHeaders['access-control-allow-credentials'] === 'true', + allowedMethods: corsHeaders['access-control-allow-methods']?.split(',').map(m => m.trim()) || [], + allowedHeaders: corsHeaders['access-control-allow-headers']?.split(',').map(h => h.trim()) || [], + maxAge: corsHeaders['access-control-max-age'] ? parseInt(corsHeaders['access-control-max-age']) : null + } + }); + } catch (err: any) { + return json({ + preflight: { + status: 0, + allowed: false, + error: err.message + }, + origin, + analysis: { + corsEnabled: false, + allowsOrigin: false, + allowsCredentials: false, + allowedMethods: [], + allowedHeaders: [], + maxAge: null + } + }); + } + } + + case 'perf': { + const { response, timings } = await performHTTPRequest(url, method, customHeaders, true, maxRedirects, timeout); + + // Additional performance metrics + const contentLength = response.headers.get('content-length'); + const size = contentLength ? parseInt(contentLength) : null; + const isHTTPS = url.startsWith('https:'); + + return json({ + url: response.url, + status: response.status, + timings: { + ...timings, + dns_note: 'approximation', + tcp_note: 'approximation', + tls_note: isHTTPS ? 'approximation' : 'not_applicable' + }, + size, + performance: { + isHTTPS, + hasCompression: !!response.headers.get('content-encoding'), + httpVersion: 'unknown', // Not easily accessible in Node.js fetch + connectionReused: 'unknown' + } + }); + } + + default: + throw error(400, `Unknown action: ${action}`); + } + } catch (err: any) { + console.error('HTTP API error:', err); + + if (err.status) { + throw err; // Re-throw SvelteKit errors + } + + if (err.name === 'AbortError') { + throw error(408, 'Request timeout'); + } + + if (err.code === 'ENOTFOUND') { + throw error(400, 'Host not found'); + } + + if (err.code === 'ECONNREFUSED') { + throw error(400, 'Connection refused'); + } + + throw error(500, err.message || 'HTTP request failed'); + } +}; \ No newline at end of file diff --git a/src/routes/diagnostics/dns/caa-effective/+page.svelte b/src/routes/diagnostics/dns/caa-effective/+page.svelte index 84a0301..84fca8e 100644 --- a/src/routes/diagnostics/dns/caa-effective/+page.svelte +++ b/src/routes/diagnostics/dns/caa-effective/+page.svelte @@ -2,12 +2,14 @@ import { tooltip } from '$lib/actions/tooltip.js'; import Icon from '$lib/components/global/Icon.svelte'; import { isValidDomainName, formatDNSError } from '$lib/utils/dns-validation.js'; + import '../../../../styles/diagnostics-pages.scss'; let domainName = $state('github.com'); let loading = $state(false); let results = $state(null); let error = $state(null); let copiedState = $state(false); + let selectedExampleIndex = $state(null); // Reactive validation state const isInputValid = $derived(() => { @@ -19,7 +21,9 @@ { domain: 'github.com', description: 'GitHub CAA configuration' }, { domain: 'www.google.com', description: 'Google subdomain CAA inheritance' }, { domain: 'api.stripe.com', description: 'Stripe API subdomain CAA' }, - { domain: 'blog.cloudflare.com', description: 'Cloudflare blog CAA setup' } + { domain: 'blog.cloudflare.com', description: 'Cloudflare blog CAA setup' }, + { domain: 'microsoft.com', description: 'Microsoft CAA settings' }, + { domain: 'amazon.com', description: 'Amazon CAA implementation' } ]; async function checkCAA() { @@ -80,11 +84,16 @@ } } - function loadExample(example: typeof examples[0]) { + function loadExample(example: typeof examples[0], index: number) { domainName = example.domain; + selectedExampleIndex = index; checkCAA(); } + function clearExampleSelection() { + selectedExampleIndex = null; + } + function parseCAA(record: string): { flag: number, tag: string, value: string } | null { // CAA format: flag tag "value" const match = record.match(/^(\d+)\s+(\w+)\s+["]?([^"]+)["]?$/); @@ -180,7 +189,12 @@
{#each examples as example, i} - @@ -204,7 +218,7 @@ bind:value={domainName} placeholder="example.com" class:invalid={domainName && !isValidDomainName(domainName.trim())} - onchange={() => { if (isInputValid) checkCAA(); }} + onchange={() => { clearExampleSelection(); if (isInputValid) checkCAA(); }} /> {#if domainName && !isValidDomainName(domainName.trim())} Invalid domain name format @@ -431,6 +445,7 @@
diff --git a/src/routes/diagnostics/dns/lookup/+page.svelte b/src/routes/diagnostics/dns/lookup/+page.svelte index 4f89b0f..3d56b7c 100644 --- a/src/routes/diagnostics/dns/lookup/+page.svelte +++ b/src/routes/diagnostics/dns/lookup/+page.svelte @@ -13,6 +13,7 @@ let results = $state(null); let error = $state(null); let copiedState = $state(false); + let selectedExampleIndex = $state(null); // Reactive validation state const isInputValid = $derived(() => { @@ -78,23 +79,41 @@ if (!response.ok) { const errorText = await response.text(); - let errorMessage = `Lookup failed (${response.status})`; try { - const errorData = JSON.parse(errorText); - if (errorData.error) { - errorMessage = errorData.error; + const responseData = JSON.parse(errorText); + + // Handle 404 as "no records found" (warning, not error) + if (response.status === 404 && responseData.noRecords) { + results = { + noRecords: true, + message: responseData.message, + name: responseData.name, + type: responseData.type, + resolver: useCustomResolver && customResolver ? customResolver.trim() : resolver + }; + return; // Don't throw error, just set results } - } catch { + + // Handle other structured errors + if (responseData.error) { + throw new Error(responseData.error); + } + + // Use API message if available + if (responseData.message) { + throw new Error(responseData.message); + } + } catch (parseError) { // If not JSON, use status-based message if (response.status === 400) { - errorMessage = 'Invalid request. Please check your input values.'; + throw new Error('Invalid request. Please check your input values.'); } else if (response.status === 500) { - errorMessage = 'DNS lookup service temporarily unavailable. Please try again.'; + throw new Error('DNS lookup service temporarily unavailable. Please try again.'); } } - throw new Error(errorMessage); + throw new Error(`Lookup failed (${response.status})`); } results = await response.json(); @@ -106,12 +125,17 @@ } } - function loadExample(example: typeof examples[0]) { + function loadExample(example: typeof examples[0], index: number) { domainName = example.domain; recordType = example.type; + selectedExampleIndex = index; performLookup(); } + function clearExampleSelection() { + selectedExampleIndex = null; + } + async function copyResults() { if (!results?.Answer?.length) return; @@ -137,7 +161,12 @@
{#each examples as example, i} - @@ -152,7 +181,8 @@

Lookup Configuration

-
+ +
- +
+ + +
- { clearExampleSelection(); if (domainName) performLookup(); }}> {#each recordTypes as type} {/each}
-
+
-
- {#if !useCustomResolver} - - {/if} - {#if useCustomResolver} - { if (domainName) performLookup(); }} - /> - {/if} - -
+ {#if !useCustomResolver} + + {/if} + {#if useCustomResolver} + { clearExampleSelection(); if (domainName) performLookup(); }} + /> + {/if} +
@@ -225,7 +256,7 @@ {#if results?.warnings?.length > 0} -
+
@@ -239,10 +270,26 @@
{/if} + + {#if results?.noRecords} +
+
+
+ +
+ No Records Found +

{results.message}

+

Using resolver: {results.resolver}

+
+
+
+
+ {/if} + - {#if results} + {#if results && !results.noRecords}
-
+

DNS Records Found

{#if results.Answer?.length > 0}
{:else} -
- -

No records found for {domainName} ({recordType})

+
+
+ +

No records found for {domainName} ({recordType})

+
{/if}
@@ -291,28 +340,17 @@
diff --git a/src/routes/diagnostics/dns/ns-soa-check/+page.svelte b/src/routes/diagnostics/dns/ns-soa-check/+page.svelte index 62cd5ed..7ccf31d 100644 --- a/src/routes/diagnostics/dns/ns-soa-check/+page.svelte +++ b/src/routes/diagnostics/dns/ns-soa-check/+page.svelte @@ -1,18 +1,22 @@ + +
+
+

CORS Policy Checker

+

Test Cross-Origin Resource Sharing (CORS) policies by sending preflight requests and analyzing the server's CORS configuration. Check if your origin is allowed to access the target resource.

+
+ + +
+
+ + +

CORS Examples

+
+
+ {#each examples as example} + + {/each} +
+
+
+ + +
+
+

CORS Test Configuration

+
+
+
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+ +
+
+
+ + + {#if results} +
+
+

CORS Policy Analysis

+ +
+
+ +
+
+ +
+ {getCORSStatusText()} +
CORS Status
+
+
+ +
+ +
+ {results.preflight.status || 'Failed'} +
Preflight Status
+
+
+ + {#if results.analysis.maxAge} +
+ +
+ {results.analysis.maxAge}s +
Cache Max Age
+
+
+ {/if} +
+ + +
+

CORS Policy Details

+
+
+ +
+ CORS Enabled +

{results.analysis.corsEnabled ? 'Server has CORS headers configured' : 'No CORS headers found - requests will be blocked by browsers'}

+
+
+ +
+ +
+ Origin Access +

+ {#if results.analysis.allowsOrigin} + Origin '{origin}' is allowed to access this resource + {:else} + Origin '{origin}' is not allowed to access this resource + {/if} +

+
+
+ +
+ +
+ Credentials Support +

{results.analysis.allowsCredentials ? 'Cookies and credentials can be sent' : 'Cookies and credentials cannot be sent'}

+
+
+
+
+ + + {#if results.analysis.allowedMethods?.length > 0} +
+

Allowed Methods

+
+ {#each results.analysis.allowedMethods as allowedMethod} + {allowedMethod} + {/each} +
+
+ {/if} + + + {#if results.analysis.allowedHeaders?.length > 0} +
+

Allowed Headers

+
+ {#each results.analysis.allowedHeaders as header} + {header} + {/each} +
+
+ {/if} + + + {#if Object.keys(results.preflight.headers || {}).length > 0} +
+

CORS Headers

+
+ {#each Object.entries(results.preflight.headers) as [name, value]} +
+
+ {name}: {value} +
+
+ {/each} +
+
+ {:else if results.analysis.corsEnabled} +
+ +

CORS enabled but no detailed headers available

+
+ {:else} +
+ +

No CORS headers found

+

The server does not provide CORS headers - cross-origin requests will be blocked by browsers

+
+ {/if} +
+
+ {/if} + + {#if error} +
+
+
+ +
+ CORS Check Failed +

{error}

+
+
+
+
+ {/if} + + +
+
+

About CORS

+
+
+
+
+

What is CORS?

+

Cross-Origin Resource Sharing (CORS) is a security mechanism that allows or restricts web pages from making requests to a different domain, protocol, or port than the one serving the web page.

+
+ +
+

Preflight Requests

+

For certain requests, browsers send a preflight OPTIONS request to check if the actual request is allowed. The server responds with CORS headers indicating permissions.

+
+ +
+

Common CORS Headers

+
    +
  • Access-Control-Allow-Origin: Allowed origins
  • +
  • Access-Control-Allow-Methods: Allowed HTTP methods
  • +
  • Access-Control-Allow-Headers: Allowed request headers
  • +
  • Access-Control-Allow-Credentials: Cookie support
  • +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/routes/diagnostics/http/headers/+page.svelte b/src/routes/diagnostics/http/headers/+page.svelte new file mode 100644 index 0000000..244810a --- /dev/null +++ b/src/routes/diagnostics/http/headers/+page.svelte @@ -0,0 +1,415 @@ + + +
+
+

HTTP Headers Analyzer

+

Analyze HTTP response headers, status codes, and response metadata. Supports custom request methods and headers for comprehensive HTTP testing.

+
+ + +
+
+ + +

Header Examples

+
+
+ {#each examples as example, i} + + {/each} +
+
+
+ + +
+
+

Request Configuration

+
+
+
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+ +
+
+
+ + + {#if results} +
+
+

HTTP Response Analysis

+ +
+
+ +
+
+ +
+ {results.status} {results.statusText} +
HTTP Status
+
+
+ + {#if results.size} +
+ +
+ {formatBytes(results.size)} +
Response Size
+
+
+ {/if} + + {#if results.timings} +
+ +
+ {results.timings.total.toFixed(0)}ms +
Total Time
+
+
+ {/if} +
+ + +
+

Response Headers

+
+ {#each Object.entries(results.headers) as [name, value]} +
+
+ {name}: {value} +
+
+ {/each} +
+
+ + {#if results.timings} +
+

Performance Timing

+
+
+
+ DNS Resolution: ~{results.timings.dns.toFixed(1)}ms +
+
+
+
+ TCP Connect: ~{results.timings.tcp.toFixed(1)}ms +
+
+ {#if results.timings.tls > 0} +
+
+ TLS Handshake: ~{results.timings.tls.toFixed(1)}ms +
+
+ {/if} +
+
+ Time to First Byte: ~{results.timings.ttfb.toFixed(1)}ms +
+
+
+

* Timing values are approximations when not isolated

+
+ {/if} +
+
+ {/if} + + {#if error} +
+
+
+ +
+ Request Failed +

{error}

+
+
+
+
+ {/if} + + +
+
+

About HTTP Headers

+
+
+
+
+

Response Headers

+

HTTP headers provide metadata about the response, including content type, caching instructions, security policies, and server information.

+
+ +
+

Status Codes

+
    +
  • 2xx: Success responses
  • +
  • 3xx: Redirection responses
  • +
  • 4xx: Client error responses
  • +
  • 5xx: Server error responses
  • +
+
+ +
+

Common Headers

+
    +
  • Content-Type: MIME type of content
  • +
  • Cache-Control: Caching directives
  • +
  • Set-Cookie: Cookie instructions
  • +
  • Location: Redirect target URL
  • +
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/routes/diagnostics/http/perf/+page.svelte b/src/routes/diagnostics/http/perf/+page.svelte new file mode 100644 index 0000000..929f540 --- /dev/null +++ b/src/routes/diagnostics/http/perf/+page.svelte @@ -0,0 +1,554 @@ + + +
+
+

HTTP Performance Analyzer

+

Measure HTTP request performance including DNS resolution, TCP connection, TLS handshake, and response times. Get detailed timing breakdowns and performance insights.

+
+ + +
+
+ + +

Performance Examples

+
+
+ {#each examples as example} + + {/each} +
+
+
+ + +
+
+

Performance Test Configuration

+
+
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+ + + {#if results} + {@const grade = getPerformanceGrade(results.timings.total)} +
+
+

Performance Analysis

+ +
+
+ +
+
+ +
+ Grade {grade.grade} +
{results.timings.total.toFixed(0)}ms Total
+
+
+ +
+ +
+ {results.status} +
HTTP Status
+
+
+ + {#if results.size} +
+ +
+ {formatBytes(results.size)} +
Response Size
+
+
+ {/if} + + {#if results.size && results.timings.total} +
+ +
+ {calculateThroughput(results.size, results.timings.total)} +
Throughput
+
+
+ {/if} +
+ + +
+

Performance Timing Breakdown

+
+
+
+ + DNS Resolution + {#if results.timings.dns_note} + ({results.timings.dns_note}) + {/if} +
+
+
+
+
{results.timings.dns.toFixed(1)}ms
+
+ +
+
+ + TCP Connect + {#if results.timings.tcp_note} + ({results.timings.tcp_note}) + {/if} +
+
+
+
+
{results.timings.tcp.toFixed(1)}ms
+
+ + {#if results.timings.tls > 0} +
+
+ + TLS Handshake + {#if results.timings.tls_note} + ({results.timings.tls_note}) + {/if} +
+
+
+
+
{results.timings.tls.toFixed(1)}ms
+
+ {/if} + +
+
+ + Time to First Byte +
+
+
+
+
{results.timings.ttfb.toFixed(1)}ms
+
+ +
+
+ + Total Time +
+
+
+
+
{results.timings.total.toFixed(1)}ms
+
+
+
+ + +
+

Connection Features

+
+
+ +
+ HTTPS +

{results.performance.isHTTPS ? 'Secure connection' : 'Unencrypted connection'}

+
+
+ +
+ +
+ Compression +

{results.performance.hasCompression ? 'Response is compressed' : 'No compression detected'}

+
+
+ +
+ +
+ HTTP Version +

{results.performance.httpVersion}

+
+
+ +
+ +
+ Connection Reuse +

{results.performance.connectionReused}

+
+
+
+
+
+
+ {/if} + + {#if error} +
+
+
+ +
+ Performance Test Failed +

{error}

+
+
+
+
+ {/if} + + +
+
+

About HTTP Performance

+
+
+
+
+

Timing Components

+
    +
  • DNS: Domain name resolution time
  • +
  • TCP: TCP connection establishment
  • +
  • TLS: SSL/TLS handshake (HTTPS only)
  • +
  • TTFB: Server processing and response start
  • +
+
+ +
+

Performance Grades

+
    +
  • A (≤200ms): Excellent performance
  • +
  • B (≤500ms): Good performance
  • +
  • C (≤1000ms): Acceptable performance
  • +
  • D/F (>1000ms): Poor performance
  • +
+
+ +
+

Optimization Tips

+

Use CDN for faster response times, enable compression, implement HTTP/2, optimize DNS resolution, and consider connection keep-alive for multiple requests.

+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/routes/diagnostics/http/redirect-trace/+page.svelte b/src/routes/diagnostics/http/redirect-trace/+page.svelte new file mode 100644 index 0000000..c8b2a50 --- /dev/null +++ b/src/routes/diagnostics/http/redirect-trace/+page.svelte @@ -0,0 +1,535 @@ + + +
+
+

HTTP Redirect Tracer

+

Follow and analyze HTTP redirect chains to understand the complete journey from initial URL to final destination. Track status codes, locations, and security implications.

+
+ + +
+
+ + +

Redirect Examples

+
+
+ {#each examples as example} + + {/each} +
+
+
+ + +
+
+

Redirect Trace Configuration

+
+
+
+
+ +
+ +
+ +
+
+ +
+ +
+
+
+ + + {#if results} +
+
+

Redirect Chain Analysis

+ +
+
+ +
+
+ +
+ {results.totalRedirects} +
Total Redirects
+
+
+ +
+ +
+ {results.finalStatus} +
Final Status
+
+
+ + {#if results.timings} +
+ +
+ {results.timings.total.toFixed(0)}ms +
Total Time
+
+
+ {/if} +
+ + + {#if results.redirectChain?.length > 0} +
+

Redirect Chain

+
+ {#each results.redirectChain as step, i} +
+
{i + 1}
+
+
+
+ + {step.status} +
+ {#if hasHSTS(step.headers)} +
+ + HSTS +
+ {/if} + {#if i < results.redirectChain.length - 1 && isSecureRedirect(step.url, step.location)} +
+ + Secure Upgrade +
+ {/if} +
+
{step.url}
+ {#if step.location} +
+ + {step.location} +
+ {/if} +
+
+ + {#if i < results.redirectChain.length - 1} +
+ +
+ {/if} + {/each} +
+
+ +
+

Final Destination

+
+
+ + {results.finalStatus} +
+
{results.finalUrl}
+
+
+ {:else} +
+ +

No redirects found - URL resolved directly

+

Final URL: {results.finalUrl}

+
+ {/if} +
+
+ {/if} + + {#if error} +
+
+
+ +
+ Redirect Trace Failed +

{error}

+
+
+
+
+ {/if} + + +
+
+

About HTTP Redirects

+
+
+
+
+

Redirect Types

+
    +
  • 301: Permanent redirect
  • +
  • 302: Temporary redirect
  • +
  • 303: See other (POST → GET)
  • +
  • 307: Temporary (preserve method)
  • +
  • 308: Permanent (preserve method)
  • +
+
+ +
+

Security Considerations

+
    +
  • HSTS: Prevents downgrade attacks
  • +
  • HTTP → HTTPS: Security upgrades
  • +
  • Open Redirects: Potential security risk
  • +
  • Redirect Loops: Infinite chains
  • +
+
+ +
+

Performance Impact

+

Each redirect adds latency. Minimize redirect chains for better performance. Use 301/308 for permanent moves and 302/307 for temporary ones.

+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/routes/diagnostics/http/security/+page.svelte b/src/routes/diagnostics/http/security/+page.svelte new file mode 100644 index 0000000..f218eaa --- /dev/null +++ b/src/routes/diagnostics/http/security/+page.svelte @@ -0,0 +1,442 @@ + + +
+
+

HTTP Security Headers Analyzer

+

Analyze and evaluate security headers to identify potential vulnerabilities and security improvements. Check for HSTS, CSP, XSS protection, and other essential security headers.

+
+ + +
+
+ + +

Security Examples

+
+
+ {#each examples as example} + + {/each} +
+
+
+ + +
+
+

Security Analysis

+
+
+
+ +
+ +
+ +
+
+
+ + + {#if results} + {@const overallScore = getOverallScore()} +
+
+

Security Headers Analysis

+ +
+
+ +
+
+ +
+ Grade {overallScore.grade} +
Security Score: {overallScore.score}%
+
+
+ +
+ +
+ {results.analysis?.filter((a: any) => a.status === 'present').length || 0} +
Headers Present
+
+
+ +
+ +
+ {results.analysis?.filter((a: any) => a.status === 'missing').length || 0} +
Headers Missing
+
+
+
+ + +
+

Security Header Analysis

+
+ {#each results.analysis as analysis} +
+
+
+ + {analysis.header} +
+
+ {analysis.status} +
+
+
{analysis.message}
+ {#if analysis.recommendation} +
+ + {analysis.recommendation} +
+ {/if} +
+ {/each} +
+
+ + + {#if Object.keys(results.headers || {}).length > 0} +
+

Security Headers Found

+
+ {#each Object.entries(results.headers) as [name, value]} +
+
+ {name}: {value} +
+
+ {/each} +
+
+ {:else} +
+ +

No security headers found

+

This site may be vulnerable to various attacks

+
+ {/if} +
+
+ {/if} + + {#if error} +
+
+
+ +
+ Security Analysis Failed +

{error}

+
+
+
+
+ {/if} + + +
+
+

About Security Headers

+
+
+
+
+

Critical Headers

+
    +
  • Strict-Transport-Security: Forces HTTPS connections
  • +
  • Content-Security-Policy: Prevents XSS and injection attacks
  • +
  • X-Frame-Options: Prevents clickjacking attacks
  • +
  • X-Content-Type-Options: Prevents MIME sniffing
  • +
+
+ +
+

Additional Protection

+
    +
  • Referrer-Policy: Controls referrer information
  • +
  • Permissions-Policy: Controls browser features
  • +
  • Cross-Origin-*: CORS and isolation policies
  • +
  • X-XSS-Protection: Legacy XSS protection
  • +
+
+ +
+

Implementation Tips

+

Start with basic headers (HSTS, CSP, X-Frame-Options) and gradually add more. Test thoroughly as some headers may break functionality if misconfigured.

+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/styles/diagnostics-pages.scss b/src/styles/diagnostics-pages.scss index 4ace71e..a8f11e6 100644 --- a/src/styles/diagnostics-pages.scss +++ b/src/styles/diagnostics-pages.scss @@ -1,116 +1,102 @@ // Shared styles for diagnostic pages -// Common components used across multiple DNS diagnostic tools +// Clean, minimal design using only valid CSS variables -// Main container +// Base card styling .card { margin: 0 auto; - &.warning-card, &.error-card { - border-width: 1px; - border-style: solid; - padding: var(--spacing-md); + border-radius: var(--radius-md); + + &.input-card { + background: var(--bg-tertiary); margin-bottom: var(--spacing-lg); - .warning-content { - display: flex; - gap: var(--spacing-md); - p { - margin: 0; - color: var(--text-primary); - } - } - } + + &.results-card { + background: var(--bg-tertiary); + margin-bottom: var(--spacing-lg); + } + + &.examples-card { + margin-bottom: var(--spacing-md); + background: var(--bg-tertiary); + padding: 0; + } + + &.info-card { + flex-direction: column; + align-items: normal; + background: var(--bg-tertiary); + } + &.warning-card { - border-color: var(--color-warning); + border: 1px solid var(--color-warning); background: color-mix(in srgb, var(--color-warning), transparent 90%); - .icon { color: var(--color-warning); } + padding: var(--spacing-md); + .icon { + color: var(--color-warning); + height: 2rem; + } } + &.error-card { - border-color: var(--color-error); + border: 1px solid var(--color-error); background: color-mix(in srgb, var(--color-error), transparent 90%); - .icon { color: var(--color-error); } + margin-bottom: var(--spacing-lg); } -} - -// Input section styling -.input-card { - background: var(--bg-tertiary); - margin-bottom: var(--spacing-lg); -} - -.info-card { - background: var(--bg-tertiary); - display: flex; - flex-direction: column; - align-items: normal; - .info-grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); + .warning-content, .error-content { + display: flex; + align-items: flex-start; gap: var(--spacing-md); - .info-section { - background: var(--bg-secondary); - padding: var(--spacing-md); - border-radius: var(--radius-md); - border: 1px solid var(--border-color); - h4 { + align-items: center; + div { + strong { + display: block; + margin-bottom: var(--spacing-xs); color: var(--text-primary); - margin: 0 0 var(--spacing-sm) 0; } p { - color: var(--text-secondary); - line-height: 1.6; - margin: 0 0 var(--spacing-sm) 0; - } - ul, ol { - color: var(--text-secondary); - margin: 0; - padding-left: var(--spacing-md); - li { - margin-bottom: var(--spacing-xs); - strong { - color: var(--text-primary); - } - code { - background: var(--bg-secondary); - padding: 2px 4px; - border-radius: 3px; - font-family: var(--font-mono); - } + line-height: 1.5; + color: var(--text-primary); + &:last-child { + margin-bottom: 0; } } } } } - -.form-grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); - gap: var(--spacing-lg); - align-items: start; - - @media (max-width: 768px) { - grid-template-columns: 1fr; - gap: var(--spacing-md); +// Card header +.card-header { + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: flex-start; + &.row { + flex-direction: row; + } + + h3 { + margin: 0; + color: var(--text-primary); } } +// Form styling .form-group { display: flex; flex-direction: column; - > label { - display: block; + label { margin-bottom: var(--spacing-xs); color: var(--text-primary); font-size: var(--font-size-sm); font-weight: 500; - text-align: left; } - input, select { + input, select, textarea { width: 100%; padding: var(--spacing-sm) var(--spacing-md); - border: 1px solid var(--border-color); + border: 1px solid var(--border-primary); border-radius: var(--radius-sm); background: var(--bg-primary); color: var(--text-primary); @@ -119,40 +105,52 @@ &:focus { outline: none; border-color: var(--color-primary); - box-shadow: 0 0 0 2px var(--color-primary-alpha); } - } - - // Resolver group styling - &.resolver-group { - .resolver-options { - display: flex; - flex-direction: column; - gap: var(--spacing-sm); - margin-top: var(--spacing-xs); + + &.invalid { + border-color: var(--color-error); + } + + // Checkbox styling + &[type="checkbox"] { + width: auto; + height: 18px; + width: 18px; + margin: 0; + accent-color: var(--color-primary); + cursor: pointer; + + &:focus { + outline: 2px solid var(--color-primary); + outline-offset: 2px; + } } } } +// Checkbox group styling .checkbox-group { display: flex; align-items: center; - gap: var(--spacing-xs); + gap: var(--spacing-sm); font-size: var(--font-size-sm); color: var(--text-primary); cursor: pointer; - padding: var(--spacing-xs) 0; - - input[type="checkbox"] { - width: auto; - margin: 0; - accent-color: var(--color-primary); + margin-top: var(--spacing-sm); + label { + display: flex; + align-items: center; + gap: var(--spacing-sm); cursor: pointer; } &:hover { color: var(--color-primary); } + + input[type="checkbox"] { + cursor: pointer; + } } // Action buttons @@ -182,30 +180,6 @@ } } -// Results section -.results-card { - background: var(--bg-tertiary); - margin-bottom: var(--spacing-lg); - - .card-header { - display: flex; - justify-content: space-between; - align-items: flex-start; - - > div { - display: flex; - flex-direction: column; - gap: var(--spacing-xs); - } - - h3 { - margin: 0; - color: var(--text-primary); - } - } -} - -// Copy functionality .copy-btn { display: flex; align-items: center; @@ -213,7 +187,7 @@ padding: var(--spacing-xs) var(--spacing-sm); background: transparent; color: var(--text-secondary); - border: 1px solid var(--border-color); + border: 1px solid var(--border-primary); border-radius: var(--radius-sm); font-size: var(--font-size-xs); cursor: pointer; @@ -223,17 +197,9 @@ color: var(--text-primary); border-color: var(--color-primary); } - - &:disabled { - cursor: not-allowed; - } -} - -// Status indicators -.status-section { - margin-bottom: var(--spacing-lg); } +// Status items .status-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); @@ -248,80 +214,28 @@ padding: var(--spacing-md); border-radius: var(--radius-md); font-weight: 500; + border: 1px solid; &.success { background: color-mix(in srgb, var(--color-success), transparent 90%); color: var(--color-success); - border: 1px solid var(--color-success); + border-color: var(--color-success); } &.warning { background: color-mix(in srgb, var(--color-warning), transparent 90%); color: var(--color-warning); - border: 1px solid var(--color-warning); + border-color: var(--color-warning); } &.error { background: color-mix(in srgb, var(--color-error), transparent 90%); color: var(--color-error); - border: 1px solid var(--color-error); - } - - Icon { - flex-shrink: 0; - } -} - -.status-text { - font-size: var(--font-size-xs); - font-weight: 500; - - &.success { - color: var(--color-success); - } - - &.warning { - color: var(--color-warning); - } - - &.error { - color: var(--color-error); + border-color: var(--color-error); } } // Record display -.record-section { - margin-bottom: var(--spacing-lg); - - h4 { - color: var(--text-primary); - margin: 0 0 var(--spacing-sm) 0; - font-size: var(--font-size-md); - } -} - -.record-display { - background: var(--bg-secondary); - border: 1px solid var(--border-color); - border-radius: var(--radius-md); - padding: var(--spacing-md); - font-family: var(--font-mono); - - .record-location { - color: var(--text-secondary); - font-size: var(--font-size-xs); - margin-bottom: var(--spacing-xs); - } - - code { - color: var(--text-primary); - background: none; - padding: 0; - font-size: var(--font-size-sm); - word-break: break-all; - } -} - .records-list { display: flex; flex-direction: column; @@ -335,7 +249,7 @@ padding: var(--spacing-md); background: var(--bg-secondary); border-radius: var(--radius-md); - border: 1px solid var(--border-color); + border: 1px solid var(--border-primary); @media (max-width: 768px) { flex-direction: column; @@ -350,192 +264,181 @@ word-break: break-all; } -.record-ttl { - color: var(--text-secondary); - font-size: var(--font-size-xs); - font-weight: 500; - white-space: nowrap; -} - -// Error handling -.error-card { - background: var(--bg-error); - border: 1px solid var(--border-error); - margin-bottom: var(--spacing-lg); -} - -.error-content { - display: flex; - align-items: flex-start; - gap: var(--spacing-md); - color: var(--text-error); - - Icon { - flex-shrink: 0; - margin-top: 2px; - } - - strong { - color: var(--text-error); - margin-bottom: var(--spacing-xs); - display: block; - } - - p { - margin: 0; - line-height: 1.5; - } -} - -.error-message, .no-records { - color: var(--text-secondary); - font-style: italic; - text-align: center; - padding: var(--spacing-lg); -} - // Examples section -.examples-card { - margin-bottom: var(--spacing-md); - background: var(--bg-tertiary); - padding: 0; -} - .examples-details { border: none; background: none; - + svg { + transition: transform var(--transition-fast); + } &[open] { - .examples-summary Icon { + .examples-summary svg { transform: rotate(90deg); } } + .examples-summary { + display: flex; + align-items: center; + gap: var(--spacing-sm); + padding: var(--spacing-md); + cursor: pointer; + list-style: none; + &::-webkit-details-marker { + display: none; + } + svg { + transition: transform var(--transition-fast); + color: var(--text-secondary); + } + h4 { + margin: 0; + color: var(--text-primary); + font-size: var(--font-size-md); + } + } + .examples-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); + gap: var(--spacing-sm); + padding: 0 var(--spacing-md) var(--spacing-md); + .example-card { + background: var(--bg-secondary); + border: 1px solid var(--border-primary); + border-radius: var(--radius-md); + padding: var(--spacing-md); + cursor: pointer; + transition: all var(--transition-fast); + text-align: left; + + &:hover, &.selected { + background: var(--bg-primary); + border-color: var(--color-primary); + } + + h5 { + margin: 0 0 var(--spacing-xs) 0; + color: var(--text-primary); + font-family: var(--font-mono); + font-size: var(--font-size-sm); + } + + p { + margin: 0; + color: var(--text-secondary); + font-size: var(--font-size-xs); + line-height: 1.4; + } + } + } } -.examples-summary { - display: flex; - align-items: center; - gap: var(--spacing-sm); - padding: var(--spacing-md); - cursor: pointer; - list-style: none; - - &::-webkit-details-marker { - display: none; - } - Icon { - transition: transform var(--transition-fast); - color: var(--text-secondary); - } - h4 { - margin: 0; - color: var(--text-primary); - font-size: var(--font-size-md); - } -} -.examples-grid { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); - gap: var(--spacing-sm); - padding: 0 var(--spacing-md) var(--spacing-md); -} - -.example-card { - background: var(--bg-secondary); - border: 1px solid var(--border-color); - border-radius: var(--radius-md); - padding: var(--spacing-md); - cursor: pointer; - transition: all var(--transition-fast); - text-align: left; - - &:hover { - background: var(--bg-primary); - border-color: var(--color-primary); - } - - h5 { - margin: 0 0 var(--spacing-xs) 0; - color: var(--text-primary); - font-family: var(--font-mono); - font-size: var(--font-size-sm); - } - - p { - margin: 0; - color: var(--text-secondary); - font-size: var(--font-size-xs); - line-height: 1.4; - } -} - -// Resolver-specific styling -.resolvers-grid { +// Info sections +.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--spacing-md); - margin-bottom: var(--spacing-lg); -} - -.resolver-card { - border-radius: var(--radius-md); - border: 2px solid var(--border-color); - background: var(--bg-secondary); - &.success { - border-color: var(--color-success); - } - - &.warning { - border-color: var(--color-warning); - } - - &.error { - border-color: var(--color-error); - } -} - -// Info sections -.lookup-info { - background: var(--bg-info); - border: 1px solid var(--border-info); - border-radius: var(--radius-md); - padding: var(--spacing-md); - margin-bottom: var(--spacing-lg); - - h4 { - color: var(--text-info); - margin: 0 0 var(--spacing-sm) 0; - display: flex; - align-items: center; - gap: var(--spacing-xs); - font-size: var(--font-size-sm); - } - - p { - color: var(--text-info); - margin: 0; - font-size: var(--font-size-xs); - line-height: 1.5; + .info-section { + background: var(--bg-secondary); + padding: var(--spacing-md); + border-radius: var(--radius-md); + border: 1px solid var(--border-primary); + + h4 { + color: var(--text-primary); + margin: 0 0 var(--spacing-sm) 0; + } + + p { + color: var(--text-secondary); + line-height: 1.6; + margin: 0 0 var(--spacing-sm) 0; + } + + ul, ol { + color: var(--text-secondary); + margin: 0; + padding-left: var(--spacing-md); + + li { + margin-bottom: var(--spacing-xs); + + strong { + color: var(--text-primary); + } + + code { + background: var(--bg-tertiary); + padding: 2px 4px; + border-radius: var(--radius-xs); + font-family: var(--font-mono); + } + } + } } } // Utility classes -.text-success { +.mono { + font-family: var(--font-mono); +} + +.help-text { + font-size: var(--font-size-xs); + color: var(--text-secondary); + font-style: italic; + margin: 0; +} + +.error-text { + color: var(--color-error); + font-size: var(--font-size-xs); + margin-top: var(--spacing-xs); +} + +// Text color utility +.text-green-500 { color: var(--color-success); } -.text-warning { - color: var(--color-warning); +.animate-spin { + animation: spin 1s linear infinite; } -.text-error { - color: var(--text-error); +@keyframes spin { + from { transform: rotate(0deg); } + to { transform: rotate(360deg); } } -.text-info { - color: var(--color-info); +// Form layout +.form-row { + margin-bottom: var(--spacing-md); + + &.two-columns { + display: grid; + grid-template-columns: 1fr 1fr; + gap: var(--spacing-md); + + @media (max-width: 768px) { + grid-template-columns: 1fr; + } + } +} + +// Example cards selection state +.example-card { + &.selected { + border-color: var(--color-primary); + background: color-mix(in srgb, var(--color-primary), transparent 95%); + } +} + +// Action section +.action-section { + display: flex; + justify-content: center; + margin-top: var(--spacing-xl); }