Chaospace
先前采用 Github + Vercel 部署,现已转移至 Cloudflare Pages。
兜兜转转又回到了 Vercel ,他实在是太快了。
Test
代码用于测试 highlight,字体采用 consolas
def request(flow: http.HTTPFlow) -> None:
# 定义要屏蔽的 URL 前缀
blocked_url_prefix = ""
# 获取请求的 URL
url = flow.request.url
if url.startswith(blocked_url_prefix):
# 如果请求的 URL 匹配条件,返回自定义响应
response_content = "Blocked by mitmproxy"
flow.response = http.Response.make(
404, # 设置响应码
content=response_content.encode("utf-8"), # 自定义响应内容,需要编码为字节
headers={"Content-Type": "text/plain"}
)
# 输出被阻止的 URL
print(f"Blocked URL: {url}")