Skip to content

使用Cloudflare Worker创建的URL缩短器|支持自定义首页|支持Menu Short|支持短网址、文本、网页分享

License

Notifications You must be signed in to change notification settings

coppea/Url-Shortener-CFWorker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

使用Cloudflare Worker创建的URL缩短器|支持自定义首页|支持Menu Short|支持短网址、文本、网页分享

首页

后台

后台

常量设置

const admin_path = '/admin_err24d' // 访问地址,如果需要公开访问,把`/admin_err24d`设置成`/`即可
const api_path = '/vcfgbn_api'  //Short Menu第三方访问api,建议设置复杂
const url_key = 'longUrl'  //原始长链接
const url_name = 'shortCode' // 自定义后缀  
const short_url_key = 'shorturl';   //完整缩短后链接,'shorturl'是为了兼容Short Menu

网址响应

{
 "longUrl":"https://abc.com",
 "shortCode":"dfcw",
 "type":"link",
 "shorturl":"https://url.com/dfcw"
}

文本响应

{
 "longUrl":"这是测试文本",
 "shortCode":"dfce",
 "type":"text",
 "shorturl":"https://url.com/dfce"
}

自定义首页index.js

const statichtml = "https://github.com/bituplink/OneHtmlNav/master/goodweb.html"

修改上方网址为自己喜欢的网址,只支持单html,建议css和js和script集成进html里


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

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

去Worker的设置选选项卡中绑定KV 命名空间

绑定KV Namespace 1

绑定KV Namespace 2

其中变量名称填写shortlink, KV 命名空间填写你刚刚创建的命名空间

绑定kv

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

点击保存并部署


Short Menu设置截图

Upic设置

短链接来自于@xyTom@code-scan

自定义首页来自@bituplink

About

使用Cloudflare Worker创建的URL缩短器|支持自定义首页|支持Menu Short|支持短网址、文本、网页分享

Resources

License

Stars

Watchers

Forks