Skip to content

Conversation

@HynoR
Copy link
Contributor

@HynoR HynoR commented Aug 26, 2025

What this PR does / why we need it?

  • 原有的防盗链内容和缓存配置混在了一起
  • Nginx防盗链参数有部分相对重要的可变内容写死
  • 拦截盗链请求的access_log off始终无效(放在return后的参数是不会生效的)
    Directives: []components.IDirective{
    &components.Directive{
    Name: "return",
    Parameters: []string{req.Return},
    },
    &components.Directive{
    Name: "access_log",
    Parameters: []string{"off"},
    },
    },
  • 后端看得出来留了一些其他防盗链的配置字段但是没有实现,Example:
    if param == "blocked" {
    res.Blocked = true
    continue
    }
    if param == "server_names" {

Summary of your change

  • 重新编排防盗链UI
  • 分离缓存请求设置和防盗链设置,防盗链设置可以单独修改,缓存也可以单独修改。
  • 添加现代静态资源后缀(webp,avif,webm)
  • 缓存允许用户在静态网站/应用部署下,将静态资源内容的返回加入缓存头,让用户浏览器下次访问且缓存时间未过期时不用再请求重复的静态资源,减少服务器流量开销。
  • 防盗链补全说明和valid_referers blocked 字段,允许非 http/https 格式的 referer 请求,这种宽松请求在某些客户端套壳网页或者其他软件下正常访问静态资源。默认为关(严格模式)。
  • 重新修改日志记录功能(用户可以选择屏蔽掉静态资源的记录,毕竟日志里一两条 api 请求夹杂一堆 js css 请求很难分析而且加大了日志大小)

Test (以应用商店 Nextchat 为测试环境)

image image image

全开后的 location 块配置
image

关闭防盗链,只设置缓存
image

设置缓存后的请求头
image

关闭静态资源 记录后的nginx日志
image

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Aug 26, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Aug 26, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign zhengkunwang223 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@HynoR HynoR marked this pull request as ready for review August 26, 2025 08:22
@HynoR HynoR changed the title feat: enhance anti-leech configuration with new options and improved UI feat: Enhance anti-leech configuration with new options and improved UI Aug 26, 2025
@HynoR
Copy link
Contributor Author

HynoR commented Aug 26, 2025

改了,选框这个是用不上的残留的代码,不需要翻译。

@zhengkunwang223 zhengkunwang223 merged commit e84aa49 into 1Panel-dev:dev-v2 Aug 27, 2025
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants