diff --git a/public/template/index.ecr b/public/template/index.ecr index 5c60b82..4c07c34 100644 --- a/public/template/index.ecr +++ b/public/template/index.ecr @@ -36,7 +36,7 @@ But you probably already knew that. You may be looking for:
  • The Git repository
  • -
  • Song reuploading
  • +
  • Song reuploading and searching
  • Levels
  • Completely legal executable download
  • diff --git a/src/template_endpoints/song_search.cr b/src/template_endpoints/song_search.cr index 0c2b7b2..9b67c42 100644 --- a/src/template_endpoints/song_search.cr +++ b/src/template_endpoints/song_search.cr @@ -2,7 +2,7 @@ require "ecr" include CrystalGauntlet -CrystalGauntlet.template_endpoints["/tools/song_search"] = ->(context : HTTP::Server::Context): String { +CrystalGauntlet.template_endpoints["/tools/song_search"] = ->(context : HTTP::Server::Context) { error = nil songs = nil result_limit = 10 @@ -13,11 +13,11 @@ CrystalGauntlet.template_endpoints["/tools/song_search"] = ->(context : HTTP::Se query = "%#{params["query"]}%" songs = DATABASE.query_all("select song_data.id, song_authors.name, song_data.name from song_data join song_authors on song_authors.id = song_data.author_id where song_data.id = ? or song_authors.name like ? or song_data.name like ? limit #{result_limit}", params["query"], query, query, as: {Int32, String, String}) rescue error - ECR.render("./public/template/song_search.ecr") + ECR.embed("./public/template/song_search.ecr", context.response) else - ECR.render("./public/template/song_search.ecr") + ECR.embed("./public/template/song_search.ecr", context.response) end + else + ECR.embed("./public/template/song_search.ecr", context.response) end - - ECR.render("./public/template/song_search.ecr") }