2019-12-03 19:50:23 -05:00
|
|
|
defmodule PhilomenaWeb.Api.Rss.WatchedController do
|
2019-11-30 18:11:24 -05:00
|
|
|
use PhilomenaWeb, :controller
|
|
|
|
|
2019-12-24 16:14:42 -05:00
|
|
|
alias PhilomenaWeb.ImageLoader
|
2020-08-23 15:47:42 -04:00
|
|
|
alias Philomena.Images.Image
|
2024-05-25 14:03:45 -04:00
|
|
|
alias PhilomenaQuery.Search
|
2020-08-23 15:47:42 -04:00
|
|
|
|
|
|
|
import Ecto.Query
|
2019-11-30 18:11:24 -05:00
|
|
|
|
|
|
|
def index(conn, _params) do
|
2019-12-24 16:14:42 -05:00
|
|
|
{:ok, {images, _tags}} = ImageLoader.search_string(conn, "my:watched")
|
2024-05-25 14:03:45 -04:00
|
|
|
images = Search.search_records(images, preload(Image, [:sources, tags: :aliases]))
|
2019-11-30 18:11:24 -05:00
|
|
|
|
2020-01-10 12:43:56 -05:00
|
|
|
# NB: this is RSS, but using the RSS format causes Phoenix not to
|
|
|
|
# escape HTML
|
2022-10-31 08:44:01 -04:00
|
|
|
conn
|
|
|
|
|> put_resp_header("content-type", "application/rss+xml")
|
|
|
|
|> render("index.html", layout: false, images: images)
|
2019-11-30 18:11:24 -05:00
|
|
|
end
|
2019-12-24 16:14:42 -05:00
|
|
|
end
|