Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd04f5c117 | |||
| cb16a667cc | |||
| b84b7bdb4e | |||
| 8321129ac8 |
@@ -31,6 +31,10 @@ dokku storage:mount teafolio /srv/teafolio-dokku/config.toml:/app/config.toml
|
|||||||
|
|
||||||
## CHANGELOG
|
## CHANGELOG
|
||||||
|
|
||||||
|
2022-12-31 v1.3.1
|
||||||
|
- Fix missing images on homepage
|
||||||
|
- Fix an issue with wrong mtime comparisons for updated repositories
|
||||||
|
|
||||||
2022-12-31 v1.3.0
|
2022-12-31 v1.3.0
|
||||||
- Add `OverrideOrder` configuration option to insert repos at specific positions
|
- Add `OverrideOrder` configuration option to insert repos at specific positions
|
||||||
- Cache target image URLs to improve homepage load performance
|
- Cache target image URLs to improve homepage load performance
|
||||||
|
|||||||
1
main.go
1
main.go
@@ -36,6 +36,7 @@ type Application struct {
|
|||||||
|
|
||||||
reposMut sync.RWMutex
|
reposMut sync.RWMutex
|
||||||
reposCache []gitea.Repo // Sorted by recently-created-first
|
reposCache []gitea.Repo // Sorted by recently-created-first
|
||||||
|
reposCacheByName map[string]int
|
||||||
reposAlphabeticalOrder map[string]int
|
reposAlphabeticalOrder map[string]int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ func (this *Application) Bannerpage(w http.ResponseWriter, r *http.Request, repo
|
|||||||
this.reposMut.RLock()
|
this.reposMut.RLock()
|
||||||
defer this.reposMut.RUnlock()
|
defer this.reposMut.RUnlock()
|
||||||
|
|
||||||
ridx, ok := this.reposAlphabeticalOrder[repoName]
|
ridx, ok := this.reposCacheByName[repoName]
|
||||||
if !ok {
|
if !ok {
|
||||||
w.Header().Set(`Location`, `/static/no_image.png`)
|
w.Header().Set(`Location`, `/static/no_image.png`)
|
||||||
w.WriteHeader(301)
|
w.WriteHeader(301)
|
||||||
|
|||||||
13
sync.go
13
sync.go
@@ -94,7 +94,7 @@ func (this *Application) sync(ctx context.Context) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, rr := range repos {
|
for i, rr := range repos {
|
||||||
if idx, ok := this.reposAlphabeticalOrder[rr.Name]; ok && this.reposCache[idx].GiteaUpdated == rr.GiteaUpdated {
|
if idx, ok := this.reposCacheByName[rr.Name]; ok && this.reposCache[idx].GiteaUpdated == rr.GiteaUpdated {
|
||||||
// Already exists in cache with same Gitea update time
|
// Already exists in cache with same Gitea update time
|
||||||
// Copy timestamps
|
// Copy timestamps
|
||||||
repos[i] = this.reposCache[idx]
|
repos[i] = this.reposCache[idx]
|
||||||
@@ -117,6 +117,11 @@ func (this *Application) sync(ctx context.Context) (bool, error) {
|
|||||||
log.Printf("loading topics for '%s': %s", rr.Name, err)
|
log.Printf("loading topics for '%s': %s", rr.Name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = this.gitea.PopulateImages(ctx, &rr)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("loading images for '%s': %s", rr.Name, err)
|
||||||
|
}
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
repos[i] = rr
|
repos[i] = rr
|
||||||
}
|
}
|
||||||
@@ -151,9 +156,15 @@ func (this *Application) sync(ctx context.Context) (bool, error) {
|
|||||||
repos = reordered
|
repos = reordered
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reposCacheByName := make(map[string]int, len(repos))
|
||||||
|
for idx, repo := range repos {
|
||||||
|
reposCacheByName[repo.Name] = idx
|
||||||
|
}
|
||||||
|
|
||||||
// Commit our changes for the other threads to look at
|
// Commit our changes for the other threads to look at
|
||||||
this.reposMut.Lock()
|
this.reposMut.Lock()
|
||||||
this.reposCache = repos
|
this.reposCache = repos
|
||||||
|
this.reposCacheByName = reposCacheByName
|
||||||
this.reposAlphabeticalOrder = alphabeticalOrderIndexes
|
this.reposAlphabeticalOrder = alphabeticalOrderIndexes
|
||||||
this.reposMut.Unlock()
|
this.reposMut.Unlock()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user