From e60a0bf01aafaeaa3cc560ceeb9abe37d50ffe44 Mon Sep 17 00:00:00 2001 From: "yakumo.izuru" Date: Thu, 17 Apr 2025 23:12:28 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9C=88=E3=81=AE=E9=A6=96=E9=83=BD=E3=81=AF?= =?UTF-8?q?=E3=81=9D=E3=82=8C=E3=81=8C=E3=81=82=E3=82=8B=E3=81=B9=E3=81=8D?= =?UTF-8?q?=E5=A0=B4=E6=89=80=E3=81=AB=E6=88=BB=E3=81=A3=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=81=BE=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///srv/svn/repo/toyohime/trunk@115 922d331f-388e-da47-97a9-ad700dc0b8b9 --- LICENSE | 2 +- Makefile | 16 +++---- README.md | 3 +- cmd/toyohime/main.go | 80 +++---------------------------- cmd/toyohime/templates/index.tmpl | 70 +++++++++++++++++++++++++++ go.mod | 4 +- rc.d/freebsd.sh | 2 +- rc.d/netbsd.sh | 2 +- rc.d/openbsd.ksh | 2 +- toyohime.1 | 2 +- version.go | 9 +--- 11 files changed, 95 insertions(+), 97 deletions(-) create mode 100644 cmd/toyohime/templates/index.tmpl diff --git a/LICENSE b/LICENSE index d101e81..02c2453 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/Makefile b/Makefile index 903799b..f3415bb 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 08a2111..ea64667 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/cmd/toyohime/main.go b/cmd/toyohime/main.go index 2204d40..c440a2c 100644 --- a/cmd/toyohime/main.go +++ b/cmd/toyohime/main.go @@ -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(` - - - -Import paths hosted at {{ .Host }} - - - -{{ $host := .Host }} -
-

でホストされているインポート パス {{ html $host }}

-
-
- -{{ range $root, $repo := .IndexMap }} - -
-
-* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -* -
-
-
-

{{ html $root }}

-Package
-Repository -{{ else }} -Nothing here. -{{ end }} -
-
-

~から明らかに盗まれた azukifont.com

-
- - -`)).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 }{ diff --git a/cmd/toyohime/templates/index.tmpl b/cmd/toyohime/templates/index.tmpl new file mode 100644 index 0000000..dac5ae5 --- /dev/null +++ b/cmd/toyohime/templates/index.tmpl @@ -0,0 +1,70 @@ + + + +Import paths hosted at {{ .Host }} + + + +{{ $host := .Host }} +
+

でホストされているインポート パス {{ html $host }}

+
+
+ +{{ range $root, $repo := .IndexMap }} + +
+
+* +* +* +* +* +* +* +* +* +* +* +* +* +* +* +* +* +* +* +* +* +* +* +* +* +
+
+
+

{{ html $root }}

+Package
+Repository +{{ else }} +Nothing here. +{{ end }} +
+
+

~から明らかに盗まれた azukifont.com

+
+ + diff --git a/go.mod b/go.mod index e2712e7..8adea2b 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/rc.d/freebsd.sh b/rc.d/freebsd.sh index 005a6e6..33b61ae 100644 --- a/rc.d/freebsd.sh +++ b/rc.d/freebsd.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $TheSupernovaDuo$ +# $YakumoLabs$ # # PROVIDE: toyohime # REQUIRE: DAEMON NETWORKING diff --git a/rc.d/netbsd.sh b/rc.d/netbsd.sh index 8c9cdd6..b044646 100644 --- a/rc.d/netbsd.sh +++ b/rc.d/netbsd.sh @@ -1,5 +1,5 @@ #!/bin/sh -# $TheSupernovaDuo$ +# $YakumoLabs$ # # PROVIDE: toyohime # REQUIRE: DAEMON diff --git a/rc.d/openbsd.ksh b/rc.d/openbsd.ksh index 5c56be0..a444060 100644 --- a/rc.d/openbsd.ksh +++ b/rc.d/openbsd.ksh @@ -1,5 +1,5 @@ #!/bin/ksh -# $TheSupernovaDuo$ +# $YakumoLabs$ . /etc/rc.d/rc.subr diff --git a/toyohime.1 b/toyohime.1 index 7ba383f..6c26761 100644 --- a/toyohime.1 +++ b/toyohime.1 @@ -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 diff --git a/version.go b/version.go index 81e847c..8fe225c 100644 --- a/version.go +++ b/version.go @@ -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 {