博文

目前显示的是标签为“Url-Shorten-Worker”的博文

调试 Url-Shorten-Worker API报错 from origin 'null' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

图片
问题  想调试 Url-Shorten-Worker, 把 index.html 保存在本地电脑上, 调用服务器https://1way.eu.org/的API, 报错 Access to fetch at 'https://1way.eu.org/bodongshouqulveweifengci' from origin 'null' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.

无服务器 自建短链服务 Url-Shorten-Worker 增加按钮可以删除某条短链

图片
源码 GitHub:  https://github.com/crazypeace/Url-Shorten-Worker 搭建教程:  https://zelikk.blogspot.com/2022/07/url-shorten-worker-hide-tutorial.html localStorage里只写短链的随机字符串 略 显示urlList的部分不用<ul>里面套<li>了。改为<div>里面套<div> 略 显示短链的时候,前面加个删除按钮 先把自动加载localStorage关了,然后在html里试着写一下,看看效果。 <div class="card-text">   <div classs="list-group" id="urlList">      <div class="list-group-item">       <button type="button" class="btn btn-danger">X</button>       <span>some text</span>     </div>     <div class="list-group-item">       <button type="button" class="btn btn-danger">X</button>       <span>some text some text some text some text some text some text some text some text some text some text some text </span>     </div>   </div> </div> API支持删除短链 POST增加字段 cmd: 取值add, del; keyPhrase: 在add时,是自定义短链;在del

无服务器 自建短链服务 Url-Shorten-Worker 小改进 | Bootstrap List group | 长链接文本框预搜索localStorage | 代码优化

图片
源码 GitHub: https://github.com/crazypeace/Url-Shorten-Worker 搭建教程: https://zelikk.blogspot.com/2022/07/url-shorten-worker-hide-tutorial.html 效果:

无服务器 自建短链服务 Url-Shorten-Worker 页面缓存曾经记录的短链接 localStorage

图片
源码 GitHub: https://github.com/crazypeace/Url-Shorten-Worker 搭建教程: https://zelikk.blogspot.com/2022/07/url-shorten-worker-hide-tutorial.html 效果: 不同的浏览器页面,缓存不互通。这样,不同的使用者互相之间不知道用本服务创建了什么短链。

无服务器 自建短链服务 Url-Shorten-Worker 美化 Bootstrap 设计框架 照猫画虎

图片
源码 GitHub: https://github.com/crazypeace/Url-Shorten-Worker 搭建教程: https://zelikk.blogspot.com/2022/07/url-shorten-worker-hide-tutorial.html 准备美化一下  https://github.com/crazypeace/Url-Shorten-Worker/ 看了一下源项目,使用的是 Bootstrap 4 参考: https://getbootstrap.com/docs/4.0/components/input-group/ 我们准备抄这个设计格式 找到对应的示例是: <div class="input-group mb-3">   <div class="input-group-prepend">     <span class="input-group-text" id="basic-addon3">https://example.com/users/</span>   </div>   <input type="text" class="form-control" id="basic-url" aria-describedby="basic-addon3"> </div>  最终效果:

无服务器 自建短链服务 Url-Shorten-Worker API不公开服务

图片
源码: https://github.com/crazypeace/Url-Shorten-Worker 搭建方法: https://zelikk.blogspot.com/2022/07/url-shorten-worker-hide-tutorial.html

无服务器 自建短链服务 Url-Shorten-Worker 支持自定义短链

图片
源码GitHub:  https://github.com/crazypeace/Url-Shorten-Worker 搭建方法: https://zelikk.blogspot.com/2022/07/url-shorten-worker-hide-tutorial.html

无服务器 自建短链服务 Url-Shorten-Worker 完整的部署教程

图片
源码 GitHub  https://github.com/crazypeace/Url-Shorten-Worker 演示站  https://urlsrv.crazypeace.workers.dev/bodongshouqulveweifengci 申请Cloudflare账号,略。 创建一个KV 记得这个KV的名字,以  urlsrv  为例 查看此KV 添加一个条目Entry 密钥key为 password ,值value为一个随机字符串. * password 这个key是在脚本中要引用的,所以要设置这个。 随机字符串可以使用http://git.io/xkcdpw生成 随机字符串以  yejiandianci  为例 创建Worker服务 设置绑定KV 变量名称必须设置为 LINKS , KV的名字选刚刚创建的 urlsrv * LINKS 是在脚本中要引用的,所以要设置这个。换句话说,如果你使用别的脚本,可能这个变量名称就不是LINKS了。 编辑Worker的脚本 把原有的内容全部删掉 换成: https://github.com/crazypeace/Url-Shorten-Worker/blob/main/worker.js 的内容 保存并部署 ====== 完 要访问 你的worker域名/ yejiandianci  来打开使用页面 如:https://snowy-disk-fd82.ciys.workers.dev/yejiandianci ====== 后记 你可以通过 在你自己的域名下worker页面添加一个路由指向worker 的方式来实现比如  https://1way.eu.org/mtSzm6  替代 snowy-disk-fd82.ciys.workers.dev/yejiandianci 的效果。 ====== 配置参数的作用 const config = {   result_page: false, // 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

无服务器 自建短链服务 Url-Shorten-Worker 修改为自用

图片
基于GitHub项目https://github.com/xyTom/Url-Shorten-Worker 本质是使用Cloudflare的Workers搭一个网页服务,使用Cloudflare的KV当"数据库"用。 因为Cloudflare的KV免费档 "100,000 - 每日键值读取",不想公开给别人扫。所以修改一下。

The Hot3 in Last 30 Days

无服务器 自建短链服务 Url-Shorten-Worker 完整的部署教程

ClouDNS .asia免费域名 托管到CloudFlare开CDN白嫖Websocket WS通道翻墙 / desec.io