From 12e4b91241b095819e910cbf2bff07b14f7a83fc Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Sun, 14 Jan 2018 00:10:03 +0000 Subject: added release selection --- d1pkgweb-query.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'd1pkgweb-query.go') diff --git a/d1pkgweb-query.go b/d1pkgweb-query.go index fe2d099..bfb36fe 100644 --- a/d1pkgweb-query.go +++ b/d1pkgweb-query.go @@ -31,7 +31,14 @@ var resTempl = `
-Search Devuan Packages for: +Search Devuan Packages for: in release +
@@ -52,6 +59,13 @@ Search Devuan Packages for: ` +var releaseMap = map[string]string{ + "jessie": "index_jessie.txt", + "ascii": "index_ascii.txt", + "ceres": "index_ceres.txt", + "experimental": "index_experimental.txt", + "any": "index.txt"} + func printError(errCode int, errMsg string) { fmt.Printf("Status:%d %s\r\n", errCode, errMsg) @@ -101,6 +115,7 @@ func getResults(req http.Request) (ResultPage, error) { req.ParseForm() searchQuery := req.Form["search"] + release := req.Form["release"] if len(searchQuery) < 1 { printError(503, fmt.Sprintf("Something went wrong in parsing query...\r\n%s\r\n", req.Form)) os.Exit(0) @@ -116,7 +131,7 @@ func getResults(req http.Request) (ResultPage, error) { commands := make([]*exec.Cmd, 0) cmd := "grep" - args := []string{QueryTerms[0], "index.txt"} + args := []string{QueryTerms[0], releaseMap[release]} commands = append(commands, exec.Command(cmd, args...)) -- cgit v1.2.3