#!/bin/bash
T="$LOCALAPPDATA/Temp"
echo "  --- tải chart.js về file để đo (local vs funnel):"
curl -s -o "$T/c_local.js" -w "    local : %{http_code} %{size_download} byte\n" -m 20 "http://127.0.0.1:8097/lib/chart.umd.min.js"
curl -s -o "$T/c_fun.js"   -w "    funnel: %{http_code} %{size_download} byte\n" -m 30 "https://desktop-9gsdkd2.tail0ffe94.ts.net/dashboard/lib/chart.umd.min.js"
ls -l "$T/c_local.js" "$T/c_fun.js" | awk '{print "    file: "$5" byte  "$NF}'
echo "  --- so khớp 2 bản:"
if cmp -s "$T/c_local.js" "$T/c_fun.js"; then echo "    GIỐNG NHAU (funnel OK)"; else echo "    KHÁC NHAU / thiếu"; fi
echo "  --- trang chủ /dashboard/ qua funnel (byte):"
curl -s -o "$T/d_fun.html" -w "    %{http_code} %{size_download} byte\n" -m 30 "https://desktop-9gsdkd2.tail0ffe94.ts.net/dashboard/"
grep -c 'chart.umd.min.js' "$T/d_fun.html" | sed 's/^/    có thẻ script chart.js: /'
