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

Commit 0ac399e

Browse files
committed
feat: update clerk
Signed-off-by: Innei <[email protected]>
1 parent 3c2f504 commit 0ac399e

File tree

1 file changed

+77
-38
lines changed

1 file changed

+77
-38
lines changed

pages/themes/shiro/index.mdx

+77-38
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
1-
import { Card, Cards, Callout } from "nextra/components";
1+
import { Card, Cards, Callout } from 'nextra/components'
22

33
# Shiro 主题
44

5-
import { ToGitHub } from '@components/ToGitHub';
5+
import { ToGitHub } from '@components/ToGitHub'
66

77
<ToGitHub repo="Innei/Shiro" />
88

99
## Demo
1010

1111
<Cards num={2}>
12-
<Card arrow href="https://innei.in" title="静かな森" icon={<img src="https://innei.in/innei.svg" width={"25em"} />} />
13-
<Card arrow href="https://blog.wibus.ren" title="可愛い松" icon={<img src="https://cdn.my-api.cn/user/w/asset-pic-picgo/2022-12-152kb_waifu-up3x-denoise3x.jpg" width={"25em"} />} />
12+
<Card
13+
arrow
14+
href="https://innei.in"
15+
title="静かな森"
16+
icon={<img src="https://innei.in/innei.svg" width={'25em'} />}
17+
/>
18+
<Card
19+
arrow
20+
href="https://blog.wibus.ren"
21+
title="可愛い松"
22+
icon={
23+
<img
24+
src="https://cdn.my-api.cn/user/w/asset-pic-picgo/2022-12-152kb_waifu-up3x-denoise3x.jpg"
25+
width={'25em'}
26+
/>
27+
}
28+
/>
1429
</Cards>
1530

1631
## 前提要求
@@ -20,24 +35,24 @@ import { ToGitHub } from '@components/ToGitHub';
2035
- 你已注册 [Clerk](https://clerk.com/) 账号
2136

2237
<Callout type="warning">
23-
请注意,Shiro 主题的部署教程与初版有所不同,如果你已经部署过 Shiro 主题,请重新阅读本文档(尤其是填入配置文件环节,配置有所变化),并阅读最后一节[「移除 Edge Config」](#移除-edge-config)
38+
请注意,Shiro 主题的部署教程与初版有所不同,如果你已经部署过 Shiro
39+
主题,请重新阅读本文档(尤其是填入配置文件环节,配置有所变化),并阅读最后一节
40+
[「移除 Edge Config」](#移除-edge-config)
2441
</Callout>
2542

2643
## 安装
2744

2845
import { Steps } from 'nextra/components'
29-
import Video from '@components/Video';
46+
import Video from '@components/Video'
3047

3148
<Steps>
3249
### 克隆仓库
3350

3451
登陆 GitHub 账号,打开 [Innei/Shiro](https://github.com/Innei/Shiro),点击右上角的 Fork 按钮,将仓库克隆到你的账号下。
3552

3653
<Video src="https://pan.vinua.cn/f/73dt6/fork_shiro.mp4" />
37-
38-
### 打开 Vercel 创建项目
39-
40-
登陆 Vercel 账号,点击右上角的 New Project 按钮,选择 Import Git Repository,选择你刚刚 Fork 的仓库,点击 Import 按钮,即可进入到项目配置页面。
54+
### 打开 Vercel 创建项目 登陆 Vercel 账号,点击右上角的 New Project 按钮,选择 Import
55+
Git Repository,选择你刚刚 Fork 的仓库,点击 Import 按钮,即可进入到项目配置页面。
4156

4257
<Video src="https://pan.vinua.cn/f/52ocj/shiro_create_new_project.mp4" />
4358

@@ -59,7 +74,7 @@ import Video from '@components/Video';
5974
- 数据:(点击下方的按钮复制)
6075

6176
<Callout>
62-
请注意,这份配置你需要自行修改成符合你的需求的配置。直接使用下面的配置可能会导致你的博客无法按照你的预期运行。
77+
请注意,这份配置你需要自行修改成符合你的需求的配置。直接使用下面的配置可能会导致你的博客无法按照你的预期运行。
6378
</Callout>
6479

6580
```json showLineNumbers
@@ -193,29 +208,27 @@ import Video from '@components/Video';
193208

194209
在下方的配置表格中,填入你的环境变量,然后点击复制按钮,将环境变量复制到剪贴板中。
195210

196-
import { EnvVariableConfig } from '@components/EnvVariableConfig';
211+
import { EnvVariableConfig } from '@components/EnvVariableConfig'
197212

198-
<EnvVariableConfig
199-
variableNames={
200-
[
201-
{
202-
key: 'NEXT_PUBLIC_API_URL',
203-
name: "后端 API 地址"
204-
},
205-
{
206-
key: 'NEXT_PUBLIC_GATEWAY_URL',
207-
name: "后端网关地址"
208-
},
209-
{
210-
key: 'NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY',
211-
name: "Clerk 页面的公钥"
212-
},
213-
{
214-
key: 'CLERK_SECRET_KEY',
215-
name: "Clerk 页面的私钥"
216-
}
217-
]
218-
}
213+
<EnvVariableConfig
214+
variableNames={[
215+
{
216+
key: 'NEXT_PUBLIC_API_URL',
217+
name: '后端 API 地址',
218+
},
219+
{
220+
key: 'NEXT_PUBLIC_GATEWAY_URL',
221+
name: '后端网关地址',
222+
},
223+
{
224+
key: 'NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY',
225+
name: 'Clerk 页面的公钥',
226+
},
227+
{
228+
key: 'CLERK_SECRET_KEY',
229+
name: 'Clerk 页面的私钥',
230+
},
231+
]}
219232
/>
220233

221234
### 键入环境变量 & 开始部署
@@ -224,6 +237,32 @@ import { EnvVariableConfig } from '@components/EnvVariableConfig';
224237

225238
<Video src="https://pan.vinua.cn/f/g3YfL/shiro_deploy.mp4" />
226239

240+
### Clerk 登录与 Mix Space 后端绑定
241+
242+
如果你遇到在 Shiro 登录之后,无法评论遇到 "和主人重名" 的报错,是因为 Clerk 的用户名和 Mix Space 后端的用户名重复了,你需要绑定本系统和 Clerk 的用户。让某个 Clerk 用户具有管理员权限。
243+
244+
具体操作方法:
245+
246+
1. 升级 Mix Space Core 到 4.7.0 以上版本。
247+
248+
2. 打开 Clerk 对于此项目的控制台:
249+
250+
PEM 的获取方式:
251+
252+
https://clerk.com/docs/backend-requests/handling/manual-jwt
253+
![](https://github.com/Innei/Shiro/assets/41265413/7bb103d1-85ef-4da8-9bba-3fc7f3bf01d7)
254+
255+
Key:
256+
![](https://github.com/Innei/Shiro/assets/41265413/db344105-e780-4727-979a-e0606daa46ef)
257+
258+
3. 在 Shiro 用 clerk 登录后,通过 console 抓取请求:
259+
260+
你的 clerk User Id 获取方式:
261+
262+
![](https://github.com/Innei/Shiro/assets/41265413/234b700b-6cd7-4be1-a6b7-e3d68af7def3)
263+
264+
Refer: https://github.com/Innei/Shiro/issues/137
265+
227266
### 完成!
228267

229268
至此,你已完成了 Shiro 主题的部署,你可以访问你的博客了。有关配置域名的教程,请参考 [Vercel 文档](https://vercel.com/docs/custom-domains)
@@ -232,7 +271,7 @@ import { EnvVariableConfig } from '@components/EnvVariableConfig';
232271

233272
## 移除 Edge Config
234273

235-
在后续的 Shiro 更新中, Edge Config 将不再被使用。你可能需要移除 Edge Config,以防止不必要的资源使用。
274+
在后续的 Shiro 更新中,Edge Config 将不再被使用。你可能需要移除 Edge Config,以防止不必要的资源使用。
236275

237276
进入 Vercel 部署此项目的仪表盘,点击上方的 Storage,进入设置页面,点击左侧的 Projects,将链接的项目取消链接,接着点击左侧的 Settings,点击右侧的 Delete Edge Config 按钮,即可完成删除。
238277

@@ -243,10 +282,10 @@ import { EnvVariableConfig } from '@components/EnvVariableConfig';
243282
![](https://pan.vinua.cn/f/GRefM/0.png)
244283

245284
<style global jsx>{`
246-
.nextra-cards img {
247-
border-radius: 50%;
285+
.nextra-cards img {
286+
border-radius: 50%;
248287
}
249-
.nextra-content pre {
250-
max-height: 50vh;
288+
.nextra-content pre {
289+
max-height: 50vh;
251290
}
252291
`}</style>

0 commit comments

Comments
 (0)