A file / image / paste upload server with a focus on embedding. https://code.ivysaur.me/contented/
Go to file
mappu bfd669bc96 doc: update changelog for v1.5.1 2023-05-20 14:33:21 +12:00
cmd contented-multi: initial commit 2023-05-19 19:15:15 +12:00
doc doc: move marketing images to /doc/ subdir 2018-10-06 13:49:00 +13:00
static albums: support custom album titles 2023-05-17 19:21:48 +12:00
.gitignore gitignore: exclude for go build in contented-multi directory 2023-05-19 19:15:15 +12:00
Makefile server: replace go-bindata with stdlib embed.FS 2023-05-17 17:24:47 +12:00
Metadata.go upload: return error if the short IDs collide for whatever reason 2023-05-17 18:54:30 +12:00
README.md doc: update changelog for v1.5.1 2023-05-20 14:33:21 +12:00
Server.go s3 backend support 2023-05-19 19:15:15 +12:00
download.go s3 backend support 2023-05-19 19:15:15 +12:00
go.mod go: import minio-go library (Apache-2.0 license) 2023-05-19 19:15:15 +12:00
go.sum go: import minio-go library (Apache-2.0 license) 2023-05-19 19:15:15 +12:00
preview.go preview: support skipping over single missing images inside large albums 2023-05-20 13:50:46 +12:00
storage.go s3 backend support 2023-05-19 19:15:15 +12:00
thumb.go s3 backend support 2023-05-19 19:15:15 +12:00
upload.go s3 backend support 2023-05-19 19:15:15 +12:00

README.md

contented

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.

The name is a pun on "content" and the -d suffix for server daemons.

Features

  • Use local disk or S3-backed storage
  • Drag and drop upload
  • Multiple files upload
  • Pastebin upload
  • Custom drawing upload (via drawingboard.js)
  • Ctrl-V upload
  • Galleries and nested galleries
  • SDK-oriented design for embedding, including CORS support
  • Mobile friendly HTML interface
  • Preserves uploaded filename and content-type metadata
  • Hash verification (SHA512/256)
  • Detect duplicate upload content and reuse storage
  • Options to limit the upload filesize, upload bandwidth, and maximum source filesize for thumbnailing
  • Short URLs (using Hashids algorithm)
  • Image thumbnailing
  • Optional multi-tenant binary (contented-multi)

Usage (Server)

Usage of contented:
  -concurrentthumbs int
        Simultaneous thumbnail generation (default 16)
  -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)
  -enableUpload
        Enable uploads (disable for read-only mode) (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

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).

Usage (HTTP)

The server responds on the following URLs:

URL Method Description
/get/{ID} GET Download item content
/p/{ID} GET Preview item content (HTML)
/p/{ID}-{ID}-... GET Preview multiple item content (HTML)
/info/{ID} GET Get item content metadata (JSON)
/thumb/{Type}/{ID} GET Get item thumbnail image (JPEG). "Type" should match [sbtmlh].
/about GET Get server metadata (JSON)

Usage (Embedding for web)

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:

<script type="text/javascript" src="SERVER_ADDR/sdk.js"></script>
contented.init("#target");

You can optionally supply additional ordered parameters to contented.init:

  1. A callback, that will be passed an array of file IDs of any uploaded items
  2. A callback, that will be called if the SDK widget is closed

Changelog

2023-05-20: 1.5.1

  • Improve support for albums with no images, and for albums with missing interior images

2023-05-19: 1.5.0

  • Feature: Support S3-backed storage
  • Feature: New contented-multi binary to host multiple server configurations from a single process
  • Enhancement: Better client-side caching for thumbnails
  • Option to cap source filesize for thumbnailing (default 20MiB)

2023-05-17: 1.4.0

  • BREAKING: Remove support for some old web browsers (require jQuery 3, ES6 template literals, Promises, Canvas.toBlob)
  • Feature: Initial album support with custom titles
  • Feature: Support readonly mode
  • Enhancement: Use lazy-loading for large image galleries
  • Enhancement: Better tab titles on preview pages
  • Fix an issue with continuing server-side thumbnailing work even if the http client has gone away
  • Fix an issue with not warning on colliding hashIDs
  • Internal: Refactor the SDK's initialization phase
  • Internal: Update bolt library dependency

2020-07-25: 1.3.1

  • Fix an issue with dependencies causing failure to compile in Modules mode

2020-07-25: 1.3.0

  • Feature: Option to limit concurrent thumbnail generation
  • Enhancement: Set charset=UTF-8 when serving user-submitted text/plain content
  • Fix an issue with large memory usage for multipart file uploads

2018-06-09: 1.2.1

2017-11-18: 1.2.0

2017-10-15: 1.1.0

  • Feature: Drawing mode
  • Feature: Ctrl+V image upload
  • Feature: Option to trust X-Forwarded-For headers when using a reverse proxy
  • Feature: Add getDownloadURL, getInfoJSONURL, getPreviewURL SDK methods
  • Feature: Option to disable uploading via the homepage
  • Feature: Add button to repeat when uploading from homepage
  • Enhancement: Automatically load library dependencies
  • Enhancement: Display homepage widget using the full screen size
  • Include drawingboard.js 0.4.6 (MIT license)
  • Fix a cosmetic issue with javascript console output
  • Fix a cosmetic issue with error messages if an upload failed
  • ⬇️ contented-1.1.0-win32.7z (1.11 MiB)
  • ⬇️ contented-1.1.0-src.zip (142.82 KiB)
  • ⬇️ contented-1.1.0-linux64.tar.gz (1.67 MiB)

2017-10-08: 1.0.1

2017-10-08: 1.0.0