Files
dns-server/.trae/documents/修复picsum.photos域名匹配问题.md
2026-01-14 23:08:46 +08:00

20 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 修复picsum.photos域名匹配问题
## 问题分析
当DNS查询picsum.photos时实际传递给`getDomainInfo()`函数的域名可能带有末尾点(如"picsum.photos."而domain-info.json中存储的是没有末尾点的域名如"picsum.photos")。在原始的`isDomainMatch()`函数中,直接比较两个域名,导致匹配失败。
## 解决方案
修改`isDomainMatch()`函数,在域名比较前对两个域名进行规范化处理,去除末尾的点,确保匹配准确性。
## 实施步骤
1. 修改`isDomainMatch()`函数,在域名比较前对`urlDomain``targetDomain`进行规范化处理,去除末尾的点
2. 确保无论是完整URL还是纯域名都能正确匹配
3. 测试修改后的代码确保picsum.photos域名能被正确匹配
## 修改内容
- 文件:`/root/dns/static/js/logs.js`
- 函数:`isDomainMatch()`
- 修改点:在域名比较前,去除`urlDomain``targetDomain`末尾的点
## 预期效果
修改后picsum.photos域名无论是否带有末尾点都能被正确匹配到domain-info.json中的条目。