Compare commits
No commits in common. "nilix" and "raw_link_fix" have entirely different histories.
nilix
...
raw_link_f
11 changed files with 139 additions and 247 deletions
15
config.yaml
15
config.yaml
|
@ -1,21 +1,22 @@
|
||||||
repo:
|
repo:
|
||||||
scanPath: /home/nilix/src/public/
|
scanPath: /var/www/git
|
||||||
readme:
|
readme:
|
||||||
- readme
|
- readme
|
||||||
- README
|
- README
|
||||||
- readme.md
|
- readme.md
|
||||||
- README.md
|
- README.md
|
||||||
mainBranch:
|
mainBranch:
|
||||||
|
- master
|
||||||
- main
|
- main
|
||||||
dirs:
|
dirs:
|
||||||
templates: ./templates
|
templates: ./templates
|
||||||
static: ./static
|
static: ./static
|
||||||
meta:
|
meta:
|
||||||
title: nilFM hack lab
|
title: git good
|
||||||
description: are you hacking?
|
description: i think it's a skill issue
|
||||||
footer: served by legit vVERSION; some of this code might suck — email patches to MAINTAINER
|
footer: served with legit vVERSION; email patches to MAINTAINER
|
||||||
maintainerEmail: nilix@nilfm.cc
|
maintainerEmail: x@icyphox.sh
|
||||||
server:
|
server:
|
||||||
name: hacklab.nilfm.cc
|
name: git.icyphox.sh
|
||||||
host: 0.0.0.0
|
host: 127.0.0.1
|
||||||
port: 5555
|
port: 5555
|
||||||
|
|
|
@ -2,8 +2,8 @@ package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
|
||||||
"os"
|
"os"
|
||||||
|
"html/template"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
|
@ -32,7 +32,6 @@ type Config struct {
|
||||||
Host string `yaml:"host"`
|
Host string `yaml:"host"`
|
||||||
Port int `yaml:"port"`
|
Port int `yaml:"port"`
|
||||||
} `yaml:"server"`
|
} `yaml:"server"`
|
||||||
Mailmap string `yaml:"mailmap,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func compileFooter(c *Config, version string) {
|
func compileFooter(c *Config, version string) {
|
||||||
|
|
49
git/git.go
49
git/git.go
|
@ -2,12 +2,11 @@ package git
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
|
|
||||||
"github.com/go-git/go-git/v5"
|
"github.com/go-git/go-git/v5"
|
||||||
"github.com/go-git/go-git/v5/plumbing"
|
"github.com/go-git/go-git/v5/plumbing"
|
||||||
"github.com/go-git/go-git/v5/plumbing/object"
|
"github.com/go-git/go-git/v5/plumbing/object"
|
||||||
"os"
|
|
||||||
"sort"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GitRepo struct {
|
type GitRepo struct {
|
||||||
|
@ -54,8 +53,7 @@ func Open(path string, ref string) (*GitRepo, error) {
|
||||||
return &g, nil
|
return &g, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GitRepo) Commits(mailmap map[string]string) ([]*object.Commit, error) {
|
func (g *GitRepo) Commits() ([]*object.Commit, error) {
|
||||||
|
|
||||||
ci, err := g.r.Log(&git.LogOptions{From: g.h})
|
ci, err := g.r.Log(&git.LogOptions{From: g.h})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("commits from ref: %w", err)
|
return nil, fmt.Errorf("commits from ref: %w", err)
|
||||||
|
@ -63,18 +61,6 @@ func (g *GitRepo) Commits(mailmap map[string]string) ([]*object.Commit, error) {
|
||||||
|
|
||||||
commits := []*object.Commit{}
|
commits := []*object.Commit{}
|
||||||
ci.ForEach(func(c *object.Commit) error {
|
ci.ForEach(func(c *object.Commit) error {
|
||||||
|
|
||||||
if mailmap != nil {
|
|
||||||
name, ok := mailmap[c.Author.Email]
|
|
||||||
if ok {
|
|
||||||
c.Author.Name = name
|
|
||||||
}
|
|
||||||
name, ok = mailmap[c.Committer.Email]
|
|
||||||
if ok {
|
|
||||||
c.Committer.Name = name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
commits = append(commits, c)
|
commits = append(commits, c)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -124,10 +110,6 @@ func (g *GitRepo) Tags() ([]*object.Tag, error) {
|
||||||
tags := []*object.Tag{}
|
tags := []*object.Tag{}
|
||||||
|
|
||||||
_ = ti.ForEach(func(t *object.Tag) error {
|
_ = ti.ForEach(func(t *object.Tag) error {
|
||||||
refName := plumbing.NewTagReferenceName(t.Name)
|
|
||||||
if _, unreachable := g.r.Reference(refName, true); unreachable != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
for i, existing := range tags {
|
for i, existing := range tags {
|
||||||
if existing.Name == t.Name {
|
if existing.Name == t.Name {
|
||||||
if t.Tagger.When.After(existing.Tagger.When) {
|
if t.Tagger.When.After(existing.Tagger.When) {
|
||||||
|
@ -172,28 +154,3 @@ func (g *GitRepo) FindMainBranch(branches []string) (string, error) {
|
||||||
}
|
}
|
||||||
return "", fmt.Errorf("unable to find main branch")
|
return "", fmt.Errorf("unable to find main branch")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GitRepo) GetMailMap(path string) map[string]string {
|
|
||||||
f, err := os.ReadFile(path)
|
|
||||||
if err != nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
self := make(map[string]string)
|
|
||||||
fileData := string(f[:])
|
|
||||||
|
|
||||||
lines := strings.Split(fileData, "\n")
|
|
||||||
|
|
||||||
for _, l := range lines {
|
|
||||||
parts := strings.Split(l, "<")
|
|
||||||
if len(parts) != 2 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if parts[1][len(parts[1])-1] != '>' {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
parts[1] = parts[1][0 : len(parts[1])-1]
|
|
||||||
self[parts[1]] = strings.Trim(parts[0], " ")
|
|
||||||
}
|
|
||||||
return self
|
|
||||||
}
|
|
||||||
|
|
8
go.mod
8
go.mod
|
@ -8,9 +8,9 @@ require (
|
||||||
github.com/dustin/go-humanize v1.0.0
|
github.com/dustin/go-humanize v1.0.0
|
||||||
github.com/go-git/go-billy/v5 v5.3.1
|
github.com/go-git/go-billy/v5 v5.3.1
|
||||||
github.com/go-git/go-git/v5 v5.5.1
|
github.com/go-git/go-git/v5 v5.5.1
|
||||||
github.com/microcosm-cc/bluemonday v1.0.26
|
github.com/microcosm-cc/bluemonday v1.0.21
|
||||||
github.com/russross/blackfriday/v2 v2.1.0
|
github.com/russross/blackfriday/v2 v2.1.0
|
||||||
golang.org/x/sys v0.13.0
|
golang.org/x/sys v0.3.0
|
||||||
gopkg.in/yaml.v3 v3.0.0
|
gopkg.in/yaml.v3 v3.0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -30,9 +30,9 @@ require (
|
||||||
github.com/sergi/go-diff v1.1.0 // indirect
|
github.com/sergi/go-diff v1.1.0 // indirect
|
||||||
github.com/skeema/knownhosts v1.1.0 // indirect
|
github.com/skeema/knownhosts v1.1.0 // indirect
|
||||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||||
golang.org/x/crypto v0.14.0 // indirect
|
golang.org/x/crypto v0.4.0 // indirect
|
||||||
golang.org/x/mod v0.7.0 // indirect
|
golang.org/x/mod v0.7.0 // indirect
|
||||||
golang.org/x/net v0.17.0 // indirect
|
golang.org/x/net v0.4.0 // indirect
|
||||||
golang.org/x/tools v0.4.0 // indirect
|
golang.org/x/tools v0.4.0 // indirect
|
||||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||||
)
|
)
|
||||||
|
|
10
go.sum
10
go.sum
|
@ -59,8 +59,6 @@ github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=
|
||||||
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
|
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
|
||||||
github.com/microcosm-cc/bluemonday v1.0.21 h1:dNH3e4PSyE4vNX+KlRGHT5KrSvjeUkoNPwEORjffHJg=
|
github.com/microcosm-cc/bluemonday v1.0.21 h1:dNH3e4PSyE4vNX+KlRGHT5KrSvjeUkoNPwEORjffHJg=
|
||||||
github.com/microcosm-cc/bluemonday v1.0.21/go.mod h1:ytNkv4RrDrLJ2pqlsSI46O6IVXmZOBBD4SaJyDwwTkM=
|
github.com/microcosm-cc/bluemonday v1.0.21/go.mod h1:ytNkv4RrDrLJ2pqlsSI46O6IVXmZOBBD4SaJyDwwTkM=
|
||||||
github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58=
|
|
||||||
github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs=
|
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
github.com/pjbgf/sha1cd v0.2.3 h1:uKQP/7QOzNtKYH7UTohZLcjF5/55EnTw0jO/Ru4jZwI=
|
github.com/pjbgf/sha1cd v0.2.3 h1:uKQP/7QOzNtKYH7UTohZLcjF5/55EnTw0jO/Ru4jZwI=
|
||||||
github.com/pjbgf/sha1cd v0.2.3/go.mod h1:HOK9QrgzdHpbc2Kzip0Q1yi3M2MFGPADtR6HjG65m5M=
|
github.com/pjbgf/sha1cd v0.2.3/go.mod h1:HOK9QrgzdHpbc2Kzip0Q1yi3M2MFGPADtR6HjG65m5M=
|
||||||
|
@ -91,8 +89,6 @@ golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0
|
||||||
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||||
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
|
golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8=
|
||||||
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
|
golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80=
|
||||||
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
|
|
||||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
|
golang.org/x/mod v0.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA=
|
||||||
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
|
@ -104,8 +100,6 @@ golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfS
|
||||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||||
golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
|
golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
|
||||||
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
|
||||||
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
|
|
||||||
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||||
|
@ -126,21 +120,17 @@ golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
|
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
|
||||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
|
||||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||||
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
|
golang.org/x/term v0.3.0 h1:qoo4akIqOcDME5bhc/NgxUdovd6BSS2uMsVjB56q1xI=
|
||||||
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
|
golang.org/x/text v0.5.0 h1:OLmvp0KP+FVG99Ct/qFiL/Fhk4zp4QQnZ7b2U+5piUM=
|
||||||
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
|
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
|
2
main.go
2
main.go
|
@ -13,7 +13,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
const version string = "0.3.0-nilix"
|
const version string = "0.2.x"
|
||||||
var cfg string
|
var cfg string
|
||||||
flag.StringVar(&cfg, "config", "./config.yaml", "path to config file")
|
flag.StringVar(&cfg, "config", "./config.yaml", "path to config file")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package routes
|
package routes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"html/template"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"html/template"
|
||||||
|
|
||||||
"git.icyphox.sh/legit/config"
|
"git.icyphox.sh/legit/config"
|
||||||
"github.com/alexedwards/flow"
|
"github.com/alexedwards/flow"
|
||||||
|
|
|
@ -103,9 +103,7 @@ func (d *deps) RepoIndex(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
mailmap := gr.GetMailMap(d.c.Mailmap)
|
commits, err := gr.Commits()
|
||||||
|
|
||||||
commits, err := gr.Commits(mailmap)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
d.Write500(w)
|
d.Write500(w)
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
@ -239,9 +237,7 @@ func (d *deps) Log(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
mailmap := gr.GetMailMap(d.c.Mailmap)
|
commits, err := gr.Commits()
|
||||||
|
|
||||||
commits, err := gr.Commits(mailmap)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
d.Write500(w)
|
d.Write500(w)
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
@ -277,21 +273,13 @@ func (d *deps) Diff(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
mailmap := gr.GetMailMap(d.c.Mailmap)
|
|
||||||
|
|
||||||
diff, err := gr.Diff()
|
diff, err := gr.Diff()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
d.Write500(w)
|
d.Write500(w)
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
authorname, ok := mailmap[diff.Commit.Author.Email]
|
|
||||||
if ok {
|
|
||||||
diff.Commit.Author.Name = authorname
|
|
||||||
}
|
|
||||||
|
|
||||||
data := make(map[string]interface{})
|
data := make(map[string]interface{})
|
||||||
|
|
||||||
data["commit"] = diff.Commit
|
data["commit"] = diff.Commit
|
||||||
|
|
BIN
static/legit.png
BIN
static/legit.png
Binary file not shown.
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 1.3 KiB |
230
static/style.css
230
static/style.css
|
@ -1,18 +1,29 @@
|
||||||
|
:root {
|
||||||
|
--light: #f4f4f4;
|
||||||
|
--cyan: #509c93;
|
||||||
|
--light-gray: #eee;
|
||||||
|
--medium-gray: #ddd;
|
||||||
|
--gray: #6a6a6a;
|
||||||
|
--dark: #444;
|
||||||
|
--darker: #222;
|
||||||
|
|
||||||
|
--sans-font: "InterVar", -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", sans-serif;
|
||||||
|
--display-font: "InterDisplay", -apple-system, BlinkMacSystemFont, "Roboto", "Segoe UI", sans-serif;
|
||||||
|
--mono-font: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', 'Roboto Mono', Menlo, Consolas, monospace;
|
||||||
|
}
|
||||||
|
|
||||||
html {
|
html {
|
||||||
background: #000;
|
background: var(--light);
|
||||||
-webkit-text-size-adjust: none;
|
-webkit-text-size-adjust: none;
|
||||||
font-family: serif;
|
font-family: var(--sans-font);
|
||||||
color: #c9c9c9;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
font-family: monospace;
|
font-family: var(--mono-font);
|
||||||
}
|
}
|
||||||
|
|
||||||
::selection {
|
::selection {
|
||||||
background: #1f9b92;
|
background: var(--medium-gray);
|
||||||
color: #000;
|
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,15 +34,15 @@ pre {
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
max-width: 750px;
|
||||||
padding: 0 13px;
|
padding: 0 13px;
|
||||||
margin: 40px auto;
|
margin: 40px auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main, footer {
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
line-height: 160%;
|
line-height: 160%;
|
||||||
overflow-x: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
@ -41,8 +52,8 @@ footer {
|
||||||
}
|
}
|
||||||
|
|
||||||
main h1, h2, h3, strong {
|
main h1, h2, h3, strong {
|
||||||
|
font-family: var(--display-font);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
width:fit-content;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
strong {
|
strong {
|
||||||
|
@ -62,14 +73,6 @@ main h2, h3 {
|
||||||
padding: 20px 0 15px 0;
|
padding: 20px 0 15px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
main h3 {
|
|
||||||
width: 80vw;
|
|
||||||
max-width: 500px;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
padding: 0.4rem 0 1.5rem 0;
|
padding: 0.4rem 0 1.5rem 0;
|
||||||
}
|
}
|
||||||
|
@ -95,22 +98,19 @@ a {
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #1f9b92;
|
color: var(--darker);
|
||||||
text-decoration: none;
|
border-bottom: 1.5px solid var(--medium-gray);
|
||||||
font-weight:bold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
color: #fff;
|
border-bottom: 1.5px solid var(--gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
.index {
|
.index {
|
||||||
margin: 0px auto;
|
|
||||||
width: 80vw;
|
|
||||||
padding-top: 2em;
|
padding-top: 2em;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: auto 1fr auto;
|
grid-template-columns: 6em 1fr minmax(0, 7em);
|
||||||
grid-gap: 0.5em;
|
grid-row-gap: 0.5em;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,83 +119,58 @@ a:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.clone-url pre {
|
.clone-url pre {
|
||||||
color: #1f9b92;
|
color: var(--dark);
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.desc {
|
.desc {
|
||||||
|
font-weight: normal;
|
||||||
}
|
color: var(--gray);
|
||||||
|
font-style: italic;
|
||||||
.tree {
|
|
||||||
margin: 0px 10vw;
|
|
||||||
max-width: 80vw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tree td {
|
.tree td {
|
||||||
padding: 0.5em 0.5ch;
|
padding: 0.5em 0.5ch;
|
||||||
font-size: 14px;
|
|
||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode, .size {
|
.mode, .size {
|
||||||
font-family: monospace;
|
font-family: var(--mono-font);
|
||||||
width: 10ch;
|
width: 10ch;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.size {
|
.size {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
}
|
}
|
||||||
|
|
||||||
.log {
|
.log {
|
||||||
width:fit-content;
|
|
||||||
max-width: 80vw;
|
|
||||||
margin: 0 auto;
|
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr auto;
|
grid-template-columns: 20rem minmax(0, 1fr);
|
||||||
grid-row-gap: 0.8em;
|
grid-row-gap: 0.8em;
|
||||||
grid-column-gap: 8rem;
|
grid-column-gap: 8rem;
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
padding-left: 1ch;
|
padding-bottom: 1em;
|
||||||
border-left: solid 2px #797979;
|
border-bottom: 1.5px solid var(--medium-gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
.commit-hash, .commit-email {
|
.log pre {
|
||||||
font-family: monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.log pre, .commit pre {
|
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
font-family: serif;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mode {
|
|
||||||
font-family: monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.readme pre {
|
.readme pre {
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.readme * {
|
.readme {
|
||||||
margin: 0 auto;
|
background: var(--light-gray);
|
||||||
width: 80vw;
|
padding: 0.5rem;
|
||||||
max-width: 500px;
|
|
||||||
}
|
|
||||||
.readme h1, .readme h2, .readme h3, .readme h4, .readme h5, .readme h6 {
|
|
||||||
text-transform: capitalize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.readme ul {
|
.readme ul {
|
||||||
padding: revert;
|
padding: revert;
|
||||||
}
|
}
|
||||||
.readme table, .readme pre { width:fit-content;max-width:100vw;margin-left:max(10vw, max(0px, calc(50vw - 250px)));transform:translateX(max(min(0px, calc(min(40vw, 250px) - 50%)), min(-10vw, calc(250px - 50%)))); }
|
|
||||||
.readme p, .readme ul, .readme ol { line-height:150%;margin-top:1em;margin-bottom:1em; }
|
|
||||||
.readme li { margin-top:0.5em;margin-bottom:0.5em;width:100%; }
|
|
||||||
.readme code, .readme pre { background:#00263b;color:#93a1a1;padding:0.25em; }
|
|
||||||
.readme pre { white-space:pre;overflow-x:auto; }
|
|
||||||
.readme blockquote {padding-left:1ch;line-height:150%;border-left:solid 2px #797979; }
|
|
||||||
|
|
||||||
.readme img {
|
.readme img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
@ -204,11 +179,10 @@ a:hover {
|
||||||
.diff {
|
.diff {
|
||||||
margin: 1rem 0 1rem 0;
|
margin: 1rem 0 1rem 0;
|
||||||
padding: 1rem 0 1rem 0;
|
padding: 1rem 0 1rem 0;
|
||||||
|
border-bottom: 1.5px solid var(--medium-gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
.diff pre {
|
.diff pre {
|
||||||
background: #002b36;
|
|
||||||
color: #93a1a1;
|
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,16 +190,16 @@ a:hover {
|
||||||
padding: 1rem 0 1rem 0;
|
padding: 1rem 0 1rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.commit-hash, .commit-email {
|
||||||
|
font-family: var(--mono-font);
|
||||||
|
}
|
||||||
|
|
||||||
.commit-email:before {
|
.commit-email:before {
|
||||||
content: '<';
|
content: '<';
|
||||||
color: #c9c9c9 !important;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.commit-email:after {
|
.commit-email:after {
|
||||||
content: '>';
|
content: '>';
|
||||||
color: #c9c9c9 !important;
|
|
||||||
font-weight: normal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.commit {
|
.commit {
|
||||||
|
@ -243,20 +217,32 @@ a:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.diff-add {
|
.diff-add {
|
||||||
color: #1f9b92;
|
color: green;
|
||||||
}
|
}
|
||||||
|
|
||||||
.diff-del {
|
.diff-del {
|
||||||
color: #dc322f;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.diff-noop {
|
.diff-noop {
|
||||||
|
color: var(--gray);
|
||||||
}
|
}
|
||||||
|
|
||||||
.refs {
|
.ref {
|
||||||
width: 80vw;
|
font-family: var(--display-font);
|
||||||
max-width: 500px;
|
font-size: 14px;
|
||||||
margin: 0 auto;
|
color: var(--gray);
|
||||||
|
display: inline-block;
|
||||||
|
padding-top: 0.7em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refs pre {
|
||||||
|
white-space: pre-wrap;
|
||||||
|
padding-bottom: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.refs h4 {
|
||||||
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.refs ul {
|
.refs ul {
|
||||||
|
@ -265,57 +251,27 @@ a:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
.refs ul li {
|
.refs ul li {
|
||||||
display: inline;
|
|
||||||
margin: 0;
|
|
||||||
margin-left: 1ch;
|
margin-left: 1ch;
|
||||||
}
|
|
||||||
|
|
||||||
.branches {
|
|
||||||
padding-left: 2ch;
|
|
||||||
border-left: 2px solid #797979;
|
|
||||||
}
|
|
||||||
|
|
||||||
.refs h4 {
|
|
||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tags time {
|
|
||||||
float: right;
|
|
||||||
font-size: 85%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.commit-info time {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
time {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag-entry {
|
.tag-entry {
|
||||||
padding-left: 2ch;
|
padding-bottom: 1em;
|
||||||
border-left: 2px solid #797979;
|
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.refs pre {
|
.tag-entry:not(:last-child) {
|
||||||
font-family: serif;
|
border-bottom: 1px solid var(--medium-gray);
|
||||||
white-space: pre-wrap;
|
|
||||||
padding-bottom: 0.5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-entry details pre, .commit-info details pre {
|
.tag-entry time {
|
||||||
font-family: monospace;
|
color: var(--gray);
|
||||||
font-size: 1.0rem;
|
float: right;
|
||||||
|
font-size: 0.85rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ref {
|
.commit time, .log time {
|
||||||
font-family: monospace;
|
display: block;
|
||||||
font-size: 75%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.refs strong {
|
|
||||||
padding-right: 1em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.line-numbers {
|
.line-numbers {
|
||||||
|
@ -326,52 +282,52 @@ time {
|
||||||
-o-user-select: none;
|
-o-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
text-align: right;
|
||||||
|
float: left;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
margin-right: 1ch;
|
margin-right: 1ch;
|
||||||
font-size: 14px;
|
|
||||||
font-family:monospace;
|
|
||||||
text-align:right;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-wrapper {
|
.file-wrapper {
|
||||||
|
background: var(--light-gray);
|
||||||
display: table;
|
display: table;
|
||||||
margin-top: 0.5em;
|
padding: 0.5rem
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.file-content {
|
.file-content {
|
||||||
color: #93a1a1;
|
background: var(--light-gray);
|
||||||
background: #002b36;
|
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
font-size: 14px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@supports (display: flex) {
|
@supports (display: flex) {
|
||||||
.line-numbers {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
.file-content {
|
|
||||||
display: inline-block;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.file-wrapper {
|
.file-wrapper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
max-width: 750px;
|
||||||
}
|
}
|
||||||
.file-wrapper tr {
|
.file-wrapper tr {
|
||||||
display:flex;
|
display:flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
width: 80vw;
|
||||||
|
max-width: 750px;
|
||||||
|
}
|
||||||
|
.line-numbers {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
.file-content {
|
||||||
|
display: iniline-block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.diff-type {
|
.diff-type {
|
||||||
color: #000;
|
color: var(--gray);
|
||||||
background: #c9c9c9;
|
|
||||||
padding: 2px 4px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.commit-info {
|
.commit-info {
|
||||||
|
color: var(--gray);
|
||||||
padding-bottom: 1.5rem;
|
padding-bottom: 1.5rem;
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
}
|
}
|
||||||
|
@ -399,12 +355,12 @@ time {
|
||||||
padding-bottom: 1.5rem;
|
padding-bottom: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 420px) {
|
@media (max-width: 420px) {
|
||||||
.tree {
|
|
||||||
grid-template-columns: 8em 1fr;
|
|
||||||
}
|
|
||||||
.tree .size {
|
.tree .size {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" href="/static/style.css" type="text/css">
|
<link rel="stylesheet" href="/static/style.css" type="text/css">
|
||||||
|
<link rel="stylesheet" href="https://cdn.icyphox.sh/fonts/inter.css" type="text/css">
|
||||||
<link rel="icon" type="image/png" size="32x32" href="/static/legit.png">
|
<link rel="icon" type="image/png" size="32x32" href="/static/legit.png">
|
||||||
{{ if .parent }}
|
{{ if .parent }}
|
||||||
<title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/</title>
|
<title>{{ .meta.Title }} — {{ .name }} ({{ .ref }}): {{ .parent }}/</title>
|
||||||
|
|
Loading…
Reference in a new issue