Compare commits

...

No commits in common. "c7cf160a20409fd3108e6ad9583a81a239876f26" and "e60a0bf01aafaeaa3cc560ceeb9abe37d50ffe44" have entirely different histories.

11 changed files with 95 additions and 97 deletions

View File

@ -1,5 +1,5 @@
Copyright (c) 2018, Jon Betti
Copyright (c) 2023, Izuru Yakumo
Copyright (c) 2023-2025, Izuru Yakumo
Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice

View File

@ -1,15 +1,13 @@
GO ?= go
GOFLAGS ?= -v -ldflags "-w -X `go list`.Version=$(VERSION) -X `go list`.Commit=$(COMMIT) -X `go list`.Build=$(BUILD)" -tags "static_build"
GOFLAGS ?= -v -ldflags "-w -X `${GO} list`.Version=${VERSION} -X `${GO} list`.Build=${BUILD}"
PREFIX ?= /usr/local
VERSION = `git describe --abbrev=0 --tags 2>/dev/null || echo "$VERSION"`
COMMIT = `git rev-parse --short HEAD || echo "$COMMIT"`
BRANCH = `git rev-parse --abbrev-ref HEAD`
BUILD = `git show -s --pretty=format:%cI`
GOARCH ?= amd64
GOOS ?= linux
VERSION = 0.4.0
BUILD = `date +%Y-%m-%d:%H:%M:%S%z`
all: toyohime
toyohime:
@ -17,10 +15,10 @@ toyohime:
clean:
rm toyohime
install:
install -m0755 toyohime ${DESTDIR}${PREFIX}/bin/yorihime
install -Dm0044 toyohime.1 ${DESTDIR}${PREFIX}/share/man/man1/toyohime.1
install -m0755 toyohime ${DESTDIR}${PREFIX}/bin/toyohime
install -Dm0044 toyohime.1 ${DESTDIR}${PREFIX}/man/man1/toyohime.1
test:
${GO} test .
uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/toyohime
rm -f ${DESTDIR}${PREFIX}/share/man/man1/toyohime.1
rm -f ${DESTDIR}${PREFIX}/man/man1/toyohime.1

View File

@ -14,9 +14,10 @@ BitBucket, etc.). A commonly used vanity import path is
* Redirects pkg.go.dev to browsable files
## Installation
Requires Go >=1.16
```bash
go install marisa.chaotic.ninja/toyohime/cmd/toyohime@latest
go install mahou-no-mori.yakumo.dev/toyohime/cmd/toyohime@latest
```
## Specification

View File

@ -27,6 +27,7 @@ package main // go.jonnrb.io/vanity
import (
"bufio"
"bytes"
_ "embed"
"flag"
"fmt"
"html/template"
@ -38,7 +39,7 @@ import (
"strings"
"time"
"marisa.chaotic.ninja/toyohime"
"mahou-no-mori.yakumo.dev/toyohime"
)
var (
@ -53,6 +54,9 @@ var (
reposPath string = "repos" // param 2
)
//go:embed templates/index.tmpl
var IndexPage string
func serveRepo(mux *http.ServeMux, root string, u *url.URL) {
vcsScheme, vcsHost := u.Scheme, u.Host
@ -107,78 +111,8 @@ func addRepoHandlers(mux *http.ServeMux, r io.Reader) error {
}
var b bytes.Buffer
err := template.Must(template.New("").Parse(`
<!DOCTYPE html>
<html>
<head>
<title>Import paths hosted at {{ .Host }}</title>
<style type="text/css">
body,td{font-size:11pt; color:#4d4d4d; font-family:ms pgothic, ms gothic, osaka; background-color:#f8dfdf}
a:link{color:#cc9999; text-decoration:none}
a:visited{color:#cc9999; text-decoration:none}
a:active{color:#cc9999; text-decoration:none; position:relative; top:3px; left:3px}
a:hover{color:#cc9999; text-decoration:none; position:relative; top:3px; left:3px}
.yohaku{margin-top:30px}
.dia{line-height:130%}
.star1{font-size:22px; color:#cc9999}
.position1{position:relative; top:7px}
.line{border-top:2px dotted #cc9999}
.waku{border:1px solid #cc9999}
.bg{background-color:#ffffff}
</style>
</head>
<body>
{{ $host := .Host }}
<div align="center">
<p>でホストされているインポート パス {{ html $host }}</p>
</div>
<div align="center">
<table width="470" class="bg waku yohaku" cellspacing="0" style="margin-bottom: 20px">
{{ range $root, $repo := .IndexMap }}
<tr><td class="bg" style="padding-top: 5px; padding-bottom: 5px">
<div class="star1" align="center">
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
</div>
</td></tr>
<tr><td class="bg line dia" style="padding: 15px 10px 10px 10px">
<center>
<h2>{{ html $root }}</h2>
<a href="https://{{ html $host }}/{{ html $root }}">Package</a> <br/>
<a href="{{ html $repo }}">Repository</a></li>
{{ else }}
Nothing here.
{{ end }}
</center>
</table>
<p>から明らかに盗まれた <a href="http://azukifont.com">azukifont.com</a></p>
</div>
</body>
</html>
`)).Execute(&b, struct {
err := template.Must(template.New("").Parse(IndexPage)).Execute(&b, struct {
//err := template.Must(template.New("").Parse(IndexTmpl))).Execute(&b, struct {
IndexMap map[string]string
Host string
}{

View File

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html>
<head>
<title>Import paths hosted at {{ .Host }}</title>
<style type="text/css">
body,td{font-size:11pt; color:#4d4d4d; font-family:ms pgothic, ms gothic, osaka; background-color:#f8dfdf}
a:link{color:#cc9999; text-decoration:none}
a:visited{color:#cc9999; text-decoration:none}
a:active{color:#cc9999; text-decoration:none; position:relative; top:3px; left:3px}
a:hover{color:#cc9999; text-decoration:none; position:relative; top:3px; left:3px}
.yohaku{margin-top:30px}
.dia{line-height:130%}
.star1{font-size:22px; color:#cc9999}
.position1{position:relative; top:7px}
.line{border-top:2px dotted #cc9999}
.waku{border:1px solid #cc9999}
.bg{background-color:#ffffff}
</style>
</head>
<body>
{{ $host := .Host }}
<div align="center">
<p>でホストされているインポート パス {{ html $host }}</p>
</div>
<div align="center">
<table width="470" class="bg waku yohaku" cellspacing="0" style="margin-bottom: 20px">
{{ range $root, $repo := .IndexMap }}
<tr><td class="bg" style="padding-top: 5px; padding-bottom: 5px">
<div class="star1" align="center">
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
<span style="position:relative; top:5px">*</span>
<span style="position:relative; top:-5px">*</span>
</div>
</td></tr>
<tr><td class="bg line dia" style="padding: 15px 10px 10px 10px">
<center>
<h2>{{ html $root }}</h2>
<a href="https://{{ html $host }}/{{ html $root }}">Package</a> <br/>
<a href="{{ html $repo }}">Repository</a></li>
{{ else }}
Nothing here.
{{ end }}
</center>
</table>
<p>~から明らかに盗まれた <a href="http://azukifont.com">azukifont.com</a></p>
</div>
</body>
</html>

4
go.mod
View File

@ -1,5 +1,5 @@
module marisa.chaotic.ninja/toyohime
module mahou-no-mori.yakumo.dev/toyohime
go 1.14
go 1.16
require github.com/fsnotify/fsnotify v1.4.9

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $TheSupernovaDuo$
# $YakumoLabs$
#
# PROVIDE: toyohime
# REQUIRE: DAEMON NETWORKING

View File

@ -1,5 +1,5 @@
#!/bin/sh
# $TheSupernovaDuo$
# $YakumoLabs$
#
# PROVIDE: toyohime
# REQUIRE: DAEMON

View File

@ -1,5 +1,5 @@
#!/bin/ksh
# $TheSupernovaDuo$
# $YakumoLabs$
. /etc/rc.d/rc.subr

View File

@ -22,4 +22,4 @@ possible.
.Sh AUTHORS
.An Jon Betti Aq Mt jonbetti@gmail.com
.Sh MAINTAINERS
.An Izuru Yakumo Aq Mt yakumo.izuru@chaotic.ninja
.An Izuru Yakumo Aq Mt eternal-servant@yakumo.dev

View File

@ -8,7 +8,6 @@ import (
const (
defaultVersion = "0.0.0"
defaultCommit = "HEAD"
defaultBuild = "0000-01-01:00:00+00:00"
)
@ -17,10 +16,6 @@ var (
// following semantic versioning and is overwritten by the build system.
Version = defaultVersion
// Commit is the commit sha of the build (normally from Git) and is overwritten
// by the build system.
Commit = defaultCommit
// Build is the date and time of the build as an RFC3339 formatted string
// and is overwritten by the build system.
Build = defaultBuild
@ -30,10 +25,10 @@ var (
func FullVersion() string {
var sb strings.Builder
isDefault := Version == defaultVersion && Commit == defaultCommit && Build == defaultBuild
isDefault := Version == defaultVersion && Build == defaultBuild
if !isDefault {
sb.WriteString(fmt.Sprintf("%s@%s %s", Version, Commit, Build))
sb.WriteString(fmt.Sprintf("%s@%s", Version, Build))
}
if info, ok := debug.ReadBuildInfo(); ok {