Skip to content

Commit 9a80d7a

Browse files
committed
fix: #350 需要通过添加反代确保真实IP来源
1 parent eeb70c7 commit 9a80d7a

File tree

2 files changed

+68
-4
lines changed

2 files changed

+68
-4
lines changed

readme.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
</div>
2121

22-
2322
## 🚀 更新计划
23+
2424
- [ ] 切片上传,同文件秒传,断点续传
2525
- [ ] 文件收集功能
2626

@@ -47,6 +47,7 @@ FileCodeBox 是一个基于 FastAPI + Vue3 开发的轻量级文件分享工具
4747
</div>
4848

4949
### 新版界面
50+
5051
<div align="center">
5152
<table>
5253
<tr>
@@ -69,6 +70,7 @@ FileCodeBox 是一个基于 FastAPI + Vue3 开发的轻量级文件分享工具
6970
</div>
7071

7172
### 经典界面
73+
7274
<div align="center">
7375
<table>
7476
<tr>
@@ -143,6 +145,7 @@ FileCodeBox 是一个基于 FastAPI + Vue3 开发的轻量级文件分享工具
143145
- IP 限制上传次数
144146
- 错误次数限制
145147
- 文件过期机制
148+
146149
</td>
147150
<td align="center">
148151
<h4>🎫 提取码分享</h4>
@@ -188,11 +191,13 @@ FileCodeBox 是一个基于 FastAPI + Vue3 开发的轻量级文件分享工具
188191
### Docker 部署
189192

190193
#### Docker CLI
194+
191195
```bash
192196
docker run -d --restart=always -p 12345:12345 -v /opt/FileCodeBox/:/app/data --name filecodebox lanol/filecodebox:beta
193197
```
194198

195199
#### Docker Compose
200+
196201
```yml
197202
version: "3"
198203
services:
@@ -208,45 +213,64 @@ volumes:
208213
external: false
209214
```
210215
216+
### 配置反向代理(Nginx示例)
217+
218+
请注意,必须添加以下配置来确保正确处理客户端IP和代理请求:
219+
220+
```nginx
221+
location / {
222+
proxy_set_header X-Real-IP $remote_addr; # 设置真实客户端IP
223+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
224+
proxy_pass http://localhost:12345;
225+
}
226+
```
227+
211228
### 手动部署
212229

213230
1. 克隆项目
231+
214232
```bash
215233
git clone https://github.com/vastsa/FileCodeBox.git
216234
```
217235

218236
2. 安装依赖
237+
219238
```bash
220239
cd FileCodeBox
221240
pip install -r requirements.txt
222241
```
223242

224243
3. 启动服务
244+
225245
```bash
226246
python main.py
227247
```
228248

229249
## 📖 使用说明
230250

231251
### 分享文件
252+
232253
1. 打开网页,点击"分享文件"
233254
2. 选择或拖拽文件
234255
3. 设置过期时间和次数
235256
4. 获取提取码
236257

237258
### 获取文件
259+
238260
1. 打开网页,输入提取码
239261
2. 点击获取
240262
3. 下载文件或查看文本
241263

242264
### 管理面板
265+
243266
1. 访问 `/#/admin`
244267
2. 输入管理员密码 `FileCodeBox2023`
245268
3. 管理文件和配置
246269

247270
## 🛠 开发指南
248271

249272
### 项目结构
273+
250274
```
251275
FileCodeBox/
252276
├── apps/ # 应用代码
@@ -258,18 +282,22 @@ FileCodeBox/
258282
```
259283

260284
### 开发环境
285+
261286
- Python 3.8+
262287
- Node.js 14+
263288
- Vue 3
264289
- FastAPI
265290

266291
### 本地开发
292+
267293
1. 后端开发
294+
268295
```bash
269296
python main.py
270297
```
271298

272299
2. 前端开发
300+
273301
```bash
274302
cd fcb-fronted
275303
npm install
@@ -287,12 +315,15 @@ npm run dev
287315
## ❓ 常见问题
288316

289317
### Q: 如何修改上传大小限制?
318+
290319
A: 在管理面板中修改配置项 `uploadSize`
291320

292321
### Q: 如何配置存储引擎?
322+
293323
A: 在管理面板中选择存储引擎并配置相应参数
294324

295325
### Q: 如何备份数据?
326+
296327
A: 备份 `data` 目录即可
297328

298329
更多问题请访问 [Wiki](https://github.com/vastsa/FileCodeBox/wiki/常见问题)

readme_en.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
## 📝 Introduction
2323

24-
FileCodeBox is a lightweight file sharing tool developed with FastAPI + Vue3. It allows users to share text and files easily, where recipients only need a passcode to retrieve the files, just like picking up a package from a delivery locker.
24+
FileCodeBox is a lightweight file sharing tool developed with FastAPI + Vue3. It allows users to share text and files
25+
easily, where recipients only need a passcode to retrieve the files, just like picking up a package from a delivery
26+
locker.
2527

2628
## 🖼️ Preview
2729

@@ -41,6 +43,7 @@ FileCodeBox is a lightweight file sharing tool developed with FastAPI + Vue3. It
4143
</div>
4244

4345
### New Interface
46+
4447
<div align="center">
4548
<table>
4649
<tr>
@@ -63,6 +66,7 @@ FileCodeBox is a lightweight file sharing tool developed with FastAPI + Vue3. It
6366
</div>
6467

6568
### Classic Interface
69+
6670
<div align="center">
6771
<table>
6872
<tr>
@@ -137,6 +141,7 @@ Support text and various file types
137141
- IP upload limits
138142
- Error attempt limits
139143
- File expiration
144+
140145
</td>
141146
<td align="center">
142147
<h4>🎫 Passcode Sharing</h4>
@@ -181,13 +186,14 @@ Command-line download
181186

182187
### Docker Deployment
183188

184-
185189
#### Docker CLI
190+
186191
```bash
187192
docker run -d --restart=always -p 12345:12345 -v /opt/FileCodeBox/:/app/data --name filecodebox lanol/filecodebox:beta
188193
```
189194

190195
#### Docker Compose
196+
191197
```yml
192198
version: "3"
193199
services:
@@ -203,45 +209,64 @@ volumes:
203209
external: false
204210
```
205211
212+
### Configure reverse proxy (Nginx example)
213+
214+
Please note that the following configurations must be added to ensure proper handling of client IP and proxy requests:
215+
216+
```nginx
217+
location / {
218+
proxy_set_header X-Real-IP $remote_addr; #Set real client IP
219+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
220+
proxy_pass http://localhost:12345 ;
221+
}
222+
```
223+
206224
### Manual Deployment
207225

208226
1. Clone the repository
227+
209228
```bash
210229
git clone https://github.com/vastsa/FileCodeBox.git
211230
```
212231

213232
2. Install dependencies
233+
214234
```bash
215235
cd FileCodeBox
216236
pip install -r requirements.txt
217237
```
218238

219239
3. Start the service
240+
220241
```bash
221242
python main.py
222243
```
223244

224245
## 📖 Usage Guide
225246

226247
### Share Files
248+
227249
1. Open the website, click "Share File"
228250
2. Select or drag files
229251
3. Set expiration time and count
230252
4. Get the passcode
231253

232254
### Retrieve Files
255+
233256
1. Open the website, enter passcode
234257
2. Click retrieve
235258
3. Download file or view text
236259

237260
### Admin Panel
261+
238262
1. Visit `/admin`
239263
2. Enter admin password
240264
3. Manage files and settings
241265

242266
## 🛠 Development Guide
243267

244268
### Project Structure
269+
245270
```
246271
FileCodeBox/
247272
├── apps/ # Application code
@@ -253,18 +278,22 @@ FileCodeBox/
253278
```
254279

255280
### Development Environment
281+
256282
- Python 3.8+
257283
- Node.js 14+
258284
- Vue 3
259285
- FastAPI
260286

261287
### Local Development
288+
262289
1. Backend development
290+
263291
```bash
264292
python main.py
265293
```
266294

267295
2. Frontend development
296+
268297
```bash
269298
cd fcb-fronted
270299
npm install
@@ -282,12 +311,15 @@ npm run dev
282311
## ❓ FAQ
283312

284313
### Q: How to modify upload size limit?
314+
285315
A: Change `uploadSize` in admin panel
286316

287317
### Q: How to configure storage engine?
318+
288319
A: Select storage engine and configure parameters in admin panel
289320

290321
### Q: How to backup data?
322+
291323
A: Backup the `data` directory
292324

293325
For more questions, visit [Wiki](https://github.com/vastsa/FileCodeBox/wiki/常见问题)
@@ -304,4 +336,5 @@ For more questions, visit [Wiki](https://github.com/vastsa/FileCodeBox/wiki/常
304336

305337
## 📜 Disclaimer
306338

307-
This project is open-source for learning purposes only. It should not be used for any illegal purposes. The author is not responsible for any consequences. Please retain the project address and copyright information when using it.
339+
This project is open-source for learning purposes only. It should not be used for any illegal purposes. The author is
340+
not responsible for any consequences. Please retain the project address and copyright information when using it.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy