self-host the build_success_brightgreen.svg image

This commit is contained in:
mappu 2021-04-12 13:33:51 +12:00
parent 78c7f82ef8
commit 3c54a6eff4
2 changed files with 5 additions and 1 deletions

View File

@ -193,7 +193,7 @@ func (this *Application) Repopage(w http.ResponseWriter, r *http.Request, repoNa
// We add some extra badges based on special text entries // We add some extra badges based on special text entries
extraBadgesMd := `` extraBadgesMd := ``
if !hasArticleTag { if !hasArticleTag {
extraBadgesMd += ` ![](https://img.shields.io/badge/build-success-brightgreen)` extraBadgesMd += ` %%REPLACEME__BADGE%%`
} }
extraBadgesMd += ` [![](https://img.shields.io/badge/vcs-git-green?logo=git)](` + repoURL + `)` extraBadgesMd += ` [![](https://img.shields.io/badge/vcs-git-green?logo=git)](` + repoURL + `)`
@ -211,6 +211,8 @@ func (this *Application) Repopage(w http.ResponseWriter, r *http.Request, repoNa
return 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) images, err := this.imageFilesForRepo(ctx, repoName)
if err != nil { if err != nil {
this.internalError(w, r, fmt.Errorf("listing images: %w", err)) this.internalError(w, r, fmt.Errorf("listing images: %w", err))

View 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