mirror of
https://github.com/lissy93/networking-toolbox.git
synced 2026-11-21 21:44:44 +03:00
Fix TS errors
This commit is contained in:
1 parent
7e106c0671
commit
267fcbfbce
56 files changed
+351
-225
No files matched your search
@@ -446,13 +446,6 @@
|
||||
border-bottom: 1px solid var(--border-secondary);
|
||||
}
|
||||
|
||||
&.active h3 {
|
||||
color: var(--color-primary);
|
||||
background-color: rgba(var(--color-primary-rgb), 0.1);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border-radius: var(--radius-md);
|
||||
border-bottom-color: var(--color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.menu-group {
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
<!-- Search Modal -->
|
||||
{#if isOpen}
|
||||
<div class="search-overlay" onclick={close}>
|
||||
<div class="search-overlay" onclick={close} onkeydown={(e) => { if (e.key === 'Escape') close(); }} role="button" tabindex="-1" aria-label="Close search">
|
||||
<div class="search-modal" onclick={(e) => e.stopPropagation()}>
|
||||
<div class="search-header">
|
||||
<Icon name="search" size="sm" />
|
||||
|
||||
@@ -867,10 +867,6 @@
|
||||
color: var(--color-success);
|
||||
}
|
||||
|
||||
&.warning {
|
||||
color: var(--color-warning);
|
||||
}
|
||||
|
||||
&.error {
|
||||
color: var(--color-error);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
activeExampleIndex = -1;
|
||||
error = null;
|
||||
dsRecords = [];
|
||||
if (isValid) {
|
||||
if (isValid()) {
|
||||
generateDS();
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@
|
||||
} else {
|
||||
selectedDigestTypes = [...selectedDigestTypes, type];
|
||||
}
|
||||
if (isValid) {
|
||||
if (isValid()) {
|
||||
generateDS();
|
||||
}
|
||||
}
|
||||
@@ -255,7 +255,7 @@
|
||||
<div class="ds-record">
|
||||
<div class="ds-header">
|
||||
<div class="digest-info">
|
||||
<span class="digest-type">{DS_DIGEST_TYPES[ds.digestType]}</span>
|
||||
<span class="digest-type">{DS_DIGEST_TYPES[ds.digestType as keyof typeof DS_DIGEST_TYPES]}</span>
|
||||
<span class="key-tag">Key Tag: {ds.keyTag}</span>
|
||||
</div>
|
||||
<button class="copy-btn small" class:copied={copiedStates[`ds-${ds.keyTag}-${ds.digestType}`]} onclick={() => copyDS(ds)} title="Copy this DS record">
|
||||
@@ -270,11 +270,11 @@
|
||||
<div class="ds-details">
|
||||
<div class="detail-item">
|
||||
<span class="label">Algorithm:</span>
|
||||
<span class="value">{ds.algorithm} ({DNSSEC_ALGORITHMS[ds.algorithm] || 'Unknown'})</span>
|
||||
<span class="value">{ds.algorithm} ({DNSSEC_ALGORITHMS[ds.algorithm as keyof typeof DNSSEC_ALGORITHMS] || 'Unknown'})</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<span class="label">Digest Type:</span>
|
||||
<span class="value">{ds.digestType} ({DS_DIGEST_TYPES[ds.digestType]})</span>
|
||||
<span class="value">{ds.digestType} ({DS_DIGEST_TYPES[ds.digestType as keyof typeof DS_DIGEST_TYPES]})</span>
|
||||
</div>
|
||||
<div class="detail-item">
|
||||
<span class="label">Digest:</span>
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
results = estimateEDNSSize(recordsToEstimate);
|
||||
results = estimateEDNSSize(queryName, queryType, recordsToEstimate);
|
||||
}
|
||||
|
||||
function formatBytes(bytes: number): string {
|
||||
@@ -165,7 +165,7 @@
|
||||
}
|
||||
|
||||
function hasRecommendations(): boolean {
|
||||
return results && results.recommendations && results.recommendations.length > 0;
|
||||
return !!(results && results.recommendations && results.recommendations.length > 0);
|
||||
}
|
||||
|
||||
async function copyEstimate() {
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
|
||||
// Use CIDR diff to get all available blocks (A - B = pools - allocations)
|
||||
const diffResult = computeCIDRDifference(pools, allocations || '', 'detailed');
|
||||
const diffResult = computeCIDRDifference(pools, allocations || '', 'minimal');
|
||||
|
||||
// Check for errors
|
||||
if (diffResult.errors.length > 0) {
|
||||
@@ -86,12 +86,13 @@
|
||||
// Filter by target prefix if specified
|
||||
let filteredBlocks = allBlocks;
|
||||
if (targetPrefix !== null) {
|
||||
const target = targetPrefix; // Capture for closure
|
||||
filteredBlocks = allBlocks.filter(block => {
|
||||
// Extract prefix length from CIDR notation
|
||||
const match = block.match(/\/(\d+)$/);
|
||||
if (!match) return false;
|
||||
const prefixLength = parseInt(match[1]);
|
||||
return prefixLength <= targetPrefix; // Can be subdivided to target prefix
|
||||
return prefixLength <= target; // Can be subdivided to target prefix
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { Copy, Download, Check, Globe, Type } from 'lucide-svelte';
|
||||
import { tooltip } from '$lib/actions/tooltip.js';
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
let mode = $state('unicode-to-punycode');
|
||||
let showExamples = $state(false);
|
||||
|
||||
let buttonStates = $state({});
|
||||
let buttonStates = $state({} as Record<string, boolean>);
|
||||
|
||||
const domainExamples = [
|
||||
{ unicode: 'münchen.de', punycode: 'xn--mnchen-3ya.de', description: 'German city domain' },
|
||||
@@ -18,7 +18,7 @@
|
||||
];
|
||||
|
||||
// Punycode implementation based on RFC 3492
|
||||
function punycodeDecode(input) {
|
||||
function punycodeDecode(input: string) {
|
||||
const BASE = 36;
|
||||
const TMIN = 1;
|
||||
const TMAX = 26;
|
||||
@@ -27,7 +27,7 @@
|
||||
const INITIAL_BIAS = 72;
|
||||
const INITIAL_N = 128;
|
||||
|
||||
function adapt(delta, numPoints, firstTime) {
|
||||
function adapt(delta: number, numPoints: number, firstTime: boolean) {
|
||||
delta = firstTime ? Math.floor(delta / DAMP) : delta >> 1;
|
||||
delta += Math.floor(delta / numPoints);
|
||||
let k = 0;
|
||||
@@ -38,7 +38,7 @@
|
||||
return k + Math.floor(((BASE - TMIN + 1) * delta) / (delta + SKEW));
|
||||
}
|
||||
|
||||
function decode(input) {
|
||||
function decode(input: string) {
|
||||
let n = INITIAL_N;
|
||||
let i = 0;
|
||||
let bias = INITIAL_BIAS;
|
||||
@@ -80,7 +80,7 @@
|
||||
return String.fromCodePoint(...output);
|
||||
}
|
||||
|
||||
function basicToDigit(codePoint) {
|
||||
function basicToDigit(codePoint: number) {
|
||||
if (codePoint - 48 < 10) return codePoint - 22;
|
||||
if (codePoint - 65 < 26) return codePoint - 65;
|
||||
if (codePoint - 97 < 26) return codePoint - 97;
|
||||
@@ -90,7 +90,7 @@
|
||||
return decode(input);
|
||||
}
|
||||
|
||||
function punycodeEncode(input) {
|
||||
function punycodeEncode(input: string) {
|
||||
const BASE = 36;
|
||||
const TMIN = 1;
|
||||
const TMAX = 26;
|
||||
@@ -99,7 +99,7 @@
|
||||
const INITIAL_BIAS = 72;
|
||||
const INITIAL_N = 128;
|
||||
|
||||
function adapt(delta, numPoints, firstTime) {
|
||||
function adapt(delta: number, numPoints: number, firstTime: boolean) {
|
||||
delta = firstTime ? Math.floor(delta / DAMP) : delta >> 1;
|
||||
delta += Math.floor(delta / numPoints);
|
||||
let k = 0;
|
||||
@@ -110,12 +110,12 @@
|
||||
return k + Math.floor(((BASE - TMIN + 1) * delta) / (delta + SKEW));
|
||||
}
|
||||
|
||||
function digitToBasic(digit) {
|
||||
function digitToBasic(digit: number) {
|
||||
return digit + 22 + (digit < 26 ? 75 : 0);
|
||||
}
|
||||
|
||||
function encode(input) {
|
||||
const codePoints = Array.from(input).map(char => char.codePointAt(0));
|
||||
function encode(input: string) {
|
||||
const codePoints = Array.from(input).map(char => char.codePointAt(0) || 0);
|
||||
let n = INITIAL_N;
|
||||
let delta = 0;
|
||||
let bias = INITIAL_BIAS;
|
||||
@@ -165,9 +165,9 @@
|
||||
return encode(input);
|
||||
}
|
||||
|
||||
function convertDomain(domain, toPunycode) {
|
||||
function convertDomain(domain: string, toPunycode: boolean) {
|
||||
const parts = domain.split('.');
|
||||
return parts.map(part => {
|
||||
return parts.map((part: string) => {
|
||||
if (!part) return part;
|
||||
|
||||
try {
|
||||
@@ -229,7 +229,7 @@
|
||||
return warns;
|
||||
});
|
||||
|
||||
function showButtonSuccess(buttonId) {
|
||||
function showButtonSuccess(buttonId: string) {
|
||||
buttonStates[buttonId] = true;
|
||||
setTimeout(() => {
|
||||
buttonStates[buttonId] = false;
|
||||
@@ -255,7 +255,7 @@
|
||||
showButtonSuccess('download');
|
||||
}
|
||||
|
||||
function loadExample(example) {
|
||||
function loadExample(example: typeof domainExamples[0]) {
|
||||
if (mode === 'unicode-to-punycode') {
|
||||
inputText = example.unicode;
|
||||
} else {
|
||||
|
||||
@@ -380,7 +380,7 @@
|
||||
<!-- Number Formats Explanation -->
|
||||
<div class="card">
|
||||
<h3>
|
||||
<Icon icon="info" size="md" />
|
||||
<Icon name="info" size="md" />
|
||||
Number Format Explanations
|
||||
</h3>
|
||||
<div class="explainer-content">
|
||||
|
||||
@@ -95,11 +95,10 @@
|
||||
|
||||
<!-- Input Section -->
|
||||
<div class="form-group">
|
||||
<IPInput
|
||||
<IPInput
|
||||
bind:value={inputValue}
|
||||
label={isIPv4ToIPv6 ? 'IPv4 Address' : 'IPv6 Address'}
|
||||
placeholder={placeholder}
|
||||
error={!validation.valid ? validation.error : undefined}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -123,7 +122,7 @@
|
||||
onclick={() => copyToClipboard(conversionResult?.result || '', 'result')}
|
||||
aria-label="Copy result to clipboard"
|
||||
>
|
||||
<SvgIcon icon={copiedStates['result'] ? 'check' : 'copy'} size="sm" />
|
||||
<SvgIcon icon={copiedStates['result'] ? 'check' : 'clipboard'} size="sm" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
@@ -154,7 +153,7 @@
|
||||
class="copy-btn-small {copiedStates['compressed'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(conversionResult?.details?.compressed || '', 'compressed')}
|
||||
>
|
||||
<SvgIcon icon={copiedStates['compressed'] ? 'check' : 'copy'} size="sm" />
|
||||
<SvgIcon icon={copiedStates['compressed'] ? 'check' : 'clipboard'} size="sm" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
@@ -170,7 +169,7 @@
|
||||
class="copy-btn-small {copiedStates['expanded'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(conversionResult?.details?.expanded || '', 'expanded')}
|
||||
>
|
||||
<SvgIcon icon={copiedStates['expanded'] ? 'check' : 'copy'} size="sm" />
|
||||
<SvgIcon icon={copiedStates['expanded'] ? 'check' : 'clipboard'} size="sm" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
@@ -186,7 +185,7 @@
|
||||
class="copy-btn-small {copiedStates['dotted'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(conversionResult?.details?.dotted || '', 'dotted')}
|
||||
>
|
||||
<SvgIcon icon={copiedStates['dotted'] ? 'check' : 'copy'} size="sm" />
|
||||
<SvgIcon icon={copiedStates['dotted'] ? 'check' : 'clipboard'} size="sm" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
@@ -233,7 +232,7 @@
|
||||
class="copy-btn-small {copiedStates['ipv6-expanded'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(expandIPv6(ipv6Info?.cleaned || ''), 'ipv6-expanded')}
|
||||
>
|
||||
<SvgIcon icon={copiedStates['ipv6-expanded'] ? 'check' : 'copy'} size="sm" />
|
||||
<SvgIcon icon={copiedStates['ipv6-expanded'] ? 'check' : 'clipboard'} size="sm" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
@@ -249,7 +248,7 @@
|
||||
class="copy-btn-small {copiedStates['ipv6-compressed'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(compressIPv6(ipv6Info?.cleaned || ''), 'ipv6-compressed')}
|
||||
>
|
||||
<SvgIcon icon={copiedStates['ipv6-compressed'] ? 'check' : 'copy'} size="sm" />
|
||||
<SvgIcon icon={copiedStates['ipv6-compressed'] ? 'check' : 'clipboard'} size="sm" />
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
@@ -514,7 +514,7 @@
|
||||
<span class="pattern-label">Regular Expression</span>
|
||||
<button
|
||||
class="copy-button {copiedStates['pattern'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(result.pattern, 'pattern')}
|
||||
onclick={() => result && copyToClipboard(result.pattern, 'pattern')}
|
||||
>
|
||||
<Icon name={copiedStates['pattern'] ? 'check' : 'copy'} size="sm" />
|
||||
{copiedStates['pattern'] ? 'Copied!' : 'Copy'}
|
||||
@@ -551,7 +551,7 @@
|
||||
<span class="example-title">JavaScript</span>
|
||||
<button
|
||||
class="copy-button {copiedStates['javascript'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(`const ipRegex = /${result.pattern}/${result.flags};\nconst isValid = ipRegex.test(ipAddress);`, 'javascript')}
|
||||
onclick={() => result && copyToClipboard(`const ipRegex = /${result.pattern}/${result.flags};\nconst isValid = ipRegex.test(ipAddress);`, 'javascript')}
|
||||
>
|
||||
<Icon name={copiedStates['javascript'] ? 'check' : 'copy'} size="xs" />
|
||||
</button>
|
||||
@@ -565,7 +565,7 @@
|
||||
<span class="example-title">Python</span>
|
||||
<button
|
||||
class="copy-button {copiedStates['python'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(`import re\npattern = r'${result.pattern}'\nis_valid = bool(re.match(pattern, ip_address${result.flags ? ', re.IGNORECASE' : ''}))`, 'python')}
|
||||
onclick={() => result && copyToClipboard(`import re\npattern = r'${result.pattern}'\nis_valid = bool(re.match(pattern, ip_address${result.flags ? ', re.IGNORECASE' : ''}))`, 'python')}
|
||||
>
|
||||
<Icon name={copiedStates['python'] ? 'check' : 'copy'} size="xs" />
|
||||
</button>
|
||||
@@ -579,7 +579,7 @@
|
||||
<span class="example-title">PHP</span>
|
||||
<button
|
||||
class="copy-button {copiedStates['php'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(`$pattern = '/${result.pattern}/${result.flags}';\n$isValid = preg_match($pattern, $ipAddress);`, 'php')}
|
||||
onclick={() => result && copyToClipboard(`$pattern = '/${result.pattern}/${result.flags}';\n$isValid = preg_match($pattern, $ipAddress);`, 'php')}
|
||||
>
|
||||
<Icon name={copiedStates['php'] ? 'check' : 'copy'} size="xs" />
|
||||
</button>
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
isPrivate?: boolean;
|
||||
isReserved?: boolean;
|
||||
info?: string[];
|
||||
compressedForm?: string;
|
||||
embeddedIPv4?: string;
|
||||
zoneId?: string;
|
||||
hasEmbeddedIPv4?: boolean;
|
||||
};
|
||||
} | null>(null);
|
||||
|
||||
|
||||
@@ -579,7 +579,7 @@
|
||||
<code class="step-value">{result.translatedAddress}</code>
|
||||
<button
|
||||
class="copy-button {copiedStates['result'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(result.translatedAddress, 'result')}
|
||||
onclick={() => result && copyToClipboard(result.translatedAddress, 'result')}
|
||||
>
|
||||
<Icon name={copiedStates['result'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
<code class="result-value unicast">{result.details.normalizedUnicast}</code>
|
||||
<button
|
||||
class="copy-button {copiedStates['unicast'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(result.details.normalizedUnicast, 'unicast')}
|
||||
onclick={() => result && copyToClipboard(result.details.normalizedUnicast, 'unicast')}
|
||||
>
|
||||
<Icon name={copiedStates['unicast'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -326,7 +326,7 @@
|
||||
<code class="result-value multicast">{result.solicitedNodeAddress}</code>
|
||||
<button
|
||||
class="copy-button {copiedStates['multicast'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(result.solicitedNodeAddress, 'multicast')}
|
||||
onclick={() => result && copyToClipboard(result.solicitedNodeAddress, 'multicast')}
|
||||
>
|
||||
<Icon name={copiedStates['multicast'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
id="ipv6-input"
|
||||
type="text"
|
||||
bind:value={networkAddress}
|
||||
oninput={(e) => handleAddressInput(e.target?.value || '')}
|
||||
oninput={(e) => handleAddressInput((e.target as HTMLInputElement)?.value || '')}
|
||||
placeholder="2001:db8::/64"
|
||||
class="ipv6-input"
|
||||
/>
|
||||
@@ -151,9 +151,8 @@
|
||||
</div>
|
||||
|
||||
<!-- Results -->
|
||||
{#if subnetResult}
|
||||
{#if subnetResult && subnetResult.success && subnetResult.subnet}
|
||||
<div class="results-section">
|
||||
{#if subnetResult.success && subnetResult.subnet}
|
||||
<!-- Network Information -->
|
||||
<div class="info-panel">
|
||||
<h3>IPv6 Subnet Information</h3>
|
||||
@@ -165,7 +164,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['network']}
|
||||
onclick={() => copyToClipboard(`${subnetResult.subnet.networkCompressed}/${subnetResult.subnet.prefixLength}`, 'network')}
|
||||
onclick={() => subnetResult?.subnet && copyToClipboard(`${subnetResult.subnet.networkCompressed}/${subnetResult.subnet.prefixLength}`, 'network')}
|
||||
>
|
||||
<Icon name={copiedStates['network'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -208,7 +207,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['compressed']}
|
||||
onclick={() => copyToClipboard(subnetResult.subnet.networkCompressed, 'compressed')}
|
||||
onclick={() => subnetResult?.subnet && copyToClipboard(subnetResult.subnet.networkCompressed, 'compressed')}
|
||||
>
|
||||
<Icon name={copiedStates['compressed'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -227,7 +226,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['expanded']}
|
||||
onclick={() => copyToClipboard(subnetResult.subnet.networkExpanded, 'expanded')}
|
||||
onclick={() => subnetResult?.subnet && copyToClipboard(subnetResult.subnet.networkExpanded, 'expanded')}
|
||||
>
|
||||
<Icon name={copiedStates['expanded'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -246,7 +245,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['mask']}
|
||||
onclick={() => copyToClipboard(subnetResult.subnet.subnetMask, 'mask')}
|
||||
onclick={() => subnetResult?.subnet && copyToClipboard(subnetResult.subnet.subnetMask, 'mask')}
|
||||
>
|
||||
<Icon name={copiedStates['mask'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -267,7 +266,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['range']}
|
||||
onclick={() => copyToClipboard(`${subnetResult.subnet.firstAddress} - ${subnetResult.subnet.lastAddress}`, 'range')}
|
||||
onclick={() => subnetResult?.subnet && copyToClipboard(`${subnetResult.subnet.firstAddress} - ${subnetResult.subnet.lastAddress}`, 'range')}
|
||||
>
|
||||
<Icon name={copiedStates['range'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -286,7 +285,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['assignable']}
|
||||
onclick={() => copyToClipboard(subnetResult.subnet.assignableAddresses, 'assignable')}
|
||||
onclick={() => subnetResult?.subnet && copyToClipboard(subnetResult.subnet.assignableAddresses, 'assignable')}
|
||||
>
|
||||
<Icon name={copiedStates['assignable'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -305,7 +304,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['reverse']}
|
||||
onclick={() => copyToClipboard(subnetResult.subnet.reverseZone, 'reverse')}
|
||||
onclick={() => subnetResult?.subnet && copyToClipboard(subnetResult.subnet.reverseZone, 'reverse')}
|
||||
>
|
||||
<Icon name={copiedStates['reverse'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -325,7 +324,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['binary']}
|
||||
onclick={() => copyToClipboard(subnetResult.subnet.binaryPrefix, 'binary')}
|
||||
onclick={() => subnetResult?.subnet && copyToClipboard(subnetResult.subnet.binaryPrefix, 'binary')}
|
||||
>
|
||||
<Icon name={copiedStates['binary'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -374,13 +373,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{:else}
|
||||
<!-- Error Display -->
|
||||
<div class="info-panel error">
|
||||
<h3>Calculation Error</h3>
|
||||
<p class="error-message">{subnetResult.error}</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{:else if subnetResult && !subnetResult.success}
|
||||
<!-- Error Display -->
|
||||
<div class="results-section">
|
||||
<div class="info-panel error">
|
||||
<h3>Calculation Error</h3>
|
||||
<p class="error-message">{subnetResult.error}</p>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -424,7 +424,7 @@
|
||||
<code class="component-value">{result.components.serverIPv4}</code>
|
||||
<button
|
||||
class="copy-button {copiedStates['server'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(result.components.serverIPv4, 'server')}
|
||||
onclick={() => result && copyToClipboard(result.components.serverIPv4, 'server')}
|
||||
>
|
||||
<Icon name={copiedStates['server'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -443,7 +443,7 @@
|
||||
<code class="component-value">{result.components.clientIPv4}</code>
|
||||
<button
|
||||
class="copy-button {copiedStates['client'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(result.components.clientIPv4, 'client')}
|
||||
onclick={() => result && copyToClipboard(result.components.clientIPv4, 'client')}
|
||||
>
|
||||
<Icon name={copiedStates['client'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -462,7 +462,7 @@
|
||||
<code class="component-value">{result.components.clientPort}</code>
|
||||
<button
|
||||
class="copy-button {copiedStates['port'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(result.components.clientPort.toString(), 'port')}
|
||||
onclick={() => result && copyToClipboard(result.components.clientPort.toString(), 'port')}
|
||||
>
|
||||
<Icon name={copiedStates['port'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
|
||||
@@ -198,15 +198,18 @@
|
||||
</div>
|
||||
|
||||
<div class="processings-list">
|
||||
{#each result.processings as processing}
|
||||
{#each result?.processings || [] as processing}
|
||||
<div class="processing-card" class:valid={processing.isValid} class:invalid={!processing.isValid}>
|
||||
<div class="card-header">
|
||||
<div class="address-info">
|
||||
<div class="original-input">
|
||||
<span class="input-label">Input:</span>
|
||||
<code onclick={() => copyToClipboard(processing.input)} title="Click to copy">
|
||||
{processing.input}
|
||||
</code>
|
||||
<div class="input-with-copy">
|
||||
<code>{processing.input}</code>
|
||||
<button type="button" onclick={() => copyToClipboard(processing.input)} title="Copy input">
|
||||
<Icon name="copy" size="xs" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -224,17 +227,23 @@
|
||||
<div class="address-breakdown">
|
||||
<div class="breakdown-item">
|
||||
<span class="breakdown-label">Address:</span>
|
||||
<code onclick={() => copyToClipboard(processing.address)} title="Click to copy">
|
||||
{processing.address}
|
||||
</code>
|
||||
<div class="input-with-copy">
|
||||
<code>{processing.address}</code>
|
||||
<button type="button" onclick={() => copyToClipboard(processing.address)} title="Copy address">
|
||||
<Icon name="copy" size="xs" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if processing.hasZoneId}
|
||||
<div class="breakdown-item">
|
||||
<span class="breakdown-label">Zone ID:</span>
|
||||
<code onclick={() => copyToClipboard(processing.zoneId)} title="Click to copy">
|
||||
{processing.zoneId}
|
||||
</code>
|
||||
<div class="input-with-copy">
|
||||
<code>{processing.zoneId}</code>
|
||||
<button type="button" onclick={() => copyToClipboard(processing.zoneId)} title="Copy zone ID">
|
||||
<Icon name="copy" size="xs" />
|
||||
</button>
|
||||
</div>
|
||||
{#if processing.processing.zoneIdValid}
|
||||
<span class="zone-status valid">
|
||||
<Icon name="check" />
|
||||
@@ -277,16 +286,22 @@
|
||||
<div class="processing-results">
|
||||
<div class="result-item">
|
||||
<span class="result-label">With Zone:</span>
|
||||
<code onclick={() => copyToClipboard(processing.processing.withZone)} title="Click to copy">
|
||||
{processing.processing.withZone}
|
||||
</code>
|
||||
<div class="input-with-copy">
|
||||
<code>{processing.processing.withZone}</code>
|
||||
<button type="button" onclick={() => copyToClipboard(processing.processing.withZone)} title="Copy with zone">
|
||||
<Icon name="copy" size="xs" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="result-item">
|
||||
<span class="result-label">Without Zone:</span>
|
||||
<code onclick={() => copyToClipboard(processing.processing.withoutZone)} title="Click to copy">
|
||||
{processing.processing.withoutZone}
|
||||
</code>
|
||||
<div class="input-with-copy">
|
||||
<code>{processing.processing.withoutZone}</code>
|
||||
<button type="button" onclick={() => copyToClipboard(processing.processing.withoutZone)} title="Copy without zone">
|
||||
<Icon name="copy" size="xs" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -295,9 +310,10 @@
|
||||
<h4>Suggested Zone Identifiers:</h4>
|
||||
<div class="zones-list">
|
||||
{#each processing.processing.suggestedZones as zone}
|
||||
<code onclick={() => copyToClipboard(`${processing.address}%${zone}`)} title="Click to copy full address">
|
||||
{zone}
|
||||
</code>
|
||||
<button type="button" onclick={() => copyToClipboard(`${processing.address}%${zone}`)} title="Copy full address" class="zone-button">
|
||||
<code>{zone}</code>
|
||||
<Icon name="copy" size="xs" />
|
||||
</button>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import Icon from '$lib/components/global/Icon.svelte';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
let parseMode = $state(false);
|
||||
let showExamples = $state(false);
|
||||
|
||||
let buttonStates = $state({});
|
||||
let buttonStates = $state({} as Record<string, boolean>);
|
||||
|
||||
const cityExamples = [
|
||||
{ name: 'San Francisco', lat: 37.7749, lng: -122.4194, alt: 10 },
|
||||
@@ -24,7 +24,7 @@
|
||||
{ name: 'Sydney', lat: -33.8688, lng: 151.2093, alt: 58 }
|
||||
];
|
||||
|
||||
function degreesToLOC(degrees, isLongitude = false) {
|
||||
function degreesToLOC(degrees: number, isLongitude = false) {
|
||||
const hemisphere = isLongitude
|
||||
? (degrees >= 0 ? 'E' : 'W')
|
||||
: (degrees >= 0 ? 'N' : 'S');
|
||||
@@ -38,12 +38,12 @@
|
||||
return `${deg.toString().padStart(isLongitude ? 3 : 2, '0')} ${min.toString().padStart(2, '0')} ${sec.toString().padStart(5, '0')}.000 ${hemisphere}`;
|
||||
}
|
||||
|
||||
function altitudeToLOC(altMeters) {
|
||||
function altitudeToLOC(altMeters: number) {
|
||||
const altCm = Math.round((altMeters + 100000) * 100);
|
||||
return altCm.toString().padStart(8, '0');
|
||||
}
|
||||
|
||||
function sizeToLOC(sizeMeters) {
|
||||
function sizeToLOC(sizeMeters: number) {
|
||||
if (sizeMeters === 0) return '00';
|
||||
|
||||
let mantissa = 0;
|
||||
@@ -90,7 +90,7 @@
|
||||
return `Parsed: ${locString}`;
|
||||
}
|
||||
|
||||
function locToData(locRecord) {
|
||||
function locToData(locRecord: string) {
|
||||
// Simplified parsing for demo
|
||||
const parts = locRecord.split(' ');
|
||||
if (parts.length < 8) return null;
|
||||
@@ -114,7 +114,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
function showButtonSuccess(buttonId) {
|
||||
function showButtonSuccess(buttonId: string) {
|
||||
buttonStates[buttonId] = true;
|
||||
setTimeout(() => {
|
||||
buttonStates[buttonId] = false;
|
||||
@@ -139,7 +139,7 @@
|
||||
showButtonSuccess('download');
|
||||
}
|
||||
|
||||
function loadCity(city) {
|
||||
function loadCity(city: any) {
|
||||
latitude = city.lat.toString();
|
||||
longitude = city.lng.toString();
|
||||
altitude = city.alt.toString();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import Icon from '$lib/components/global/Icon.svelte';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
let regexp = $state('!^.*$!sip:info@example.com!');
|
||||
let replacement = $state('.');
|
||||
|
||||
let buttonStates = $state({});
|
||||
let buttonStates = $state({} as Record<string, boolean>);
|
||||
let showExamples = $state(false);
|
||||
|
||||
const flagOptions = [
|
||||
@@ -76,7 +76,7 @@
|
||||
/**
|
||||
* @param {string} buttonId
|
||||
*/
|
||||
function showButtonSuccess(buttonId) {
|
||||
function showButtonSuccess(buttonId: string) {
|
||||
buttonStates[buttonId] = true;
|
||||
setTimeout(() => {
|
||||
buttonStates[buttonId] = false;
|
||||
@@ -101,7 +101,7 @@
|
||||
showButtonSuccess('download');
|
||||
}
|
||||
|
||||
function loadExample(exampleType) {
|
||||
function loadExample(exampleType: string) {
|
||||
switch (exampleType) {
|
||||
case 'sip':
|
||||
domain = 'example.com';
|
||||
@@ -157,7 +157,7 @@
|
||||
<summary class="examples-summary">
|
||||
<Icon name="lightbulb" size="sm" />
|
||||
Quick Examples
|
||||
<Icon name="chevron-down" size="sm" class="chevron" />
|
||||
<span class="chevron"><Icon name="chevron-down" size="sm" /></span>
|
||||
</summary>
|
||||
<div class="examples-grid">
|
||||
<button class="example-btn" onclick={() => loadExample('sip')}>
|
||||
|
||||
@@ -301,7 +301,7 @@ very-long-subdomain-name.example.com. IN A 192.0.2.2"
|
||||
<!-- Success State -->
|
||||
<div class="success-card">
|
||||
<div class="success-content">
|
||||
<Icon name="check-circle" size="xl" />
|
||||
<Icon name="check-circle" size="lg" />
|
||||
<div class="success-message">
|
||||
<h4>All Names Valid!</h4>
|
||||
<p>All {results.totalNames} domain names in your zone comply with DNS length limits.</p>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { NETWORK_CLASSES } from '$lib/constants/networks.js';
|
||||
import Tooltip from '$lib/components/global/Tooltip.svelte';
|
||||
import SvgIcon from '$lib/components/global/SvgIcon.svelte';
|
||||
import Icon from '$lib/components/global/Icon.svelte';
|
||||
import '../../styles/converters.scss';
|
||||
import '../../styles/components.scss';
|
||||
</script>
|
||||
@@ -49,7 +50,7 @@
|
||||
<!-- Quick Tips -->
|
||||
<section class="tips-section">
|
||||
<h4 class="tips-header">
|
||||
<SvgIcon icon="info" size="md" />
|
||||
<Icon name="info" size="md" />
|
||||
Understanding Network Classes
|
||||
</h4>
|
||||
<div class="tips-content">
|
||||
@@ -69,7 +70,7 @@
|
||||
<!-- Explainer Section -->
|
||||
<div class="explainer-card">
|
||||
<h3>
|
||||
<SvgIcon icon="info" size="md" />
|
||||
<Icon name="info" size="md" />
|
||||
Network Class Fundamentals
|
||||
</h3>
|
||||
<div class="explainer-content">
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
}
|
||||
|
||||
/* Generate tooltip text for visualization segments */
|
||||
function getSegmentTooltip(range: { cidr: string }, type: 'pool' | 'allocation' | 'free' | 'candidate'): string {
|
||||
function getSegmentTooltip(range: { cidr: string; start?: bigint; end?: bigint }, type: 'pool' | 'allocation' | 'free' | 'candidate'): string {
|
||||
const labels = {
|
||||
pool: 'Pool',
|
||||
allocation: 'Allocation',
|
||||
|
||||
@@ -239,14 +239,14 @@
|
||||
<div class="details-grid">
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">Start:</span>
|
||||
<code onclick={() => copyToClipboard(calculation.details.networkStart)} title="Click to copy">
|
||||
<code onclick={() => calculation.details && copyToClipboard(calculation.details.networkStart)} title="Click to copy">
|
||||
{calculation.details.networkStart}
|
||||
</code>
|
||||
</div>
|
||||
|
||||
<div class="detail-item">
|
||||
<span class="detail-label">End:</span>
|
||||
<code onclick={() => copyToClipboard(calculation.details.networkEnd)} title="Click to copy">
|
||||
<code onclick={() => calculation.details && copyToClipboard(calculation.details.networkEnd)} title="Click to copy">
|
||||
{calculation.details.networkEnd}
|
||||
</code>
|
||||
</div>
|
||||
|
||||
@@ -338,7 +338,7 @@
|
||||
</h4>
|
||||
<button
|
||||
class="copy-button {copiedStates['missing-ptrs'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(results.analysis.missingPTRs.join('\n'), 'missing-ptrs')}
|
||||
onclick={() => results && copyToClipboard(results.analysis.missingPTRs.join('\n'), 'missing-ptrs')}
|
||||
>
|
||||
<Icon name={copiedStates['missing-ptrs'] ? 'check' : 'copy'} size="sm" />
|
||||
Copy List
|
||||
@@ -370,7 +370,7 @@
|
||||
</h4>
|
||||
<button
|
||||
class="copy-button {copiedStates['extra-ptrs'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(results.analysis.extraPTRs.join('\n'), 'extra-ptrs')}
|
||||
onclick={() => results && copyToClipboard(results.analysis.extraPTRs.join('\n'), 'extra-ptrs')}
|
||||
>
|
||||
<Icon name={copiedStates['extra-ptrs'] ? 'check' : 'copy'} size="sm" />
|
||||
Copy List
|
||||
@@ -409,7 +409,7 @@
|
||||
<span>Create Missing PTR Records</span>
|
||||
<button
|
||||
class="copy-button {copiedStates['create-commands'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(generateCreateCommands(results.analysis.missingPTRs), 'create-commands')}
|
||||
onclick={() => results && copyToClipboard(generateCreateCommands(results.analysis.missingPTRs), 'create-commands')}
|
||||
>
|
||||
<Icon name={copiedStates['create-commands'] ? 'check' : 'copy'} size="sm" />
|
||||
Copy Zone Lines
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { Copy, Download, Check, User, Mail } from 'lucide-svelte';
|
||||
import { tooltip } from '$lib/actions/tooltip.js';
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
let txtDname = $state('admin-info.example.com.');
|
||||
let showExamples = $state(false);
|
||||
|
||||
let buttonStates = $state({});
|
||||
let buttonStates = $state({} as Record<string, boolean>);
|
||||
|
||||
const roleExamples = [
|
||||
{
|
||||
@@ -101,7 +101,7 @@
|
||||
return infos;
|
||||
});
|
||||
|
||||
function showButtonSuccess(buttonId) {
|
||||
function showButtonSuccess(buttonId: string) {
|
||||
buttonStates[buttonId] = true;
|
||||
setTimeout(() => {
|
||||
buttonStates[buttonId] = false;
|
||||
@@ -136,19 +136,19 @@
|
||||
showButtonSuccess('download');
|
||||
}
|
||||
|
||||
function loadRoleExample(role) {
|
||||
function loadRoleExample(role: any) {
|
||||
mailboxDname = role.mbox;
|
||||
txtDname = role.txt;
|
||||
if (!domain) domain = 'example.com';
|
||||
}
|
||||
|
||||
function emailToDname(email) {
|
||||
function emailToDname(email: string) {
|
||||
if (!email.includes('@')) return email;
|
||||
const [local, domain] = email.split('@');
|
||||
return `${local.replace(/\./g, '\\.')}.${domain}.`;
|
||||
}
|
||||
|
||||
function dnameToEmail(dname) {
|
||||
function dnameToEmail(dname: string) {
|
||||
if (!dname.includes('.') || dname === '.') return '';
|
||||
const parts = dname.replace(/\.$/, '').split('.');
|
||||
if (parts.length < 2) return '';
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { RESERVED_RANGES } from '$lib/constants/networks.js';
|
||||
import Tooltip from '$lib/components/global/Tooltip.svelte';
|
||||
import SvgIcon from '$lib/components/global/SvgIcon.svelte';
|
||||
import Icon from '$lib/components/global/Icon.svelte';
|
||||
import '../../styles/converters.scss';
|
||||
import '../../styles/components.scss';
|
||||
</script>
|
||||
@@ -45,7 +46,7 @@
|
||||
<!-- Explainer Section -->
|
||||
<div class="explainer-card">
|
||||
<h3>
|
||||
<SvgIcon icon="info" size="md" />
|
||||
<Icon name="info" size="md" />
|
||||
Understanding Reserved IP Ranges
|
||||
</h3>
|
||||
<div class="explainer-content">
|
||||
|
||||
@@ -306,7 +306,7 @@ chmod 644 /etc/bind/zones/${zone.zone}`;
|
||||
<h5>BIND9 Configuration</h5>
|
||||
<button
|
||||
class="copy-button {copiedStates['bind-config'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(generateBindConfig(results.zones), 'bind-config')}
|
||||
onclick={() => results && copyToClipboard(generateBindConfig(results.zones), 'bind-config')}
|
||||
>
|
||||
<Icon name={copiedStates['bind-config'] ? 'check' : 'copy'} size="sm" />
|
||||
Copy Config
|
||||
@@ -321,7 +321,7 @@ chmod 644 /etc/bind/zones/${zone.zone}`;
|
||||
<h5>Zone File Setup Commands</h5>
|
||||
<button
|
||||
class="copy-button {copiedStates['setup-commands'] ? 'copied' : ''}"
|
||||
onclick={() => copyToClipboard(generateDelegationCommands(results.zones), 'setup-commands')}
|
||||
onclick={() => results && copyToClipboard(generateDelegationCommands(results.zones), 'setup-commands')}
|
||||
>
|
||||
<Icon name={copiedStates['setup-commands'] ? 'check' : 'copy'} size="sm" />
|
||||
Copy Commands
|
||||
|
||||
@@ -259,7 +259,7 @@
|
||||
<option value={4}>4 - Ed25519</option>
|
||||
</select>
|
||||
<div class="parameter-description">
|
||||
{algorithmDescriptions[algorithm]}
|
||||
{algorithmDescriptions[algorithm as keyof typeof algorithmDescriptions]}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
<option value={2}>2 - SHA-256</option>
|
||||
</select>
|
||||
<div class="parameter-description">
|
||||
{fingerprintTypeDescriptions[fingerprintType]}
|
||||
{fingerprintTypeDescriptions[fingerprintType as keyof typeof fingerprintTypeDescriptions]}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -371,8 +371,8 @@
|
||||
<label class="parameter-toggle">
|
||||
<input type="checkbox" bind:checked={parameter.enabled} />
|
||||
<span class="parameter-name">{parameter.key}</span>
|
||||
<span class="parameter-description" use:tooltip={parameterDescriptions[parameter.key]}>
|
||||
{parameterDescriptions[parameter.key]}
|
||||
<span class="parameter-description" use:tooltip={parameterDescriptions[parameter.key as keyof typeof parameterDescriptions]}>
|
||||
{parameterDescriptions[parameter.key as keyof typeof parameterDescriptions]}
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
}
|
||||
|
||||
/* Generate tooltip text for visualization segments */
|
||||
function getSegmentTooltip(item: { cidr: string; name?: string }, type: 'allocated' | 'leftover'): string {
|
||||
function getSegmentTooltip(item: { cidr: string; name?: string; start?: bigint; end?: bigint }, type: 'allocated' | 'leftover'): string {
|
||||
if (type === 'allocated' && item.name) {
|
||||
const size = item.start && item.end ? (item.end - item.start + 1n).toLocaleString() : 'Unknown';
|
||||
return `${item.name}\n${item.cidr}\nSize: ${size} addresses`;
|
||||
|
||||
@@ -157,7 +157,6 @@
|
||||
<IPInput
|
||||
bind:value={network.network}
|
||||
placeholder="192.168.1.0"
|
||||
showValidation={true}
|
||||
/>
|
||||
</div>
|
||||
<div class="cidr-input">
|
||||
@@ -251,7 +250,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['supernet']}
|
||||
onclick={() => copyToClipboard(`${supernetResult.supernet.network}/${supernetResult.supernet.cidr}`, 'supernet')}
|
||||
onclick={() => supernetResult?.supernet && copyToClipboard(`${supernetResult.supernet.network}/${supernetResult.supernet.cidr}`, 'supernet')}
|
||||
>
|
||||
<Icon name={copiedStates['supernet'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -308,7 +307,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['network']}
|
||||
onclick={() => copyToClipboard(supernetResult.supernet.network, 'network')}
|
||||
onclick={() => supernetResult?.supernet && copyToClipboard(supernetResult.supernet.network, 'network')}
|
||||
>
|
||||
<Icon name={copiedStates['network'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -327,7 +326,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['mask']}
|
||||
onclick={() => copyToClipboard(supernetResult.supernet.subnetMask, 'mask')}
|
||||
onclick={() => supernetResult?.supernet && copyToClipboard(supernetResult.supernet.subnetMask, 'mask')}
|
||||
>
|
||||
<Icon name={copiedStates['mask'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -346,7 +345,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['wildcard']}
|
||||
onclick={() => copyToClipboard(supernetResult.supernet.wildcardMask, 'wildcard')}
|
||||
onclick={() => supernetResult?.supernet && copyToClipboard(supernetResult.supernet.wildcardMask, 'wildcard')}
|
||||
>
|
||||
<Icon name={copiedStates['wildcard'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -367,7 +366,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['range']}
|
||||
onclick={() => copyToClipboard(`${supernetResult.supernet.addressRange.first} - ${supernetResult.supernet.addressRange.last}`, 'range')}
|
||||
onclick={() => supernetResult?.supernet && copyToClipboard(`${supernetResult.supernet.addressRange.first} - ${supernetResult.supernet.addressRange.last}`, 'range')}
|
||||
>
|
||||
<Icon name={copiedStates['range'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -386,7 +385,7 @@
|
||||
<button
|
||||
class="btn btn-icon copy-btn"
|
||||
class:copied={copiedStates['binary']}
|
||||
onclick={() => copyToClipboard(supernetResult.supernet.binaryMask, 'binary')}
|
||||
onclick={() => supernetResult?.supernet && copyToClipboard(supernetResult.supernet.binaryMask, 'binary')}
|
||||
>
|
||||
<Icon name={copiedStates['binary'] ? 'check' : 'copy'} size="sm" />
|
||||
</button>
|
||||
@@ -511,7 +510,7 @@
|
||||
font-weight: 600;
|
||||
font-size: var(--font-size-sm);
|
||||
flex-shrink: 0;
|
||||
margin-top: 1.5rem; // Align with input labels
|
||||
margin-top: 1.5rem; /* Align with input labels */
|
||||
}
|
||||
|
||||
.network-inputs-row {
|
||||
@@ -851,7 +850,7 @@
|
||||
border-radius: var(--radius-sm);
|
||||
border: 1px solid var(--border-primary);
|
||||
flex: 1;
|
||||
min-width: 0; // Allow text to wrap/truncate
|
||||
min-width: 0; /* Allow text to wrap/truncate */
|
||||
font-size: var(--font-size-sm);
|
||||
|
||||
&.binary-mask {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import Icon from '$lib/components/global/Icon.svelte';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
let showExamples = $state(false);
|
||||
let selectedExample = $state(null);
|
||||
let buttonStates = $state({});
|
||||
let buttonStates = $state({} as Record<string, boolean>);
|
||||
|
||||
const usageDescriptions = {
|
||||
0: 'CA Constraint - Certificate must be issued by the CA represented in the TLSA record',
|
||||
@@ -115,14 +115,14 @@
|
||||
};
|
||||
});
|
||||
|
||||
function showButtonSuccess(buttonId) {
|
||||
function showButtonSuccess(buttonId: string) {
|
||||
buttonStates[buttonId] = true;
|
||||
setTimeout(() => {
|
||||
buttonStates[buttonId] = false;
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
function copyToClipboard(text, buttonId) {
|
||||
function copyToClipboard(text: string, buttonId: string) {
|
||||
navigator.clipboard.writeText(text);
|
||||
showButtonSuccess(buttonId);
|
||||
}
|
||||
@@ -190,7 +190,7 @@
|
||||
}
|
||||
];
|
||||
|
||||
function loadExample(example) {
|
||||
function loadExample(example: any) {
|
||||
domain = example.domain;
|
||||
port = example.port;
|
||||
protocol = example.protocol;
|
||||
@@ -264,7 +264,7 @@
|
||||
<option value={2}>2 - Trust Anchor Assertion</option>
|
||||
<option value={3}>3 - Domain-Issued Certificate</option>
|
||||
</select>
|
||||
<p class="description">{usageDescriptions[usage]}</p>
|
||||
<p class="description">{usageDescriptions[usage as keyof typeof usageDescriptions]}</p>
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
@@ -273,7 +273,7 @@
|
||||
<option value={0}>0 - Full Certificate</option>
|
||||
<option value={1}>1 - Subject Public Key Info</option>
|
||||
</select>
|
||||
<p class="description">{selectorDescriptions[selector]}</p>
|
||||
<p class="description">{selectorDescriptions[selector as keyof typeof selectorDescriptions]}</p>
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
@@ -283,7 +283,7 @@
|
||||
<option value={1}>1 - SHA-256 Hash</option>
|
||||
<option value={2}>2 - SHA-512 Hash</option>
|
||||
</select>
|
||||
<p class="description">{matchingTypeDescriptions[matchingType]}</p>
|
||||
<p class="description">{matchingTypeDescriptions[matchingType as keyof typeof matchingTypeDescriptions]}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -466,7 +466,7 @@
|
||||
<summary class="examples-summary">
|
||||
<Icon name="lightbulb" size="sm" />
|
||||
Example Configurations
|
||||
<Icon name="chevron-down" size="sm" class="chevron" />
|
||||
<span class="chevron"><Icon name="chevron-down" size="sm" /></span>
|
||||
</summary>
|
||||
<div class="examples-grid">
|
||||
{#each exampleConfigurations as example}
|
||||
|
||||
@@ -206,7 +206,7 @@
|
||||
type="text"
|
||||
placeholder="Subnet name"
|
||||
bind:value={subnet.name}
|
||||
oninput={(e) => updateSubnet(subnet.id, 'name', e.target?.value)}
|
||||
oninput={(e) => updateSubnet(subnet.id, 'name', (e.target as HTMLInputElement)?.value)}
|
||||
class="subnet-name-input"
|
||||
/>
|
||||
<div class="hosts-input">
|
||||
@@ -216,7 +216,7 @@
|
||||
min="1"
|
||||
max="16777214"
|
||||
bind:value={subnet.hostsNeeded}
|
||||
oninput={(e) => updateSubnet(subnet.id, 'hostsNeeded', parseInt(e.target?.value || '1'))}
|
||||
oninput={(e) => updateSubnet(subnet.id, 'hostsNeeded', parseInt((e.target as HTMLInputElement)?.value || '1'))}
|
||||
class="hosts-number-input"
|
||||
/>
|
||||
</div>
|
||||
@@ -236,7 +236,7 @@
|
||||
type="text"
|
||||
placeholder="Description (optional)"
|
||||
bind:value={subnet.description}
|
||||
oninput={(e) => updateSubnet(subnet.id, 'description', e.target?.value)}
|
||||
oninput={(e) => updateSubnet(subnet.id, 'description', (e.target as HTMLTextAreaElement)?.value)}
|
||||
class="description-input"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
|
||||
export type Field = typeof fieldOptionsArray[number]['type'];
|
||||
|
||||
export interface FieldOption {
|
||||
type: Field;
|
||||
label: string;
|
||||
regex?: RegExp;
|
||||
example: string;
|
||||
explanation: string;
|
||||
}
|
||||
|
||||
export const fieldOptionsArray = [
|
||||
{
|
||||
type: 'ipv4',
|
||||
label: 'IPv4 Address',
|
||||
example: '3.33.130.190',
|
||||
explanation: 'A single IPv4 address (dotted decimal, 0-255 per octet)',
|
||||
},
|
||||
{
|
||||
type: 'ipv6',
|
||||
label: 'IPv6 Address',
|
||||
example: '2001:db8::1',
|
||||
explanation: 'A single IPv6 address (supports zero-compression like ::)',
|
||||
},
|
||||
{
|
||||
type: 'ipv4-cidr',
|
||||
label: 'IPv4 CIDR Notation',
|
||||
example: '192.168.1.0/24',
|
||||
explanation: 'IPv4 address followed by a slash and prefix length',
|
||||
},
|
||||
{
|
||||
type: 'ipv6-cidr',
|
||||
label: 'IPv6 CIDR Notation',
|
||||
example: '2001:db8::/64',
|
||||
explanation: 'IPv6 address followed by a slash and prefix length',
|
||||
},
|
||||
{
|
||||
type: 'ipv4-range',
|
||||
label: 'Continuous IPv4 range',
|
||||
example: '192.168.1.10-192.168.1.20',
|
||||
explanation: 'Inclusive start-end range of IPv4 addresses (same address family)',
|
||||
},
|
||||
{
|
||||
type: 'ipv6-range',
|
||||
label: 'Continuous IPv6 range',
|
||||
example: '2001:db8::10-2001:db8::20',
|
||||
explanation: 'Inclusive start-end range of IPv6 addresses (same address family)',
|
||||
},
|
||||
{
|
||||
type: 'ipv4-prefix',
|
||||
label: 'IPv4 Prefix',
|
||||
example: '24',
|
||||
explanation:
|
||||
'Number of leading bits in the network portion (0-32). Larger value → smaller subnet',
|
||||
},
|
||||
{
|
||||
type: 'ipv6-prefix',
|
||||
label: 'IPv6 Prefix',
|
||||
example: '64',
|
||||
explanation:
|
||||
'Number of leading bits in the network portion (0-128). Larger value → smaller subnet',
|
||||
},
|
||||
{
|
||||
type: 'ipv4-subnet',
|
||||
label: 'IPv4 Subnet',
|
||||
example: '192.168.1.0/26',
|
||||
explanation:
|
||||
'An IPv4 CIDR used as a child network carved from a larger parent',
|
||||
},
|
||||
{
|
||||
type: 'ipv6-subnet',
|
||||
label: 'IPv6 Subnet',
|
||||
example: '2001:db8::/72',
|
||||
explanation:
|
||||
'An IPv6 CIDR used as a child network carved from a larger parent',
|
||||
},
|
||||
{
|
||||
type: 'subnets',
|
||||
label: 'Subnets Count',
|
||||
example: '4',
|
||||
explanation:
|
||||
'How many equal-sized subnets to create; typically a power of two (e.g., 1, 2, 4, 8)',
|
||||
},
|
||||
] as const;
|
||||
|
||||
|
||||
// build the map when you need it
|
||||
export const fieldOptions: Record<Field, Omit<FieldOption, 'type'>> =
|
||||
Object.fromEntries(
|
||||
fieldOptionsArray.map(({ type, ...rest }) => [type, rest])
|
||||
) as any;
|
||||
|
||||
interface PageSpec {
|
||||
path: string;
|
||||
params: Field[] | { optional: Field[] } | { either: Field[] };
|
||||
}
|
||||
|
||||
export const pageSpec: PageSpec[] = [
|
||||
{ path: '/subnetting/ipv4-subnet-calculator', params: ['ipv4-cidr'] },
|
||||
];
|
||||
|
||||
|
||||
// Page-param spec types:
|
||||
// either-or
|
||||
// list
|
||||
// optional
|
||||
|
||||
|
||||
// export const QUERY_SPEC = {
|
||||
// '/subnetting/ipv4-subnet-calculator': [ 'cidr' ],
|
||||
// '/subnetting/ipv6-subnet-calculator': ['ipv6', 'prefix-len'],
|
||||
// '/cidr/summarize': [],
|
||||
// };
|
||||
@@ -36,12 +36,12 @@
|
||||
const query = searchQuery.toLowerCase().trim();
|
||||
filteredTools = toolPages.filter(tool =>
|
||||
tool.label.toLowerCase().includes(query) ||
|
||||
tool.description.toLowerCase().includes(query) ||
|
||||
tool.description?.toLowerCase().includes(query) ||
|
||||
tool.keywords?.some(keyword => keyword.toLowerCase().includes(query))
|
||||
);
|
||||
filteredReference = referencePages.filter(page =>
|
||||
page.label.toLowerCase().includes(query) ||
|
||||
page.description.toLowerCase().includes(query) ||
|
||||
page.description?.toLowerCase().includes(query) ||
|
||||
page.keywords?.some(keyword => keyword.toLowerCase().includes(query))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@
|
||||
bind:value={domainName}
|
||||
placeholder="example.com"
|
||||
class:invalid={domainName && !isValidDomainName(domainName.trim())}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) checkCAA(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) checkCAA(); }}
|
||||
/>
|
||||
{#if domainName && !isValidDomainName(domainName.trim())}
|
||||
<span class="error-text">Invalid domain name format</span>
|
||||
@@ -246,7 +246,7 @@
|
||||
<div class="card-header row">
|
||||
<h3>CAA Policy Results</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Results"}
|
||||
</button>
|
||||
</div>
|
||||
@@ -257,7 +257,7 @@
|
||||
{#if results.effective}
|
||||
<div class="effective-policy">
|
||||
<div class="effective-header">
|
||||
<Icon name="shield-check" size="md" class="text-success" />
|
||||
<span class="text-success"><Icon name="shield-check" size="md" /></span>
|
||||
<div>
|
||||
<h5>Policy found at: <span class="domain-name">{results.effective.domain}</span></h5>
|
||||
<p>This domain has CAA records that control certificate issuance</p>
|
||||
@@ -295,7 +295,7 @@
|
||||
</div>
|
||||
{:else}
|
||||
<div class="no-policy">
|
||||
<Icon name="shield-off" size="md" class="text-warning" />
|
||||
<span class="text-warning"><Icon name="shield-off" size="md" /></span>
|
||||
<div>
|
||||
<h5>No CAA policy found</h5>
|
||||
<p>No CAA records found in the domain chain for <code>{domainName}</code></p>
|
||||
|
||||
@@ -184,7 +184,7 @@
|
||||
<div class="card-header row">
|
||||
<h3>DNSSEC Status for {results.name}</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Raw JSON"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -293,7 +293,7 @@
|
||||
<h3>DNS Records Found</h3>
|
||||
{#if results.Answer?.length > 0}
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Results"}
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
@@ -214,7 +214,7 @@
|
||||
<div class="card-header row">
|
||||
<h3>NS/SOA Analysis Results</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Results"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -255,7 +255,7 @@
|
||||
<h3>Reverse DNS Results</h3>
|
||||
{#if results.Answer?.length > 0}
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Results"}
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
<div class="card-header row">
|
||||
<h3>SOA Analysis for {results.name}</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Raw JSON"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -220,7 +220,7 @@
|
||||
<div class="card-header row">
|
||||
<h3>SPF Evaluation Results</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Results"}
|
||||
</button>
|
||||
</div>
|
||||
@@ -274,9 +274,9 @@
|
||||
<span class="include-type">{item.type}:</span>
|
||||
<span class="include-domain">{item.domain}</span>
|
||||
{#if item.result?.error}
|
||||
<Icon name="alert-triangle" size="xs" class="text-error" />
|
||||
<span class="text-error"><Icon name="alert-triangle" size="xs" /></span>
|
||||
{:else}
|
||||
<Icon name="check-circle" size="xs" class="text-success" />
|
||||
<span class="text-success"><Icon name="check-circle" size="xs" /></span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -307,9 +307,9 @@
|
||||
<Icon name="external-link" size="xs" />
|
||||
<span>redirect to: {redirect.domain}</span>
|
||||
{#if redirect.result?.error}
|
||||
<Icon name="alert-triangle" size="xs" class="text-error" />
|
||||
<span class="text-error"><Icon name="alert-triangle" size="xs" /></span>
|
||||
{:else}
|
||||
<Icon name="check-circle" size="xs" class="text-success" />
|
||||
<span class="text-success"><Icon name="check-circle" size="xs" /></span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@
|
||||
</div>
|
||||
|
||||
<div class="mx-status">
|
||||
<Icon name={mx.error ? 'x-circle' : 'check-circle'} size="sm" class={mx.error ? 'text-error' : 'text-success'} />
|
||||
<span class={mx.error ? 'text-error' : 'text-success'}><Icon name={mx.error ? 'x-circle' : 'check-circle'} size="sm" /></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -207,10 +207,10 @@
|
||||
type="url"
|
||||
bind:value={url}
|
||||
placeholder="https://api.example.com"
|
||||
class:invalid={url && !isInputValid}
|
||||
onchange={() => { if (isInputValid) checkCORS(); }}
|
||||
class:invalid={url && !isInputValid()}
|
||||
onchange={() => { if (isInputValid()) checkCORS(); }}
|
||||
/>
|
||||
{#if url && !isInputValid}
|
||||
{#if url && !isInputValid()}
|
||||
<span class="error-text">Invalid URL format</span>
|
||||
{/if}
|
||||
</label>
|
||||
@@ -225,7 +225,7 @@
|
||||
bind:value={origin}
|
||||
placeholder="https://yoursite.com"
|
||||
class:invalid={origin && !isInputValid}
|
||||
onchange={() => { if (isInputValid) checkCORS(); }}
|
||||
onchange={() => { if (isInputValid()) checkCORS(); }}
|
||||
/>
|
||||
{#if origin && !isInputValid}
|
||||
<span class="error-text">Invalid origin format</span>
|
||||
@@ -236,7 +236,7 @@
|
||||
<div class="form-group">
|
||||
<label for="method" use:tooltip={"HTTP method to test in preflight request"}>
|
||||
Method
|
||||
<select id="method" bind:value={method} onchange={() => { if (isInputValid) checkCORS(); }}>
|
||||
<select id="method" bind:value={method} onchange={() => { if (isInputValid()) checkCORS(); }}>
|
||||
{#each methods as methodOption}
|
||||
<option value={methodOption}>{methodOption}</option>
|
||||
{/each}
|
||||
@@ -265,7 +265,7 @@
|
||||
<div class="card-header">
|
||||
<h3>CORS Policy Analysis</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Results"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -201,10 +201,10 @@
|
||||
type="url"
|
||||
bind:value={url}
|
||||
placeholder="https://example.com"
|
||||
class:invalid={url && !isInputValid}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) checkHeaders(); }}
|
||||
class:invalid={url && !isInputValid()}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) checkHeaders(); }}
|
||||
/>
|
||||
{#if url && !isInputValid}
|
||||
{#if url && !isInputValid()}
|
||||
<span class="error-text">Invalid URL format</span>
|
||||
{/if}
|
||||
</label>
|
||||
@@ -213,7 +213,7 @@
|
||||
<div class="form-group">
|
||||
<label for="method" use:tooltip={"HTTP method to use"}>
|
||||
Method
|
||||
<select id="method" bind:value={method} onchange={() => { clearExampleSelection(); if (isInputValid) checkHeaders(); }}>
|
||||
<select id="method" bind:value={method} onchange={() => { clearExampleSelection(); if (isInputValid()) checkHeaders(); }}>
|
||||
{#each methods as methodOption}
|
||||
<option value={methodOption}>{methodOption}</option>
|
||||
{/each}
|
||||
@@ -230,7 +230,7 @@
|
||||
bind:value={customHeadersText}
|
||||
placeholder="User-Agent: My Custom Agent Authorization: Bearer token123"
|
||||
rows="3"
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) checkHeaders(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) checkHeaders(); }}
|
||||
></textarea>
|
||||
</label>
|
||||
</div>
|
||||
@@ -255,7 +255,7 @@
|
||||
<div class="card-header row">
|
||||
<h3>HTTP Response Analysis</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Results"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -186,10 +186,10 @@
|
||||
type="url"
|
||||
bind:value={url}
|
||||
placeholder="https://example.com"
|
||||
class:invalid={url && !isInputValid}
|
||||
onchange={() => { if (isInputValid) measurePerformance(); }}
|
||||
class:invalid={url && !isInputValid()}
|
||||
onchange={() => { if (isInputValid()) measurePerformance(); }}
|
||||
/>
|
||||
{#if url && !isInputValid}
|
||||
{#if url && !isInputValid()}
|
||||
<span class="error-text">Invalid URL format</span>
|
||||
{/if}
|
||||
</label>
|
||||
@@ -198,7 +198,7 @@
|
||||
<div class="form-group">
|
||||
<label for="method" use:tooltip={"HTTP method to use for the request"}>
|
||||
Method
|
||||
<select id="method" bind:value={method} onchange={() => { if (isInputValid) measurePerformance(); }}>
|
||||
<select id="method" bind:value={method} onchange={() => { if (isInputValid()) measurePerformance(); }}>
|
||||
{#each methods as methodOption}
|
||||
<option value={methodOption}>{methodOption}</option>
|
||||
{/each}
|
||||
@@ -228,7 +228,7 @@
|
||||
<div class="card-header">
|
||||
<h3>Performance Analysis</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Results"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -165,8 +165,8 @@
|
||||
<h4>Redirect Examples</h4>
|
||||
</summary>
|
||||
<div class="examples-grid">
|
||||
{#each examples as example}
|
||||
<button class="example-card" onclick={() => loadExample(example)}>
|
||||
{#each examples as example, index}
|
||||
<button class="example-card" onclick={() => loadExample(example, index)}>
|
||||
<h5>{example.url}</h5>
|
||||
<p>{example.description}</p>
|
||||
</button>
|
||||
@@ -190,10 +190,10 @@
|
||||
type="url"
|
||||
bind:value={url}
|
||||
placeholder="https://bit.ly/example"
|
||||
class:invalid={url && !isInputValid}
|
||||
onchange={() => { if (isInputValid) traceRedirects(); }}
|
||||
class:invalid={url && !isInputValid()}
|
||||
onchange={() => { if (isInputValid()) traceRedirects(); }}
|
||||
/>
|
||||
{#if url && !isInputValid}
|
||||
{#if url && !isInputValid()}
|
||||
<span class="error-text">Invalid URL format</span>
|
||||
{/if}
|
||||
</label>
|
||||
@@ -208,7 +208,7 @@
|
||||
bind:value={maxRedirects}
|
||||
min="1"
|
||||
max="50"
|
||||
onchange={() => { if (isInputValid) traceRedirects(); }}
|
||||
onchange={() => { if (isInputValid()) traceRedirects(); }}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
@@ -234,7 +234,7 @@
|
||||
<div class="card-header">
|
||||
<h3>Redirect Chain Analysis</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Chain"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -186,10 +186,10 @@
|
||||
type="url"
|
||||
bind:value={url}
|
||||
placeholder="https://example.com"
|
||||
class:invalid={url && !isInputValid}
|
||||
onchange={() => { if (isInputValid) analyzeSecurity(); }}
|
||||
class:invalid={url && !isInputValid()}
|
||||
onchange={() => { if (isInputValid()) analyzeSecurity(); }}
|
||||
/>
|
||||
{#if url && !isInputValid}
|
||||
{#if url && !isInputValid()}
|
||||
<span class="error-text">Invalid URL format</span>
|
||||
{/if}
|
||||
</label>
|
||||
@@ -216,7 +216,7 @@
|
||||
<div class="card-header">
|
||||
<h3>Security Headers Analysis</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Analysis"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
});
|
||||
|
||||
const isInputValid = $derived(() => {
|
||||
return isUrlValid && count >= 1 && count <= 20;
|
||||
return isUrlValid() && count >= 1 && count <= 20;
|
||||
});
|
||||
|
||||
async function httpPing() {
|
||||
@@ -94,7 +94,7 @@
|
||||
function setMethod(newMethod: string) {
|
||||
method = newMethod;
|
||||
clearExampleSelection();
|
||||
if (isInputValid) httpPing();
|
||||
if (isInputValid()) httpPing();
|
||||
}
|
||||
|
||||
function getLatencyClass(latency: number): string {
|
||||
@@ -201,10 +201,10 @@
|
||||
type="url"
|
||||
bind:value={url}
|
||||
placeholder="https://example.com"
|
||||
class:invalid={url && !isUrlValid}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) httpPing(); }}
|
||||
class:invalid={url && !isUrlValid()}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) httpPing(); }}
|
||||
/>
|
||||
{#if url && !isUrlValid}
|
||||
{#if url && !isUrlValid()}
|
||||
<span class="error-text">Must be a valid HTTP or HTTPS URL</span>
|
||||
{/if}
|
||||
</label>
|
||||
@@ -241,7 +241,7 @@
|
||||
bind:value={count}
|
||||
min="1"
|
||||
max="20"
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) httpPing(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) httpPing(); }}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
@@ -255,14 +255,14 @@
|
||||
min="1000"
|
||||
max="30000"
|
||||
step="1000"
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) httpPing(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) httpPing(); }}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="action-section">
|
||||
<button class="lookup-btn" onclick={httpPing} disabled={loading || !isInputValid}>
|
||||
<button class="lookup-btn" onclick={httpPing} disabled={loading || !isInputValid()}>
|
||||
{#if loading}
|
||||
<Icon name="loader-2" size="sm" animate="spin" />
|
||||
Pinging...
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
});
|
||||
|
||||
const isInputValid = $derived(() => {
|
||||
return targetsList.length > 0 &&
|
||||
targetsList.every(target => /^[a-zA-Z0-9.-]+:\d+$/.test(target));
|
||||
return targetsList().length > 0 &&
|
||||
targetsList().every((target: string) => /^[a-zA-Z0-9.-]+:\d+$/.test(target));
|
||||
});
|
||||
|
||||
async function checkPorts() {
|
||||
@@ -214,8 +214,8 @@
|
||||
bind:value={targets}
|
||||
placeholder="google.com:443 github.com:22 example.com:80"
|
||||
rows="6"
|
||||
class:invalid={targets && !isInputValid}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) checkPorts(); }}
|
||||
class:invalid={targets && !isInputValid()}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) checkPorts(); }}
|
||||
></textarea>
|
||||
<div class="input-help">
|
||||
<span class="target-count">{targetsList.length}/50 targets</span>
|
||||
@@ -257,7 +257,7 @@
|
||||
min="1000"
|
||||
max="30000"
|
||||
step="1000"
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) checkPorts(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) checkPorts(); }}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
<div class="card-header row">
|
||||
<h3>RDAP Data for {formatASN(results.asn)}</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Raw JSON"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
<div class="card-header row">
|
||||
<h3>RDAP Data for {results.domain}</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Raw JSON"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
<div class="card-header row">
|
||||
<h3>RDAP Data for {results.ip}</h3>
|
||||
<button class="copy-btn" onclick={copyResults} disabled={copiedState}>
|
||||
<Icon name={copiedState ? "check" : "copy"} size="xs" class={copiedState ? "text-green-500" : ""} />
|
||||
<span class={copiedState ? "text-green-500" : ""}><Icon name={copiedState ? "check" : "copy"} size="xs" /></span>
|
||||
{copiedState ? "Copied!" : "Copy Raw JSON"}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
function setCommonProtocols(protocolSet: string) {
|
||||
protocols = protocolSet;
|
||||
clearExampleSelection();
|
||||
if (isInputValid) probeALPN();
|
||||
if (isInputValid()) probeALPN();
|
||||
}
|
||||
|
||||
function getProtocolInfo(protocol: string): { name: string, description: string, version: string } {
|
||||
@@ -210,7 +210,7 @@
|
||||
bind:value={host}
|
||||
placeholder="google.com:443"
|
||||
class:invalid={host && !isInputValid}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) probeALPN(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) probeALPN(); }}
|
||||
/>
|
||||
{#if host && !isInputValid}
|
||||
<span class="error-text">Invalid host:port format</span>
|
||||
@@ -229,7 +229,7 @@
|
||||
type="text"
|
||||
bind:value={protocols}
|
||||
placeholder="h2,http/1.1"
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) probeALPN(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) probeALPN(); }}
|
||||
/>
|
||||
</label>
|
||||
<div class="protocol-presets">
|
||||
@@ -254,7 +254,7 @@
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={useCustomServername}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) probeALPN(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) probeALPN(); }}
|
||||
/>
|
||||
Use custom SNI servername
|
||||
</label>
|
||||
@@ -264,7 +264,7 @@
|
||||
bind:value={servername}
|
||||
placeholder="example.com"
|
||||
use:tooltip={"Custom servername for SNI (Server Name Indication)"}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) probeALPN(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) probeALPN(); }}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -348,7 +348,7 @@
|
||||
<div class="selected-protocol">
|
||||
<div class="protocol-item selected">
|
||||
<div class="protocol-header">
|
||||
<Icon name="check-circle" size="sm" class="success-icon" />
|
||||
<span class="success-icon"><Icon name="check-circle" size="sm" /></span>
|
||||
<span class="protocol-name">{selectedProtocol.name}</span>
|
||||
<span class="protocol-id mono">({results.negotiatedProtocol})</span>
|
||||
</div>
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
bind:value={host}
|
||||
placeholder="google.com:443"
|
||||
class:invalid={host && !isInputValid}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) analyzeCertificate(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) analyzeCertificate(); }}
|
||||
/>
|
||||
{#if host && !isInputValid}
|
||||
<span class="error-text">Invalid host:port format</span>
|
||||
@@ -176,7 +176,7 @@
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={useCustomServername}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) analyzeCertificate(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) analyzeCertificate(); }}
|
||||
/>
|
||||
Use custom SNI servername
|
||||
</label>
|
||||
@@ -186,7 +186,7 @@
|
||||
bind:value={servername}
|
||||
placeholder="example.com"
|
||||
use:tooltip={"Custom servername for SNI (Server Name Indication)"}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) analyzeCertificate(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) analyzeCertificate(); }}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -191,7 +191,7 @@
|
||||
bind:value={host}
|
||||
placeholder="google.com:443"
|
||||
class:invalid={host && !isInputValid}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) probeTLSVersions(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) probeTLSVersions(); }}
|
||||
/>
|
||||
{#if host && !isInputValid}
|
||||
<span class="error-text">Invalid host:port format</span>
|
||||
@@ -206,7 +206,7 @@
|
||||
<input
|
||||
type="checkbox"
|
||||
bind:checked={useCustomServername}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) probeTLSVersions(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) probeTLSVersions(); }}
|
||||
/>
|
||||
Use custom SNI servername
|
||||
</label>
|
||||
@@ -216,7 +216,7 @@
|
||||
bind:value={servername}
|
||||
placeholder="example.com"
|
||||
use:tooltip={"Custom servername for SNI (Server Name Indication)"}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid) probeTLSVersions(); }}
|
||||
onchange={() => { clearExampleSelection(); if (isInputValid()) probeTLSVersions(); }}
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -2,9 +2,12 @@
|
||||
import Icon from '$lib/components/global/Icon.svelte';
|
||||
import { SUB_NAV } from '$lib/constants/nav.js';
|
||||
|
||||
const zoneTools = (SUB_NAV['/dns']?.find(group =>
|
||||
typeof group === 'object' && 'title' in group && group.title === 'Zone File Tools'
|
||||
))?.items || [];
|
||||
const zoneTools = (() => {
|
||||
const dnsNavGroup = SUB_NAV['/dns']?.find(group =>
|
||||
typeof group === 'object' && 'title' in group && group.title === 'Zone File Tools'
|
||||
);
|
||||
return (dnsNavGroup && 'items' in dnsNavGroup) ? dnsNavGroup.items : [];
|
||||
})();
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
||||
Reference in new issue
Block a user