白嫖worker 自建短链服务 Url-Shorten-Worker 保护password

需求

有PR提到, password应该要保护起来.

https://github.com/crazypeace/Url-Shorten-Worker/pull/6

也有评论提到, 要避免显示password.


思路

定一个 protect_keylist 

const protect_keylist = [
  "password",
]

判断list是否包含指定元素, 用 protect_keylist.includes(req_key)

在 add, del, qry 时, 判断key属于 protect_keylist 就返回报错.


在 qryall 时, 遇到 protect_keylist 就不要放到返回结果中.



========

Github: https://github.com/crazypeace/Url-Shorten-Worker

演示站: https://1way.eu.org/bodongshouqulveweifengci 你用 loadKV 查不到 password 的结果


评论

The Hot3 in Last 30 Days

日常自用的自建梯子 reality wss+cdn hy2 同时搭着 哪个好用就用哪个 2025-1-4

搭建 C 编译环境 手动编译 jq

RackNerd VPS搭Hysteria2 HY2梯子 年付 $10.98 1G端口 3T流量 17G存储 1GB内存