Skip to content

Commit d34a86b

Browse files
authored
Merge branch 'stepbystepcode:main' into main
2 parents 9026026 + 522dcaa commit d34a86b

File tree

6 files changed

+234
-3
lines changed

6 files changed

+234
-3
lines changed

.DS_Store

0 Bytes
Binary file not shown.

API.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# API Documentation
2+
## User Management
3+
4+
```POST /api/signup```
5+
6+
Register a new user account.
7+
8+
- Request Body:
9+
10+
username: Username string
11+
password: Password string
12+
13+
- Response:
14+
15+
201: User created successfully
16+
409: Username already exists
17+
18+
```POST /api/login```
19+
20+
Login with username and password.
21+
22+
- Request Body:
23+
24+
username: Username string
25+
password: Password string
26+
27+
- Response:
28+
29+
200: Login succeeded
30+
401: Invalid credentials
31+
32+
```POST /api/avatar```
33+
34+
Set user avatar.
35+
36+
- Request Body:
37+
38+
avatar: Avatar ID int
39+
40+
- Response:
41+
42+
200: Login succeeded
43+
401: Invalid credentials
44+
45+
## Chat
46+
47+
```POST /api/chat```
48+
49+
Send a chat message.
50+
51+
- Request Body:
52+
53+
content: Chat message content
54+
receiver: receiver username string
55+
56+
- Response:
57+
58+
200: Message sent
59+
404: User or chat room not found
60+
61+
```POST /api/check```
62+
63+
Send a chat message.
64+
65+
- Response:
66+
67+
200: Message sent
68+
404: User or chat room not found
69+
70+
## Friend Management
71+
72+
```POST /api/nfmgr```
73+
74+
Manage friend requests.
75+
76+
- Request Body:
77+
78+
info: add string
79+
username: Recipient username
80+
81+
- Response:
82+
83+
200: Request success
84+
404: User not found
85+
86+
```GET /api/newfriends```
87+
88+
Get list of pending friend requests.
89+
90+
- Response:
91+
92+
200: Array of friend request objects
93+
401: Unauthorized
94+
95+
User Info
96+
97+
```GET /api/info```
98+
99+
Get user profile information.
100+
101+
- Request Header:
102+
103+
Authorization: JWT token
104+
105+
- Response:
106+
107+
200: User info object
108+
401: Invalid token
109+
110+
File Management
111+
112+
```POST /api/file/save```
113+
114+
Save a file.
115+
116+
- Request Body:
117+
118+
file: File data
119+
path: File path
120+
filename: Filename
121+
122+
- Response:
123+
124+
201: File saved
125+
500: Error saving file
126+
127+
```GET /api/file/get```
128+
129+
Get a file.
130+
131+
- Request Parameter:
132+
133+
filePath: Path of file on server
134+
135+
Response:
136+
137+
200: File data
138+
404: File not found

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Jing Li
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ mkdir build
5555
./run.sh
5656
```
5757
## API Documentation
58-
See API.md for details on APIs for authentication, user management, documents, etc.
58+
See [API.md](API.md) for details on APIs for authentication, user management, documents, etc.
5959

6060
## Contributing
6161
See CONTRIBUTING.md for contribution guidelines.
6262

6363
## License
64-
This project is licensed under the MIT License. See LICENSE for details.
64+
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
6565

6666
## Contact
67-
For any questions, please reach out at [email protected]
67+
For any questions, please reach out at [email protected]

README.zh_Hans.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<p align="center"><a href="#"><img width="100" src="https://s2.loli.net/2023/09/22/WsZuGM3S49DA8we.jpg" alt="Python logo"></a></p>
2+
<h2 align="center">Flypen</h2>
3+
<p align="center">
4+
<!-- <a href="https://travis-ci.com/github/ybygjylj/habits-apriori/"><img src="https://travis-ci.com/ybygjylj/habits-apriori.svg?branch=master" alt="Build Status"></a> -->
5+
<a href="https://raw.githubusercontent.com/ybygjylj/habits-apriori/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="LICENSE"></a>
6+
<a href="https://github.com/topics/cpp"><img src="https://img.shields.io/badge/language-c++-blue.svg" alt="languange"></a>
7+
<!-- <a href="https://gitter.im/habits-apriori/community"><img src="https://badges.gitter.im/Join%20Chat.svg" alt="chat"></a> -->
8+
</p>
9+
*以其他语言阅读: [英文](README.md), [简体中文](README.zh_Hans.md)
10+
11+
### C++ 课程设计
12+
### 协作软件后端
13+
这是办公协作软件Flypen的C++后端。
14+
15+
### 功能
16+
- 实时协作编辑文档
17+
- 聊天和通知
18+
- 用户管理和访问控制
19+
- 文档管理和存储(markdown)
20+
## 架构
21+
- 使用 C++ drogon famework 构建的服务器应用程序
22+
- 用于存储的 MariaDB 数据库
23+
- 客户端通信使用 REST API
24+
- 使用 MySQL Connector/C++ 8.1.0 连接数据库
25+
### 入门
26+
27+
#### 安装
28+
29+
```
30+
git clone https://github.com/stepbystepcode/flypen.git
31+
cd flypen
32+
git submodule update --init
33+
cd drogon
34+
git submodule update --init
35+
sudo apt install git gcc g++ cmake libjsoncpp-dev uuid-dev zlib1g-dev openssl libssl-dev
36+
mkdir build
37+
cd build
38+
cmake .
39+
make -j 8
40+
sudo make install
41+
cd ./...
42+
cd jwt-cpp
43+
mkdir build
44+
cd build
45+
cmake .
46+
make -j 8
47+
sudo make install
48+
cd ../..
49+
wget https://dev.mysql.com/get/Downloads/Connector-C++/mysql-connector-c++-8.1.0-linux-glibc2.28-x86-64bit.tar.gz
50+
tar zxvf mysql-connector-c++-8.1.0-linux-glibc2.28-x86-64bit.tar.gz
51+
mv mysql-connector-c++-8.1.0-linux-glibc2.28-x86-64bit mysql-connector
52+
rm mysql-connector-c++-8.1.0-linux-glibc2.28-x86-64bit.tar.gz
53+
mkdir build
54+
./run.sh
55+
```
56+
## API 文档
57+
请参阅 [API.md](API.md) 了解有关身份验证、用户管理、文档等 API 的详细信息。
58+
59+
## 投稿
60+
请参阅 [CONTRIBUTING.md](CONTRIBUTING.md),了解贡献指南。
61+
62+
## 许可证
63+
本项目采用 MIT 许可。详见 [LICENSE](LICENSE)
64+
65+
## 联系
66+
如有任何问题,请联系 [email protected]

run.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
echo "███████╗██╗░░░░░██╗░░░██╗██████╗░███████╗███╗░░██╗"
2+
echo "██╔════╝██║░░░░░╚██╗░██╔╝██╔══██╗██╔════╝████╗░██║"
3+
echo "█████╗░░██║░░░░░░╚████╔╝░██████╔╝█████╗░░██╔██╗██║"
4+
echo "██╔══╝░░██║░░░░░░░╚██╔╝░░██╔═══╝░██╔══╝░░██║╚████║"
5+
echo "██║░░░░░███████╗░░░██║░░░██║░░░░░███████╗██║░╚███║"
6+
echo "╚═╝░░░░░╚══════╝░░░╚═╝░░░╚═╝░░░░░╚══════╝╚═╝░░╚══╝"
17
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(pwd)/mysql-connector/lib64
28
export DYLD_LIBRARY_PATH=/Users/stepbystep/Documents/flypen/mysql-connector/lib64:$DYLD_LIBRARY_PATH
39
cd build

0 commit comments

Comments
 (0)