diff --git a/static/css/style.css b/static/css/style.css index 51a0fe6..c61d7f4 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -132,26 +132,7 @@ header p { /* 响应式布局 - 移动设备 */ @media (max-width: 768px) { - .sidebar { - position: fixed; - left: -var(--sidebar-width); - top: var(--header-height); - z-index: 99; - height: calc(100vh - var(--header-height)); - } - - .sidebar.open { - left: 0; - width: var(--sidebar-width); - } - - .sidebar.open .nav-item span { - display: block; - } - - .sidebar.open .nav-item i { - margin-right: 1rem; - } + /* 这些样式已经通过Tailwind CSS类在HTML中实现,这里移除避免冲突 */ } .nav-menu { diff --git a/static/index.html b/static/index.html index 7503240..48b246b 100644 --- a/static/index.html +++ b/static/index.html @@ -268,7 +268,7 @@
  • - DNS查询 + DNS屏蔽查询
  • @@ -295,7 +295,7 @@
    -

    仪表盘

    diff --git a/static/index.html.2 b/static/index.html.2 new file mode 100644 index 0000000..bd74d67 --- /dev/null +++ b/static/index.html.2 @@ -0,0 +1,1727 @@ + + + + + + DNS服务器管理中心 + + + + + + +
    +
    +

    DNS服务器管理中心

    +

    高性能DNS服务器,支持规则屏蔽和Hosts管理

    +
    + +
    +
    + + + + +
    + + +
    +

    服务器状态

    +
    +
    + +
    --
    +
    屏蔽规则数
    +
    + +
    +
    + +
    + +
    --
    +
    Hosts条目数
    +
    + +
    +
    +
    + +
    --
    +
    DNS查询次数
    +
    + +
    +
    +
    + +
    --
    +
    屏蔽次数
    +
    + +
    +
    +
    + +

    TOP域名统计

    +
    +
    +
    +

    TOP 10 屏蔽域名

    +
    +
    +
    +
    + +

    加载中...

    +
    +
    +
    +
    + +
    +
    +

    TOP 10 解析域名

    +
    +
    +
    +
    + +

    加载中...

    +
    +
    +
    +
    +
    + +
    +
    +

    24小时屏蔽统计

    +
    +
    +
    + +
    +
    +
    +
    +

    服务器信息

    +

    服务器地址: --

    +

    当前时间: --

    +

    运行状态: 正常运行

    +
    +
    + + +
    +
    +
    +

    屏蔽设置

    +
    +
    +
    + + + +
    + + NXDOMAIN: 返回域名不存在错误
    + refused: 返回查询拒绝错误
    + emptyIP: 返回0.0.0.0
    + customIP: 返回自定义IP地址 +
    +
    +
    +
    +
    +

    添加屏蔽规则

    +
    +
    +
    + + + +
    + 支持AdGuardHome规则格式:域名规则(||example.com^)、排除规则(@@||example.com^)、正则规则(/regex/)、通配符规则(*example.com)等 +
    +
    +
    +
    +

    规则列表

    +
    +
    +
    +
    + +

    规则列表加载中...

    +
    +
    +
    +
    +
    + + +
    +
    +
    +

    添加Hosts条目

    +
    +
    +
    + + + +
    +
    +
    +
    +
    +

    当前Hosts条目

    +
    +
    +
    +
    + +

    Hosts列表加载中...

    +
    +
    +
    +
    +
    + + +
    +
    +
    +

    DNS查询

    +
    +
    +
    + + +
    +
    +
    +
    +
    +

    查询结果

    +
    +
    +
    请输入域名并点击查询按钮
    +
    +
    +
    +
    +
    + + + + diff --git a/static/index.html.bak b/static/index.html.bak new file mode 100644 index 0000000..174160b --- /dev/null +++ b/static/index.html.bak @@ -0,0 +1,1190 @@ + + + + + + DNS服务器管理中心 + + + + + + +
    +
    +

    DNS服务器管理中心

    +

    高性能DNS服务器,支持规则屏蔽和Hosts管理

    +
    + +
    +
    + + + + +
    + + +
    +
    +

    服务器状态

    +
    +
    + + 规则: -- +
    +
    + + Hosts: -- +
    +
    +
    +
    +
    + +
    --
    +
    DNS查询次数
    +
    + +
    +
    +
    + +
    --
    +
    屏蔽次数
    +
    + +
    +
    +
    + +

    TOP域名统计

    +
    +
    +
    +

    TOP 10 屏蔽域名

    +
    +
    +
    +
    + +

    加载中...

    +
    +
    +
    +
    + +
    +
    +

    TOP 10 解析域名

    +
    +
    +
    +
    + +

    加载中...

    +
    +
    +
    +
    +
    + +
    +
    +

    24小时屏蔽统计

    +
    +
    +
    + +
    +
    +
    +
    +

    服务器信息

    +
    +
    + +
    --
    +
    屏蔽规则数
    +
    + +
    +
    +
    + +
    --
    +
    Hosts条目数
    +
    + +
    +
    +
    +

    服务器地址: --

    +

    当前时间: --

    +

    运行状态: 正常运行

    +
    +
    + + +
    +
    +
    +

    检查过滤

    +
    +
    +

    检查主机名是否被过滤。

    +
    + + + +
    +
    +
    + +
    +
    +

    检查结果

    +
    +
    +
    +
    + +

    请输入域名并点击检查按钮

    +
    +
    +
    +
    +
    + + +
    +
    +
    +

    添加Hosts条目

    +
    +
    +
    + + + +
    +
    +
    +
    +
    +

    当前Hosts条目

    +
    +
    +
    +
    + +

    Hosts列表加载中...

    +
    +
    +
    +
    +
    + + +
    +
    +
    +

    DNS查询

    +
    +
    +
    + + +
    +
    +
    +
    +
    +

    查询结果

    +
    +
    +
    请输入域名并点击查询按钮
    +
    +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/static/js/main.js b/static/js/main.js index 8f600bc..2f6bb6e 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -40,40 +40,52 @@ function setupNavigation() { // 打开侧边栏函数 function openSidebar() { + console.log('Opening sidebar...'); if (sidebar) { sidebar.classList.remove('-translate-x-full'); + sidebar.classList.add('translate-x-0'); } if (sidebarOverlay) { sidebarOverlay.classList.remove('hidden'); + sidebarOverlay.classList.add('block'); } // 防止页面滚动 document.body.style.overflow = 'hidden'; + console.log('Sidebar opened successfully'); } // 关闭侧边栏函数 function closeSidebar() { + console.log('Closing sidebar...'); if (sidebar) { sidebar.classList.add('-translate-x-full'); + sidebar.classList.remove('translate-x-0'); } if (sidebarOverlay) { sidebarOverlay.classList.add('hidden'); + sidebarOverlay.classList.remove('block'); } // 恢复页面滚动 document.body.style.overflow = ''; + console.log('Sidebar closed successfully'); } // 切换侧边栏函数 function toggleSidebarVisibility() { + console.log('Toggling sidebar visibility...'); + console.log('Current sidebar classes:', sidebar ? sidebar.className : 'sidebar not found'); if (sidebar && sidebar.classList.contains('-translate-x-full')) { + console.log('Sidebar is hidden, opening...'); openSidebar(); } else { + console.log('Sidebar is visible, closing...'); closeSidebar(); } } // 绑定切换按钮事件 if (toggleSidebar) { - toggleSidebar.addEventListener('click', openSidebar); + toggleSidebar.addEventListener('click', toggleSidebarVisibility); } // 绑定关闭按钮事件 diff --git a/test_remove_rule.go b/test_remove_rule.go deleted file mode 100644 index 458d94b..0000000 --- a/test_remove_rule.go +++ /dev/null @@ -1,49 +0,0 @@ -package main - -import ( - "fmt" - "dns-server/config" - "dns-server/shield" - "log" - "os" -) - -func main() { - // 创建默认Shield配置 - shieldCfg := &config.ShieldConfig{ - LocalRulesFile: "data/rules.txt", - } - - // 创建ShieldManager - shieldManager := shield.NewShieldManager(shieldCfg) - - // 添加一条测试规则 - rule := "||test.example.com" - err := shieldManager.AddRule(rule) - if err != nil { - log.Fatalf("添加规则失败: %v", err) - } - fmt.Printf("添加规则 %s 成功\n", rule) - - // 验证规则是否被添加 - localRules := shieldManager.GetLocalRules() - fmt.Printf("添加规则后,本地规则数量: %d\n", len(localRules["domainRules"].([]string))) - - // 删除规则 - err = shieldManager.RemoveRule(rule + "^") - if err != nil { - log.Fatalf("删除规则失败: %v", err) - } - fmt.Printf("删除规则 %s 成功\n", rule) - - // 验证规则是否被删除 - localRules = shieldManager.GetLocalRules() - fmt.Printf("删除规则后,本地规则数量: %d\n", len(localRules["domainRules"].([]string))) - - // 验证文件内容 - fileContent, err := os.ReadFile("data/rules.txt") - if err != nil { - log.Fatalf("读取规则文件失败: %v", err) - } - fmt.Printf("规则文件内容: %s\n", string(fileContent)) -}