白嫖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

酒馆SillyTavern 用中文讲故事 修改角色卡 修改AI生成的历史记录

酒馆SillyTavern 18x 玩法 导入角色卡

酒馆SillyTavern 玩英文角色卡 也能以中文输出 设置世界书Lorebooks