mirror of
https://github.com/makew0rld/amfora.git
synced 2024-12-04 14:46:29 -05:00
✨ Cache pages with queries, don't cache bB URLs - fixes #29
This commit is contained in:
parent
542239932b
commit
6f1f14a67a
@ -19,6 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Bottom bar now says `URL/Num./Search: ` when space is pressed
|
- Bottom bar now says `URL/Num./Search: ` when space is pressed
|
||||||
- Update to [go-gemini](https://github.com/makeworld-the-better-one/go-gemini) v0.6.0
|
- Update to [go-gemini](https://github.com/makeworld-the-better-one/go-gemini) v0.6.0
|
||||||
- Help layout doesn't have borders anymore
|
- Help layout doesn't have borders anymore
|
||||||
|
- Pages with query strings are still cached (#29)
|
||||||
|
- URLs or searches typed in the bottom bar are not loaded from the cache (#29)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Actual unicode bullet symbol is used for lists: U+2022
|
- Actual unicode bullet symbol is used for lists: U+2022
|
||||||
|
6
cache/cache.go
vendored
6
cache/cache.go
vendored
@ -3,7 +3,6 @@
|
|||||||
package cache
|
package cache
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/url"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@ -52,11 +51,6 @@ func Add(p *structs.Page) {
|
|||||||
// Just in case, these pages shouldn't be cached
|
// Just in case, these pages shouldn't be cached
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Never cache pages with query strings, to reduce unexpected behaviour
|
|
||||||
parsed, err := url.Parse(p.Url)
|
|
||||||
if err == nil && parsed.RawQuery != "" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if p.Size() > maxSize && maxSize > 0 {
|
if p.Size() > maxSize && maxSize > 0 {
|
||||||
// This page can never be added
|
// This page can never be added
|
||||||
|
@ -172,9 +172,12 @@ func Init() {
|
|||||||
// It's a full URL or search term
|
// It's a full URL or search term
|
||||||
// Detect if it's a search or URL
|
// Detect if it's a search or URL
|
||||||
if strings.Contains(query, " ") || (!strings.Contains(query, "//") && !strings.Contains(query, ".") && !strings.HasPrefix(query, "about:")) {
|
if strings.Contains(query, " ") || (!strings.Contains(query, "//") && !strings.Contains(query, ".") && !strings.HasPrefix(query, "about:")) {
|
||||||
URL(viper.GetString("a-general.search") + "?" + pathEscape(query))
|
u := viper.GetString("a-general.search") + "?" + pathEscape(query)
|
||||||
|
cache.Remove(u) // Don't use the cached version of the search
|
||||||
|
URL(u)
|
||||||
} else {
|
} else {
|
||||||
// Full URL
|
// Full URL
|
||||||
|
cache.Remove(query) // Don't use cached version for manually entered URL
|
||||||
URL(query)
|
URL(query)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user