mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 12:37:58 +01:00
23 lines
551 B
Elixir
23 lines
551 B
Elixir
defmodule PhilomenaWeb.Autocomplete.CompiledController do
|
|
use PhilomenaWeb, :controller
|
|
|
|
alias Philomena.Autocomplete
|
|
|
|
def show(conn, _params) do
|
|
autocomplete = Autocomplete.get_autocomplete()
|
|
|
|
case autocomplete do
|
|
nil ->
|
|
conn
|
|
|> put_status(:not_found)
|
|
|> configure_session(drop: true)
|
|
|> text("")
|
|
|
|
%{content: content} ->
|
|
conn
|
|
|> put_resp_header("cache-control", "public, max-age=86400")
|
|
|> configure_session(drop: true)
|
|
|> resp(200, content)
|
|
end
|
|
end
|
|
end
|