https://github.com/wdssmq/later-url-cf
使用 Cloudflare Workers KV 存储服务收集网址并以 RSS 输出;
https://github.com/wdssmq/later-url-cf
cloudflare feed kv-store rss workers
Last synced: about 1 month ago
JSON representation
使用 Cloudflare Workers KV 存储服务收集网址并以 RSS 输出;
- Host: GitHub
- URL: https://github.com/wdssmq/later-url-cf
- Owner: wdssmq
- License: mit
- Created: 2023-12-19T14:06:43.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-08-29T10:24:27.000Z (about 1 year ago)
- Last Synced: 2024-08-30T05:36:08.095Z (about 1 year ago)
- Topics: cloudflare, feed, kv-store, rss, workers
- Language: JavaScript
- Homepage:
- Size: 56.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# later-url-cf
使用 Cloudflare Workers KV 存储服务收集网址并以 RSS 输出;## 使用「GM_脚本」收集网址
wdssmq/userscript - 各种「GM\_脚本」:
[https://userscript.canihave.xyz/](https://userscript.canihave.xyz/ "wdssmq/userscript - 各种「GM\_脚本」")
## 使用 Wrangler CLI 开发
> wrangler 安装和登录见下方链接:
>
> wdssmq/fadian-cf:[https://github.com/wdssmq/fadian-cf#readme](https://github.com/wdssmq/fadian-cf#readme "wdssmq/fadian-cf")## 初始配置
### 克隆项目并安装依赖
```bash
git clone git@github.com:wdssmq/later-url.git later-url
cd later-url
pnpm install```
### 配置 wrangler 及 R2 存储
通过「面板」或者「命令行」创建 KV 命名空间,然后配置 wrangler.toml 文件。
- [文档:通过管理面板创建 KV](https://developers.cloudflare.com/kv/get-started/#create-a-kv-namespace-via-the-dashboard "文档:通过管理面板创建 KV")
- [文档:通过命令行创建 KV](https://developers.cloudflare.com/kv/get-started/#create-a-kv-namespace-via-wrangler "文档:通过命令行创建 KV")
- wrangler.toml 内 `binding` 的值好像只要和 `src/index.js` 内同名即可?### 设置 Secrets 变量
需要设置 `BEARER_TOKEN` 变量用于鉴权,可以使用 Secrets 变量而不是直接写在代码里;
1、本地开发环境设置 Secrets
- 在项目根目录下创建 `.dev.vars` 文件,内容如下:
```dotenv
BEARER_TOKEN = token_value_here
IS_DEBUG = true```
- 使用命令行写入:
```bash
echo "BEARER_TOKEN = token_value_here" > .dev.vars
echo "IS_DEBUG = true" >> .dev.vars```
2、线上环境设置 Secrets
```bash
# 依次执行以下命令,输入对应的值;
wrangler secret put BEARER_TOKENwrangler secret put other_secret_key
# 查看 Secrets
wrangler secret list# 删除 Secrets
# wrangler secret delete [OPTIONS]```
### 运行 / 发布
> VSCode 可使用 [REST Client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client "REST Client") 插件实现 API 调试,见项目内的 `test/dev.http`;
```bash
# 调试运行
npm run dev# │ [b] open a browser, [d] open Devtools, [l] turn on local mode, [c] clear console, [x] to exit
```
```bash
# 发布
npm run deploy```
## 文档链接
Get started · Cloudflare Workers KV:
[https://developers.cloudflare.com/kv/get-started/#create-a-kv-namespace-via-the-dashboard](https://developers.cloudflare.com/kv/get-started/#create-a-kv-namespace-via-the-dashboard "Get started · Cloudflare Workers KV")
Environment variables · Cloudflare Workers docs:
[https://developers.cloudflare.com/workers/configuration/environment-variables/](https://developers.cloudflare.com/workers/configuration/environment-variables/ "Environment variables · Cloudflare Workers docs")