Compare commits

...

4 Commits

2 changed files with 32 additions and 9 deletions

View File

@ -10,20 +10,22 @@ The name is a pun on "content" and the -d suffix for server daemons.
## Features ## Features
- Use local disk or S3-backed storage
- Drag and drop upload - Drag and drop upload
- Multiple files upload - Multiple files upload
- Pastebin upload - Pastebin upload
- Custom drawing upload ([via drawingboard.js](https://github.com/Leimi/drawingboard.js)) - Custom drawing upload ([via drawingboard.js](https://github.com/Leimi/drawingboard.js))
- Ctrl-V upload - Ctrl-V upload
- Galleries - Galleries and nested galleries
- SDK-oriented design for embedding, including CORS support - SDK-oriented design for embedding, including CORS support
- Mobile friendly HTML interface - Mobile friendly HTML interface
- Preserves uploaded filename and content-type metadata - Preserves uploaded filename and content-type metadata
- Hash verification (SHA512/256) - Hash verification (SHA512/256)
- Detect duplicate upload content and reuse storage - Detect duplicate upload content and reuse storage
- Options to limit the upload filesize and the upload bandwidth - Options to limit the upload filesize, upload bandwidth, and maximum source filesize for thumbnailing
- Short URLs (using [Hashids](http://hashids.org) algorithm) - Short URLs (using [Hashids](http://hashids.org) algorithm)
- Image thumbnailing - Image thumbnailing
- Optional multi-tenant binary (`contented-multi`)
## Usage (Server) ## Usage (Server)
@ -84,6 +86,9 @@ You can optionally supply additional ordered parameters to `contented.init`:
## Changelog ## 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 2023-05-19: 1.5.0
- Feature: Support S3-backed storage - Feature: Support S3-backed storage
- Feature: New `contented-multi` binary to host multiple server configurations from a single process - Feature: New `contented-multi` binary to host multiple server configurations from a single process

View File

@ -109,8 +109,27 @@ html, body {
m, err := this.Metadata(fileID) m, err := this.Metadata(fileID)
if err != nil { if err != nil {
if os.IsNotExist(err) { if os.IsNotExist(err) {
http.Error(w, "Not found", 404)
return // If this is just one image out of many, show a 404 box and continue to show the other entries
// But if this is only a single image requested, abandon the whole pageload
if len(fileIDs) == 1 {
http.Error(w, "Not found", 404)
return
}
tmpl += `
<div class="entry">
<div class="thumbnail">
<img loading="lazy" src="/nothumb_340.png"></a>
</div>
<div class="properties">
Requested ID ` + html.EscapeString(fileID) + ` not found in storage (404)
</div>
</div>
`
continue
} }
log.Println(err.Error()) log.Println(err.Error())
@ -136,16 +155,15 @@ html, body {
return return
} }
if len(childIDs) == 0 { albumThumb := `/nothumb_340.png`
log.Printf("Failed to parse album '%s': no entries in album", fileID) if len(childIDs) > 0 {
http.Error(w, "Internal error", 500) albumThumb = `/thumb/m/` + childIDs[0]
return
} }
tmpl += ` tmpl += `
<div class="entry"> <div class="entry">
<div class="thumbnail"> <div class="thumbnail">
<a href="` + html.EscapeString(`/p/`+strings.Join(childIDs, `-`)) + `"><img loading="lazy" src="` + html.EscapeString(`/thumb/m/`+childIDs[0]) + `"></a> <a href="` + html.EscapeString(`/p/`+strings.Join(childIDs, `-`)) + `"><img loading="lazy" src="` + html.EscapeString(albumThumb) + `"></a>
<div class="thumbnail-overlay">` + fmt.Sprintf("%d", len(childIDs)) + ` image(s)</div> <div class="thumbnail-overlay">` + fmt.Sprintf("%d", len(childIDs)) + ` image(s)</div>
</div> </div>
<div class="properties"> <div class="properties">