removed 'source' link from image results & fixed dynamic scrolling on image page
This commit is contained in:
parent
ac7b468d71
commit
44e9d3356f
4 changed files with 18 additions and 21 deletions
|
@ -273,6 +273,7 @@ func handleImageServe(w http.ResponseWriter, r *http.Request) {
|
|||
resp, err := http.Get(imageURL)
|
||||
if err != nil {
|
||||
printWarn("Error fetching image: %v", err)
|
||||
recordInvalidImageID(imageID)
|
||||
serveMissingImage(w, r)
|
||||
return
|
||||
}
|
||||
|
@ -311,7 +312,18 @@ func handleImageStatus(w http.ResponseWriter, r *http.Request) {
|
|||
continue
|
||||
}
|
||||
|
||||
// Check for cached full or thumbnail images
|
||||
// Check if the image ID is marked as invalid
|
||||
invalidImageIDsMu.Lock()
|
||||
_, isInvalid := invalidImageIDs[id]
|
||||
invalidImageIDsMu.Unlock()
|
||||
|
||||
if isInvalid {
|
||||
// Image is invalid; inform the frontend by setting the missing image URL
|
||||
statusMap[id] = "/static/images/missing.svg"
|
||||
continue
|
||||
}
|
||||
|
||||
// Existing code to check for cached images
|
||||
extensions := []string{"webp", "svg"} // Extensions without leading dots
|
||||
imageReady := false
|
||||
|
||||
|
@ -341,15 +353,13 @@ func handleImageStatus(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
// If neither is ready
|
||||
// If neither is ready and image is not invalid
|
||||
if !imageReady {
|
||||
if !config.DriveCacheEnabled {
|
||||
// Hard cache is disabled; use the proxy URL
|
||||
statusMap[id] = fmt.Sprintf("/image/%s_thumb", id)
|
||||
} else {
|
||||
// Hard cache is enabled; image is not yet cached
|
||||
// Do not set statusMap[id]; the frontend will keep checking
|
||||
}
|
||||
// Else, do not set statusMap[id]; the frontend will keep checking
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ html {
|
|||
|
||||
.image {
|
||||
flex-grow: 1;
|
||||
padding: .5rem .5rem 3rem .5rem;
|
||||
padding: .5rem .5rem 2rem .5rem;
|
||||
margin: .25rem;
|
||||
border: 1px solid #00000000;
|
||||
border-radius: 12px;
|
||||
|
@ -311,8 +311,7 @@ html {
|
|||
box-shadow: 0 14px 28px var(--view-image-color);
|
||||
}
|
||||
|
||||
.img_title,
|
||||
.img_source {
|
||||
.img_title {
|
||||
display: block;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
|
@ -328,11 +327,6 @@ html {
|
|||
color: var(--blue);
|
||||
}
|
||||
|
||||
.img_source {
|
||||
padding: 1.8rem 0 0 0;
|
||||
font-size: .7rem;
|
||||
}
|
||||
|
||||
.image img {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
@ -726,6 +720,7 @@ hr {
|
|||
background: var(--html-bg);
|
||||
cursor: pointer;
|
||||
transition: all .3s ease;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.torrent-cat:hover,
|
||||
|
|
|
@ -116,7 +116,6 @@
|
|||
<div class="resolution">{{ $result.Width }} × {{ $result.Height }}</div>
|
||||
<div class="details">
|
||||
<span class="img_title clickable">{{ $result.Title }}</span>
|
||||
<a href="{{ $result.Source }}" target="_blank" class="img_source">{{ translate "source" }}</a>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
{{ range $index, $result := .Results }}
|
||||
<div class="image">
|
||||
{{ if $.HardCacheEnabled }}
|
||||
<noscript>
|
||||
<!-- JavaScript is disabled; serve actual images -->
|
||||
<img src="{{ $result.ProxyFull }}" alt="{{ $result.Title }}" class="clickable" />
|
||||
</noscript>
|
||||
|
||||
<!-- JavaScript is enabled; use placeholders -->
|
||||
<img
|
||||
src="/static/images/placeholder.svg"
|
||||
data-id="{{ $result.ID }}"
|
||||
|
@ -22,7 +16,6 @@
|
|||
<div class="resolution">{{ $result.Width }} × {{ $result.Height }}</div>
|
||||
<div class="details">
|
||||
<span class="img_title clickable">{{ $result.Title }}</span>
|
||||
<a href="{{ $result.Source }}" target="_blank" class="img_source">{{ translate "source" }}</a>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
Loading…
Add table
Reference in a new issue