make it work

This commit is contained in:
wjqserver 2025-09-14 08:44:19 +08:00
parent 86a4ad881a
commit ca9a638369
3 changed files with 7 additions and 7 deletions

2
go.mod
View file

@ -20,7 +20,7 @@ require (
github.com/fenthope/record v0.0.4
github.com/go-json-experiment/json v0.0.0-20250813233538-9b1f9ea2e11b
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/infinite-iroha/touka v0.3.7
github.com/infinite-iroha/touka v0.3.8
github.com/wjqserver/modembed v0.0.1
)

4
go.sum
View file

@ -22,8 +22,8 @@ github.com/go-json-experiment/json v0.0.0-20250813233538-9b1f9ea2e11b h1:6Q4zRHX
github.com/go-json-experiment/json v0.0.0-20250813233538-9b1f9ea2e11b/go.mod h1:TiCD2a1pcmjd7YnhGH0f/zKNcCD06B029pHhzV23c2M=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/infinite-iroha/touka v0.3.7 h1:bIIZW5Weh7lVpyOWh4FmyR9UOfb5FOt+cR9yQ30FJLA=
github.com/infinite-iroha/touka v0.3.7/go.mod h1:uwkF1gTrNEgQ4P/Gwtk6WLbERehq3lzB8x1FMedyrfE=
github.com/infinite-iroha/touka v0.3.8 h1:BK7+hwk5s5SpRFjFKIPe5CzZNzjP36kLHkM/HX6SU38=
github.com/infinite-iroha/touka v0.3.8/go.mod h1:uwkF1gTrNEgQ4P/Gwtk6WLbERehq3lzB8x1FMedyrfE=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/wjqserver/modembed v0.0.1 h1:8ZDz7t9M5DLrUFlYgBUUmrMzxWsZPmHvOazkr/T2jEs=

View file

@ -390,8 +390,7 @@ func main() {
logger.Errorf("Failed to read IP filter list: %v", err)
os.Exit(1)
}
var ipBlockFilter *ipfilter.IPFilter
ipBlockFilter, err = ipfilter.NewIPFilter(ipfilter.IPFilterConfig{
ipBlockFilter, err := ipfilter.NewIPFilter(ipfilter.IPFilterConfig{
EnableAllowList: cfg.IPFilter.EnableAllowList,
EnableBlockList: cfg.IPFilter.EnableBlockList,
AllowList: ipAllowList,
@ -532,12 +531,13 @@ func main() {
}
func setBackendRoute(r *touka.Engine) {
backend, err := fs.Sub(backendFS, "backend")
if err != nil {
logger.Errorf("Failed to load embedded backend pages: %s", err)
fmt.Printf("Failed to load embedded backend pages: %s", err)
os.Exit(1)
}
r.HandleFunc([]string{"GET"}, "/admin", pageCacheHeader(), touka.FileServer(http.FS(backend)))
r.HandleFunc([]string{"GET"}, "/admin/script.js", pageCacheHeader(), touka.FileServer(http.FS(backend)))
r.StaticFS("/backend", http.FS(backend))
}