crazypeace

Results 218 comments of crazypeace

> 1. 访问一级域名(myurl.com)打开我的博客 --请问你的博客地址是 myurl.com吗? 还是其它? 2. 访问二级域名(url.myurl.com) 打开短链接主页,并生成短连接格式为myurl.com/abcdef -- 你把url.myurl.com和myurl.com这两域名都指向同一个worker,这样你在url.myurl.com生成的短链url.myurl.com/abcdef,其实 myurl.com/abcdef 也可以使用。 -- 如果你希望访问 myurl.com 要打开你的博客。你可以 url.myurl.com和myurl.com这两域名分别指向不同的worker,但是这两个workder使用同一个KV空间。这样,你在一个地方添加了短链,在另一个地方可以调用。 而为了实现访问myurl.com 要打开你的博客,你可以在myurl.com的那个worker的脚本里让 path为 /时, 302跳转出去。 如: ``` if(!path){ return Response.redirect("https://zelikk.blogspot.com/", 302) }...

> 我改了下main.js, 复制的时候会加上 `https://`了 [实现](https://github.com/Sakaizd/Url-Shorten-Worker/blob/gh-pages/main.js#L49) 我觉得这个修改很好,你可以提 pull request 啊,作者可以把你的代码合并进来。

https://github.com/xyTom/Url-Shorten-Worker/issues/39

推荐看看这个项目 https://github.com/crazypeace/Url-Shorten-Worker 演示: https://1way.eu.org/bodongshouqulveweifengci

虽然我的能力有限,不过我知道你应该去抄 https://gcore.jsdelivr.net/npm/[email protected]/main.js 在https://github.com/xyTom/Url-Shorten-Worker/blob/gh-pages/index.html 中被引用

支持自定义短链 https://zelikk.blogspot.com/2022/07/url-shorten-worker-custom.html API 不公开服务 https://zelikk.blogspot.com/2022/07/url-shorten-worker-api-password.html

页面缓存设置过的短链 https://zelikk.blogspot.com/2022/08/url-shorten-worker-localstorage.html 长链接文本框预搜索localStorage https://zelikk.blogspot.com/2022/08/url-shorten-worker-bootstrap-list-group-oninput.html 增加删除某条短链的按钮 https://zelikk.blogspot.com/2022/08/url-shorten-worker-delete-kv-localstorage.html

> @Anpiluo > > https://github.com/xyTom/Url-Shorten-Worker/blob/681d43ec4d6c95a8dddc75bbb1a1ad2e889b09fc/index.js#L129 > > 改這行,改成像是 `if(path == "/manage")` 之類的,然後把 Cloudflare Access 驗證路徑,設定在 `/manage`。 我的思路是在 kv 里写一个秘密路径,key为"password",value为秘密路径。 https://github.com/xyTom/Url-Shorten-Worker/pull/38

> > key为"password",value为秘密路径。 > > @crazypeace JS有可能被外部讀取嗎?🤔 此JS非彼JS。 写了逻辑的JS运行在worker上,如果cloudflare的服务没有漏洞,这个JS不会被攻击者拿到运行过程。而这个JS的源码是可以让攻击者知道的,写明了要读取KV中的password。而如果攻击者没有cloudflare账户权限是读不到KV的数据内容的,也就是说不知道KV中key为passowrd的entry的value是多少。 还有个main.js是由index.html调用的。里面是一些业务逻辑。 你可以看一下 https://github.com/crazypeace/Url-Shorten-Worker 解释:https://zelikk.blogspot.com/2022/07/url-shorten-worker-hide.html https://zelikk.blogspot.com/2022/07/url-shorten-worker-hide-tutorial.html https://zelikk.blogspot.com/2022/07/url-shorten-worker-api-password.html

示例: https://1ladder.eu.org/tiananmen