docs: add chinese docs for developer
This commit is contained in:
48
README-zh.md
48
README-zh.md
@@ -5,14 +5,48 @@
|
||||
<!-- <img src="https://wr.do/_static/images/light-preview.png"/> -->
|
||||
</div>
|
||||
|
||||
## 功能
|
||||
## 简介
|
||||
|
||||
- 🔗 **短链生成**:生成附有访问者统计信息的短链接 (支持密码保护, 支持调用 API)
|
||||
- 📮 **临时邮箱**:创建多个临时邮箱接收和发送邮件(支持调用 API)
|
||||
- 🌐 **多租户支持**:无缝管理多个 DNS 记录
|
||||
- 📸 **截图 API**:访问截图 API、网站元数据抓取 API
|
||||
- <EFBFBD>😀 **权限管理**:方便审核的管理员面板
|
||||
- 🔒 **安全可靠**:基于 Cloudflare 强大的 DNS API
|
||||
WR.DO 是一个一站式网络工具平台,集成短链服务、临时邮箱、子域名管理和开放API接口。支持自定义链接、密码保护、访问统计;提供无限制临时邮箱收发;管理多域名DNS记录;内置网站截图、元数据提取等实用API。完整的管理后台,支持用户权限控制和服务配置。
|
||||
|
||||
## 功能列表
|
||||
|
||||
- 🔗 **短链服务**:
|
||||
- 支持自定义短链
|
||||
- 支持生成自定义二维码
|
||||
- 支持密码保护链接
|
||||
- 支持设置过期时间
|
||||
- 支持访问统计(实时日志、地图等多维度数据分析)
|
||||
- 支持调用 API 创建短链
|
||||
|
||||
- 📮 **临时邮箱服务**:
|
||||
- 支持创建自定义前缀邮箱
|
||||
- 支持过滤未读邮件列表
|
||||
- 可创建无限数量邮箱
|
||||
- 支持接收无限制邮件 (依赖 Cloudflare Email Worker)
|
||||
- 支持发送邮件(依赖 Resend)
|
||||
- 支持调用 API 创建邮箱
|
||||
- 支持调用 API 获取收件箱邮件
|
||||
-
|
||||
- 🌐 **子域名管理服务**:
|
||||
- 支持管理多 Cloudflare 账户下的多个域名的 DNS 记录
|
||||
- 支持创建多种 DNS 记录类型(CNAME、A、TXT 等)
|
||||
|
||||
- 📡 **开放接口模块**:
|
||||
- 获取网站元数据 API
|
||||
- 获取网站截图 API
|
||||
- 生成网站二维码 API
|
||||
- 将网站转换为 Markdown、Text
|
||||
- 支持所有类型 API 调用统计日志
|
||||
- 支持生成用户 API Key,用于第三方调用开放接口
|
||||
|
||||
- 🔒 **管理员模块**:
|
||||
- 多维度图表展示网站状态
|
||||
- 域名服务配置(动态配置各项服务是否启用,包括短链、临时邮箱(收发邮件)、子域名管理)
|
||||
- 用户列表管理(设置权限、分配使用额度、禁用用户等)
|
||||
- 短链管理(管理所有用户创建的短链)
|
||||
- 邮箱管理(管理所有用户创建的临时邮箱)
|
||||
- 子域名管理(管理所有用户创建的子域名)
|
||||
|
||||
## 截图预览
|
||||
|
||||
|
||||
47
README.md
47
README.md
@@ -4,15 +4,48 @@
|
||||
<p>Make Short Links, Manage DNS Records, Receive Emails.</p>
|
||||
</div>
|
||||
|
||||
## Introduction
|
||||
|
||||
WR.DO is a all-in-one web utility platform featuring short links with analytics, temporary email service, subdomain management, open APIs for screenshots and metadata extraction, plus comprehensive admin dashboard.
|
||||
|
||||
## Features
|
||||
|
||||
- 🔗 **URL Shortening:** Generate short links with visitor analytic and password(support api)
|
||||
- 📮 **Email Support:** Receive emails and send emails(support api)
|
||||
- 💬 **P2P Chat:** Start chat in seconds
|
||||
- 🌐 **Multi-Tenant Support:** Manage multiple DNS records seamlessly
|
||||
- 📸 **Screenshot API:** Access to screenshot api、website meta-info scraping api.
|
||||
- 😀 **Permission Management:** A convenient admin panel for auditing
|
||||
- 🔒 **Secure & Reliable:** Built on Cloudflare's robust DNS API
|
||||
- 🔗 **Short Link Service**:
|
||||
- Custom short links
|
||||
- Generate custom QR codes
|
||||
- Password-protected links
|
||||
- Expiration time control
|
||||
- Access analytics (real-time logs, maps, and multi-dimensional data analysis)
|
||||
- API integration for link creation
|
||||
|
||||
- 📮 **Email Service**:
|
||||
- Create custom prefix emails
|
||||
- Filter unread email lists
|
||||
- Unlimited mailbox creation
|
||||
- Receive unlimited emails (powered by Cloudflare Email Worker)
|
||||
- Send emails (powered by Resend)
|
||||
- API endpoints for mailbox creation
|
||||
- API endpoints for inbox retrieval
|
||||
|
||||
- 🌐 **Subdomain Management Service**:
|
||||
- Manage DNS records across multiple Cloudflare accounts and domains
|
||||
- Create various DNS record types (CNAME, A, TXT, etc.)
|
||||
|
||||
- 📡 **Open API Module**:
|
||||
- Website metadata extraction API
|
||||
- Website screenshot capture API
|
||||
- Website QR code generation API
|
||||
- Convert websites to Markdown/Text format
|
||||
- Comprehensive API call logging and statistics
|
||||
- User API key generation for third-party integrations
|
||||
|
||||
- 🔒 **Administrator Module**:
|
||||
- Multi-dimensional dashboard with website analytics
|
||||
- Dynamic service configuration (toggle short links, email, subdomain management)
|
||||
- User management (permissions, quotas, account control)
|
||||
- Centralized short link administration
|
||||
- Centralized email management
|
||||
- Centralized subdomain administration
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ import BlurImage from "@/components/shared/blur-image";
|
||||
import { Callout } from "@/components/shared/callout";
|
||||
import { CopyButton } from "@/components/shared/copy-button";
|
||||
|
||||
import { DocsLang } from "../shared/docs-lang";
|
||||
|
||||
const components = {
|
||||
h1: ({ className, ...props }) => (
|
||||
<h1
|
||||
@@ -166,6 +168,7 @@ const components = {
|
||||
),
|
||||
Callout,
|
||||
Card: MdxCard,
|
||||
DocsLang,
|
||||
Step: ({ className, ...props }: React.ComponentProps<"h3">) => (
|
||||
<h3
|
||||
className={cn(
|
||||
|
||||
27
components/shared/docs-lang.tsx
Normal file
27
components/shared/docs-lang.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
|
||||
export function DocsLang({ en, zh }: { en: string; zh: string }) {
|
||||
const pathname = usePathname();
|
||||
return (
|
||||
<div className="flex items-center gap-2">
|
||||
{pathname !== en ? (
|
||||
<Link href={en} className="text-blue-500 hover:underline">
|
||||
English
|
||||
</Link>
|
||||
) : (
|
||||
<p className="text-muted-foreground">English</p>
|
||||
)}
|
||||
<span className="text-muted-foreground">|</span>
|
||||
{pathname !== zh ? (
|
||||
<Link href={zh} className="text-blue-500 hover:underline">
|
||||
中文
|
||||
</Link>
|
||||
) : (
|
||||
<p className="text-muted-foreground">中文</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
107
content/docs/developer/cloudflare-email-worker-zh.mdx
Normal file
107
content/docs/developer/cloudflare-email-worker-zh.mdx
Normal file
@@ -0,0 +1,107 @@
|
||||
---
|
||||
title: Cloudflare Email Worker 配置
|
||||
description: 配置 Cloudflare Email Worker 来激活接收邮件功能
|
||||
---
|
||||
|
||||
<DocsLang en="/docs/developer/cloudflare-email-worker" zh="/docs/developer/cloudflare-email-worker-zh" />
|
||||
|
||||
在开始之前,你需要拥有一个 Cloudflare 账户,并且你的域名已经托管在 Cloudflare 上。
|
||||
|
||||
### Email Worker 与 R2 简介
|
||||
|
||||
#### Email Worker
|
||||
|
||||
Cloudflare Email Worker 是 Cloudflare 的电子邮件路由服务(Email Routing)与 Workers 平台结合提供的一项功能。它允许用户在 Cloudflare 的边缘网络中以编程方式处理接收到的电子邮件。
|
||||
当邮件发送到在 Email Routing 中配置的自定义地址时,关联的 Worker 会被触发,接收邮件数据(例如发件人、收件人、头部、正文等)。
|
||||
开发者可以编写 JavaScript 代码来定义自定义逻辑,比如将邮件转发到指定地址、过滤垃圾邮件,或与外部 API 集成。
|
||||
|
||||
#### Cloudflare R2
|
||||
|
||||
Cloudflare R2 是一款可扩展的、兼容 S3 的对象存储解决方案。它允许用户在边缘存储和读取文件(如电子邮件附件),并且没有出口流量费用。
|
||||
在邮件 Worker 的上下文中,R2 可用于存储邮件附件或其他数据,并可通过环境绑定在 Worker 脚本中访问。
|
||||
|
||||
### cf-email-forwarding-worker 概述
|
||||
|
||||
仓库:[oiov/cf-email-forwarding-worker](https://github.com/oiov/cf-email-forwarding-worker)
|
||||
|
||||
使用 Cloudflare Email Worker 和 R2 实现了一个高级的邮件转发解决方案。核心功能是将邮件数据通过 HTTP POST 请求发送到第三方 API 接口进行自定义处理。
|
||||
|
||||
此外,还利用 Cloudflare R2 来存储邮件附件,并使第三方应用可访问。
|
||||
|
||||
#### 主要特性
|
||||
|
||||
- **基于 API 的转发**:邮件以结构化数据的形式通过 POST 请求发送到可配置的第三方 API(`APP_API_URL` 环境变量)。
|
||||
- **附件存储**:邮件附件上传到 R2 存储桶,并将其 URL 包含在 API 请求中。
|
||||
- **高度可定制**:第三方应用可根据需要处理邮件数据(如发件人、主题、正文、附件等)。
|
||||
|
||||
#### 配置说明
|
||||
|
||||
Worker 依赖 `wrangler.jsonc` 文件中定义的两个环境变量:
|
||||
|
||||
```json
|
||||
"vars": {
|
||||
"APP_API_URL": "https://wr.do/api/v1/email-catcher"
|
||||
},
|
||||
"r2_buckets": [
|
||||
{
|
||||
"binding": "R2_BUCKET",
|
||||
"bucket_name": "wremail"
|
||||
}
|
||||
]
|
||||
````
|
||||
|
||||
* `APP_API_URL`:接收邮件数据的第三方 API 地址。可以让第三方应用自定义处理邮件内容(如记录日志、进一步处理或转发)。
|
||||
* `R2_BUCKET`:R2 存储桶的绑定名,在 Worker 代码中可通过 `env.R2_BUCKET` 访问。
|
||||
其中 `bucket_name`(如 `wremail`)指的是你在 Cloudflare 中预先创建的 R2 存储桶名称。
|
||||
|
||||
#### 工作原理
|
||||
|
||||
1. **接收邮件**:当邮件发送到配置的地址时,Worker 被触发。
|
||||
2. **处理附件**:若邮件包含附件,则提取并上传到 R2 存储桶(如 wremail),并生成可访问的 URL。
|
||||
3. **转发邮件数据**:将邮件数据(发件人、收件人、主题、正文、附件链接等)封装为 JSON,发送到 `APP_API_URL`。
|
||||
4. **第三方处理**:第三方应用接收并根据自身逻辑处理这些数据。
|
||||
|
||||
#### 使用示例
|
||||
|
||||
* 用户向 [example@yourdomain.com](mailto:example@yourdomain.com) 发送邮件;
|
||||
* Worker 将附件上传至刚才创建的存储桶;
|
||||
* Worker 向 [https://wr.do/api/v1/email-catcher](https://wr.do/api/v1/email-catcher) 发送包含邮件信息的 POST 请求;
|
||||
* 第三方应用接收数据,并进行记录、存入数据库或转发。
|
||||
|
||||
#### 前置条件
|
||||
|
||||
* 一个启用了 Email Routing 的 Cloudflare 账户;
|
||||
* 已创建并绑定到 Worker 的 R2 存储桶(如 wremail);
|
||||
* 一个已准备好接收 POST 请求的第三方 API 接口。
|
||||
|
||||
### 部署 Email Worker 到 Cloudflare
|
||||
|
||||
```bash
|
||||
git clone https://github.com/oiov/cf-email-forwarding-worker.git
|
||||
cd cf-email-forwarding-worker
|
||||
pnpm install
|
||||
|
||||
wranler login
|
||||
wranler deploy
|
||||
```
|
||||
|
||||
在部署前,记得在 `wrangler.jsonc` 中添加你的环境变量。
|
||||
|
||||
### 配置你的域名邮箱规则
|
||||
|
||||
访问:
|
||||
|
||||
```bash
|
||||
https://dash.cloudflare.com/[account_id]/[zone_name]/email/routing/routes
|
||||
```
|
||||
|
||||
编辑 `Catch-all address`,选择:
|
||||
|
||||
* `Action` -> `Send to a worker`
|
||||
* `Destination` -> `wrdo-email-worker`(你部署的 Worker 名称)
|
||||
|
||||
然后保存并启用。
|
||||
|
||||
<Callout type="warning" twClass="mb-3">
|
||||
每当你添加一个新域名时,都需要执行相同操作。
|
||||
</Callout>
|
||||
@@ -3,6 +3,8 @@ title: Cloudflare Email Worker Configs
|
||||
description: How to config the cloudflare api.
|
||||
---
|
||||
|
||||
<DocsLang en="/docs/developer/cloudflare-email-worker" zh="/docs/developer/cloudflare-email-worker-zh" />
|
||||
|
||||
Before you start, you must have a Cloudflare account and a domain be hosted on Cloudflare.
|
||||
|
||||
### Introduction to Cloudflare Email Worker and R2
|
||||
|
||||
55
content/docs/developer/deploy-zh.mdx
Normal file
55
content/docs/developer/deploy-zh.mdx
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
title: 部署指南
|
||||
description: 选择你的部署方式
|
||||
---
|
||||
|
||||
<DocsLang en="/docs/developer/deploy" zh="/docs/developer/deploy-zh" />
|
||||
|
||||
## 使用 Vercel 部署(推荐)
|
||||
|
||||
[](https://vercel.com/new/clone?repository-url=https://github.com/oiov/wr.do.git&project-name=wrdo&env=DATABASE_URL&env=AUTH_SECRET&env=RESEND_API_KEY&env=NEXT_PUBLIC_EMAIL_R2_DOMAIN&env=NEXT_PUBLIC_OPEN_SIGNUP&env=GITHUB_TOKEN)
|
||||
|
||||
记得填写必要的环境变量。
|
||||
|
||||
## 使用 Docker Compose 部署
|
||||
|
||||
<Callout type="warning" twClass="mt-4">
|
||||
请在部署前先创建你的数据库实例。
|
||||
|
||||
将 `.env` 文件中的 `SKIP_DB_CHECK` 和 `SKIP_DB_MIGRATION` 设置为 `false`,
|
||||
这样会在启动时进行数据库检查、初始化和迁移。
|
||||
</Callout>
|
||||
|
||||
创建一个新文件夹,并将 [docker-compose.yml](https://github.com/oiov/wr.do/blob/main/docker-compose.yml) 和 [.env](https://github.com/oiov/wr.do/blob/main/.env.example) 文件复制到该文件夹中。
|
||||
|
||||
> 或者只创建一个 [docker-compose.yml](https://github.com/oiov/wr.do/blob/main/docker-compose.yml) 文件,将其中的 `${DATABASE_URL}` 等变量替换为你的数据库连接地址等信息。
|
||||
|
||||
```bash
|
||||
- wrdo
|
||||
| - docker-compose.yml
|
||||
| - .env
|
||||
````
|
||||
|
||||
在 `.env` 文件中填写环境变量,然后执行:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
此命令会自动拉取最新的镜像并启动服务。(自动初始化数据库表,可以在容器日志中查看启动日志)
|
||||
|
||||
## 使用 Docker Compose(本地数据库)部署
|
||||
|
||||
创建一个新文件夹,并将 `docker-compose-localdb.yml` 和 `.env` 文件复制到该文件夹中。
|
||||
|
||||
```bash
|
||||
- wrdo
|
||||
| - docker-compose.yml
|
||||
| - .env
|
||||
```
|
||||
|
||||
在 `.env` 文件中填写环境变量,然后执行:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
@@ -3,6 +3,8 @@ title: Deploy Guide
|
||||
description: Choose your deployment method
|
||||
---
|
||||
|
||||
<DocsLang en="/docs/developer/deploy" zh="/docs/developer/deploy-zh" />
|
||||
|
||||
## Deploy with Vercel (Recommended)
|
||||
|
||||
[](https://vercel.com/new/clone?repository-url=https://github.com/oiov/wr.do.git&project-name=wrdo&env=DATABASE_URL&env=AUTH_SECRET&env=RESEND_API_KEY&env=NEXT_PUBLIC_EMAIL_R2_DOMAIN&env=NEXT_PUBLIC_OPEN_SIGNUP&env=GITHUB_TOKEN)
|
||||
|
||||
47
content/docs/developer/email-zh.mdx
Normal file
47
content/docs/developer/email-zh.mdx
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: 邮件配置
|
||||
description: 如何配置项目中的邮件服务
|
||||
---
|
||||
|
||||
<DocsLang en="/docs/developer/email" zh="/docs/developer/email-zh" />
|
||||
|
||||
在 WR.DO 项目中,有两个功能依赖于 Resend:
|
||||
|
||||
- 邮箱验证登录(魔法链接)
|
||||
- 邮件发送功能(如果你需要接收邮件功能,请参考 [cloudflare-email-worker](/docs/developer/cloudflare-email-worker))。
|
||||
|
||||
`.env` 文件中配置的 `RESEND_API_KEY` 和 `RESEND_FROM_EMAIL` 用于登录功能,
|
||||
而邮件发送功能所需的 Resend 密钥需要你在登录后台管理面板(`/admin/domains`)后,在域名配置中自行添加。
|
||||
|
||||
<Callout type="note">
|
||||
这两个功能可以使用同一个密钥,因为它们本质上都是通过 Resend 发送邮件。
|
||||
</Callout>
|
||||
|
||||
以下将演示如何配置登录所需的 Resend 密钥。
|
||||
|
||||
## 步骤
|
||||
|
||||
<Callout type="note">
|
||||
邮件部分配置类似于 [resend](https://resend.com/) 的文档。
|
||||
如果你想查阅官方文档,可以参考
|
||||
[这里](https://authjs.dev/getting-started/installation#setup-environment)。
|
||||
</Callout>
|
||||
|
||||
<Steps>
|
||||
|
||||
### 创建账号
|
||||
|
||||
如果你还没有 Resend 账号,请按照 [这里](https://resend.com/signup) 的注册流程操作。
|
||||
|
||||
### 创建 API 密钥
|
||||
|
||||
登录 Resend 后,它会提示你创建第一个 API 密钥。
|
||||
|
||||
将其复制并粘贴到你的 `.env` 文件中:
|
||||
|
||||
```js
|
||||
RESEND_API_KEY = re_your_resend_api_key;
|
||||
RESEND_FROM_EMAIL="you <support@your-domain.com>"
|
||||
````
|
||||
|
||||
</Steps>
|
||||
@@ -3,6 +3,8 @@ title: Email
|
||||
description: How to manage emails in this project.
|
||||
---
|
||||
|
||||
<DocsLang en="/docs/developer/email" zh="/docs/developer/email-zh" />
|
||||
|
||||
In the WR.DO project, there are two features that rely on Resend,
|
||||
one is email login (magic link), and the other is email sending feature (if you need to receive email feature,
|
||||
please refer to /docs/developer/cloudflare-email-worker).
|
||||
|
||||
65
content/docs/developer/installation-zh.mdx
Normal file
65
content/docs/developer/installation-zh.mdx
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
title: 开发手册
|
||||
description: 如何快速开始 WR.DO
|
||||
---
|
||||
|
||||
<DocsLang en="/docs/developer/installation" zh="/docs/developer/installation-zh" />
|
||||
|
||||
<Steps>
|
||||
|
||||
### 创建项目
|
||||
|
||||
首先使用 `create-next-app` 创建一个新的 Next.js 项目:
|
||||
|
||||
```bash
|
||||
npx create-next-app wrdo --example "https://github.com/oiov/wr.do"
|
||||
```
|
||||
|
||||
或者使用 Vercel 部署:
|
||||
|
||||
[](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Foiov%2Fwr.do)
|
||||
|
||||
<Callout type="warning" twClass="mt-4">
|
||||
这是一种创建代码仓库的好方法,但是部署可能会失败,
|
||||
因为你需要在本地项目中添加环境变量。请按照文档进行设置。
|
||||
</Callout>
|
||||
|
||||
### 安装依赖
|
||||
|
||||
进入文件夹并为项目安装依赖项:
|
||||
|
||||
```bash
|
||||
cd wrdo
|
||||
pnpm install
|
||||
```
|
||||
|
||||
### 创建 `.env` 文件
|
||||
|
||||
将 `.env.example` 内容复制粘贴到 `.env` 文件中:
|
||||
|
||||
| 环境变量 | 值 | 描述 |
|
||||
| -------------------------- | ------------------------------------------------- | ------------------------------------------------------------------------ |
|
||||
| NEXTAUTH\_URL | `http://localhost:3000` | Next.js 应用的 URL。 |
|
||||
| AUTH\_SECRET | `123465` | 用于加密令牌和邮件验证哈希的密钥。 |
|
||||
| DATABASE\_URL | `postgres://username:password@host:port/database` | Postgres 数据库的路径。 |
|
||||
| GOOGLE\_CLIENT\_ID | `123465` | Google OAuth 客户端的 ID。 |
|
||||
| GOOGLE\_CLIENT\_SECRET | `123465` | Google OAuth 客户端的密钥。 |
|
||||
| GITHUB\_ID | `123465` | GitHub OAuth 客户端的 ID。 |
|
||||
| GITHUB\_SECRET | `123465` | GitHub OAuth 客户端的密钥。 |
|
||||
| RESEND\_API\_KEY | `123465` | Resend 的 API 密钥。 |
|
||||
| RESEND\_FROM\_EMAIL | `"you <support@your-domain.com>"` | 用于发送邮件的邮箱地址。 |
|
||||
| NEXT\_PUBLIC\_OPEN\_SIGNUP | `1` | 开放注册。 |
|
||||
| SCREENSHOTONE\_BASE\_URL | `https://api.example.com` | 待补充 |
|
||||
| GITHUB\_TOKEN | `ghp_sscsfarwetqet` | [https://github.com/settings/tokens](https://github.com/settings/tokens) |
|
||||
|
||||
* 如何获取 `GOOGLE_CLIENT_ID`、`GITHUB_ID`,请参见 [认证](/docs/developer/authentification)。
|
||||
* 如何获取 `RESEND_API_KEY`,请参见 [邮件](/docs/developer/email)。
|
||||
* 如何启用邮件 worker,请参见 [邮件 Worker](/docs/developer/cloudflare-email-worker)。
|
||||
|
||||
如需逐步安装说明,请参见 [快速开始](/docs/developer/quick-start)。
|
||||
|
||||
### 配置部分
|
||||
|
||||
在使用 `pnpm run dev` 之前,请确保检查配置部分并更新所有环境变量。
|
||||
|
||||
</Steps>
|
||||
@@ -3,6 +3,8 @@ title: Installation
|
||||
description: How to install the project.
|
||||
---
|
||||
|
||||
<DocsLang en="/docs/developer/installation" zh="/docs/developer/installation-zh" />
|
||||
|
||||
<Steps>
|
||||
|
||||
### Create project
|
||||
@@ -36,8 +38,6 @@ pnpm install
|
||||
|
||||
Copy/paste the `.env.example` in the `.env` file:
|
||||
|
||||
{/* env表格 */}
|
||||
|
||||
| Environment Variable | Value | Description |
|
||||
|----------------------|-------|-------------|
|
||||
| NEXTAUTH_URL | `http://localhost:3000` | The URL of the Next.js application. |
|
||||
|
||||
245
content/docs/developer/quick-start-zh.mdx
Normal file
245
content/docs/developer/quick-start-zh.mdx
Normal file
@@ -0,0 +1,245 @@
|
||||
---
|
||||
title: 快速开始
|
||||
description: 手把手安装步骤详解
|
||||
---
|
||||
|
||||
<DocsLang en="/docs/developer/quick-start" zh="/docs/developer/quick-start-zh" />
|
||||
|
||||
## 0. 安装
|
||||
|
||||
```bash
|
||||
git clone https://github.com/oiov/wr.do
|
||||
````
|
||||
|
||||
进入项目文件夹并安装依赖项:
|
||||
|
||||
```bash
|
||||
cd wrdo
|
||||
pnpm install
|
||||
```
|
||||
|
||||
### 创建 `.env` 文件
|
||||
|
||||
将 `.env.example` 的内容复制粘贴到 `.env` 文件中。
|
||||
|
||||
## 1. 配置数据库
|
||||
|
||||
### 创建服务器数据库实例并获取连接 URL
|
||||
|
||||
在部署前,请确保你已准备好一个 Postgres 数据库实例。你可以选择以下方式之一:
|
||||
|
||||
* A. 使用 Vercel / Neon 等 Serverless Postgres 实例;
|
||||
* B. 使用 Docker 等方式自建 Postgres 实例。
|
||||
|
||||
这两种方式的配置稍有不同,我们将在下一步中进行区分。
|
||||
|
||||
### 在 Vercel 中添加环境变量
|
||||
|
||||
在 Vercel 的部署环境变量中,添加 `DATABASE_URL` 以及其他环境变量,
|
||||
并填写上一步中准备好的 Postgres 数据库连接 URL。
|
||||
数据库连接 URL 的典型格式如下:
|
||||
|
||||
`postgres://username:password@host:port/database`
|
||||
|
||||
```js title=".env"
|
||||
DATABASE_URL=
|
||||
```
|
||||
|
||||
### 部署 Postgres
|
||||
|
||||
```bash
|
||||
pnpm postinstall
|
||||
pnpm db:push
|
||||
```
|
||||
|
||||
#### 或者手动初始化
|
||||
|
||||
通过 [migration.sql](https://github.com/oiov/wr.do/blob/main/prisma/migrations),
|
||||
将 SQL 代码复制到数据库中以初始化数据库结构。
|
||||
|
||||
### 添加 AUTH_SECRET 环境变量
|
||||
|
||||
`AUTH_SECRET` 环境变量用于加密 token 和邮件验证哈希(NextAuth.js)。
|
||||
你可以通过 [https://generate-secret.vercel.app/32](https://generate-secret.vercel.app/32) 生成
|
||||
|
||||
`AUTH_URL` 是用于 NextAuth.js 的回调 URL,如果使用docker部署,需要设置为你的**站点域名**;如果使用vercel部署,可不填。
|
||||
|
||||
注意,`AUTH_URL` 与 `NEXT_PUBLIC_APP_URL` 需要保持一致
|
||||
|
||||
```js title=".env"
|
||||
AUTH_SECRET=10000032bsfasfafk4lkkfsa
|
||||
AUTH_URL=http://localhost:3000
|
||||
NEXT_PUBLIC_APP_URL=http://localhost:3000
|
||||
```
|
||||
|
||||
## 2. 配置认证服务
|
||||
|
||||
服务器端数据库需要配合用户认证服务才能正常运行,
|
||||
因此需要配置相应的认证服务。
|
||||
|
||||
提供以下认证方式:
|
||||
|
||||
* Google
|
||||
* Github
|
||||
* LinuxDo
|
||||
* Resend 邮件验证
|
||||
|
||||
### Google 配置
|
||||
|
||||
在本部分中,你需要更新以下变量:
|
||||
|
||||
```js title=".env"
|
||||
GOOGLE_CLIENT_ID = your_secret_client_id.apps.googleusercontent.com;
|
||||
GOOGLE_CLIENT_SECRET = your_secret_client;
|
||||
```
|
||||
|
||||
参见配置教程:[Authjs - Google OAuth](https://authjs.dev/getting-started/providers/google)
|
||||
|
||||
### Github 配置
|
||||
|
||||
在本部分中,你需要更新以下变量:
|
||||
|
||||
```js title=".env"
|
||||
GITHUB_ID = your_secret_client_id;
|
||||
GITHUB_SECRET = your_secret_client;
|
||||
```
|
||||
|
||||
参见配置教程:[Authjs - Github OAuth](https://authjs.dev/getting-started/providers/github)
|
||||
|
||||
### LinuxDo 配置
|
||||
|
||||
```js title=".env"
|
||||
LinuxDo_CLIENT_ID=
|
||||
LinuxDo_CLIENT_SECRET=
|
||||
```
|
||||
|
||||
参见配置教程:[Connect LinuxDo](https://connect.linux.do)
|
||||
|
||||
注意在配置Connect LinuxDo时,参考以下配置:
|
||||
|
||||

|
||||
|
||||
### Resend 邮件验证配置
|
||||
|
||||
<Callout type="note">
|
||||
邮件部分与 [resend](https://resend.com/) 的文档类似。
|
||||
如果你想了解详细配置,可以查阅官方文档:
|
||||
[这里](https://authjs.dev/getting-started/installation#setup-environment)
|
||||
</Callout>
|
||||
|
||||
<Steps>
|
||||
|
||||
#### 创建账号
|
||||
|
||||
如果你还没有 Resend 账号,请按照 [这里](https://resend.com/signup) 的注册流程操作。
|
||||
|
||||
#### 创建 API 密钥
|
||||
|
||||
登录 Resend 后,它会提示你创建第一个 API 密钥。
|
||||
|
||||
将其复制并粘贴到你的 `.env` 文件中:
|
||||
|
||||
```js
|
||||
RESEND_API_KEY=re_your_resend_api_key;
|
||||
RESEND_FROM_EMAIL="you <support@your-domain.com>"
|
||||
```
|
||||
|
||||
其中 your-domain 与Resend绑定的域名一致(与 `NEXT_PUBLIC_APP_URL` 一致)。
|
||||
|
||||
</Steps>
|
||||
|
||||
## 3. 邮件 Worker 配置(接收邮件)
|
||||
|
||||
详见:[Cloudflare Email Worker 配置教程](/docs/developer/cloudflare-email-worker)
|
||||
|
||||
完成上述步骤后,你需要为 r2 存储添加一个公共域名。
|
||||
|
||||
通过以下地址:
|
||||
|
||||
```bash
|
||||
https://dash.cloudflare.com/[account_id]/r2/default/buckets/[bucket]/settings
|
||||
```
|
||||
|
||||

|
||||
|
||||
```js title=".env"
|
||||
NEXT_PUBLIC_EMAIL_R2_DOMAIN=https://email-attachment.wr.do
|
||||
```
|
||||
|
||||
## 4. 添加业务配置
|
||||
|
||||
```js title=".env"
|
||||
# 允许任何人注册
|
||||
NEXT_PUBLIC_OPEN_SIGNUP=1
|
||||
```
|
||||
|
||||
## 5. 添加 SCREENSHOTONE\_BASE\_URL 环境变量
|
||||
|
||||
这是 screenshotone API 的基础地址。
|
||||
|
||||
你可以通过部署 [jasonraimondi/url-to-png](https://github.com/jasonraimondi/url-to-png) 自建服务。
|
||||
部署说明见:[这里](https://jasonraimondi.github.io/url-to-png/)
|
||||
|
||||
```js title=".env"
|
||||
SCREENSHOTONE_BASE_URL=https://api.screenshotone.com
|
||||
```
|
||||
|
||||
## 6. 添加 GITHUB\_TOKEN 环境变量
|
||||
|
||||
通过 [https://github.com/settings/tokens](https://github.com/settings/tokens) 获取你的 token:
|
||||
|
||||
```js title=".env"
|
||||
GITHUB_TOKEN=
|
||||
```
|
||||
|
||||
## 7. 启动开发服务器
|
||||
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
通过浏览器访问:[http://localhost:3000](http://localhost:3000)
|
||||
|
||||
## 8. 设置系统
|
||||
|
||||
#### 创建第一个账号并将账号权限更改为 ADMIN
|
||||
|
||||
请按以下步骤操作:
|
||||
|
||||
* 1. 通过 [http://localhost:3000/login](http://localhost:3000/login) 注册登录你的第一个账号;
|
||||
* 2. 通过 [http://localhost:3000/setup](http://localhost:3000/setup) 将账号权限更改为 ADMIN;
|
||||
* 3. 然后根据 **面板引导** 配置系统并添加第一个域名。
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
<Callout type="info">
|
||||
将账号权限更改为 ADMIN 后,你可以刷新页面并访问 http://localhost:3000/admin。
|
||||
|
||||
<strong>你必须至少添加一个域名,才能使用短链接、邮件或子域名管理等功能。</strong>
|
||||
</Callout>
|
||||
|
||||
## 9. 部署
|
||||
|
||||
详见:[部署指南](/docs/developer/deploy)
|
||||
|
||||
## Q & A
|
||||
|
||||
### Worker 错误 - 重定向过多
|
||||
|
||||
请访问:
|
||||
|
||||
```bash
|
||||
https://dash.cloudflare.com/[account_id]/[zone_name]/ssl-tls/configuration
|
||||
```
|
||||
|
||||
将 `SSL/TLS 加密模式` 更改为 `Full` 模式。
|
||||
|
||||
### 如何修改团队计划配额?
|
||||
|
||||
通过 team.ts 文件修改:
|
||||
|
||||
```bash
|
||||
https://github.com/oiov/wr.do/tree/main/config/team.ts
|
||||
```
|
||||
@@ -3,6 +3,8 @@ title: Quick Start for Developer
|
||||
description: Step by step installation
|
||||
---
|
||||
|
||||
<DocsLang en="/docs/developer/quick-start" zh="/docs/developer/quick-start-zh" />
|
||||
|
||||
## 0. Installation
|
||||
|
||||
```bash
|
||||
@@ -62,6 +64,7 @@ You can generate one from https://generate-secret.vercel.app/32:
|
||||
|
||||
```js title=".env"
|
||||
AUTH_SECRET=10000032bsfasfafk4lkkfsa
|
||||
AUTH_URL=http://localhost:3000
|
||||
```
|
||||
|
||||
## 2. Configure Authentication Service
|
||||
|
||||
@@ -3,15 +3,48 @@ title: Introduction
|
||||
description: Welcome to the WR.DO documentation.
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
WR.DO is a all-in-one web utility platform featuring short links with analytics, temporary email service, subdomain management, open APIs for screenshots and metadata extraction, plus comprehensive admin dashboard.
|
||||
|
||||
## Features
|
||||
|
||||
- 🔗 **URL Shortening:** Generate short links with visitor analytic and password(support api)
|
||||
- 📮 **Email Support:** Receive emails and send emails(support api)
|
||||
- 💬 **P2P Chat:** Start chat in seconds
|
||||
- 🌐 **Multi-Tenant Support:** Manage multiple DNS records seamlessly
|
||||
- 📸 **Screenshot API:** Access to screenshot api、website meta-info scraping api.
|
||||
- 😀 **Permission Management:** A convenient admin panel for auditing
|
||||
- 🔒 **Secure & Reliable:** Built on Cloudflare's robust DNS API
|
||||
- 🔗 **Short Link Service**:
|
||||
- Custom short links
|
||||
- Generate custom QR codes
|
||||
- Password-protected links
|
||||
- Expiration time control
|
||||
- Access analytics (real-time logs, maps, and multi-dimensional data analysis)
|
||||
- API integration for link creation
|
||||
|
||||
- 📮 **Email Service**:
|
||||
- Create custom prefix emails
|
||||
- Filter unread email lists
|
||||
- Unlimited mailbox creation
|
||||
- Receive unlimited emails (powered by Cloudflare Email Worker)
|
||||
- Send emails (powered by Resend)
|
||||
- API endpoints for mailbox creation
|
||||
- API endpoints for inbox retrieval
|
||||
|
||||
- 🌐 **Subdomain Management Service**:
|
||||
- Manage DNS records across multiple Cloudflare accounts and domains
|
||||
- Create various DNS record types (CNAME, A, TXT, etc.)
|
||||
|
||||
- 📡 **Open API Module**:
|
||||
- Website metadata extraction API
|
||||
- Website screenshot capture API
|
||||
- Website QR code generation API
|
||||
- Convert websites to Markdown/Text format
|
||||
- Comprehensive API call logging and statistics
|
||||
- User API key generation for third-party integrations
|
||||
|
||||
- 🔒 **Administrator Module**:
|
||||
- Multi-dimensional dashboard with website analytics
|
||||
- Dynamic service configuration (toggle short links, email, subdomain management)
|
||||
- User management (permissions, quotas, account control)
|
||||
- Centralized short link administration
|
||||
- Centralized email management
|
||||
- Centralized subdomain administration
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
||||
BIN
public/_static/docs/linuxdo-connect.png
Normal file
BIN
public/_static/docs/linuxdo-connect.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user