From 788d4fdded17d18b8660a814ea23b9c3712d624f Mon Sep 17 00:00:00 2001 From: Sebastian Danielsson Date: Sun, 4 Oct 2026 19:00:24 +0200 Subject: [PATCH] fix(dns-query, gitattributes-generator): hide dns-query offline, pin commands to the snapshot dns-query calls Cloudflare DNS over HTTPS and rdap.org, so offline mode now hides it like dns-queries. The gitattributes download commands are now built from the URLs the preview was generated from. When the snapshot was used, they point at the snapshot commit instead of master, so they reproduce what is shown. Co-Authored-By: Claude Opus 5.5 (1M context) --- README.md | 2 +- src/tools/dns-query/index.ts | 1 + .../gitattributes-generator.vue | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 44f26201..8836a5d1 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,7 @@ To define the default UI language, add a `default_locale` key to json: Fonts, editor extensions, the ffmpeg core, the ONNX runtime, the Tesseract OCR engine and its English and Simplified Chinese language data ship with the app, so these never come from a third-party CDN. The large ones are only downloaded when their tool is opened, and are left out of the PWA precache. -On a network without internet access, add `"offline": true` to `tools-settings.json`. Tools that only work with internet are then hidden (my-ip, ip-geo-location, dns-queries, dnsbl-checker, dns-propagation-tester, online-wiktionary, iana-whois-checker), and tools with a bundled fallback switch to it: +On a network without internet access, add `"offline": true` to `tools-settings.json`. Tools that only work with internet are then hidden (my-ip, ip-geo-location, dns-query, dns-queries, dnsbl-checker, dns-propagation-tester, online-wiktionary, iana-whois-checker), and tools with a bundled fallback switch to it: - gitignore-generator and gitattributes-generator use a template snapshot bundled at build time (also used online when GitHub can't be reached). Refresh it with `pnpm script:update:git-templates`. - ocr-image offers only the bundled languages. diff --git a/src/tools/dns-query/index.ts b/src/tools/dns-query/index.ts index 35f65163..a5821330 100644 --- a/src/tools/dns-query/index.ts +++ b/src/tools/dns-query/index.ts @@ -28,4 +28,5 @@ export const tool = defineTool({ category: 'Network', externAccessDescription: "This tool resolves DNS records for a given domain using Cloudflare's DNS over HTTPS API (https://cloudflare-dns.com). It resolves WhoIs throught RDAP API (https://rdap.org).", + requiresInternet: true, }); diff --git a/src/tools/gitattributes-generator/gitattributes-generator.vue b/src/tools/gitattributes-generator/gitattributes-generator.vue index 2538e10c..d56ed343 100644 --- a/src/tools/gitattributes-generator/gitattributes-generator.vue +++ b/src/tools/gitattributes-generator/gitattributes-generator.vue @@ -5,7 +5,6 @@ import { useLocalStorage } from '@vueuse/core'; import { type GitTemplatesSnapshot, type GitTemplatesSource, - liveTemplateUrl, loadTemplate, loadTemplateNames, snapshotDay, @@ -17,6 +16,8 @@ const { t } = useI18n(); const options = useLocalStorage<{ label: string; value: string }[]>('gitattr-gen:opts2', []); const selected = ref([]); const output = ref(''); +// Where each template in `output` came from: the live branch, or the snapshot commit when the snapshot was used +const outputUrls = ref([]); // Timestamp cache to allow refresh after X hours const lastFetched = useLocalStorage('gitattr-gen:ts', 0); @@ -55,22 +56,25 @@ async function loadOptions() { async function generateOutput() { let gitattributes = ''; + const urls: string[] = []; for (const lang of selected.value) { const { content, url, snapshot } = await loadTemplate(source, lang, { offline: isOfflineMode }); if (snapshot) { snapshotDate.value = snapshotDay(snapshot); } + urls.push(url); gitattributes += `${gitattributes ? '\n\n' : ''}# === .gitattributes for ${lang} (${url}) ===\n\n${content}`; } output.value = gitattributes; + outputUrls.value = urls; } -// Multi-command generation +// Multi-command generation, downloading the same files as the generated preview const commands = computed(() => { - if (!selected.value.length) { + if (!outputUrls.value.length) { return { curl: '', wget: '', powershell: '', cmd: '' }; } - const urls = selected.value.map((lang) => liveTemplateUrl(source, lang)).join(' '); + const urls = outputUrls.value.join(' '); return { curl: `curl ${urls} > .gitattributes`, wget: `wget ${urls} -O .gitattributes`,