Compare commits
No commits in common. "master" and "v1.5.0" have entirely different histories.
|
@ -10,22 +10,20 @@ 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 and nested galleries
|
- 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, upload bandwidth, and maximum source filesize for thumbnailing
|
- Options to limit the upload filesize and the upload bandwidth
|
||||||
- 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)
|
||||||
|
|
||||||
|
@ -86,9 +84,6 @@ 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
|
||||||
|
|
32
preview.go
32
preview.go
|
@ -109,27 +109,8 @@ 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)
|
||||||
// If this is just one image out of many, show a 404 box and continue to show the other entries
|
return
|
||||||
// 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())
|
||||||
|
@ -155,15 +136,16 @@ html, body {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
albumThumb := `/nothumb_340.png`
|
if len(childIDs) == 0 {
|
||||||
if len(childIDs) > 0 {
|
log.Printf("Failed to parse album '%s': no entries in album", fileID)
|
||||||
albumThumb = `/thumb/m/` + childIDs[0]
|
http.Error(w, "Internal error", 500)
|
||||||
|
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(albumThumb) + `"></a>
|
<a href="` + html.EscapeString(`/p/`+strings.Join(childIDs, `-`)) + `"><img loading="lazy" src="` + html.EscapeString(`/thumb/m/`+childIDs[0]) + `"></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">
|
||||||
|
|
Loading…
Reference in New Issue