mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
fix(repo-card): manually revert to the version in 2.87.0
The md5 method has severe performance degradation It is approximately 2x slower without cache and 5x slower with cache Reverted due to lack of a better option
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
{{ $repoColors := site.Data.repoColors }}
|
||||
{{ $classNameMap := dict }}
|
||||
{{ range $language, $unused := $repoColors }}
|
||||
{{ $className := printf "background-color-%s" (md5 $language) }}
|
||||
{{ $classNameMap = merge $classNameMap (dict $className $language) }}
|
||||
{{ end }}
|
||||
|
||||
{{ $repoLanguages := slice }}
|
||||
{{ range site.Pages }}
|
||||
{{ $matchedClasses := findRE `background-color-[a-f0-9]{32}` .Content }}
|
||||
{{ range $matchedClasses }}
|
||||
{{ with index $classNameMap . }}
|
||||
{{ $repoLanguages = $repoLanguages | append . }}
|
||||
{{ else }}
|
||||
{{ $repoLanguages = $repoLanguages | append "fallback" }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ return (uniq $repoLanguages) }}
|
||||
@@ -54,15 +54,6 @@
|
||||
{{ $cssZoom := resources.Get "lib/zoom/style.css" }}
|
||||
{{ $assets.Add "css" (slice $cssZoom) }}
|
||||
{{ end }}
|
||||
{{ $repoLanguages := partial "functions/repo-languages.html" }}
|
||||
{{ $repoColors := .Site.Data.repoColors }}
|
||||
{{ range $repoLanguages }}
|
||||
{{ $color := index $repoColors . | default "#0077b6" }}
|
||||
{{ $className := printf "background-color-%s" (md5 .) }}
|
||||
{{ $cssRepoColor := printf ".%s { background-color: %s; }" $className $color }}
|
||||
{{ $cssRepoColor = $cssRepoColor | resources.FromString (printf "css/background-color.css") }}
|
||||
{{ $assets.Add "css" (slice $cssRepoColor) }}
|
||||
{{ end }}
|
||||
{{ $bundleCSS := $assets.Get "css" | resources.Concat "css/main.bundle.css" | resources.Minify | resources.Fingerprint
|
||||
(.Site.Params.fingerprintAlgorithm | default "sha512")
|
||||
}}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{{ $id := delimit (slice "codeberg" (partial "functions/uid.html" .)) "-" }}
|
||||
{{- $codebergURL := print "https://codeberg.org/api/v1/repos/" (.Get "repo") -}}
|
||||
{{- $codebergColors := .Site.Data.repoColors -}}
|
||||
{{- $codebergData := dict -}}
|
||||
{{- with try (resources.GetRemote $codebergURL) -}}
|
||||
{{- with .Err -}}
|
||||
@@ -32,10 +33,13 @@
|
||||
</p>
|
||||
|
||||
<div class="m-0 mt-2 flex items-center">
|
||||
{{ $language := .language | default "fallback" }}
|
||||
{{ $className := printf "background-color-%s" (md5 $language) }}
|
||||
<span
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full"
|
||||
style="background-color: {{ if .language }}
|
||||
{{- index $codebergColors .language -}}
|
||||
{{ else }}
|
||||
#0077b6
|
||||
{{ end }}"></span>
|
||||
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{{ $id := delimit (slice "forgejo" (partial "functions/uid.html" .)) "-" }}
|
||||
{{- $forgejoURL := print (.Get "server" | default .Site.Params.forgejoDefaultServer) "/api/v1/repos/" (.Get "repo") -}}
|
||||
{{- $forgejoColors := .Site.Data.repoColors -}}
|
||||
{{- $forgejoData := dict -}}
|
||||
{{- with try (resources.GetRemote $forgejoURL) -}}
|
||||
{{- with .Err -}}
|
||||
@@ -32,10 +33,13 @@
|
||||
</p>
|
||||
|
||||
<div class="m-0 mt-2 flex items-center">
|
||||
{{ $language := .language | default "fallback" }}
|
||||
{{ $className := printf "background-color-%s" (md5 $language) }}
|
||||
<span
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full"
|
||||
style="background-color: {{ if .language }}
|
||||
{{- index $forgejoColors .language -}}
|
||||
{{ else }}
|
||||
#0077b6
|
||||
{{ end }}"></span>
|
||||
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{{ $id := delimit (slice "gitea" (partial "functions/uid.html" .)) "-" }}
|
||||
{{- $giteaURL := print (.Get "server" | default .Site.Params.giteaDefaultServer) "/api/v1/repos/" (.Get "repo") -}}
|
||||
{{- $giteaColors := .Site.Data.repoColors -}}
|
||||
{{- $giteaData := dict -}}
|
||||
{{- with try (resources.GetRemote $giteaURL) -}}
|
||||
{{- with .Err -}}
|
||||
@@ -32,10 +33,13 @@
|
||||
</p>
|
||||
|
||||
<div class="m-0 mt-2 flex items-center">
|
||||
{{ $language := .language | default "fallback" }}
|
||||
{{ $className := printf "background-color-%s" (md5 $language) }}
|
||||
<span
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full"
|
||||
style="background-color: {{ if .language }}
|
||||
{{- index $giteaColors .language -}}
|
||||
{{ else }}
|
||||
#0077b6
|
||||
{{ end }}"></span>
|
||||
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
{{- $githubURL := print "https://api.github.com/repos/" (.Get "repo") -}}
|
||||
{{- $githubThumbnailURL := print "https://opengraph.githubassets.com/0/" (.Get "repo") -}}
|
||||
{{- $showThumbnail := .Get "showThumbnail" | default true -}}
|
||||
{{- $githubColors := .Site.Data.repoColors -}}
|
||||
{{- $githubData := dict -}}
|
||||
{{- with try (resources.GetRemote $githubURL) -}}
|
||||
{{- with .Err -}}
|
||||
@@ -45,10 +46,13 @@
|
||||
</p>
|
||||
|
||||
<div class="m-0 mt-2 flex items-center">
|
||||
{{ $language := .language | default "fallback" }}
|
||||
{{ $className := printf "background-color-%s" (md5 $language) }}
|
||||
<span
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full {{ $className }}"></span>
|
||||
class="mr-1 inline-block h-3 w-3 rounded-full"
|
||||
style="background-color: {{ if .language }}
|
||||
{{- index $githubColors .language -}}
|
||||
{{ else }}
|
||||
#0077b6
|
||||
{{ end }}"></span>
|
||||
<div class="m-0 mr-5 text-md text-neutral-800 dark:text-neutral">
|
||||
{{ if .language }}{{ .language }}{{ else }}null{{ end }}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user