add support for repo tags and links

このコミットが含まれているのは:
Arya Kiran 2023-03-16 15:25:17 +05:30
コミット 3e6d0bec06
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 842D12BDA50DF120
4個のファイルの変更31行の追加9行の削除

ファイルの表示

@ -10,6 +10,7 @@ import (
"log"
"net/http"
"os"
"strings"
)
type Repo struct {
@ -23,6 +24,8 @@ type Repo struct {
License string
DefaultBranch string
Readme string
Link string
Tags []string
}
type RepoFiles struct {
@ -63,8 +66,12 @@ func HandleRepo(c *fiber.Ctx) error {
Scrape.Description = e.ChildText("p.f4")
Scrape.Stars = e.ChildText("a[href*='/" + c.Params("user") + "/" + c.Params("repo") + "/stargazers' i] strong")
Scrape.Watchers = e.ChildText("a[href*='/" + c.Params("user") + "/" + c.Params("repo") + "/watchers' i] strong")
Scrape.Forks = e.ChildText("a[href*='/" + c.Params("user") + "/" + c.Params("repo") + "/network/members' i] strong")
Scrape.Forks = e.ChildText("a[href*='/" + c.Params("user") + "/" + c.Params("repo") + "/forks' i] strong")
Scrape.Link = e.ChildAttr("span.css-truncate a.text-bold", "href")
Scrape.License = e.ChildText("a[data-analytics-event*='{\"category\":\"Repository Overview\",\"action\":\"click\",\"label\":\"location:sidebar;file:license\"}']")
e.ForEach("a.topic-tag", func(i int, el *colly.HTMLElement) {
Scrape.Tags = append(Scrape.Tags, strings.TrimPrefix(el.Attr("data-octo-dimensions"), "topic:"))
})
})
sc.OnHTML("div#readme", func(e *colly.HTMLElement) {
Scrape.Readme = e.ChildText("a[href*='#readme']")

ファイルの表示

@ -29,7 +29,9 @@
>
</p>
<ul>
<li><b>Go Version</b>: Fiber {{ .FiberVersion}} running on {{ .GoVersion}}</li>
<li>
<b>Go Version</b>: Fiber {{ .FiberVersion}} running on {{ .GoVersion}}
</li>
<li><b>Country:</b> {{.Country}}</li>
<li><b>Cloudflare:</b> {{.Cloudflare}}</li>
<li><b>ISP:</b> {{.Provider}}</li>

ファイルの表示

@ -3,7 +3,9 @@
<main>
{{ if .dir }} {{ range $key, $value := .dir}}
<div class="buttonParent">
<a href="https://github.com/{{.Fullname}}/tree/{{.DirName}}" class="button">View on GitHub</a>
<a href="https://github.com/{{.Fullname}}/tree/{{.DirName}}" class="button"
>View on GitHub</a
>
<a href="/{{.Fullname}}" class="button">Back to {{.Fullname}}</a>
</div>
@ -17,7 +19,11 @@
<ul class="filesUList">
{{ range $key, $value := .files}} {{ if eq .Type "dir" }}
<li class="filesList">
<a href="/{{.Fullname}}/tree/{{.Branch}}/{{.DirName}}/{{.Path}}" class="filesA">{{.Path}} (directory)</a>
<a
href="/{{.Fullname}}/tree/{{.Branch}}/{{.DirName}}/{{.Path}}"
class="filesA"
>{{.Path}} (directory)</a
>
</li>
{{ else }}
<li class="filesList">

ファイルの表示

@ -15,6 +15,9 @@
<p>This repository is a fork of <a href="/{{.Parent}}">{{.Parent}}</a>.</p>
{{ end }} {{ if .Description }}
<p>{{.Description}}</p>
{{ end }} {{ if .Link }} <a href="{{.Link}}">{{.Link}}</a> {{end}} {{ if
.Tags }}
<p>Tags: {{range .Tags}} {{.}} {{end}}</p>
{{end}} {{ if .License }}
<p>
⭐ {{.Stars}} 🍴 {{.Forks}} 👀 {{.Watchers}} ⚖️ {{.License}} 🌿
@ -36,7 +39,11 @@
<ul class="filesUList">
{{ range $key, $value := .files}} {{ if eq .Type "dir" }}
<li class="filesList">
<a href="/{{.Fullname}}/tree/{{.DefaultBranch}}/{{.Path}}" class="filesA">{{.Path}} (directory)</a>
<a
href="/{{.Fullname}}/tree/{{.DefaultBranch}}/{{.Path}}"
class="filesA"
>{{.Path}} (directory)</a
>
</li>
{{ else }}
<li class="filesList">