Url-Shorten-Worker

A URL Shortener created using Cloudflare Worker

API

API Documentation (API文档)

Getting start

去Workers KV中创建一个命名空间

Go to Workers KV and create a namespace.

添加一个条目Entry 密钥key为password,值value为一个随机字符串 value为/登陆值 ### 去Worker的Settings选选项卡中绑定KV Namespace

Bind an instance of a KV Namespace to access its data in a Worker.

Where Variable name should set as LINKS and KV namespace is the namespace you just created in the first step.

复制本项目中的index.js的代码到Cloudflare Worker

Copy the index.js code from this project to Cloudflare Worker.

new index.js https://github.com/crazypeace/Url-Shorten-Worker/blob/main/index.js

点击Save and Deploy

Click Save and Deploy

你可以通过在你自己的域名下worker页面添加一个路由指向worker的方式来实现比如 域名/value 替代 cf.workers.dev/value的效果。

如果你想使用原版,worker里面的脚本使用 https://github.com/xyTom/Url-Shorten-Worker/blob/main/index.js 的内容

Demo

https://lnks.tools/

Note: Because someone abuse this demo website, all the generated link will automatically expired after 24 hours. For long-term use, please deploy your own.

注意:所有由Demo网站生成的链接24小时后会自动失效,如需长期使用请自行搭建。