add support for repo tags and links
このコミットが含まれているのは:
コミット
3e6d0bec06
@ -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,12 +3,14 @@
|
||||
<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="/{{.Fullname}}" class="button">Back to {{.Fullname}}</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>
|
||||
|
||||
<div class="userProfile">
|
||||
<h1>{{.Fullname}} | {{.DirName}}</h1>
|
||||
<h1>{{.Fullname}} | {{.DirName}}</h1>
|
||||
</div>
|
||||
{{end}} {{ if .files}}
|
||||
<div class="userReadme">
|
||||
@ -17,11 +19,15 @@
|
||||
<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">
|
||||
<a href="/{{.Fullname}}/blob/{{.Branch}}/{{.DirName}}/{{.Path}}"
|
||||
<a href="/{{.Fullname}}/blob/{{.Branch}}/{{.DirName}}/{{.Path}}"
|
||||
>{{.Path}}</a
|
||||
>
|
||||
</li>
|
||||
|
@ -15,7 +15,10 @@
|
||||
<p>This repository is a fork of <a href="/{{.Parent}}">{{.Parent}}</a>.</p>
|
||||
{{ end }} {{ if .Description }}
|
||||
<p>{{.Description}}</p>
|
||||
{{ end }} {{ if .License }}
|
||||
{{ 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}} 🌿
|
||||
{{.DefaultBranch}}
|
||||
@ -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">
|
||||
|
読み込み中…
新しいイシューから参照
ユーザーをブロックする