From 4080d7992fd02e3be5e696bd25de5975f413113c Mon Sep 17 00:00:00 2001 From: Arnas Udovicius Date: Tue, 30 Aug 2022 19:54:55 +0300 Subject: [PATCH] support many languages --- README.md | 2 +- main.go | 8 ++++++-- text_server.go | 18 ------------------ 3 files changed, 7 insertions(+), 21 deletions(-) delete mode 100644 text_server.go diff --git a/README.md b/README.md index ceffe6f..cba0f22 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,10 @@ My capsule in Gemini space. Built with zord-tree support ## TODO * add image or other file not `gmi` download -* feed * security * citata from some file __DONE__ +* feed * add category view * add tag view * add file view diff --git a/main.go b/main.go index 97ce560..1840143 100644 --- a/main.go +++ b/main.go @@ -147,8 +147,12 @@ func process(_ context.Context, w gemini.ResponseWriter, r *gemini.Request) { } func renderIndex(lang string, w gemini.ResponseWriter, client TreeManagerClient) { - langFilter := TreeRequest_Filter{Key: "lang", Value: lang} - filters := []*TreeRequest_Filter{&langFilter} + filters := []*TreeRequest_Filter{{Key: "lang", Value: lang}} + if lang == "sgs" { + for _, l := range []string{"lt", "prg", "eo"} { + filters = append(filters, &TreeRequest_Filter{Key: "lang", Value: l}) + } + } path := "" tr := TreeRequest{Path: &path, Filter: filters} diff --git a/text_server.go b/text_server.go deleted file mode 100644 index edd0e10..0000000 --- a/text_server.go +++ /dev/null @@ -1,18 +0,0 @@ -package main - -import ( - "bufio" - "fmt" - "net" -) - -func GetSummery() string { - conn, err := net.Dial("tcp", fileSrvHost+":"+fileSrvPort) - if err != nil { - panic(err.Error()) - } - fmt.Fprintf(conn, "\n") - message, err := bufio.NewReader(conn).ReadString('\n') - conn.Close() - return message -}