キャッチ・アンド・リリース!

Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/yukari/trunk@151 f3bd38d9-da89-464d-a02a-eb04e43141b5
This commit is contained in:
yakumo.izuru 2024-03-24 22:42:12 +00:00
parent a13aa42ba5
commit d32086317e
5 changed files with 40 additions and 5 deletions

View File

@ -1,3 +1,7 @@
# v0.2.4 - 2024.03.24
* Replace invalid favicon with one sourced from [here](https://en.touhouwiki.net/wiki/File:Th123YukariSigil.png), as well as using `//go:embed` for it
* Add rc.d files for FreeBSD and OpenBSD, respectively
# v0.2.3 - 2024.03.21 # v0.2.3 - 2024.03.21
* Document the configuration file format, which is INI-style (which is compatible to the old format in the codebase, though it's now called as `config.Config.<key>`) * Document the configuration file format, which is INI-style (which is compatible to the old format in the codebase, though it's now called as `config.Config.<key>`)
* Manual page has been rewritten (using `mdoc(7)`) * Manual page has been rewritten (using `mdoc(7)`)

BIN
cmd/yukari/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -76,7 +76,6 @@ type HTMLMainPageFormParam struct {
URLParamName string URLParamName string
} }
var faviconBytes []byte
var htmlFormExtension *template.Template var htmlFormExtension *template.Template
var htmlBodyExtension *template.Template var htmlBodyExtension *template.Template
var htmlMainPageForm *template.Template var htmlMainPageForm *template.Template
@ -87,11 +86,10 @@ var htmlHeadContentType string
var htmlPageStart string var htmlPageStart string
//go:embed templates/yukari_stop.html //go:embed templates/yukari_stop.html
var htmlPageStop string var htmlPageStop string
//go:embed favicon.ico
var faviconBytes []byte
func init() { func init() {
FaviconBase64 := "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII"
faviconBytes, _ = base64.StdEncoding.DecodeString(FaviconBase64)
var err error var err error
htmlFormExtension, err = template.New("html_form_extension").Parse( htmlFormExtension, err = template.New("html_form_extension").Parse(
`<input type="hidden" name="yukariurl" value="{{.BaseURL}}" />{{if .YukariHash}}<input type="hidden" name="yukarihash" value="{{.YukariHash}}" />{{end}}`) `<input type="hidden" name="yukariurl" value="{{.BaseURL}}" />{{if .YukariHash}}<input type="hidden" name="yukarihash" value="{{.YukariHash}}" />{{end}}`)
@ -387,7 +385,7 @@ func appRequestHandler(ctx *fasthttp.RequestCtx) bool {
// server favicon.ico // server favicon.ico
if bytes.Equal(ctx.Path(), []byte("/favicon.ico")) { if bytes.Equal(ctx.Path(), []byte("/favicon.ico")) {
ctx.SetContentType("image/png") ctx.SetContentType("image/vnd.microsoft.icon")
ctx.Write(faviconBytes) ctx.Write(faviconBytes)
return true return true
} }

23
rc.d/yukari Normal file
View File

@ -0,0 +1,23 @@
#!/bin/sh
# $TheSupernovaDuo$
# PROVIDE: yukari
# REQUIRE: DAEMON NETWORKING
# KEYWORD: shutdown
. /etc/rc.subr
name="yukari"
rcvar="yukari_enable"
load_rc_config "${name}"
: ${yukari_enable="NO"}
: ${yukari_config=""}
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
procname="/usr/local/bin/${name}"
command_args="-S -m 3 -s info -l daemon -p ${pidfile} /usr/bin/env ${procname} ${yukari_args}"
run_rc_command "$1"

10
rc.d/yukarid Normal file
View File

@ -0,0 +1,10 @@
#!/bin/ksh
# $TheSupernovaDuo
daemon="/usr/local/bin/yukari"
. /etc/rc.d/rc.subr
rc_bg=YES
rc_reload=NO
rc_cmd "$1"