Refactor JSON optimizer script and update data fetching logic for improved performance
This commit is contained in:
parent
7694bdad22
commit
d110a106ad
3 changed files with 5 additions and 7 deletions
1
dist/index.html
vendored
1
dist/index.html
vendored
|
|
@ -39,7 +39,6 @@
|
||||||
<!-- Prefetch data for quick subsequent use (non-blocking) -->
|
<!-- Prefetch data for quick subsequent use (non-blocking) -->
|
||||||
<link rel="prefetch" as="fetch" href="/json/file-hosts-optimized.json" crossorigin>
|
<link rel="prefetch" as="fetch" href="/json/file-hosts-optimized.json" crossorigin>
|
||||||
<link rel="prefetch" as="fetch" href="/json/adult-hosts-optimized.json" crossorigin>
|
<link rel="prefetch" as="fetch" href="/json/adult-hosts-optimized.json" crossorigin>
|
||||||
<link rel="prefetch" as="fetch" href="/json/pricing.json" crossorigin>
|
|
||||||
<link as="style" rel="preload" href="/css/styles-min.css">
|
<link as="style" rel="preload" href="/css/styles-min.css">
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
||||||
3
dist/js/app.js
vendored
3
dist/js/app.js
vendored
|
|
@ -1002,8 +1002,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
// Prefer optimized JSON, fall back to original if missing
|
// Prefer optimized JSON, fall back to original if missing
|
||||||
const datasets = [
|
const datasets = [
|
||||||
['./json/file-hosts-optimized.json', './json/file-hosts.json'],
|
['./json/file-hosts-optimized.json', './json/file-hosts.json'],
|
||||||
['./json/adult-hosts-optimized.json', './json/adult-hosts.json'],
|
['./json/adult-hosts-optimized.json', './json/adult-hosts.json']
|
||||||
['./json/pricing.json']
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const fetchPromises = datasets.map(list => fetchJsonFallback(list, 8000));
|
const fetchPromises = datasets.map(list => fetchJsonFallback(list, 8000));
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# JSON Optimizer Script - Converts host data to indexed format
|
# JSON Optimizer Script - Converts host data to indexed format
|
||||||
|
# Converts ✅/❌ format to compact indexed format for better performance
|
||||||
# Usage: ./scripts/json-optimizer.sh file-hosts.json
|
# Usage: ./scripts/json-optimizer.sh file-hosts.json
|
||||||
# ./scripts/json-optimizer.sh adult-hosts.json
|
# ./scripts/json-optimizer.sh adult-hosts.json
|
||||||
# ./scripts/json-optimizer.sh pricing.json
|
|
||||||
|
|
||||||
# Colors for output
|
# Colors for output
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
|
|
@ -41,7 +41,7 @@ if [ $# -eq 0 ]; then
|
||||||
echo "Examples:"
|
echo "Examples:"
|
||||||
echo " $0 file-hosts.json"
|
echo " $0 file-hosts.json"
|
||||||
echo " $0 ./json/adult-hosts.json"
|
echo " $0 ./json/adult-hosts.json"
|
||||||
echo " $0 pricing.json pricing-optimized.json"
|
echo " $0 ./json/file-hosts.json file-hosts-optimized.json"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -118,11 +118,11 @@ def convert_to_indexed_format(input_file, output_file):
|
||||||
total_support_instances = 0
|
total_support_instances = 0
|
||||||
|
|
||||||
for host, host_data in data.items():
|
for host, host_data in data.items():
|
||||||
# Get indices of services with 'yes' values (case insensitive)
|
# Get indices of services with '✅' values (new format)
|
||||||
supported_indices = [
|
supported_indices = [
|
||||||
service_to_index[service]
|
service_to_index[service]
|
||||||
for service, value in host_data.items()
|
for service, value in host_data.items()
|
||||||
if str(value).lower() == 'yes'
|
if str(value) == '✅'
|
||||||
]
|
]
|
||||||
supported[host] = sorted(supported_indices)
|
supported[host] = sorted(supported_indices)
|
||||||
total_support_instances += len(supported_indices)
|
total_support_instances += len(supported_indices)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue