URL Shorten Worker Config Update & Archive
Configuration item added password
Committed to Github
No need to add a password entry in KV
const config = {
password: "testpwd", // 管理面板使用密码 // if password != null, then use this config; otherwise, read password from KV.
result_page: false, // 是否用特定的result页面来显示value // After get the value from KV, if use a page to show the result.
theme: "", // 管理面板的主题 // Homepage theme, use the empty value for default theme. To use urlcool theme, please fill with "theme/urlcool" .
cors: true, // 是否允许CORS使用API // Allow Cross-origin resource sharing for API requests.
unique_link: false, // 一个长链是否只有唯一的短链(会增加写入的使用量) // If it is true, the same long url will be shorten into the same short url
custom_link: true, // 允许自定义短链 // Allow users to customize the short url.
overwrite_kv: false, // 允许覆盖已存在的key // Allow user to overwrite an existed key.
snapchat_mode: false, // 短链只能访问一次(访问后就删除了) // The link will be distroyed after access.
visit_count: false, // 使用记数(会大大增加写入的使用量, 多人共用不推荐打开) // Count visit times.
load_kv: false, // 从KV加载全部数据(自用推荐打开, 多人共用会看到别人的数据) // Load all from Cloudflare KV
system_type: "shorturl", // 系统的功能定义 // shorturl, imghost, other types {pastebin, journal}
}
To remain compatible with the KV and user habits from deployment tutorials in older versions, when the configuration item password is empty, the value of the password entry is read from KV.
Committed to Github
https://github.com/crazypeace/url-Shorten-Worker/
Friends who have already deployed using the original method do not need to make any changes.
When deploying a new project, there is no need to add an entry in KV; just set the password in the worker.js configuration item.
Deployment tutorial has been updated
========
This project will be archived; if there are no bugs, it will not be modified. The main reason is the fear that major changes would affect friends who have already deployed it.
========
Initially, my idea of setting a password in KV was that I wanted to treat KV as a storage, where the access permission password is also one of the data items to be saved.
Another thought is that when we want to change the root password of a VPS, we don't necessarily have to go into the VPS provider's backend management panel to modify it. We can modify it on the command line after logging in as root.
Later, during actual use, based on everyone's feedback, in order to avoid exposing the password, the API's read and write operations on it were actually blocked.
In order to implement this idea thoroughly, I will create a new project as an example.