|
1 |
| -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). |
| 1 | +# Chat Record Viewer |
2 | 2 |
|
3 |
| -## Getting Started |
| 3 | +聊天记录查看器 |
4 | 4 |
|
5 |
| -First, run the development server: |
| 5 | +本项目是为 [Q2TG](https://github.com/Clansty/Q2TG) 所生,设计上的作用是用于查看合并转发的消息记录。可以根据 ResID 获取并展示转发的聊天记录。 |
6 | 6 |
|
7 |
| -```bash |
8 |
| -npm run dev |
9 |
| -# or |
10 |
| -yarn dev |
11 |
| -``` |
| 7 | +使用 Next.JS + React,用了 [Antd](https://ant.design/) 的图片放大查看组件。为了防止滥用搭建好的实例,可以设置 secretKey 用于签名校验。 |
| 8 | + |
| 9 | +## 搭建方法 |
| 10 | + |
| 11 | +1. 将 `config.example.yaml` 复制到 `config.yaml`,填写相关信息 |
| 12 | + |
| 13 | + ```bash |
| 14 | + cp config.example.yaml config.yaml |
| 15 | + ``` |
12 | 16 |
|
13 |
| -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
| 17 | + ```yaml |
| 18 | + host: |
| 19 | + account: # 用于获取记录的帐号 |
| 20 | + password: # 密码 |
| 21 | + token: # 随便生成一个密钥,用来校验参数的签名 |
| 22 | + ``` |
14 | 23 |
|
15 |
| -You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file. |
| 24 | +2. 安装依赖 |
16 | 25 |
|
17 |
| -[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.tsx`. |
| 26 | + ```bash |
| 27 | + yarn install |
| 28 | + ``` |
18 | 29 |
|
19 |
| -The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages. |
| 30 | +3. 编译 Next.JS |
20 | 31 |
|
21 |
| -## Learn More |
| 32 | + ```bash |
| 33 | + yarn build |
| 34 | + ``` |
22 | 35 |
|
23 |
| -To learn more about Next.js, take a look at the following resources: |
| 36 | +4. 运行服务 |
24 | 37 |
|
25 |
| -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. |
26 |
| -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. |
| 38 | + ``` |
| 39 | + yarn start |
| 40 | + ``` |
27 | 41 |
|
28 |
| -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! |
| 42 | +5. 将 `3000` 端口暴露出来,建议使用类似 caddy 的软件反代并提供 HTTPS 连接 |
| 43 | + |
| 44 | +## 签名生成 |
| 45 | + |
| 46 | +在需要生成访问链接的应用中,使用以下方式生成访问地址的 `sign` 参数 |
| 47 | + |
| 48 | +```js |
| 49 | +md5(md5(resId) + token) |
| 50 | +``` |
29 | 51 |
|
30 |
| -## Deploy on Vercel |
| 52 | +该生成算法位于 [`index.tsx` 的第 45 行附近](./pages/index.tsx#L45) |
31 | 53 |
|
32 |
| -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. |
| 54 | +如果实例部署在 `https://example.com`,则访问地址为 `https://example.com/?res=ResID&sign=签名` |
33 | 55 |
|
34 |
| -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. |
|
0 commit comments