利用Cloudflare Worker搭建一个无需服务器的短链接服务,支持:
- 缩短您的网址URL,使它更容易书写或者点击访问
- STUN服务器NAT端口转发,您无需公网IP即可使用
- 支持API自动更新链接,支持到期自动删除
Build a server free short link service using Cloudflare Worker, supporting:
- Shorten your website URL to make it easier to write or click to access
- STUN server NAT port forwarding, you don't need a public IP to use it
- Support API automatic link update and automatic link deletion upon expiration
Demo: https://1web.us.kg/
git clone https://github.com/PIKACHUIM/CFWorkerUrls.git
cd CFWorkerUrls
npm install
cp wrangler.toml.example wrangler.toml
修改wrangler.toml
的内容
account_id
: 登录cloudflare,在workers-and-pages查看FULL_URL
: 完整服务访问地址,比如https://1web.us.kg/id
: 登录cloudflare-存储与数据库-KV-新建数据库查看ID
account_id = "******************************"
FULL_URL= "https://*********/"
id = "*****************************"
wrangler login
wrangler deploy
- 请求类型:POST
- 请求地址:
https://1web.us.kg/p/
{
"suffix": "网站后缀",
"tokens": "更新密码",
"typing": "http",
"ipaddr": "{ip}",
"porter": "{port}"
}
网站后缀和更新密码:https://1web.us.kg/
修改wrangler.toml
文件:
...
[vars]
EDIT_SUB=true # <--- set true
EDIT_LEN=8
...