Skip to content
This repository was archived by the owner on Nov 2, 2024. It is now read-only.

Commit 4515b32

Browse files
committed
chore: update
Signed-off-by: Innei <[email protected]>
1 parent 0ac399e commit 4515b32

File tree

4 files changed

+80
-38
lines changed

4 files changed

+80
-38
lines changed

pages/docs/advanced.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pnpm bundle
4040
MX_ENCRYPT_KEY: {
4141
type: 'password',
4242
tip: '加密密钥,可选',
43-
default: 'mx-space',
43+
default: null,
4444
},
4545
PORT: {
4646
type: 'number',

pages/docs/docker.mdx

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Docker 部署
22

3-
4-
import { Card, Cards, Callout, Steps } from 'nextra/components';
5-
import { UilExternalLinkAlt } from '@components/Icons/ExternalLinkAlt';
6-
import { UilArrowCircleUp } from '@components/Icons/ArrowCircleUp';
3+
import { Card, Cards, Callout, Steps } from 'nextra/components'
4+
import { UilExternalLinkAlt } from '@components/Icons/ExternalLinkAlt'
5+
import { UilArrowCircleUp } from '@components/Icons/ArrowCircleUp'
76

87
<Steps>
98
### 安装 Docker
@@ -13,6 +12,7 @@ import { UilArrowCircleUp } from '@components/Icons/ArrowCircleUp';
1312
```bash
1413
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
1514
```
15+
1616
在国外,可以直接使用官方脚本安装:
1717

1818
```bash
@@ -27,7 +27,6 @@ docker -v
2727
docker compose version
2828
```
2929

30-
3130
### 拉取配置文件
3231

3332
```bash
@@ -43,38 +42,37 @@ wget https://fastly.jsdelivr.net/gh/mx-space/core@master/docker-compose.yml
4342

4443
> 鼠标悬停在下方的表格中,可以查看对应的配置项名字。
4544
46-
import { EnvVariableConfig } from '@components/EnvVariableConfig';
47-
48-
<EnvVariableConfig
49-
variableNames={
50-
[
51-
{
52-
key: 'JWT_SECRET',
53-
name: "[JWT 密钥] 长度不小于 16 个字符,不大于 32 个字符",
54-
},
55-
{
56-
key: 'ALLOWED_ORIGINS',
57-
name: "[被允许的域名] 如果允许多个域名访问,用英文逗号,分隔",
58-
},
59-
{
60-
key: 'ENCRYPT_ENABLE',
61-
name: "[是否开启加密] true 为开启,false 为关闭",
62-
},
63-
{
64-
key: 'ENCRYPT_KEY',
65-
name: "[加密密钥] 详情请见下方提示",
66-
},
67-
]
68-
}
45+
import { EnvVariableConfig } from '@components/EnvVariableConfig'
46+
47+
<EnvVariableConfig
48+
variableNames={[
49+
{
50+
key: 'JWT_SECRET',
51+
name: '[JWT 密钥] 长度不小于 16 个字符,不大于 32 个字符',
52+
},
53+
{
54+
key: 'ALLOWED_ORIGINS',
55+
name: '[被允许的域名] 如果允许多个域名访问,用英文逗号,分隔',
56+
},
57+
{
58+
key: 'ENCRYPT_ENABLE',
59+
name: '[是否开启加密] true 为开启,false 为关闭',
60+
},
61+
{
62+
key: 'ENCRYPT_KEY',
63+
name: '[加密密钥] 详情请见下方提示',
64+
},
65+
]}
6966
/>
7067

7168
- **`JWT 密钥`**:需要填写长度不小于 16 个字符,不大于 32 个字符的字符串,用于加密用户的 JWT,务必保存好自己的密钥,不要泄露给他人。
7269
- **`被允许的域名`**:需要填写被允许的域名,通常是前端的域名,如果允许多个域名访问,用英文逗号,分隔。
7370
- **`是否开启加密`**:如果你确定要开启加密,将 false 改为 true,开启加密后,你需要在下方填写加密密钥。
74-
- **`加密密钥`**:具体内容可参考 https://mx-space.js.org/feature/security.html
71+
- **`加密密钥`**如果你不知道这是什么,那么不建议开启此功能,具体内容可参考 https://mx-space.js.org/usage/security.html
7572

7673
<Callout type="warning">
77-
若开启加密,则需注意密钥长度**必须为 64 位**,不然会在初始化时报错。注意这是**不可逆**的,务必保存自己的秘钥。所以并不是非常推荐使用,除非你真的需要加密,
74+
若开启加密,则需注意密钥长度**必须为 64
75+
**,不然会在初始化时报错。注意这是**不可逆**的,务必保存自己的秘钥。所以并不是非常推荐使用,除非你真的需要加密,
7876
</Callout>
7977

8078
### 启动 Core
@@ -92,11 +90,17 @@ docker compose up -d
9290
## 相关链接
9391

9492
<Cards num={2}>
95-
<Card arrow title="反向代理配置" href="/docs/extra#反向代理" icon={<UilExternalLinkAlt />} />
96-
<Card arrow title="前端主题部署" href="/themes" icon={<UilExternalLinkAlt />} />
93+
<Card
94+
arrow
95+
title="反向代理配置"
96+
href="/docs/extra#反向代理"
97+
icon={<UilExternalLinkAlt />}
98+
/>
99+
<Card
100+
arrow
101+
title="前端主题部署"
102+
href="/themes"
103+
icon={<UilExternalLinkAlt />}
104+
/>
97105
<Card arrow title="使用指南" href="/usage" icon={<UilArrowCircleUp />} />
98106
</Cards>
99-
100-
101-
102-

pages/usage/_meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"xlog": "xLog 集成",
1010
"search": "Algolia Search",
1111
"backup": "备份与回滚",
12-
"update": "更新 Mx-Space",
12+
"update": "更新 Mix Space",
1313
"-- community": {
1414
"type": "separator",
1515
"title": "社区使用指南"

pages/usage/security.mdx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# 信息加密与安全性
2+
3+
在 v3.41.0 后续版本,加入了敏感信息加密功能。默认为关。
4+
5+
为什么需要信息加密。
6+
7+
假设黑客通过某种手段数据库被脱库。如果开启了信息加密,即便是拿到了全部数据也不能解密某些关键数据,例如配置项中的各类 API Key。
8+
9+
但是,也需要谨慎开启此功能,开启后你需要记住加密秘钥。否则,你也将会永远丢失这些数据。
10+
11+
## 如何开启
12+
13+
你可以附加 `--encrypt_enable` 来启动服务。如:
14+
15+
```bash
16+
node index.js --encrypt_enable
17+
```
18+
19+
可以通过附加 `--encrypt_key <key>` 来指定加密密钥,长度必须为 64 位。请牢记此密钥。或者通过环境变量 `MX_ENCRYPT_KEY` 也可以指定密钥。
20+
21+
::: info
22+
`MX_ENCRYPT_KEY` `--encrypt_key` 不是必须的,默认取机器的 [machine-id](https://www.npmjs.com/package/node-machine-id)
23+
:::
24+
25+
::: warning
26+
此操作时不可逆的,操作前请备份数据库。
27+
:::
28+
29+
## 自动化加密配置(进阶指令)(非必要)
30+
31+
::: danger
32+
此操作时也是不可逆的,操作前请备份数据库。
33+
:::
34+
35+
```bash
36+
cd core
37+
tsx src/migration/helper/encrypt-configs.ts
38+
```

0 commit comments

Comments
 (0)