Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 65b520daa6 | |||
| f7833f8dde | |||
| 3c54a6eff4 | |||
| 78c7f82ef8 | |||
| 4f6814f3da | |||
| d21998a9fd |
@@ -31,6 +31,11 @@ dokku storage:mount teafolio /srv/teafolio-dokku/config.toml:/app/config.toml
|
||||
|
||||
## CHANGELOG
|
||||
|
||||
2021-04-12 v1.2.1
|
||||
- Exclude 'build:success' tag from article-only repositories, and re-host the image locally
|
||||
- Also search root repo directory for images
|
||||
- Enhance mobile viewport and table styling
|
||||
|
||||
2020-11-19 v1.2.0
|
||||
- Cache homepage repositories, sync changes in the background
|
||||
- Consider the updated time to be the most recent commit, not the Gitea repository metadata update field
|
||||
|
||||
4
api.go
4
api.go
@@ -273,12 +273,12 @@ func (this *Application) filesInDirectory(ctx context.Context, repo, dir string)
|
||||
}
|
||||
|
||||
// imageFilesForRepo finds documentation images for the repository.
|
||||
// It searches the dist/ and doc/ subdirectories.
|
||||
// It searches the top-level directory and the dist/ and doc/ subdirectories.
|
||||
func (this *Application) imageFilesForRepo(ctx context.Context, repo string) ([]ReaddirEntry, error) {
|
||||
|
||||
ret := []ReaddirEntry{}
|
||||
|
||||
for _, dirName := range []string{`dist`, `doc`} {
|
||||
for _, dirName := range []string{``, `dist`, `doc`} {
|
||||
|
||||
files, err := this.filesInDirectory(ctx, repo, dirName)
|
||||
if err != nil {
|
||||
|
||||
25
pages.go
25
pages.go
@@ -25,7 +25,7 @@ func (this *Application) Templatepage(w http.ResponseWriter, r *http.Request, pa
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=960">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>`+html.EscapeString(pageTitle)+`</title>
|
||||
`+extraHead+`
|
||||
<link rel="shortcut icon" href="/static/logo.png" type="image/png">
|
||||
@@ -174,8 +174,27 @@ func (this *Application) Repopage(w http.ResponseWriter, r *http.Request, repoNa
|
||||
|
||||
lines := strings.Split(string(readme), "\n")
|
||||
|
||||
// Check if this repo has the 'article' tag
|
||||
hasArticleTag := false
|
||||
this.reposMut.RLock()
|
||||
for _, rr := range this.reposCache {
|
||||
if rr.Name != repoName {
|
||||
continue
|
||||
}
|
||||
for _, topic := range rr.topics {
|
||||
if topic == "article" {
|
||||
hasArticleTag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
this.reposMut.RUnlock()
|
||||
|
||||
// We add some extra badges based on special text entries
|
||||
extraBadgesMd := ` `
|
||||
extraBadgesMd := ``
|
||||
if !hasArticleTag {
|
||||
extraBadgesMd += ` %%REPLACEME__BADGE%%`
|
||||
}
|
||||
extraBadgesMd += ` [](` + repoURL + `)`
|
||||
|
||||
// Inject more badges to 3rd line; or, create badges on 3rd line if there are none already
|
||||
@@ -192,6 +211,8 @@ func (this *Application) Repopage(w http.ResponseWriter, r *http.Request, repoNa
|
||||
return
|
||||
}
|
||||
|
||||
readmeHtml = []byte(strings.Replace(string(readmeHtml), `%%REPLACEME__BADGE%%`, `<img src="/static/build_success_brightgreen.svg" style="width:90px;height:20px;">`, 1))
|
||||
|
||||
images, err := this.imageFilesForRepo(ctx, repoName)
|
||||
if err != nil {
|
||||
this.internalError(w, r, fmt.Errorf("listing images: %w", err))
|
||||
|
||||
2
static/build_success_brightgreen.svg
Normal file
2
static/build_success_brightgreen.svg
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="90" height="20" role="img" aria-label="build: success"><title>build: success</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="90" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="37" height="20" fill="#555"/><rect x="37" width="53" height="20" fill="#4c1"/><rect width="90" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="195" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="270">build</text><text x="195" y="140" transform="scale(.1)" fill="#fff" textLength="270">build</text><text aria-hidden="true" x="625" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">success</text><text x="625" y="140" transform="scale(.1)" fill="#fff" textLength="430">success</text></g></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -161,6 +161,25 @@ img[src*="shields.io"] {
|
||||
|
||||
/* */
|
||||
|
||||
.projbody table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.projbody table {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.projbody table td, .projbody table th {
|
||||
border: 1px solid #eee;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.projbody tr:hover td {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
/* */
|
||||
|
||||
@media screen and (max-width:960px) {
|
||||
|
||||
#container {
|
||||
|
||||
Reference in New Issue
Block a user