diff --git a/doc.go b/doc.go index 79722f3d..c9a6fc53 100644 --- a/doc.go +++ b/doc.go @@ -77,11 +77,7 @@ The following options can be added to [Override]. # Tasks - Finish this doc.go file. - - JS-DOS 6.22 https://js-dos.com/6.22/examples/?arkanoid - - https://js-dos.com/index_6.22.html - - Make JS-DOS only work with MS-DOS platforms. - (long) group/releaser pages should have a link to the end of the document. - - history on the domain, Registered: 9th April 1998 [25 years, 6 months, 19 days back] previously used .com and .org. - database on start fixes, replace empty cells with NULL. # Mobile fixes @@ -90,7 +86,7 @@ The following options can be added to [Override]. # Bugs - - `public/text/osd.xml` needs updating to use current search links. + - # New features to deliver diff --git a/handler/app/render_search.go b/handler/app/render_search.go index 9659328b..73911425 100644 --- a/handler/app/render_search.go +++ b/handler/app/render_search.go @@ -42,13 +42,8 @@ func SearchDesc(z *zap.SugaredLogger, c echo.Context) error { return nil } -// PostDescriptions is the handler for the Search for file descriptions form post page. -func PostDescriptions(z *zap.SugaredLogger, c echo.Context) error { - return PostDesc(z, c, Descriptions) -} - -// PostDesc is the handler for the Search for filenames form post page. -func PostDesc(z *zap.SugaredLogger, c echo.Context, mode FileSearch) error { +// PostDesc is the handler for the Search for file descriptions form post page. +func PostDesc(z *zap.SugaredLogger, c echo.Context, input string) error { const name = "files" ctx := context.Background() db, err := postgres.ConnectDB() @@ -57,7 +52,7 @@ func PostDesc(z *zap.SugaredLogger, c echo.Context, mode FileSearch) error { } defer db.Close() - input := c.FormValue("search-term-query") + //input := c.FormValue("search-term-query") terms := helper.SearchTerm(input) rel := model.Files{} @@ -65,7 +60,7 @@ func PostDesc(z *zap.SugaredLogger, c echo.Context, mode FileSearch) error { if err != nil { return DatabaseErr(z, c, name, err) } - d := mode.postStats(ctx, db, terms) + d := Descriptions.postStats(ctx, db, terms) s := strings.Join(terms, ", ") data := emptyFiles() data["title"] = "Title and description results" diff --git a/handler/router.go b/handler/router.go index 6c0a7603..94af80f7 100644 --- a/handler/router.go +++ b/handler/router.go @@ -6,6 +6,7 @@ import ( "embed" "fmt" "net/http" + "strings" "github.com/Defacto2/releaser" "github.com/Defacto2/server/handler/app" @@ -151,7 +152,7 @@ func (conf Configuration) Routes(z *zap.SugaredLogger, e *echo.Echo, public embe return app.SearchDesc(z, c) }) e.POST("/search/desc", func(c echo.Context) error { - return app.PostDescriptions(z, c) + return app.PostDesc(z, c, c.FormValue("search-term-query")) }) e.GET("/search/releaser", func(c echo.Context) error { return app.SearchReleaser(z, c) @@ -159,8 +160,15 @@ func (conf Configuration) Routes(z *zap.SugaredLogger, e *echo.Echo, public embe e.POST("/search/releaser", func(c echo.Context) error { return app.PostReleaser(z, c) }) + e.GET("/search/result", func(c echo.Context) error { + // this legacy get result should be kept for (osx.xml) opensearch compatibility + // and to keep possible backwards compatibility with third party site links. + terms := strings.ReplaceAll(c.QueryParam("query"), "+", " ") // AND replacement + terms = strings.ReplaceAll(terms, "|", ",") // OR replacement + return app.PostDesc(z, c, terms) + }) e.GET("/sum/:id", func(c echo.Context) error { - return app.Checksum(z, c, c.Param("id")) + return app.Checksum(z, c, c.Param("query")) }) e.GET("/thanks", func(c echo.Context) error { return app.Thanks(z, c) @@ -326,9 +334,6 @@ func (c Configuration) Moved(z *zap.SugaredLogger, e *echo.Echo) (*echo.Echo, er e.GET("/person/list/writers", func(c echo.Context) error { return c.Redirect(code, "/writer") }) - e.GET("/search/result", func(c echo.Context) error { - return c.Redirect(code, "/search/") - }) e.GET("/upload", func(c echo.Context) error { return c.Redirect(code, "/") }) diff --git a/public/text/osd.xml b/public/text/osd.xml index 2952b820..063e828d 100644 --- a/public/text/osd.xml +++ b/public/text/osd.xml @@ -1,19 +1,16 @@ - + Defacto2 - Site wide search of the organizations, authors, web links and hosted files metadata served on Defacto2. - - - Defacto2 filename, group, person, word or a phrase lookup. + Search Defacto2 for historical articles, files and digital artefacts on The Scene, underground and online. + UTF-8 https://defacto2.net/image/layout/favicon-192x192.png https://defacto2.net/favicon.ico - - - + + + Search tiltes and descriptions. + + Search data is licensed under Creative Commons Attribution 4.0 International diff --git a/view/app/searchList.tmpl b/view/app/searchList.tmpl index d35e1fa2..7ab04309 100644 --- a/view/app/searchList.tmpl +++ b/view/app/searchList.tmpl @@ -10,7 +10,7 @@

- + {{- range $index, $name := index . "releasers"}}