Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Rin 本地开发配置
# 复制此文件为 .env.local 并填入你的实际配置

# ============================================
# 前端配置 (client/.env)
# ============================================
# 后端 API 地址
API_URL=http://localhost:11498

# 网站基本信息
NAME=YourName
DESCRIPTION=Your Description
AVATAR=https://avatars.githubusercontent.com/u/your-id

# 分页设置
PAGE_SIZE=5

# RSS 设置
RSS_ENABLE=false

# ============================================
# 后端配置 (wrangler.toml 中的 vars)
# ============================================
# 前端地址(用于 Webhook 等)
FRONTEND_URL=http://localhost:5173

# S3/R2 存储配置
S3_FOLDER=images/
S3_CACHE_FOLDER=cache/
S3_REGION=auto
S3_ENDPOINT=https://your-account.r2.cloudflarestorage.com
S3_ACCESS_HOST=https://your-image-domain.com
S3_BUCKET=your-bucket-name
S3_FORCE_PATH_STYLE=false

# Webhook 通知地址(可选)
WEBHOOK_URL=

# RSS 标题和描述
RSS_TITLE=Rin Development
RSS_DESCRIPTION=Development Environment

# ============================================
# 敏感配置(会被加密存储)
# ============================================
# GitHub OAuth 配置
RIN_GITHUB_CLIENT_ID=your-github-client-id
RIN_GITHUB_CLIENT_SECRET=your-github-client-secret

# JWT 密钥
JWT_SECRET=your-jwt-secret-key

# S3 访问密钥
S3_ACCESS_KEY_ID=your-s3-access-key
S3_SECRET_ACCESS_KEY=your-s3-secret-key

# ============================================
# 数据库配置
# ============================================
DB_NAME=rin
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
pull_request:
branches:
- main
- dev

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Set up Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.3.6

- name: Install dependencies
run: bun install --frozen-lockfile

- name: Run typecheck
run: bun run typecheck

- name: Run format check
run: bun run format:check

- name: Run build
run: bun run build
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:

- name: Set up Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.3.6

- name: Deploy
env: # Or as an environment variable
Expand Down Expand Up @@ -52,4 +54,4 @@ jobs:
run: |
cd Rin/
bun install --frozen-lockfile
bun scripts/migrator.ts
bun scripts/deploy-cf.ts
2 changes: 1 addition & 1 deletion .github/workflows/seo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ jobs:
run: |
cd Rin/
bun install --frozen-lockfile
bun scripts/render.ts
bun scripts/seo-render.ts
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ dist-ssr
*.sln
*.sw?
/.dev.vars

# Bun
.bun/*
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ We are happy to accept your patches and contributions to this project. You just

# Commit-msg hooks

We have a sample commit-msg hook in `scripts/commit-msg.sh`. Please run the following command to set it up:
We have a sample commit-msg hook in `scripts/git-commit-msg.sh`. Please run the following command to set it up:

```sh
ln -s ../../scripts/commit-msg.sh commit-msg
ln -s ../../scripts/git-commit-msg.sh commit-msg
```

On Windows, copy the `commit-msg.sh` file directly to `.git/hooks/commit-msg`.
On Windows, copy the `git-commit-msg.sh` file directly to `.git/hooks/commit-msg`.

```powershell
cp .\scripts\commit-msg.sh .\.git\hooks\commit-msg
cp .\scripts\git-commit-msg.sh .\.git\hooks\commit-msg
```

This will run the following checks before each commit:
Expand Down Expand Up @@ -49,9 +49,9 @@ If you want to skip the hook, run `git commit` with the `--no-verify` option.
6. Perform the database migration
> [!TIP]
> If your database name (`database_name` in `wrangler.toml`) is not `rin`\
> Please modify the `DB_NAME` field in `scripts/dev-migrator.sh` before performing the migration
> Please modify the `DB_NAME` field in `scripts/db-migrate-local.ts` before performing the migration
```sh
bun m
bun run db:migrate
```

7. Configuring the `.dev.vars' file
Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@

# Commit-msg 钩子

我们在 `scripts/commit-msg.sh` 中有一个示例 commit-msg hook。请运行以下命令设置:
我们在 `scripts/git-commit-msg.sh` 中有一个示例 commit-msg hook。请运行以下命令设置:

```sh
ln -s ../../scripts/commit-msg.sh ./.git/hooks/commit-msg
ln -s ../../scripts/git-commit-msg.sh ./.git/hooks/commit-msg
```

Windows 下请直接将 `commit-msg.sh` 文件复制到 `.git/hooks/commit-msg`。
Windows 下请直接将 `git-commit-msg.sh` 文件复制到 `.git/hooks/commit-msg`。

```powershell
cp .\scripts\commit-msg.sh .\.git\hooks\commit-msg
cp .\scripts\git-commit-msg.sh .\.git\hooks\commit-msg
```

这将在每次提交之前运行以下检查:
Expand Down Expand Up @@ -48,9 +48,9 @@ cp .\scripts\commit-msg.sh .\.git\hooks\commit-msg
6. 执行数据库迁移
> [!TIP]
> 如果您的数据库名称(`wrangler.toml`中`database_name`)不为 `rin`\
> 请在执行迁移之前修改 `scripts/dev-migrator.sh` 中的 `DB_NAME` 字段
> 请在执行迁移之前修改 `scripts/db-migrate-local.ts` 中的 `DB_NAME` 字段
```sh
bun m
bun run db:migrate
```

7. 配置 `.dev.vars` 文件
Expand Down
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,31 @@ Rin is a blog based on Cloudflare Pages + Workers + D1 + R2. It does not require
13. For more features, please refer to https://xeu.life

# Documentation
[docs.openrin.org](https://docs.openrin.org)

## 快速开始

```bash
# 1. 克隆项目
git clone https://github.com/openRin/Rin.git && cd Rin

# 2. 安装依赖
bun install

# 3. 配置环境变量
cp .env.example .env.local
# 编辑 .env.local 填入你的配置

# 4. 启动开发服务器
bun run dev
```

访问 http://localhost:5173 开始开发!

详细文档:
- 📖 [本地开发指南](./docs/DEVELOPMENT.md)
- 🚀 [部署指南](./docs/DEPLOY.md)
- 🔧 [环境变量说明](./docs/ENV.md)
- 📚 [完整文档](https://docs.openrin.org)

## Star History

Expand Down
Binary file modified bun.lockb
Binary file not shown.
37 changes: 36 additions & 1 deletion client/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"notfound": "Set the article alias to `about` to create an about page",
"title": "About"
},
"ai_summary": {
"title": "AI Summary"
},
"alert": "Alert",
"alias": "Alias",
"article": {
Expand Down Expand Up @@ -196,6 +199,38 @@
},
"title": "Friend Link Settings"
},
"ai_summary": {
"title": "AI Summary Settings",
"enable": {
"title": "Enable AI Summary",
"desc": "Automatically generate AI summary when publishing articles"
},
"provider": {
"title": "AI Provider",
"desc": "Select or enter an AI service provider"
},
"model": {
"title": "Model",
"desc": "Select or enter model name"
},
"api_key": {
"title": "API Key",
"desc": "Enter your API key",
"set": "Set",
"placeholder_set": "Enter new key to update"
},
"api_url": {
"title": "API URL",
"desc": "Custom API URL (OpenAI compatible format)"
},
"save": {
"title": "Save Configuration",
"desc": "Save AI configuration to database",
"button": "Save Configuration"
},
"save_success": "Saved successfully",
"unsaved_changes": "You have unsaved changes"
},
"get_config_failed$message": "Failed to get configuration, {{message}}",
"import_failed$message": "Import failed, {{message}}",
"import_result": "Import Result",
Expand Down Expand Up @@ -255,4 +290,4 @@
},
"writing": "Writing",
"year$year": "{{year}}"
}
}
37 changes: 36 additions & 1 deletion client/public/locales/ja/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"notfound": "About ページを作成するには、記事のエイリアスを about に設定します",
"title": "概要"
},
"ai_summary": {
"title": "AI 要約"
},
"alert": "警告",
"alias": "エイリアス",
"article": {
Expand Down Expand Up @@ -196,6 +199,38 @@
},
"title": "友リンク設定"
},
"ai_summary": {
"title": "AI 要約設定",
"enable": {
"title": "AI 要約を有効にする",
"desc": "記事公開時に AI 要約を自動生成"
},
"provider": {
"title": "AI プロバイダー",
"desc": "AI サービスプロバイダーを選択または入力"
},
"model": {
"title": "モデル",
"desc": "モデル名を選択または入力"
},
"api_key": {
"title": "API キー",
"desc": "API キーを入力してください",
"set": "設定済み",
"placeholder_set": "新しいキーを入力して更新"
},
"api_url": {
"title": "API URL",
"desc": "カスタム API URL(OpenAI 互換形式)"
},
"save": {
"title": "設定を保存",
"desc": "AI 設定をデータベースに保存",
"button": "設定を保存"
},
"save_success": "保存しました",
"unsaved_changes": "保存されていない変更があります"
},
"get_config_failed$message": "設定の取得に失敗しました: {{message}}",
"import_failed$message": "インポートに失敗しました: {{message}}",
"import_result": "インポート結果",
Expand Down Expand Up @@ -255,4 +290,4 @@
},
"writing": "執筆",
"year$year": "{{year}} 年"
}
}
37 changes: 36 additions & 1 deletion client/public/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"notfound": "将文章别名设置为 about 可以创建关于页面",
"title": "关于"
},
"ai_summary": {
"title": "AI 总结"
},
"alert": "提示",
"alias": "别名",
"article": {
Expand Down Expand Up @@ -196,6 +199,38 @@
},
"title": "友链设置"
},
"ai_summary": {
"title": "AI 总结设置",
"enable": {
"title": "启用 AI 总结",
"desc": "发布文章时自动生成 AI 总结"
},
"provider": {
"title": "AI 供应商",
"desc": "选择或输入 AI 服务供应商"
},
"model": {
"title": "模型",
"desc": "选择或输入模型名称"
},
"api_key": {
"title": "API Key",
"desc": "输入您的 API 密钥",
"set": "已设置",
"placeholder_set": "输入新密钥以更新"
},
"api_url": {
"title": "API URL",
"desc": "自定义 API 地址(OpenAI 兼容格式)"
},
"save": {
"title": "保存配置",
"desc": "保存 AI 配置到数据库",
"button": "保存配置"
},
"save_success": "保存成功",
"unsaved_changes": "您有未保存的更改"
},
"get_config_failed$message": "获取配置失败,{{message}}",
"import_failed$message": "导入失败,{{message}}",
"import_result": "导入结果",
Expand Down Expand Up @@ -255,4 +290,4 @@
},
"writing": "写作",
"year$year": "{{year}} 年"
}
}
Loading