|
6 months ago | |
---|---|---|
cmd/contented | 2 years ago | |
doc | 2 years ago | |
static | 3 years ago | |
.gitignore | 2 years ago | |
Makefile | 2 years ago | |
Metadata.go | 2 years ago | |
README.md | 6 months ago | |
Server.go | 2 years ago | |
download.go | 2 years ago | |
go.mod | 6 months ago | |
go.sum | 6 months ago | |
preview.go | 2 years ago | |
staticResources.go | 3 years ago | |
thumb.go | 2 years ago | |
upload.go | 6 months ago |
A file / image / paste upload server with a focus on embedding.
You can use contented as a standalone upload server, or you can use the SDK to embed its upload widget into another website.
Usage of contented:
-data string
Directory for stored content (default "")
-db string
Path for metadata database (default "contented.db")
-diskFilesWorldReadable
Save files as 0644 instead of 0600
-enableHomepage
Enable homepage (disable for embedded use only) (default true)
-listen string
IP/Port to bind server (default "127.0.0.1:80")
-max int
Maximum size of uploaded files in MiB (set zero for unlimited) (default 8)
-speed int
Maximum upload speed in bytes/sec (set zero for unlimited)
-title string
Title used in web interface (default "contented")
-trustXForwardedFor
Trust X-Forwarded-For reverse proxy headers
-concurrentthumbs
Simultaneous thumbnail generation (default 16)
If you are hosting behind a reverse proxy, remember to set its post body size parameter appropriately (e.g. client_max_body_size
for nginx).
The server responds on the following URLs:
URL | Method | Description |
---|---|---|
/get/{ID} |
GET |
Download item content |
/info/{ID} |
GET |
Get item content metadata (JSON) |
/thumb/{Type}/{ID} |
GET |
Get item thumbnail image |
/about |
GET |
Get server metadata (JSON) |
Your webpage should load the SDK from the contented server, then call the contented.init
function to display the upload widget over the top of an existing DOM element. Your callback will be passed an array of file IDs of any uploaded items.
<script type="text/javascript" src="SERVER_ADDR/sdk.js"></script>
contented.init("#target", function(/* String[] */ items) {});
2020-07-25: 1.3.1
2020-07-25: 1.3.0
2018-06-09: 1.2.1
2017-11-18: 1.2.0
/p/{file1}-{file2}-...
)-diskFilesWorldReadable
option to save files with 0644
mode2017-10-15: 1.1.0
getDownloadURL
, getInfoJSONURL
, getPreviewURL
SDK methods2017-10-08: 1.0.1
2017-10-08: 1.0.0