Skip to content

Commit a909c15

Browse files
authored
Merge pull request #20 from pdnode-team/feature/updatechatroom
Feature/updatechatroom
2 parents dab35e9 + 21e5cb2 commit a909c15

File tree

8 files changed

+241
-89
lines changed

8 files changed

+241
-89
lines changed

LICENSE

Lines changed: 183 additions & 0 deletions
Large diffs are not rendered by default.

zh/chatroom/index.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ lang: zh-CN
55

66
::: info 背景
77
ChatRooM起初是由 Mark 开发,现由Pdnode接手。
8+
9+
现以GPL 3许可证开源。
810
:::
911

1012
::: warning 提醒
@@ -15,9 +17,17 @@ ChatRooM起初是由 Mark 开发,现由Pdnode接手。
1517
::: warning 注意
1618
ChatRooM Enterprise处于非常基础的阶段,短期内没有对外使用的考虑.
1719

18-
ChatRooM 使用 [Supabase](https://supabase.com)[为什么选择Supabase?](/zh/chatroom/whysupabase.md)
20+
ChatRooM 使用 [Pocketbase](https://pocketbase.io/)[为什么选择Pocketbase?](/zh/chatroom/whypocketbase.md)
1921

2022
此文档只针对Pdnode 开发者。
2123

2224
你可以联系 bret@pdnode.com 来获取内部资格。
23-
:::
25+
:::
26+
27+
## ChatRooM Enterprise 介绍
28+
ChatRooM Enterprise**是什么**
29+
30+
一个针对中小型团队的开源团队即时聊天工具。
31+
32+
33+
**不是什么**:大型团队聊天(500人+),多个团队等复杂场景。

zh/chatroom/login.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
# 登录
2-
::: tip
3-
更多信息请查看此[文档](https://supabase.com/docs/guides/auth/passwords?queryGroups=language&language=js&queryGroups=flow&flow=implicit#signing-in-with-an-email-and-password)
4-
:::
5-
62
```ts
7-
async function signInWithEmail() {
8-
const { data, error } = await supabase.auth.signInWithPassword({
9-
email: '<email>',
10-
password: '<password>',
11-
})
12-
}
3+
import PocketBase from 'pocketbase';
4+
5+
const pb = new PocketBase('https://chatapi.pdnode.com');
6+
7+
const authData = await pb.collection('users').authWithPassword(
8+
'YOUR_USERNAME_OR_EMAIL',
9+
'YOUR_PASSWORD',
10+
);
11+
12+
// after the above you can also access the auth data from the authStore
13+
console.log(pb.authStore.isValid);
14+
console.log(pb.authStore.token);
15+
console.log(pb.authStore.record.id);
16+
17+
// "logout" the last authenticated record
18+
pb.authStore.clear();
1319
```

zh/chatroom/prices.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
11
# 价格
22
## 免费计划
3-
暂不支持**免费计划**
43

5-
## Plus 计划
4+
5+
## Pro 计划
66
5 美金/月/每个Workspace ( 工作区 )
77

8-
- 50人以下
9-
- 日活跃用户30人以下
8+
- 100人以下
9+
- 日活跃用户50人以下
1010
- 日活跃用户指的是在一天(24小时)中登录的用户有多少,无论是否使用功能。
1111

1212

1313

14-
## Pro 计划
14+
## Team 计划
1515
15 美金/月/每个Workspace ( 工作区 )
1616

17-
- 500 人以下
18-
- 日活跃用户200人以下
19-
- 日活跃用户指的是在一天(24小时)中登录的用户有多少,无论是否使用功能。
20-
21-
## Team 计划
22-
50 美金/月/每个Workspace ( 工作区 )
23-
- 2000 人以下
24-
- 日活跃用户700人以下
17+
- 300 人以下
18+
- 日活跃用户100人以下
2519
- 日活跃用户指的是在一天(24小时)中登录的用户有多少,无论是否使用功能。
2620

27-
## 企业计划
28-
暂不支持日活跃人数超过700人或者超过2000人
21+
## 更高的需求?
22+
PdNode ChatRooM Enterprise可能不太适合你/你们团队

zh/chatroom/register.md

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
11
# 注册
2-
::: tip
3-
更多信息请查看此[文档](https://supabase.com/docs/guides/auth/passwords?queryGroups=language&language=js&queryGroups=flow&flow=implicit#signing-up-with-an-email-and-password)
4-
:::
52

6-
::: warning
7-
你必须引导用户前往他的邮箱去验证邮箱。(会发送一个链接)。
3+
```ts
4+
import PocketBase from 'pocketbase';
85

9-
**如果用户没有验证邮箱**那么他不能**登录**
6+
const pb = new PocketBase('https://chatapi.pdnode.com');
107

11-
*请一定要用户验证邮箱!*
12-
:::
138

14-
```ts
15-
async function signUpNewUser() {
16-
const { data, error } = await supabase.auth.signUp({
17-
email: '<email>', // 邮箱
18-
password: '<password>', // 密码
19-
options: {
20-
emailRedirectTo: 'https://localhost:5173/welcome', // 邮箱重定向的地方 | 可选。
21-
},
22-
})
23-
}
24-
```
9+
const data = {
10+
"email": "test@example.com",
11+
"emailVisibility": true,
12+
"name": "test",
13+
"password": "12345678",
14+
"passwordConfirm": "12345678"
15+
};
16+
17+
const record = await pb.collection('users').create(data);
2518

19+
await pb.collection('users').requestVerification('test@example.com');
20+
```

zh/chatroom/whypocketbase.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# 为什么我们选择Pocketbase?
2+
3+
**选择Pocketbase的原因有很多,以下是主要原因:**
4+
- 权限管理 - Pocketbase的权限管理非常灵活和强大
5+
- Realtime - 即实时,Pocketbase的实时配合权限管理可以达到很好的效果。
6+
- 快捷 - Pocketbase使用go和sqlite开发,其部署非常容易。
7+
- 可扩展 - 虽然Pocketbase只能垂直扩展,不过大多数中小型团队使用Pocketbase绰绰有余。扩展Pocketbase的代码非常容易。

zh/chatroom/whysupabase.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

zh/chatroom/workspace.md

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1 @@
11
# 工作区
2-
3-
::: tip
4-
用户需要登录并验证邮箱。
5-
:::
6-
7-
## 创建工作区
8-
::: tip
9-
工作区名称不应该超过**20个字符**
10-
11-
每个人只能有一个工作区,这是硬性限制。
12-
:::
13-
14-
```ts
15-
const { data: { user } } = await supabase.auth.getUser()
16-
const { error } = await supabase
17-
.from('countries')
18-
.insert({ name: "<NAME>", owner: user.id })
19-
```
20-
21-
::: warning
22-
你需要处理错误。
23-
:::
24-
25-
::: tip 更多信息
26-
[获取用户(id)](https://supabase.com/docs/reference/javascript/auth-getuser)
27-
28-
[插入数据](https://supabase.com/docs/reference/javascript/insert)
29-
30-
[错误处理 - Auth](https://supabase.com/docs/guides/auth/debugging/error-codes)
31-
:::
32-
33-
## 更改工作区
34-
暂无文档
35-
36-
## 删除工作区
37-
**目前无法自主删除工作区,需要联系客服。**

0 commit comments

Comments
 (0)