Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
mappu | bfd669bc96 | |
mappu | ea1309eb75 | |
mappu | b146db9d0a | |
mappu | 0a22d1ca8a |
|
@ -10,20 +10,22 @@ 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](https://github.com/Leimi/drawingboard.js))
|
||||
- Ctrl-V upload
|
||||
- Galleries
|
||||
- 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 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)
|
||||
- Image thumbnailing
|
||||
- Optional multi-tenant binary (`contented-multi`)
|
||||
|
||||
## Usage (Server)
|
||||
|
||||
|
@ -84,6 +86,9 @@ You can optionally supply additional ordered parameters to `contented.init`:
|
|||
|
||||
## 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
|
||||
|
|
28
preview.go
28
preview.go
|
@ -109,10 +109,29 @@ html, body {
|
|||
m, err := this.Metadata(fileID)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
|
||||
// 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())
|
||||
http.Error(w, "Internal error", 500)
|
||||
return
|
||||
|
@ -136,16 +155,15 @@ html, body {
|
|||
return
|
||||
}
|
||||
|
||||
if len(childIDs) == 0 {
|
||||
log.Printf("Failed to parse album '%s': no entries in album", fileID)
|
||||
http.Error(w, "Internal error", 500)
|
||||
return
|
||||
albumThumb := `/nothumb_340.png`
|
||||
if len(childIDs) > 0 {
|
||||
albumThumb = `/thumb/m/` + childIDs[0]
|
||||
}
|
||||
|
||||
tmpl += `
|
||||
<div class="entry">
|
||||
<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>
|
||||
<div class="properties">
|
||||
|
|
Loading…
Reference in New Issue