diff --git a/cmd/mai/main.go b/cmd/mai/main.go index 609fd31..bd17042 100644 --- a/cmd/mai/main.go +++ b/cmd/mai/main.go @@ -14,6 +14,7 @@ import ( "marisa.chaotic.ninja/mai/engines" "github.com/gofiber/fiber/v2" + "github.com/gofiber/fiber/v2/middleware/favicon" "github.com/gofiber/fiber/v2/middleware/logger" "github.com/gofiber/fiber/v2/middleware/limiter" "github.com/gofiber/template/html/v2" @@ -60,6 +61,12 @@ func main() { Views: engine, }) + app.Use(favicon.New( + favicon.Config{ + File: conf.staticpath + "/favicon.ico", + }, + )) + app.Use(logger.New( logger.Config{ Format: "==> ${ip}:${port} ${status} - ${method} ${path}\n", @@ -280,5 +287,6 @@ func main() { ByteRange: true, Browse: true, }) + app.Static("/docs", "./docs", fiber.Static{}) app.Listen(conf.listen) } diff --git a/cmd/mai/flag.go b/cmd/mai/parseflags.go similarity index 100% rename from cmd/mai/flag.go rename to cmd/mai/parseflags.go diff --git a/cmd/mai/readconf.go b/cmd/mai/readconf.go index 4fe9248..9e86bb3 100644 --- a/cmd/mai/readconf.go +++ b/cmd/mai/readconf.go @@ -10,7 +10,6 @@ func readConf(file string) error { if err != nil { return err } - conf.group = cfg.Section("mai").Key("group").String() conf.listen = cfg.Section("mai").Key("listen").String() conf.staticpath = cfg.Section("mai").Key("static").String() diff --git a/static/docs/index.html b/docs/api/index.html similarity index 89% rename from static/docs/index.html rename to docs/api/index.html index c61ea82..ef9b03e 100644 --- a/static/docs/index.html +++ b/docs/api/index.html @@ -1,18 +1,18 @@ - + API Documentation | Mai -

Documentation

+

API Documentation



[GET] /api/translate

[POST] /api/translate

Description

-

Translation endpoint

+

Translation endpoint, input must be URL-encoded (e.g. multi-byte characters, words separated by space)

Arguments