updownserver 1.0.2__py3-none-any.whl
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.
- updownserver/__init__.py +847 -0
- updownserver/__main__.py +4 -0
- updownserver/cgi.py +1015 -0
- updownserver-1.0.2.dist-info/METADATA +242 -0
- updownserver-1.0.2.dist-info/RECORD +9 -0
- updownserver-1.0.2.dist-info/WHEEL +5 -0
- updownserver-1.0.2.dist-info/entry_points.txt +2 -0
- updownserver-1.0.2.dist-info/licenses/LICENSE +22 -0
- updownserver-1.0.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: updownserver
|
|
3
|
+
Version: 1.0.2
|
|
4
|
+
Summary: A lightweight HTTP server with unified upload/download interface
|
|
5
|
+
Home-page: https://github.com/harry18456/updownserver
|
|
6
|
+
Author: Harry (Original by Densaugeo)
|
|
7
|
+
Author-email: harry18456@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Provides-Extra: qr
|
|
15
|
+
Requires-Dist: qrcode; extra == "qr"
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: author-email
|
|
18
|
+
Dynamic: classifier
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
Dynamic: provides-extra
|
|
24
|
+
Dynamic: requires-python
|
|
25
|
+
Dynamic: summary
|
|
26
|
+
|
|
27
|
+
# updownserver
|
|
28
|
+
|
|
29
|
+
A lightweight HTTP server with unified upload/download interface.
|
|
30
|
+
Based on the excellent [uploadserver](https://github.com/Densaugeo/uploadserver) by Densaugeo.
|
|
31
|
+
|
|
32
|
+
[繁體中文說明 (Traditional Chinese)](README_zh-tw.md)
|
|
33
|
+
|
|
34
|
+
[](https://mit-license.org/)
|
|
35
|
+
|
|
36
|
+
## Key Features
|
|
37
|
+
|
|
38
|
+
* **Unified Interface**: Drag & drop uploads, file management, and downloads all in one page.
|
|
39
|
+
* **File Management**: Create folders and delete files directly from the web UI.
|
|
40
|
+
* **Mobile Friendly**: Generate a QR code in the terminal for easy mobile access.
|
|
41
|
+
* **Security First**: Auto-shutdown timer (default 5 mins) and enforcing timeouts for unauthenticated sessions.
|
|
42
|
+
* **Docker Support**: Ready-to-use Dockerfile for containerized deployment.
|
|
43
|
+
* **Zero Dependency**: Core features run with standard Python libraries.
|
|
44
|
+
|
|
45
|
+
## Supported Platforms
|
|
46
|
+
|
|
47
|
+
| Platform | Supported? | Notes |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| Python 3.9+ | Yes | Tested on 3.9 through 3.14 every release. |
|
|
50
|
+
| Python 3.6-3.8 | No | Was supported by previous versions. |
|
|
51
|
+
| Python 3.5- | No | |
|
|
52
|
+
| Linux | Yes | Tested on Fedora and Ubuntu every release. |
|
|
53
|
+
| Windows | Yes | Occasional manual testing. Haven't noticed any obvious problems. |
|
|
54
|
+
| Mac | No idea | I don't have a Mac. Idk if it works or not. |
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
~~~bash
|
|
59
|
+
python3 -m pip install --user updownserver
|
|
60
|
+
# Optional: Install query dependencies for QR code support
|
|
61
|
+
python3 -m pip install --user updownserver[qr]
|
|
62
|
+
|
|
63
|
+
# Or using uv (Recommended for speed)
|
|
64
|
+
uv pip install updownserver[qr]
|
|
65
|
+
~~~
|
|
66
|
+
|
|
67
|
+
## Docker Support
|
|
68
|
+
|
|
69
|
+
Build the image:
|
|
70
|
+
~~~bash
|
|
71
|
+
docker build -t updownserver .
|
|
72
|
+
~~~
|
|
73
|
+
|
|
74
|
+
Run sharing the current directory (mapped to `/data` in the container):
|
|
75
|
+
~~~bash
|
|
76
|
+
# Linux/Mac
|
|
77
|
+
docker run -p 8000:8000 -v $(pwd):/data updownserver
|
|
78
|
+
|
|
79
|
+
# Windows (PowerShell)
|
|
80
|
+
docker run -p 8000:8000 -v ${PWD}:/data updownserver
|
|
81
|
+
~~~
|
|
82
|
+
|
|
83
|
+
Run with custom arguments (e.g., auto-shutdown disabled):
|
|
84
|
+
~~~bash
|
|
85
|
+
docker run -p 8000:8000 -v $(pwd):/data updownserver --timeout 0 --basic-auth user:pass
|
|
86
|
+
~~~
|
|
87
|
+
|
|
88
|
+
## Usage
|
|
89
|
+
|
|
90
|
+
Start the server:
|
|
91
|
+
~~~bash
|
|
92
|
+
python3 -m updownserver
|
|
93
|
+
~~~
|
|
94
|
+
|
|
95
|
+
Show a QR code for mobile connection (requires `updownserver[qr]`):
|
|
96
|
+
~~~bash
|
|
97
|
+
python3 -m updownserver --qr
|
|
98
|
+
~~~
|
|
99
|
+
|
|
100
|
+
To prevent forgetting to close the server, it auto-shutdowns after 300 seconds (5 minutes) by default.
|
|
101
|
+
To run indefinitely (**authentication required** for security):
|
|
102
|
+
~~~bash
|
|
103
|
+
python3 -m updownserver --timeout 0 --basic-auth user:pass
|
|
104
|
+
~~~
|
|
105
|
+
|
|
106
|
+
After the server starts, the unified upload/download interface is at the root URL.
|
|
107
|
+
This main page allows you to:
|
|
108
|
+
- **Download files**: Click on any file in the list.
|
|
109
|
+
- **Upload files**: Drag and drop files into the upload zone or use the file selector.
|
|
110
|
+
- **Manage files**: Create new folders or delete files (trash icon) directly from the UI. (**Note**: For security, these operations are disabled if no authentication is configured.)
|
|
111
|
+
|
|
112
|
+
The POST endpoint `/upload` is still available for programmatic access (e.g. cURL).
|
|
113
|
+
|
|
114
|
+
Warning: This is an upload server, and running it will allow uploads.
|
|
115
|
+
|
|
116
|
+
Now supports uploading multiple files at once! Select multiple files in the web page's file selector, or upload with cURL:
|
|
117
|
+
~~~bash
|
|
118
|
+
curl -X POST http://127.0.0.1:8000/upload -F 'files=@multiple-example-1.txt' -F 'files=@multiple-example-2.txt'
|
|
119
|
+
~~~
|
|
120
|
+
|
|
121
|
+
## Basic Authentication (downloads and uploads)
|
|
122
|
+
|
|
123
|
+
~~~bash
|
|
124
|
+
python3 -m updownserver --basic-auth hello:world
|
|
125
|
+
~~~
|
|
126
|
+
|
|
127
|
+
Now you can upload with basic authentication. For example:
|
|
128
|
+
~~~bash
|
|
129
|
+
curl -X POST http://127.0.0.1:8000/upload -F 'files=@basicauth-example.txt' -u hello:world
|
|
130
|
+
~~~
|
|
131
|
+
|
|
132
|
+
All requests without authentication will be rejected. Note that basic authentication credentials can be stolen if sent over plain HTTP, so this option is best used with HTTPS.
|
|
133
|
+
|
|
134
|
+
## Basic Authentication (uploads only)
|
|
135
|
+
|
|
136
|
+
~~~bash
|
|
137
|
+
python3 -m updownserver --basic-auth-upload hello:world
|
|
138
|
+
~~~
|
|
139
|
+
|
|
140
|
+
The same as above, but authentication is only required for upload operations.
|
|
141
|
+
|
|
142
|
+
If both `--basic-auth` and `--basic-auth-upload` are specified, all requests will require one of the two credentials, but only the `--basic-auth-upload` credentials will be able to upload files.
|
|
143
|
+
|
|
144
|
+
## Theme Option
|
|
145
|
+
|
|
146
|
+
The upload page supports a dark mode for showing white text on black background. If no option is specified, the color scheme is chosen from the client’s browser’s preference (which typically matches their operating system’s setting, if light or dark mode is supported by the OS). To enforce the light or dark theme, the CLI parameter `--theme` can be used:
|
|
147
|
+
~~~bash
|
|
148
|
+
python3 -m updownserver --theme light
|
|
149
|
+
~~~
|
|
150
|
+
or
|
|
151
|
+
~~~bash
|
|
152
|
+
python3 -m updownserver --theme dark
|
|
153
|
+
~~~
|
|
154
|
+
|
|
155
|
+
## HTTPS Option
|
|
156
|
+
|
|
157
|
+
Run with HTTPS and without client authentication:
|
|
158
|
+
~~~bash
|
|
159
|
+
# Generate self-signed server certificate
|
|
160
|
+
openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'
|
|
161
|
+
|
|
162
|
+
# The server root should not contain the certificate, for security reasons
|
|
163
|
+
cd server-root
|
|
164
|
+
python3 -m updownserver --server-certificate server.pem
|
|
165
|
+
|
|
166
|
+
# Connect as a client
|
|
167
|
+
curl -X POST https://localhost:8000/upload --insecure -F files=@simple-example.txt
|
|
168
|
+
~~~
|
|
169
|
+
|
|
170
|
+
Run with HTTPS and with client authentication:
|
|
171
|
+
~~~bash
|
|
172
|
+
# Generate self-signed server certificate
|
|
173
|
+
openssl req -x509 -out server.pem -keyout server.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=server'
|
|
174
|
+
|
|
175
|
+
# Generate self-signed client certificate
|
|
176
|
+
openssl req -x509 -out client.pem -keyout client.pem -newkey rsa:2048 -nodes -sha256 -subj '/CN=client'
|
|
177
|
+
|
|
178
|
+
# Extract public key from self-signed client certificate
|
|
179
|
+
openssl x509 -in client.pem -out client.crt
|
|
180
|
+
|
|
181
|
+
# The server root should not contain the certificates, for security reasons
|
|
182
|
+
cd server-root
|
|
183
|
+
python3 -m updownserver --server-certificate server.pem --client-certificate client.crt
|
|
184
|
+
|
|
185
|
+
# Connect as a client
|
|
186
|
+
curl -X POST https://localhost:8000/upload --insecure --cert client.pem -F files=@mtls-example.txt
|
|
187
|
+
~~~
|
|
188
|
+
|
|
189
|
+
Note: This uses a self-signed server certificate which clients such as web browser and cURL will warn about. Most browsers will allow you to proceed after adding an exception, and cURL will work if given the -k/--insecure option. Using your own certificate from a certificate authority will avoid these warnings.
|
|
190
|
+
|
|
191
|
+
## Available Options
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
usage: __main__.py [-h] [--cgi] [--allow-replace] [--bind ADDRESS]
|
|
195
|
+
[--directory DIRECTORY] [--theme {light,auto,dark}]
|
|
196
|
+
[--server-certificate SERVER_CERTIFICATE]
|
|
197
|
+
[--client-certificate CLIENT_CERTIFICATE]
|
|
198
|
+
[--basic-auth BASIC_AUTH]
|
|
199
|
+
[--basic-auth-upload BASIC_AUTH_UPLOAD] [--timeout TIMEOUT]
|
|
200
|
+
[--qr]
|
|
201
|
+
[port]
|
|
202
|
+
|
|
203
|
+
positional arguments:
|
|
204
|
+
port Specify alternate port [default: 8000]
|
|
205
|
+
|
|
206
|
+
options:
|
|
207
|
+
-h, --help show this help message and exit
|
|
208
|
+
--cgi Run as CGI Server
|
|
209
|
+
--allow-replace Replace existing file if uploaded file has the same
|
|
210
|
+
name. Auto rename by default.
|
|
211
|
+
--bind, -b ADDRESS Specify alternate bind address [default: all
|
|
212
|
+
interfaces]
|
|
213
|
+
--directory, -d DIRECTORY
|
|
214
|
+
Specify alternative directory [default:current
|
|
215
|
+
directory]
|
|
216
|
+
--theme {light,auto,dark}
|
|
217
|
+
Specify a light or dark theme for the upload page
|
|
218
|
+
[default: auto]
|
|
219
|
+
--server-certificate, --certificate, -c SERVER_CERTIFICATE
|
|
220
|
+
Specify HTTPS server certificate to use [default:
|
|
221
|
+
none]
|
|
222
|
+
--client-certificate CLIENT_CERTIFICATE
|
|
223
|
+
Specify HTTPS client certificate to accept for mutual
|
|
224
|
+
TLS [default: none]
|
|
225
|
+
--basic-auth BASIC_AUTH
|
|
226
|
+
Specify user:pass for basic authentication (downloads
|
|
227
|
+
and uploads)
|
|
228
|
+
--basic-auth-upload BASIC_AUTH_UPLOAD
|
|
229
|
+
Specify user:pass for basic authentication (uploads
|
|
230
|
+
only)
|
|
231
|
+
--timeout TIMEOUT Auto-shutdown server after N seconds (0 to disable)
|
|
232
|
+
[default: 300]
|
|
233
|
+
--qr Show QR code at startup
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
## Acknowledgements
|
|
240
|
+
|
|
241
|
+
Special thanks to [Densaugeo](https://github.com/Densaugeo) and all contributors of the original [uploadserver](https://github.com/Densaugeo/uploadserver) project for providing the solid foundation for this tool.
|
|
242
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
updownserver/__init__.py,sha256=V-pDeCWrL9IB4I46KNDI2wdDG9SaCFdSDdXyZUZZTFQ,32176
|
|
2
|
+
updownserver/__main__.py,sha256=Mk6uj8tDqKqncunzXt_uVB2nECHkJKHL7HT2FIbQEhc,72
|
|
3
|
+
updownserver/cgi.py,sha256=HoNbum1t52qTe9qtAN-iwkbjFWEyfS-O7vem7ueq2W0,34575
|
|
4
|
+
updownserver-1.0.2.dist-info/licenses/LICENSE,sha256=-y64riz_nGVQhvdMSkybdv_GmoFE79CZ_oYbjAmHzRs,1091
|
|
5
|
+
updownserver-1.0.2.dist-info/METADATA,sha256=QnfOxjHh8VqnPg2Q2hXDHqYyZ4BUHGfgCEXzVFdm0c0,9109
|
|
6
|
+
updownserver-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
updownserver-1.0.2.dist-info/entry_points.txt,sha256=eslbtoY0Qf6-s1kGYZR00g6KZZp_8ZZwxNhXclwY-dg,51
|
|
8
|
+
updownserver-1.0.2.dist-info/top_level.txt,sha256=ejojNAY5J3t8Ga9h13Ma_KcV76kDZTLPxHw6PZsfBNY,13
|
|
9
|
+
updownserver-1.0.2.dist-info/RECORD,,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Densaugeo
|
|
4
|
+
Copyright (c) 2026 Harry
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
updownserver
|