API: Add Explicit Cache Header for Existing Thumbs #822
This commit is contained in:
parent
a9193c47a9
commit
6c4fc42415
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package acl contains PhotoPrism's access control lists for authorizing user actions.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package api contains PhotoPrism REST API handlers.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -63,11 +63,10 @@ func GetThumb(router *gin.RouterGroup) {
|
|||
return
|
||||
}
|
||||
|
||||
AddThumbCacheHeader(c)
|
||||
|
||||
if download {
|
||||
c.FileAttachment(fileName, cropName.Jpeg())
|
||||
} else {
|
||||
AddThumbCacheHeader(c)
|
||||
c.File(fileName)
|
||||
}
|
||||
|
||||
|
@ -108,11 +107,10 @@ func GetThumb(router *gin.RouterGroup) {
|
|||
return
|
||||
}
|
||||
|
||||
AddThumbCacheHeader(c)
|
||||
|
||||
if c.Query("download") != "" {
|
||||
c.FileAttachment(cached.FileName, cached.ShareName)
|
||||
} else {
|
||||
AddThumbCacheHeader(c)
|
||||
c.File(cached.FileName)
|
||||
}
|
||||
|
||||
|
@ -122,6 +120,7 @@ func GetThumb(router *gin.RouterGroup) {
|
|||
// Return existing thumbs straight away.
|
||||
if !download {
|
||||
if fileName, err := thumb.FileName(fileHash, conf.ThumbPath(), size.Width, size.Height, size.Options...); err == nil && fs.FileExists(fileName) {
|
||||
AddThumbCacheHeader(c)
|
||||
c.File(fileName)
|
||||
return
|
||||
}
|
||||
|
@ -202,11 +201,10 @@ func GetThumb(router *gin.RouterGroup) {
|
|||
cache.SetDefault(cacheKey, ThumbCache{thumbnail, f.ShareBase(0)})
|
||||
log.Debugf("cached %s [%s]", cacheKey, time.Since(start))
|
||||
|
||||
AddThumbCacheHeader(c)
|
||||
|
||||
if download {
|
||||
c.FileAttachment(thumbnail, f.DownloadName(DownloadName(c), 0))
|
||||
} else {
|
||||
AddThumbCacheHeader(c)
|
||||
c.File(thumbnail)
|
||||
}
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package auto contains index & import background workers.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package classify encapsulates image classification using TensorFlow.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package crop provides image crop data structures and helpers.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package face provides facial recognition.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package form contains tagged structs for input value validation.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package hub contains backend api config & clients.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package places encapsulates the PhotoPrism Places geolocation API.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package i18n contains PhotoPrism status and error message strings.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package maps encapsulates external geolocation APIs.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package meta encapsulates image metadata decoding and conversion to/from XMP and Exif.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package migrate provides database schema migrations.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package nsfw uses TensorFlow to detect images that may not be safe for work.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package photoprism contains PhotoPrism core functionality.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package query provides frequently used database queries for use in commands and API.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -5,7 +5,7 @@ Package remote implements remote service sync and uploads.
|
|||
See also:
|
||||
- RClone (https://rclone.org/), a popular Go tool for syncing data with remote services
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package webdav implements sharing with WebDAV servers.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package search performs common index search queries.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package session provides session storage and management.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package thumb provides JPEG resampling and thumbnail generation.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package video provides video file related types and functions.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package viewer provides photo viewer data structures and utility functions.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Package workers contains background workers for file sync & metadata optimization.
|
||||
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.org>
|
||||
Copyright (c) 2018 - 2022 Michael Mayer <hello@photoprism.app>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
|
|
Loading…
Reference in a new issue