ttup 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ttup-2.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ttup
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.
ttup-2.1.0/MANIFEST.in ADDED
@@ -0,0 +1,6 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include ttup *.py
4
+ recursive-include ttup/static *
5
+ global-exclude __pycache__
6
+ global-exclude *.py[co]
ttup-2.1.0/PKG-INFO ADDED
@@ -0,0 +1,488 @@
1
+ Metadata-Version: 2.4
2
+ Name: ttup
3
+ Version: 2.1.0
4
+ Summary: 终端文件上传工具 - 支持网页版和命令行上传
5
+ Home-page: https://codeberg.org/ttup/ttup
6
+ Author: ttup
7
+ Author-email: ttupio@bf00.com
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Requires-Python: >=3.8
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: click>=8.0.0
23
+ Requires-Dist: requests>=2.28.0
24
+ Requires-Dist: fastapi>=0.100.0
25
+ Requires-Dist: uvicorn[standard]>=0.23.0
26
+ Requires-Dist: python-multipart>=0.0.6
27
+ Dynamic: author
28
+ Dynamic: author-email
29
+ Dynamic: classifier
30
+ Dynamic: description
31
+ Dynamic: description-content-type
32
+ Dynamic: home-page
33
+ Dynamic: license-file
34
+ Dynamic: requires-dist
35
+ Dynamic: requires-python
36
+ Dynamic: summary
37
+
38
+ <div align="center">
39
+
40
+ <img src="https://img.shields.io/badge/ttup-文件上传工具-667eea?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0id2hpdGUiPjxwYXRoIGQ9Ik0xOSAzSDVjLTEuMSAwLTIgLjktMiAydjE0YzAgMS4xLjkgMiAyIDJoMTRjMS4xIDAgMi0uOSAyLTJWNWMwLTEuMS0uOS0yLTItMnptLTUgMTRIN3YtMmg3djJ6bTMtNEg3di0yaDEwdjJ6bTAtNEg3VjdoMTB2MnoiLz48L3N2Zz4=" alt="ttup" />
41
+
42
+ **简单高效的终端文件上传工具**
43
+
44
+ [![Python Version](https://img.shields.io/badge/python-3.8%2B-blue?style=flat-square)](https://www.python.org/downloads/)
45
+ [![License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE)
46
+ [![Version](https://img.shields.io/badge/version-2.1.0-orange?style=flat-square)](https://codeberg.org/ttup/ttup)
47
+ [![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey?style=flat-square)]()
48
+
49
+ 一款轻量级的文件传输工具,支持网页端和命令行,让文件分享变得简单快捷。
50
+
51
+ [快速开始](#-快速开始) · [功能特性](#-功能特性) · [安装](#-安装) · [使用文档](#-使用文档) · [贡献](#-贡献)
52
+
53
+ </div>
54
+
55
+ ---
56
+
57
+ ## 🎯 什么是 ttup?
58
+
59
+ ttup 是一个**开箱即用**的文件传输工具,无需复杂的配置,一行命令即可启动服务端,一行命令即可上传文件。
60
+
61
+ **适用场景:**
62
+ - 📤 临时分享文件给同事/朋友
63
+ - 📱 跨设备文件传输
64
+ - 🔒 敏感文件阅后即焚
65
+ - 🤖 脚本自动化文件分发
66
+ - 🏠 家庭/团队私有文件服务
67
+
68
+ ---
69
+
70
+ ## ✨ 功能特性
71
+
72
+ <table>
73
+ <tr>
74
+ <td width="50%">
75
+
76
+ ### 🖥️ 多端支持
77
+ - **网页版** - 拖拽上传,简洁美观
78
+ - **命令行** - 终端快速操作
79
+ - **curl** - 脚本友好接口
80
+ - **API** - 完整 RESTful 接口
81
+
82
+ </td>
83
+ <td width="50%">
84
+
85
+ ### 🔒 安全可控
86
+ - **过期时间** - 1s/1m/1h/1d/1w
87
+ - **下载限制** - 阅后即焚模式
88
+ - **自动清理** - 过期文件自动删除
89
+ - **唯一ID** - 8位取件码
90
+
91
+ </td>
92
+ </tr>
93
+ <tr>
94
+ <td width="50%">
95
+
96
+ ### 🎯 简洁高效
97
+ - **零配置** - 开箱即用
98
+ - **真实IP** - 自动识别
99
+ - **无数据库** - 文件存储
100
+ - **轻量级** - 最小依赖
101
+
102
+ </td>
103
+ <td width="50%">
104
+
105
+ ### 📦 跨平台
106
+ - **Linux** - 全面支持
107
+ - **macOS** - 原生体验
108
+ - **Windows** - 无缝运行
109
+ - **Python 3.8+** - 广泛兼容
110
+
111
+ </td>
112
+ </tr>
113
+ </table>
114
+
115
+ ---
116
+
117
+ ## 📦 安装
118
+
119
+ ### 方式一:下载 Wheel 包(推荐)
120
+
121
+ ```bash
122
+ # 下载最新的 wheel 包
123
+ pip install ttup-2.1.0-py3-none-any.whl
124
+ ```
125
+
126
+ ### 方式二:源码安装
127
+
128
+ ```bash
129
+ git clone https://codeberg.org/ttup/ttup.git
130
+ cd ttup
131
+ pip install -e .
132
+ ```
133
+
134
+ <details>
135
+ <summary>📋 系统要求</summary>
136
+
137
+ | 项目 | 要求 |
138
+ |------|------|
139
+ | Python | 3.8+ |
140
+ | 操作系统 | Linux / macOS / Windows |
141
+ | 依赖 | fastapi, uvicorn, click, requests |
142
+ | 存储 | 根据文件大小决定 |
143
+
144
+ </details>
145
+
146
+ ---
147
+
148
+ ## 🚀 快速开始
149
+
150
+ ### 1️⃣ 启动服务端
151
+
152
+ ```bash
153
+ ttup-server
154
+ ```
155
+
156
+ ```
157
+ ==================================================
158
+ ttup 文件上传服务 v2.1.0
159
+ ==================================================
160
+ 上传目录: /home/user/.ttup/uploads
161
+ 监听地址: http://0.0.0.0:7888
162
+ ==================================================
163
+ 访问 http://localhost:7888 使用网页版
164
+ ==================================================
165
+ ```
166
+
167
+ <details>
168
+ <summary>⚙️ 自定义配置</summary>
169
+
170
+ ```bash
171
+ # 指定端口
172
+ ttup-server -p 9000
173
+
174
+ # 指定上传目录
175
+ ttup-server -d /path/to/uploads
176
+
177
+ # 指定绑定地址
178
+ ttup-server -H 127.0.0.1
179
+
180
+ # 组合使用
181
+ ttup-server -p 9000 -H 0.0.0.0 -d ~/my-uploads
182
+ ```
183
+
184
+ </details>
185
+
186
+ ### 2️⃣ 上传文件
187
+
188
+ **方式一:网页版** → 浏览器打开 `http://localhost:7888`
189
+
190
+ **方式二:命令行**
191
+ ```bash
192
+ ttup document.pdf
193
+ ```
194
+
195
+ **方式三:curl**
196
+ ```bash
197
+ curl -F "file=@document.pdf" http://localhost:7888/upload
198
+ ```
199
+
200
+ ### 3️⃣ 下载文件
201
+
202
+ ```bash
203
+ # 命令行下载
204
+ curl -O http://localhost:7888/file/abc12345
205
+
206
+ # 或直接浏览器打开链接
207
+ ```
208
+
209
+ ---
210
+
211
+ ## 📖 使用文档
212
+
213
+ ### 客户端命令 (ttup)
214
+
215
+ ```
216
+ 用法: ttup [OPTIONS] FILENAME
217
+
218
+ 选项:
219
+ -s, --server TEXT 服务端地址
220
+ -e, --expires-in TEXT 过期时间 (1h, 24h, 7d)
221
+ -n, --max-downloads INT 最大下载次数
222
+ -v, --verbose 详细输出
223
+ -V, --version 显示版本
224
+ -h, --help [cn|en] 显示帮助 (默认中文,en=英文)
225
+
226
+ 环境变量:
227
+ TTUP_SERVER 默认服务端地址
228
+ ```
229
+
230
+ <details>
231
+ <summary>🌐 English Help</summary>
232
+
233
+ ```
234
+ USAGE: ttup [OPTIONS] FILENAME
235
+
236
+ OPTIONS:
237
+ -s, --server TEXT Server address (default: from TTUP_SERVER env)
238
+ -e, --expires-in TEXT Expiration time (e.g., 1h, 24h, 7d)
239
+ -n, --max-downloads INT Maximum download count
240
+ -v, --verbose Show detailed output
241
+ -V, --version Show version
242
+ -h, --help [cn|en] Show help (cn=Chinese, en=English)
243
+
244
+ ENVIRONMENT:
245
+ TTUP_SERVER Default server address
246
+ ```
247
+
248
+ </details>
249
+
250
+ ### 服务端命令 (ttup-server)
251
+
252
+ ```
253
+ 用法: ttup-server [OPTIONS]
254
+
255
+ 选项:
256
+ -p, --port INTEGER 端口 (默认: 7888)
257
+ -H, --host TEXT 地址 (默认: 0.0.0.0)
258
+ -d, --dir TEXT 目录 (默认: ~/.ttup/uploads)
259
+ -V, --version 显示版本
260
+ -h, --help [cn|en] 显示帮助 (默认中文,en=英文)
261
+ ```
262
+
263
+ <details>
264
+ <summary>🌐 English Help</summary>
265
+
266
+ ```
267
+ USAGE: ttup-server [OPTIONS]
268
+
269
+ OPTIONS:
270
+ -p, --port INTEGER Server port (default: 7888)
271
+ -H, --host TEXT Bind address (default: 0.0.0.0)
272
+ -d, --dir TEXT Upload directory (default: ~/.ttup/uploads)
273
+ -V, --version Show version
274
+ -h, --help [cn|en] Show help (cn=Chinese, en=English)
275
+ ```
276
+
277
+ </details>
278
+
279
+ ### 使用示例
280
+
281
+ ```bash
282
+ # 基本上传
283
+ ttup file.pdf
284
+
285
+ # 1小时后过期
286
+ ttup -e 1h file.pdf
287
+
288
+ # 只能下载3次
289
+ ttup -n 3 file.pdf
290
+
291
+ # 阅后即焚
292
+ ttup -n 1 secret.txt
293
+
294
+ # 组合使用:24小时或下载5次后失效
295
+ ttup -e 24h -n 5 bigfile.zip
296
+
297
+ # 指定服务端
298
+ ttup -s http://192.168.1.100:7888 file.pdf
299
+
300
+ # 使用环境变量
301
+ export TTUP_SERVER=http://your-server:7888
302
+ ttup file.pdf
303
+ ```
304
+
305
+ ### 过期时间格式
306
+
307
+ | 参数 | 说明 | 使用场景 |
308
+ |------|------|----------|
309
+ | `1s` | 1秒 | 临时分享 |
310
+ | `1m` | 1分钟 | 快速传输 |
311
+ | `1h` | 1小时 | 短期分享 |
312
+ | `24h` | 24小时 | 日常使用 |
313
+ | `7d` | 7天 | 一周有效 |
314
+ | `30d` | 30天 | 长期存储 |
315
+
316
+ ---
317
+
318
+ ## 🌐 API 接口
319
+
320
+ ### 接口列表
321
+
322
+ | 方法 | 路径 | 说明 |
323
+ |------|------|------|
324
+ | `POST` | `/upload` | 上传文件 |
325
+ | `GET` | `/file/{id}` | 下载文件 |
326
+ | `GET` | `/info/{id}` | 文件信息 |
327
+ | `DELETE` | `/file/{id}` | 删除文件 |
328
+ | `GET` | `/health` | 健康检查 |
329
+
330
+ ### 上传示例
331
+
332
+ ```bash
333
+ # 基本上传
334
+ curl -F "file=@test.txt" http://localhost:7888/upload
335
+
336
+ # 带过期时间
337
+ curl -F "file=@test.txt" -F "expires_in=24h" http://localhost:7888/upload
338
+
339
+ # 带下载限制
340
+ curl -F "file=@test.txt" -F "max_downloads=5" http://localhost:7888/upload
341
+
342
+ # 完整参数
343
+ curl -F "file=@test.txt" \
344
+ -F "expires_in=24h" \
345
+ -F "max_downloads=5" \
346
+ http://localhost:7888/upload
347
+ ```
348
+
349
+ ### 响应示例
350
+
351
+ ```json
352
+ {
353
+ "file_id": "abc12345",
354
+ "filename": "test.txt",
355
+ "ext": ".txt",
356
+ "size": 1024,
357
+ "url": "http://192.168.1.100:7888/file/abc12345",
358
+ "expires_at": "2026-02-20T10:00:00",
359
+ "max_downloads": 5
360
+ }
361
+ ```
362
+
363
+ ---
364
+
365
+ ## 🚢 生产部署
366
+
367
+ ### 后台运行
368
+
369
+ ```bash
370
+ # 使用 nohup
371
+ nohup ttup-server > /var/log/ttup.log 2>&1 &
372
+
373
+ # 查看日志
374
+ tail -f /var/log/ttup.log
375
+ ```
376
+
377
+ ### Nginx 反向代理
378
+
379
+ ```nginx
380
+ server {
381
+ listen 80;
382
+ server_name your-domain.com;
383
+
384
+ location / {
385
+ proxy_pass http://127.0.0.1:7888;
386
+ proxy_set_header Host $host;
387
+ proxy_set_header X-Real-IP $remote_addr;
388
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
389
+ client_max_body_size 100M;
390
+ }
391
+ }
392
+ ```
393
+
394
+ ### HTTPS 配置
395
+
396
+ ```bash
397
+ # 使用 Certbot
398
+ sudo apt install certbot python3-certbot-nginx
399
+ sudo certbot --nginx -d your-domain.com
400
+ ```
401
+
402
+ ### 防火墙配置
403
+
404
+ ```bash
405
+ # Ubuntu/Debian
406
+ sudo ufw allow 7888/tcp
407
+
408
+ # CentOS/RHEL
409
+ sudo firewall-cmd --add-port=7888/tcp --permanent
410
+ sudo firewall-cmd --reload
411
+ ```
412
+
413
+ ---
414
+
415
+ ## 📁 项目结构
416
+
417
+ ```
418
+ ttup/
419
+ ├── ttup/
420
+ │ ├── __init__.py # 包初始化
421
+ │ ├── __main__.py # 服务端入口
422
+ │ ├── cli.py # 客户端 CLI
423
+ │ ├── ttup_server.py # FastAPI 服务
424
+ │ └── static/
425
+ │ └── index.html # 网页界面
426
+ ├── setup.py # 安装配置
427
+ ├── LICENSE # MIT 许可证
428
+ └── README.md # 说明文档
429
+ ```
430
+
431
+ ---
432
+
433
+ ---
434
+
435
+ ## 🤝 贡献
436
+
437
+ 欢迎贡献代码、报告问题或提出建议!
438
+
439
+ 1. Fork 本仓库
440
+ 2. 创建特性分支 (`git checkout -b feature/AmazingFeature`)
441
+ 3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)
442
+ 4. 推送到分支 (`git push origin feature/AmazingFeature`)
443
+ 5. 提交 Pull Request
444
+
445
+ ---
446
+
447
+ ## 📝 更新日志
448
+
449
+ ### v2.1.0 (2026-02-20)
450
+ - ✨ 添加中英文双语帮助支持
451
+ - ✨ 优化帮助文本,移除冗余信息
452
+ - 🐛 修复多项问题
453
+
454
+ ### v2.0.0 (2026-02-19)
455
+ - 🎉 首次发布
456
+ - ✅ 基础文件上传/下载功能
457
+ - ✅ 过期时间支持
458
+ - ✅ 下载次数限制
459
+ - ✅ 自动清理功能
460
+ - ✅ 网页界面
461
+ - ✅ 命令行工具
462
+
463
+ ---
464
+
465
+ ## 📜 许可证
466
+
467
+ 本项目基于 [MIT License](LICENSE) 开源。
468
+
469
+ ---
470
+
471
+ ## 🔗 相关链接
472
+
473
+ | 链接 | 地址 |
474
+ |------|------|
475
+ | 项目主页 | https://codeberg.org/ttup/ttup |
476
+ | 问题反馈 | https://codeberg.org/ttup/ttup/issues |
477
+
478
+ ---
479
+
480
+ <div align="center">
481
+
482
+ **如果觉得有用,请给个 ⭐ Star 支持一下!**
483
+
484
+ [![Star History Chart](https://api.star-history.com/svg?repos=ttup/ttup&type=Date)](https://star-history.com/#ttup/ttup&Date)
485
+
486
+ **Made with ❤️ by ttup**
487
+
488
+ </div>